Prechádzať zdrojové kódy

add news, ppob, commerce

alqindiirsyam 2 rokov pred
rodič
commit
101ed1ebff

+ 16 - 13
appbuilder-ios/DigiXLite/DigiXLite/Source/View/BNIView/BNIBookingWebView.swift

@@ -50,19 +50,22 @@ class BNIBookingWebView: UIViewController, WKNavigationDelegate, UIScrollViewDel
         webView.backgroundColor = .white
         webView.scrollView.backgroundColor = .white
         
-        Database().database?.inTransaction({ fmdb, rollback in
-            let idMe = UserDefaults.standard.string(forKey: "me") as String?
-            if let c = Database().getRecords(fmdb: fmdb, query: "select first_name || ' ' || last_name from BUDDY where f_pin = '\(idMe!)'"), c.next() {
-                let name = c.string(forColumnIndex: 0)!.trimmingCharacters(in: .whitespacesAndNewlines)
-                var stringQMS = "https://sqbni.murni.id:4200/bnibookingonline/#/?userid="
-                if !customUrl.isEmpty {
-                    stringQMS = customUrl
-                }
-                let url = URL(string: "\(stringQMS)\(name)")!
-                webView.load(URLRequest(url: url))
-                c.close()
-            }
-        })
+        var stringQMS = "https://sqbni.murni.id:4200/bnibookingonline/#/?userid="
+        if !customUrl.isEmpty {
+            stringQMS = customUrl
+        }
+        if stringQMS.lowercased().contains("?userid=") {
+            let name = User.getData(pin: User.getMyPin())!.fullName
+            stringQMS += name
+        } else if stringQMS.lowercased().contains("?f_pin=") {
+            stringQMS += User.getMyPin()!
+        }
+        
+        if stringQMS.contains("<<f_pin>>") {
+            stringQMS = stringQMS.replacingOccurrences(of: "<<f_pin>>", with: User.getMyPin()!)
+        }
+        let url = URL(string: "\(stringQMS)")!
+        webView.load(URLRequest(url: url))
     }
     
     func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {

+ 16 - 13
appbuilder-ios/NexilisLite/NexilisLite/Source/View/BNIView/BNIBookingWebView.swift

@@ -50,19 +50,22 @@ class BNIBookingWebView: UIViewController, WKNavigationDelegate, UIScrollViewDel
         webView.backgroundColor = .white
         webView.scrollView.backgroundColor = .white
         
-        Database().database?.inTransaction({ fmdb, rollback in
-            let idMe = UserDefaults.standard.string(forKey: "me") as String?
-            if let c = Database().getRecords(fmdb: fmdb, query: "select first_name || ' ' || last_name from BUDDY where f_pin = '\(idMe!)'"), c.next() {
-                let name = c.string(forColumnIndex: 0)!.trimmingCharacters(in: .whitespacesAndNewlines)
-                var stringQMS = "https://sqbni.murni.id:4200/bnibookingonline/#/?userid="
-                if !customUrl.isEmpty {
-                    stringQMS = customUrl
-                }
-                let url = URL(string: "\(stringQMS)\(name)")!
-                webView.load(URLRequest(url: url))
-                c.close()
-            }
-        })
+        var stringQMS = "https://sqbni.murni.id:4200/bnibookingonline/#/?userid="
+        if !customUrl.isEmpty {
+            stringQMS = customUrl
+        }
+        if stringQMS.lowercased().contains("?userid=") {
+            let name = User.getData(pin: User.getMyPin())!.fullName
+            stringQMS += name
+        } else if stringQMS.lowercased().contains("?f_pin=") {
+            stringQMS += User.getMyPin()!
+        }
+        
+        if stringQMS.contains("<<f_pin>>") {
+            stringQMS = stringQMS.replacingOccurrences(of: "<<f_pin>>", with: User.getMyPin()!)
+        }
+        let url = URL(string: "\(stringQMS)")!
+        webView.load(URLRequest(url: url))
     }
     
     func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {