alqindiirsyam 2 년 전
부모
커밋
7a1a7d7477

+ 81 - 100
appbuilder-ios/AppBuilder/AppBuilder/ViewController.swift

@@ -447,7 +447,9 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
         }
         if firstLoad {
             firstLoad = false
-            ViewController.pullActionButton()
+            if PrefsUtil.getCpaasMode() == PrefsUtil.CPAAS_MODE_DOCKED {
+                ViewController.pullActionButton()
+            }
             let customTab = PrefsUtil.getCustomTab().split(separator: ",")
             if customTab[0] == "1" {
                 firstTab?.viewWillAppear(false)
@@ -604,25 +606,20 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
                     app_id = String(ViewController.listPullFB[2].split(separator: "|")[1])
                 }
                 if package_id.contains("_fb") {
-                    let indexTap = Int(String(package_id.split(separator: "_")[1]).substring(from: 2, to: 2))
-                    if indexTap! < 5 {
-                        Nexilis.buttonClicked(index: indexTap!)
+                    let indexTap = Int(String(package_id.split(separator: "_")[1]).substring(from: 2, to: 2))!
+                    if indexTap == 99 {
+                        openTabPost()
                     } else {
-                        if indexTap == 5 {
-                            Nexilis.buttonClicked(index: 0, id: "openQMS")
-                        } else if indexTap == 6 {
-                            Nexilis.buttonClicked(index: 0, id: "openHistoryCC")
-                        } else if indexTap == 7 {
-                            Nexilis.buttonClicked(index: 7, id: String(package_id.split(separator: "_")[2]))
+                        if indexTap == 2 {
+                            let url = package_id.components(separatedBy: "_")[2]
+                            Nexilis.buttonClicked(index: indexTap, id: url)
+                        } else {
+                            Nexilis.buttonClicked(index: indexTap)
                         }
                     }
                 } else {
                     if !app_id.isEmpty {
                         Nexilis.buttonClicked(index: 0, id: app_id)
-                    } else {
-                        if let url = URL(string: String(package_id)) {
-                            UIApplication.shared.open(url)
-                        }
                     }
                 }
             } else {
@@ -644,25 +641,20 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
                     app_id = String(ViewController.listPullFB[4].split(separator: "|")[1])
                 }
                 if package_id.contains("_fb") {
-                    let indexTap = Int(String(package_id.split(separator: "_")[1]).substring(from: 2, to: 2))
-                    if indexTap! < 5 {
-                        Nexilis.buttonClicked(index: indexTap!)
+                    let indexTap = Int(String(package_id.split(separator: "_")[1]).substring(from: 2, to: 2))!
+                    if indexTap == 99 {
+                        openTabPost()
                     } else {
-                        if indexTap == 5 {
-                            Nexilis.buttonClicked(index: 0, id: "openQMS")
-                        } else if indexTap == 6 {
-                            Nexilis.buttonClicked(index: 0, id: "openHistoryCC")
-                        } else if indexTap == 7 {
-                            Nexilis.buttonClicked(index: 7, id: String(package_id.split(separator: "_")[2]))
+                        if indexTap == 2 {
+                            let url = package_id.components(separatedBy: "_")[2]
+                            Nexilis.buttonClicked(index: indexTap, id: url)
+                        } else {
+                            Nexilis.buttonClicked(index: indexTap)
                         }
                     }
                 } else {
                     if !app_id.isEmpty {
                         Nexilis.buttonClicked(index: 0, id: app_id)
-                    } else {
-                        if let url = URL(string: String(package_id)) {
-                            UIApplication.shared.open(url)
-                        }
                     }
                 }
             } else {
@@ -684,25 +676,20 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
                     app_id = String(ViewController.listPullFB[1].split(separator: "|")[1])
                 }
                 if package_id.contains("_fb") {
-                    let indexTap = Int(String(package_id.split(separator: "_")[1]).substring(from: 2, to: 2))
-                    if indexTap! < 5 {
-                        Nexilis.buttonClicked(index: indexTap!)
+                    let indexTap = Int(String(package_id.split(separator: "_")[1]).substring(from: 2, to: 2))!
+                    if indexTap == 99 {
+                        openTabPost()
                     } else {
-                        if indexTap == 5 {
-                            Nexilis.buttonClicked(index: 0, id: "openQMS")
-                        } else if indexTap == 6 {
-                            Nexilis.buttonClicked(index: 0, id: "openHistoryCC")
-                        } else if indexTap == 7 {
-                            Nexilis.buttonClicked(index: 7, id: String(package_id.split(separator: "_")[2]))
+                        if indexTap == 2 {
+                            let url = package_id.components(separatedBy: "_")[2]
+                            Nexilis.buttonClicked(index: indexTap, id: url)
+                        } else {
+                            Nexilis.buttonClicked(index: indexTap)
                         }
                     }
                 } else {
                     if !app_id.isEmpty {
                         Nexilis.buttonClicked(index: 0, id: app_id)
-                    } else {
-                        if let url = URL(string: String(package_id)) {
-                            UIApplication.shared.open(url)
-                        }
                     }
                 }
             } else {
@@ -724,25 +711,20 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
                     app_id = String(ViewController.listPullFB[0].split(separator: "|")[1])
                 }
                 if package_id.contains("_fb") {
-                    let indexTap = Int(String(package_id.split(separator: "_")[1]).substring(from: 2, to: 2))
-                    if indexTap! < 5 {
-                        Nexilis.buttonClicked(index: indexTap!)
+                    let indexTap = Int(String(package_id.split(separator: "_")[1]).substring(from: 2, to: 2))!
+                    if indexTap == 99 {
+                        openTabPost()
                     } else {
-                        if indexTap == 5 {
-                            Nexilis.buttonClicked(index: 0, id: "openQMS")
-                        } else if indexTap == 6 {
-                            Nexilis.buttonClicked(index: 0, id: "openHistoryCC")
-                        } else if indexTap == 7 {
-                            Nexilis.buttonClicked(index: 7, id: String(package_id.split(separator: "_")[2]))
+                        if indexTap == 2 {
+                            let url = package_id.components(separatedBy: "_")[2]
+                            Nexilis.buttonClicked(index: indexTap, id: url)
+                        } else {
+                            Nexilis.buttonClicked(index: indexTap)
                         }
                     }
                 } else {
                     if !app_id.isEmpty {
                         Nexilis.buttonClicked(index: 0, id: app_id)
-                    } else {
-                        if let url = URL(string: String(package_id)) {
-                            UIApplication.shared.open(url)
-                        }
                     }
                 }
             } else {
@@ -763,61 +745,60 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
                     app_id = String(ViewController.listPullFB[3].split(separator: "|")[1])
                 }
                 if package_id.contains("_fb") {
-                    let indexTap = Int(String(package_id.split(separator: "_")[1]).substring(from: 2, to: 2))
-                    if indexTap! < 5 {
-                        Nexilis.buttonClicked(index: indexTap!)
+                    let indexTap = Int(String(package_id.split(separator: "_")[1]).substring(from: 2, to: 2))!
+                    if indexTap == 99 {
+                        openTabPost()
                     } else {
-                        if indexTap == 5 {
-                            Nexilis.buttonClicked(index: 0, id: "openQMS")
-                        } else if indexTap == 6 {
-                            Nexilis.buttonClicked(index: 0, id: "openHistoryCC")
-                        } else if indexTap == 7 {
-                            Nexilis.buttonClicked(index: 7, id: String(package_id.split(separator: "_")[2]))
+                        if indexTap == 2 {
+                            let url = package_id.components(separatedBy: "_")[2]
+                            Nexilis.buttonClicked(index: indexTap, id: url)
+                        } else {
+                            Nexilis.buttonClicked(index: indexTap)
                         }
                     }
                 } else {
                     if !app_id.isEmpty {
                         Nexilis.buttonClicked(index: 0, id: app_id)
-                    } else {
-                        if let url = URL(string: String(package_id)) {
-                            UIApplication.shared.open(url)
-                        }
                     }
                 }
             } else {
-                let customTab = PrefsUtil.getCustomTab().split(separator: ",")
-                let cpaasMode = PrefsUtil.getCpaasMode()
-                var i = 0
-                var j = 0
-                print("custom tab post tap = \(customTab)")
-                while j < customTab.count {
-                    if(((i == 1 && customTab.count == 3) || i == 2) &&
-                       (cpaasMode == PrefsUtil.CPAAS_MODE_DOCKED || cpaasMode == PrefsUtil.CPAAS_MODE_MIX)){
-                        
-                    }
-                    else {
-                        if customTab[j] == "3" {
-                            break
-                        }
-                        j += 1
-                    }
-                    i += 1
-                }
-                if(j < customTab.count){
-                    self.selectedIndex = i
-                    
-                    DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + .seconds(1), execute: {
-                        let me = UserDefaults.standard.string(forKey: "me")
-                        let address = "\(PrefsUtil.getURLBase() ?? "https://qmera.io/")nexilis/pages/tab5-new-post?f_pin=\(me ?? "")"
-                        self.thirdTab?.webView.evaluateJavaScript("window.location = '\(address)'")
-                        
-                    })
-                }
+                openTabPost()
             }
         }
         
     }
     
+    func openTabPost() {
+        let customTab = PrefsUtil.getCustomTab().split(separator: ",")
+        let cpaasMode = PrefsUtil.getCpaasMode()
+        var i = 0
+        var j = 0
+        print("custom tab post tap = \(customTab)")
+        while j < customTab.count {
+            if(((i == 1 && customTab.count == 3) || i == 2) &&
+               (cpaasMode == PrefsUtil.CPAAS_MODE_DOCKED || cpaasMode == PrefsUtil.CPAAS_MODE_MIX)){
+                
+            }
+            else {
+                if customTab[j] == "3" {
+                    break
+                }
+                j += 1
+            }
+            i += 1
+        }
+        if(j < customTab.count){
+            self.selectedIndex = i
+            
+            DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + .seconds(1), execute: {
+                let me = UserDefaults.standard.string(forKey: "me")
+                let address = "\(PrefsUtil.getURLBase() ?? "https://qmera.io/")nexilis/pages/tab5-new-post?f_pin=\(me ?? "")"
+                self.thirdTab?.webView.evaluateJavaScript("window.location = '\(address)'")
+                
+            })
+        }
+    }
+    
     static func pullActionButton() {
         if datePullFB == nil || Int(Date().timeIntervalSince(datePullFB!)) >= 60 {
             datePullFB = Date()
@@ -832,14 +813,14 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
                                     if jsonArray.count != 0 {
                                         var count = 0
                                         for json in jsonArray {
-                                            let package_id = json["package_id"] as! String
+                                            let package_id = json["package_act"] as! String
                                             let app_id = (json["app_id"] as? String) ?? ""
                                             let icon = (json["icon"] as? String) ?? ""
                                             listPullFB.append("\(package_id)|\(app_id)")
                                             if count == 0 {
                                                 if !icon.isEmpty {
                                                     DispatchQueue.global().async {
-                                                        ViewController.getDataImageFromUrl(from: URL(string: "http://202.158.33.26/filepalio/image/\(icon)")!) { data, response, error in
+                                                        ViewController.getDataImageFromUrl(from: URL(string: "http://\(Nexilis.ADDRESS)/filepalio/image/\(icon)")!) { data, response, error in
                                                             guard let data = data, error == nil else { return }
                                                             // always update the UI from the main thread
                                                             DispatchQueue.main.async() {
@@ -853,7 +834,7 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
                                             } else if count == 1 {
                                                 if !icon.isEmpty {
                                                     DispatchQueue.global().async {
-                                                        ViewController.getDataImageFromUrl(from: URL(string: "http://202.158.33.26/filepalio/image/\(icon)")!) { data, response, error in
+                                                        ViewController.getDataImageFromUrl(from: URL(string: "http://\(Nexilis.ADDRESS)/filepalio/image/\(icon)")!) { data, response, error in
                                                             guard let data = data, error == nil else { return }
                                                             // always update the UI from the main thread
                                                             DispatchQueue.main.async() {
@@ -867,7 +848,7 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
                                             } else if count == 2 {
                                                 if !icon.isEmpty {
                                                     DispatchQueue.global().async {
-                                                        ViewController.getDataImageFromUrl(from: URL(string: "http://202.158.33.26/filepalio/image/\(icon)")!) { data, response, error in
+                                                        ViewController.getDataImageFromUrl(from: URL(string: "http://\(Nexilis.ADDRESS)/filepalio/image/\(icon)")!) { data, response, error in
                                                             guard let data = data, error == nil else { return }
                                                             // always update the UI from the main thread
                                                             DispatchQueue.main.async() {
@@ -881,7 +862,7 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
                                             } else if count == 3 {
                                                 if !icon.isEmpty {
                                                     DispatchQueue.global().async {
-                                                        ViewController.getDataImageFromUrl(from: URL(string: "http://202.158.33.26/filepalio/image/\(icon)")!) { data, response, error in
+                                                        ViewController.getDataImageFromUrl(from: URL(string: "http://\(Nexilis.ADDRESS)/filepalio/image/\(icon)")!) { data, response, error in
                                                             guard let data = data, error == nil else { return }
                                                             // always update the UI from the main thread
                                                             DispatchQueue.main.async() {
@@ -895,7 +876,7 @@ class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMAB
                                             } else if count == 4 {
                                                 if !icon.isEmpty {
                                                     DispatchQueue.global().async {
-                                                        ViewController.getDataImageFromUrl(from: URL(string: "http://202.158.33.26/filepalio/image/\(icon)")!) { data, response, error in
+                                                        ViewController.getDataImageFromUrl(from: URL(string: "http://\(Nexilis.ADDRESS)/filepalio/image/\(icon)")!) { data, response, error in
                                                             guard let data = data, error == nil else { return }
                                                             // always update the UI from the main thread
                                                             DispatchQueue.main.async() {

+ 29 - 425
appbuilder-ios/NexilisLite/NexilisLite/Source/FloatingButton/FloatingButton.swift

@@ -145,109 +145,24 @@ public class FloatingButton: UIView {
                                     getDefaultButton()
                                 } else {
                                     for json in jsonArray {
-                                        if (json["package_id"] as! String).contains("_fb1") {
-                                            button_fb1 = UIButton()
-                                            button_fb1.heightAnchor.constraint(equalToConstant: 40).isActive = true
-                                            button_fb1.translatesAutoresizingMaskIntoConstraints = false
-                                            DispatchQueue.global().async {
-                                                let data = try? Data(contentsOf: URL(string: "https://\(Nexilis.ADDRESS)/filepalio/image/\(json["icon"]!!)")!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
-                                                DispatchQueue.main.async { [self] in
-                                                    if data != nil {
-                                                        button_fb1.setImage(UIImage(data: data!), for: .normal)
-                                                    }
+                                        let package_id = json["package_id"] as! String
+                                        let app_id = (json["app_id"] as? String) ?? ""
+                                        let icon = (json["icon"] as? String) ?? ""
+                                        let newButton = UIButton()
+                                        newButton.heightAnchor.constraint(equalToConstant: 40).isActive = true
+                                        newButton.translatesAutoresizingMaskIntoConstraints = false
+                                        DispatchQueue.global().async {
+                                            let data = try? Data(contentsOf: URL(string: "http://\(Nexilis.ADDRESS)/filepalio/image/\(icon)")!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
+                                            DispatchQueue.main.async {
+                                                if data != nil {
+                                                    newButton.setImage(UIImage(data: data!), for: .normal)
                                                 }
                                             }
-                                            groupView.addArrangedSubview(button_fb1)
-                                            button_fb1.addTarget(self, action: #selector(fb1Tap), for: .touchUpOutside)
-                                        } else if (json["package_id"] as! String).contains("_fb2") {
-                                            button_fb2 = UIButton()
-                                            button_fb2.heightAnchor.constraint(equalToConstant: 40).isActive = true
-                                            button_fb2.translatesAutoresizingMaskIntoConstraints = false
-                                            DispatchQueue.global().async {
-                                                let data = try? Data(contentsOf: URL(string: "https://\(Nexilis.ADDRESS)/filepalio/image/\(json["icon"]!!)")!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
-                                                DispatchQueue.main.async { [self] in
-                                                    if data != nil {
-                                                        button_fb2.setImage(UIImage(data: data!), for: .normal)
-                                                    }
-                                                }
-                                            }
-                                            groupView.addArrangedSubview(button_fb2)
-                                            button_fb2.addTarget(self, action: #selector(fb2Tap), for: .touchUpOutside)
-                                            checkCounter()
-                                        } else if (json["package_id"] as! String).contains("_fb3") {
-                                            button_fb3 = UIButton()
-                                            button_fb3.heightAnchor.constraint(equalToConstant: 40).isActive = true
-                                            button_fb3.translatesAutoresizingMaskIntoConstraints = false
-                                            DispatchQueue.global().async {
-                                                let data = try? Data(contentsOf: URL(string: "https://\(Nexilis.ADDRESS)/filepalio/image/\(json["icon"]!!)")!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
-                                                DispatchQueue.main.async { [self] in
-                                                    if data != nil {
-                                                        button_fb3.setImage(UIImage(data: data!), for: .normal)
-                                                    }
-                                                }
-                                            }
-                                            groupView.addArrangedSubview(button_fb3)
-                                            button_fb3.addTarget(self, action: #selector(fb3Tap), for: .touchUpOutside)
-                                        } else if (json["package_id"] as! String).contains("_fb4") {
-                                            button_fb4 = UIButton()
-                                            button_fb4.heightAnchor.constraint(equalToConstant: 40).isActive = true
-                                            button_fb4.translatesAutoresizingMaskIntoConstraints = false
-                                            iconCC = json["icon"] as! String
-                                            DispatchQueue.global().async {
-                                                let data = try? Data(contentsOf: URL(string: "https://\(Nexilis.ADDRESS)/filepalio/image/\(json["icon"]!!)")!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
-                                                DispatchQueue.main.async { [self] in
-                                                    if data != nil {
-                                                        button_fb4.setImage(UIImage(data: data!), for: .normal)
-                                                    }
-                                                }
-                                            }
-                                    
-                                            groupView.addArrangedSubview(button_fb4)
-                                            button_fb4.addTarget(self, action: #selector(fb4Tap), for: .touchUpOutside)
-                                        } else if (json["package_id"] as! String).contains("_fb5") {
-                                            let newButton = UIButton()
-                                            newButton.heightAnchor.constraint(equalToConstant: 40).isActive = true
-                                            newButton.translatesAutoresizingMaskIntoConstraints = false
-                                            DispatchQueue.global().async {
-                                                let data = try? Data(contentsOf: URL(string: "https://\(Nexilis.ADDRESS)/filepalio/image/\(json["icon"]!!)")!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
-                                                DispatchQueue.main.async {
-                                                    if data != nil {
-                                                        newButton.setImage(UIImage(data: data!), for: .normal)
-                                                    }
-                                                }
-                                            }
-                                            groupView.addArrangedSubview(newButton)
-                                            newButton.addTarget(self, action: #selector(bniBookingTap), for: .touchUpOutside)
-                                        } else if (json["package_id"] as! String).contains("_fb6") {
-                                            let newButton = UIButton()
-                                            newButton.heightAnchor.constraint(equalToConstant: 40).isActive = true
-                                            newButton.translatesAutoresizingMaskIntoConstraints = false
-                                            DispatchQueue.global().async {
-                                                let data = try? Data(contentsOf: URL(string: "https://\(Nexilis.ADDRESS)/filepalio/image/\(json["icon"]!!)")!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
-                                                DispatchQueue.main.async {
-                                                    if data != nil {
-                                                        newButton.setImage(UIImage(data: data!), for: .normal)
-                                                    }
-                                                }
-                                            }
-                                            groupView.addArrangedSubview(newButton)
-                                            newButton.addTarget(self, action: #selector(historyBroadcastTap), for: .touchUpOutside)
-                                        } else {
-                                            let newButton = UIButton()
-                                            newButton.heightAnchor.constraint(equalToConstant: 40).isActive = true
-                                            newButton.translatesAutoresizingMaskIntoConstraints = false
-                                            DispatchQueue.global().async {
-                                                let data = try? Data(contentsOf: URL(string: "https://\(Nexilis.ADDRESS)/filepalio/image/\(json["icon"]!!)")!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
-                                                DispatchQueue.main.async {
-                                                    if data != nil {
-                                                        newButton.setImage(UIImage(data: data!), for: .normal)
-                                                    }
-                                                }
-                                            }
-                                            groupView.addArrangedSubview(newButton)
-                                            newButton.restorationIdentifier = json["app_id"] as? String
-                                            newButton.addTarget(self, action: #selector(tapMoreApp(_:)), for: .touchUpOutside)
                                         }
+                                        groupView.addArrangedSubview(newButton)
+                                        newButton.restorationIdentifier = package_id
+                                        newButton.accessibilityIdentifier = app_id
+                                        newButton.addTarget(self, action: #selector(fbTap), for: .touchUpOutside)
                                     }
                                 }
                                 let countSubviewsAfter = groupView.subviews.count
@@ -397,348 +312,37 @@ public class FloatingButton: UIView {
         show(isShow: !isShow)
     }
     
-    @objc func tapMoreApp(_ sender: UIButton) {
-        let id = sender.restorationIdentifier
-        let isChangeProfile = Utils.getSetProfile()
-        if !isChangeProfile {
-            let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
-            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
-                let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
-                let navigationController = UINavigationController(rootViewController: controller)
-                navigationController.modalPresentationStyle = .fullScreen
-                navigationController.navigationBar.tintColor = .white
-                navigationController.navigationBar.barTintColor = .mainColor
-                navigationController.navigationBar.isTranslucent = false
-                let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
-                navigationController.navigationBar.titleTextAttributes = textAttributes
-                navigationController.view.backgroundColor = .mainColor
-                if UIApplication.shared.visibleViewController?.navigationController != nil {
-                    UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
-                } else {
-                    UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
-                }
-            }))
-            if UIApplication.shared.visibleViewController?.navigationController != nil {
-                UIApplication.shared.visibleViewController?.navigationController?.present(alert, animated: true, completion: nil)
-            } else {
-                UIApplication.shared.visibleViewController?.present(alert, animated: true, completion: nil)
-            }
-            hideButton()
-            return
-        }
-        if id == nil {
-            return
+    @objc func fbTap(_ sender: UIButton) {
+        let package_id = sender.restorationIdentifier!
+        var app_id = sender.accessibilityIdentifier!
+        var indexTap = 0
+        if package_id.contains("_fb"){
+            indexTap = Int(String(package_id.split(separator: "_")[1]).substring(from: 2, to: 2))!
         }
-        if let url = URL(string: "itms-apps://apple.com/app/\(id!)") {
-            UIApplication.shared.open(url)
+        if indexTap == 2 {
+            app_id = package_id.components(separatedBy: "_")[2]
         }
+        Nexilis.buttonClicked(index: indexTap, id: app_id)
         hideButton()
     }
     
     @objc func fb1Tap() {
-        let isChangeProfile = Utils.getSetProfile()
-        if !isChangeProfile {
-            let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
-            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
-                let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
-                let navigationController = UINavigationController(rootViewController: controller)
-                navigationController.modalPresentationStyle = .fullScreen
-                navigationController.navigationBar.tintColor = .white
-                navigationController.navigationBar.barTintColor = .mainColor
-                navigationController.navigationBar.isTranslucent = false
-                let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
-                navigationController.navigationBar.titleTextAttributes = textAttributes
-                navigationController.view.backgroundColor = .mainColor
-                if UIApplication.shared.visibleViewController?.navigationController != nil {
-                    UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
-                } else {
-                    UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
-                }
-            }))
-            if UIApplication.shared.visibleViewController?.navigationController != nil {
-                UIApplication.shared.visibleViewController?.navigationController?.present(alert, animated: true, completion: nil)
-            } else {
-                UIApplication.shared.visibleViewController?.present(alert, animated: true, completion: nil)
-            }
-            hideButton()
-            return
-        }
-        let isWaitingRequestCC = UserDefaults.standard.bool(forKey: "waitingRequestCC")
-        if isWaitingRequestCC {
-            let imageView = UIImageView(image: UIImage(systemName: "info.circle"))
-            imageView.tintColor = .white
-            let banner = FloatingNotificationBanner(title: "You have requested Call Center, please wait for response.".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .info, colors: nil, iconPosition: .center)
-            banner.show()
-            return
-        }
-        let controller = AppStoryBoard.Palio.instance.instantiateViewController(identifier: "editorPersonalVC") as! EditorPersonal
-        controller.isContactCenter = true
-        let navigationController = UINavigationController(rootViewController: controller)
-        navigationController.modalPresentationStyle = .fullScreen
-        navigationController.navigationBar.tintColor = .white
-        navigationController.navigationBar.barTintColor = .mainColor
-        navigationController.navigationBar.isTranslucent = false
-        let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
-        navigationController.navigationBar.titleTextAttributes = textAttributes
-        navigationController.view.backgroundColor = .mainColor
-        if UIApplication.shared.visibleViewController?.navigationController != nil {
-            UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
-        } else {
-            UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
-        }
+        Nexilis.openContactCenter()
         hideButton()
     }
     
     @objc func fb2Tap() {
-        let isChangeProfile = Utils.getSetProfile()
-        if !isChangeProfile {
-            let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
-            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
-                let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
-                let navigationController = UINavigationController(rootViewController: controller)
-                navigationController.modalPresentationStyle = .fullScreen
-                navigationController.navigationBar.tintColor = .white
-                navigationController.navigationBar.barTintColor = .mainColor
-                navigationController.navigationBar.isTranslucent = false
-                let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
-                navigationController.navigationBar.titleTextAttributes = textAttributes
-                navigationController.view.backgroundColor = .mainColor
-                if UIApplication.shared.visibleViewController?.navigationController != nil {
-                    UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
-                } else {
-                    UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
-                }
-            }))
-            if UIApplication.shared.visibleViewController?.navigationController != nil {
-                UIApplication.shared.visibleViewController?.navigationController?.present(alert, animated: true, completion: nil)
-            } else {
-                UIApplication.shared.visibleViewController?.present(alert, animated: true, completion: nil)
-            }
-            hideButton()
-            return
-        }
-        let navigationController = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "contactChatNav") as! UINavigationController
-        navigationController.modalPresentationStyle = .fullScreen
-        navigationController.navigationBar.tintColor = .white
-        navigationController.navigationBar.barTintColor = .mainColor
-        navigationController.navigationBar.isTranslucent = false
-        let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
-        navigationController.navigationBar.titleTextAttributes = textAttributes
-        navigationController.view.backgroundColor = .mainColor
-        if UIApplication.shared.visibleViewController?.navigationController != nil {
-            UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
-        } else {
-            UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
-        }
+        Nexilis.openChat()
         hideButton()
     }
     
     @objc func fb3Tap() {
-        let isChangeProfile = Utils.getSetProfile()
-        if !isChangeProfile {
-            let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
-            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
-                let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
-                let navigationController = UINavigationController(rootViewController: controller)
-                navigationController.modalPresentationStyle = .fullScreen
-                navigationController.navigationBar.tintColor = .white
-                navigationController.navigationBar.barTintColor = .mainColor
-                navigationController.navigationBar.isTranslucent = false
-                let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
-                navigationController.navigationBar.titleTextAttributes = textAttributes
-                navigationController.view.backgroundColor = .mainColor
-                if UIApplication.shared.visibleViewController?.navigationController != nil {
-                    UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
-                } else {
-                    UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
-                }
-            }))
-            if UIApplication.shared.visibleViewController?.navigationController != nil {
-                UIApplication.shared.visibleViewController?.navigationController?.present(alert, animated: true, completion: nil)
-            } else {
-                UIApplication.shared.visibleViewController?.present(alert, animated: true, completion: nil)
-            }
-            hideButton()
-            return
-        }
-        let callContact = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "contactSID")
-        let navigationController = UINavigationController(rootViewController: callContact)
-        navigationController.modalPresentationStyle = .fullScreen
-        navigationController.navigationBar.tintColor = .white
-        navigationController.navigationBar.barTintColor = .mainColor
-        navigationController.navigationBar.isTranslucent = false
-        let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
-        navigationController.navigationBar.titleTextAttributes = textAttributes
-        navigationController.view.backgroundColor = .mainColor
-        if UIApplication.shared.visibleViewController?.navigationController != nil {
-            UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
-        } else {
-            UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
-        }
+        Nexilis.openCall()
         hideButton()
     }
     
     @objc func fb4Tap() {
-        let isChangeProfile = Utils.getSetProfile()
-        if !isChangeProfile {
-            let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
-            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
-                let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
-                let navigationController = UINavigationController(rootViewController: controller)
-                navigationController.modalPresentationStyle = .fullScreen
-                navigationController.navigationBar.tintColor = .white
-                navigationController.navigationBar.barTintColor = .mainColor
-                navigationController.navigationBar.isTranslucent = false
-                let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
-                navigationController.navigationBar.titleTextAttributes = textAttributes
-                navigationController.view.backgroundColor = .mainColor
-                if UIApplication.shared.visibleViewController?.navigationController != nil {
-                    UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
-                } else {
-                    UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
-                }
-            }))
-            if UIApplication.shared.visibleViewController?.navigationController != nil {
-                UIApplication.shared.visibleViewController?.navigationController?.present(alert, animated: true, completion: nil)
-            } else {
-                UIApplication.shared.visibleViewController?.present(alert, animated: true, completion: nil)
-            }
-            hideButton()
-            return
-        }
-        let navigationController = UINavigationController(rootViewController: QmeraCreateStreamingViewController())
-        navigationController.modalPresentationStyle = .fullScreen
-        navigationController.navigationBar.tintColor = .white
-        navigationController.navigationBar.barTintColor = .mainColor
-        navigationController.navigationBar.isTranslucent = false
-        let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
-        navigationController.navigationBar.titleTextAttributes = textAttributes
-        navigationController.view.backgroundColor = .mainColor
-        if UIApplication.shared.visibleViewController?.navigationController != nil {
-            UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
-        } else {
-            UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
-        }
-        hideButton()
-    }
-
-    @objc func bniBookingTap() {
-        let isChangeProfile = Utils.getSetProfile()
-        if !isChangeProfile {
-            let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
-            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
-                let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
-                let navigationController = UINavigationController(rootViewController: controller)
-                navigationController.modalPresentationStyle = .fullScreen
-                navigationController.navigationBar.tintColor = .white
-                navigationController.navigationBar.barTintColor = .mainColor
-                navigationController.navigationBar.isTranslucent = false
-                let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
-                navigationController.navigationBar.titleTextAttributes = textAttributes
-                navigationController.view.backgroundColor = .mainColor
-                if UIApplication.shared.visibleViewController?.navigationController != nil {
-                    UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
-                } else {
-                    UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
-                }
-            }))
-            if UIApplication.shared.visibleViewController?.navigationController != nil {
-                UIApplication.shared.visibleViewController?.navigationController?.present(alert, animated: true, completion: nil)
-            } else {
-                UIApplication.shared.visibleViewController?.present(alert, animated: true, completion: nil)
-            }
-            hideButton()
-            return
-        }
-        let controller = BNIBookingWebView()
-        if UIApplication.shared.visibleViewController?.navigationController != nil {
-            UIApplication.shared.visibleViewController?.navigationController?.present(controller, animated: true, completion: nil)
-        } else {
-            UIApplication.shared.visibleViewController?.present(controller, animated: true, completion: nil)
-        }
-        hideButton()
-    }
-    
-    @objc func openCustomURL(url: String) {
-        let isChangeProfile = Utils.getSetProfile()
-        if !isChangeProfile {
-            let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
-            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
-                let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
-                let navigationController = UINavigationController(rootViewController: controller)
-                navigationController.modalPresentationStyle = .fullScreen
-                navigationController.navigationBar.tintColor = .white
-                navigationController.navigationBar.barTintColor = .mainColor
-                navigationController.navigationBar.isTranslucent = false
-                let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
-                navigationController.navigationBar.titleTextAttributes = textAttributes
-                navigationController.view.backgroundColor = .mainColor
-                if UIApplication.shared.visibleViewController?.navigationController != nil {
-                    UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
-                } else {
-                    UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
-                }
-            }))
-            if UIApplication.shared.visibleViewController?.navigationController != nil {
-                UIApplication.shared.visibleViewController?.navigationController?.present(alert, animated: true, completion: nil)
-            } else {
-                UIApplication.shared.visibleViewController?.present(alert, animated: true, completion: nil)
-            }
-            hideButton()
-            return
-        }
-        let controller = BNIBookingWebView()
-        controller.customUrl = url
-        if UIApplication.shared.visibleViewController?.navigationController != nil {
-            UIApplication.shared.visibleViewController?.navigationController?.present(controller, animated: true, completion: nil)
-        } else {
-            UIApplication.shared.visibleViewController?.present(controller, animated: true, completion: nil)
-        }
-        hideButton()
-    }
-    
-    @objc func historyBroadcastTap() {
-        let isChangeProfile = Utils.getSetProfile()
-        if !isChangeProfile {
-            let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
-            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
-                let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
-                let navigationController = UINavigationController(rootViewController: controller)
-                navigationController.modalPresentationStyle = .fullScreen
-                navigationController.navigationBar.tintColor = .white
-                navigationController.navigationBar.barTintColor = .mainColor
-                navigationController.navigationBar.isTranslucent = false
-                let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
-                navigationController.navigationBar.titleTextAttributes = textAttributes
-                navigationController.view.backgroundColor = .mainColor
-                if UIApplication.shared.visibleViewController?.navigationController != nil {
-                    UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
-                } else {
-                    UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
-                }
-        }))
-        if UIApplication.shared.visibleViewController?.navigationController != nil {
-            UIApplication.shared.visibleViewController?.navigationController?.present(alert, animated: true, completion: nil)
-        } else {
-            UIApplication.shared.visibleViewController?.present(alert, animated: true, completion: nil)
-        }
-        hideButton()
-            return
-        }
-        let controller = HistoryBroadcastViewController()
-        let navigationController = UINavigationController(rootViewController: controller)
-        navigationController.modalPresentationStyle = .fullScreen
-        navigationController.navigationBar.tintColor = .white
-        navigationController.navigationBar.barTintColor = .mainColor
-        navigationController.navigationBar.isTranslucent = false
-        let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
-        navigationController.navigationBar.titleTextAttributes = textAttributes
-        navigationController.view.backgroundColor = .mainColor
-        if UIApplication.shared.visibleViewController?.navigationController != nil {
-            UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
-        } else {
-            UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
-        }
+        Nexilis.openStreaming()
         hideButton()
     }
     
@@ -761,7 +365,7 @@ public class FloatingButton: UIView {
         }
     }
     
-    @objc func hideButton() {
+    @objc public func hideButton() {
         if isShow {
             show(isShow: false)
         }

+ 308 - 16
appbuilder-ios/NexilisLite/NexilisLite/Source/Nexilis.swift

@@ -467,25 +467,317 @@ public class Nexilis: NSObject {
     }
 
     public static func buttonClicked(index: Int, id: String = "") {
-        let fb = FloatingButton()
-        if index == 1 {
-            fb.fb1Tap()
-        } else if index == 2 {
-            fb.fb2Tap()
+        print("BTNCLICK \(index) \(id)")
+        if index == 2 {
+            Nexilis.openUrl(url: id)
         } else if index == 3 {
-            fb.fb3Tap()
-        } else if index == 4 {
-            fb.fb4Tap()
-        } else if id == "openQMS" {
-            fb.bniBookingTap()
-        } else if id == "openHistoryCC" {
-            fb.historyBroadcastTap()
+            Nexilis.openNotificationCenter()
+        } else if index == 6 {
+            Nexilis.openChat()
         } else if index == 7 {
-            fb.openCustomURL(url: id)
+            Nexilis.openCall()
+        } else if index == 8 {
+            Nexilis.openStreaming()
+        } else if index == 9 {
+            Nexilis.openContactCenter()
         } else {
-            let idButton = UIButton()
-            idButton.restorationIdentifier = id
-            fb.tapMoreApp(idButton)
+            Nexilis.openApp(id: id)
+        }
+    }
+    
+    public static func openContactCenter() {
+        let isChangeProfile = Utils.getSetProfile()
+        if !isChangeProfile {
+            let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
+            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
+                let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
+                let navigationController = UINavigationController(rootViewController: controller)
+                navigationController.modalPresentationStyle = .fullScreen
+                navigationController.navigationBar.tintColor = .white
+                navigationController.navigationBar.barTintColor = .mainColor
+                navigationController.navigationBar.isTranslucent = false
+                let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
+                navigationController.navigationBar.titleTextAttributes = textAttributes
+                navigationController.view.backgroundColor = .mainColor
+                if UIApplication.shared.visibleViewController?.navigationController != nil {
+                    UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
+                } else {
+                    UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
+                }
+            }))
+            if UIApplication.shared.visibleViewController?.navigationController != nil {
+                UIApplication.shared.visibleViewController?.navigationController?.present(alert, animated: true, completion: nil)
+            } else {
+                UIApplication.shared.visibleViewController?.present(alert, animated: true, completion: nil)
+            }
+            return
+        }
+        let isWaitingRequestCC = UserDefaults.standard.bool(forKey: "waitingRequestCC")
+        if isWaitingRequestCC {
+            let imageView = UIImageView(image: UIImage(systemName: "info.circle"))
+            imageView.tintColor = .white
+            let banner = FloatingNotificationBanner(title: "You have requested Call Center, please wait for response.".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .info, colors: nil, iconPosition: .center)
+            banner.show()
+            return
+        }
+        let controller = AppStoryBoard.Palio.instance.instantiateViewController(identifier: "editorPersonalVC") as! EditorPersonal
+        controller.isContactCenter = true
+        let navigationController = UINavigationController(rootViewController: controller)
+        navigationController.modalPresentationStyle = .fullScreen
+        navigationController.navigationBar.tintColor = .white
+        navigationController.navigationBar.barTintColor = .mainColor
+        navigationController.navigationBar.isTranslucent = false
+        let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
+        navigationController.navigationBar.titleTextAttributes = textAttributes
+        navigationController.view.backgroundColor = .mainColor
+        if UIApplication.shared.visibleViewController?.navigationController != nil {
+            UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
+        } else {
+            UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
+        }
+    }
+    
+    public static func openChat() {
+        let isChangeProfile = Utils.getSetProfile()
+        if !isChangeProfile {
+            let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
+            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
+                let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
+                let navigationController = UINavigationController(rootViewController: controller)
+                navigationController.modalPresentationStyle = .fullScreen
+                navigationController.navigationBar.tintColor = .white
+                navigationController.navigationBar.barTintColor = .mainColor
+                navigationController.navigationBar.isTranslucent = false
+                let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
+                navigationController.navigationBar.titleTextAttributes = textAttributes
+                navigationController.view.backgroundColor = .mainColor
+                if UIApplication.shared.visibleViewController?.navigationController != nil {
+                    UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
+                } else {
+                    UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
+                }
+            }))
+            if UIApplication.shared.visibleViewController?.navigationController != nil {
+                UIApplication.shared.visibleViewController?.navigationController?.present(alert, animated: true, completion: nil)
+            } else {
+                UIApplication.shared.visibleViewController?.present(alert, animated: true, completion: nil)
+            }
+            return
+        }
+        let navigationController = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "contactChatNav") as! UINavigationController
+        navigationController.modalPresentationStyle = .fullScreen
+        navigationController.navigationBar.tintColor = .white
+        navigationController.navigationBar.barTintColor = .mainColor
+        navigationController.navigationBar.isTranslucent = false
+        let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
+        navigationController.navigationBar.titleTextAttributes = textAttributes
+        navigationController.view.backgroundColor = .mainColor
+        if UIApplication.shared.visibleViewController?.navigationController != nil {
+            UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
+        } else {
+            UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
+        }
+    }
+    
+    public static func openCall() {
+        let isChangeProfile = Utils.getSetProfile()
+        if !isChangeProfile {
+            let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
+            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
+                let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
+                let navigationController = UINavigationController(rootViewController: controller)
+                navigationController.modalPresentationStyle = .fullScreen
+                navigationController.navigationBar.tintColor = .white
+                navigationController.navigationBar.barTintColor = .mainColor
+                navigationController.navigationBar.isTranslucent = false
+                let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
+                navigationController.navigationBar.titleTextAttributes = textAttributes
+                navigationController.view.backgroundColor = .mainColor
+                if UIApplication.shared.visibleViewController?.navigationController != nil {
+                    UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
+                } else {
+                    UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
+                }
+            }))
+            if UIApplication.shared.visibleViewController?.navigationController != nil {
+                UIApplication.shared.visibleViewController?.navigationController?.present(alert, animated: true, completion: nil)
+            } else {
+                UIApplication.shared.visibleViewController?.present(alert, animated: true, completion: nil)
+            }
+            return
+        }
+        let callContact = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "contactSID")
+        let navigationController = UINavigationController(rootViewController: callContact)
+        navigationController.modalPresentationStyle = .fullScreen
+        navigationController.navigationBar.tintColor = .white
+        navigationController.navigationBar.barTintColor = .mainColor
+        navigationController.navigationBar.isTranslucent = false
+        let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
+        navigationController.navigationBar.titleTextAttributes = textAttributes
+        navigationController.view.backgroundColor = .mainColor
+        if UIApplication.shared.visibleViewController?.navigationController != nil {
+            UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
+        } else {
+            UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
+        }
+    }
+    
+    public static func openStreaming() {
+        let isChangeProfile = Utils.getSetProfile()
+        if !isChangeProfile {
+            let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
+            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
+                let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
+                let navigationController = UINavigationController(rootViewController: controller)
+                navigationController.modalPresentationStyle = .fullScreen
+                navigationController.navigationBar.tintColor = .white
+                navigationController.navigationBar.barTintColor = .mainColor
+                navigationController.navigationBar.isTranslucent = false
+                let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
+                navigationController.navigationBar.titleTextAttributes = textAttributes
+                navigationController.view.backgroundColor = .mainColor
+                if UIApplication.shared.visibleViewController?.navigationController != nil {
+                    UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
+                } else {
+                    UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
+                }
+            }))
+            if UIApplication.shared.visibleViewController?.navigationController != nil {
+                UIApplication.shared.visibleViewController?.navigationController?.present(alert, animated: true, completion: nil)
+            } else {
+                UIApplication.shared.visibleViewController?.present(alert, animated: true, completion: nil)
+            }
+            return
+        }
+        let navigationController = UINavigationController(rootViewController: QmeraCreateStreamingViewController())
+        navigationController.modalPresentationStyle = .fullScreen
+        navigationController.navigationBar.tintColor = .white
+        navigationController.navigationBar.barTintColor = .mainColor
+        navigationController.navigationBar.isTranslucent = false
+        let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
+        navigationController.navigationBar.titleTextAttributes = textAttributes
+        navigationController.view.backgroundColor = .mainColor
+        if UIApplication.shared.visibleViewController?.navigationController != nil {
+            UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
+        } else {
+            UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
+        }
+    }
+    
+    public static func openUrl(isBNI: Bool = false, url: String = "") {
+        let isChangeProfile = Utils.getSetProfile()
+        if !isChangeProfile {
+            let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
+            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
+                let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
+                let navigationController = UINavigationController(rootViewController: controller)
+                navigationController.modalPresentationStyle = .fullScreen
+                navigationController.navigationBar.tintColor = .white
+                navigationController.navigationBar.barTintColor = .mainColor
+                navigationController.navigationBar.isTranslucent = false
+                let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
+                navigationController.navigationBar.titleTextAttributes = textAttributes
+                navigationController.view.backgroundColor = .mainColor
+                if UIApplication.shared.visibleViewController?.navigationController != nil {
+                    UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
+                } else {
+                    UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
+                }
+            }))
+            if UIApplication.shared.visibleViewController?.navigationController != nil {
+                UIApplication.shared.visibleViewController?.navigationController?.present(alert, animated: true, completion: nil)
+            } else {
+                UIApplication.shared.visibleViewController?.present(alert, animated: true, completion: nil)
+            }
+            return
+        }
+        let controller = BNIBookingWebView()
+        if !isBNI {
+            controller.customUrl = url
+        }
+        if UIApplication.shared.visibleViewController?.navigationController != nil {
+            UIApplication.shared.visibleViewController?.navigationController?.present(controller, animated: true, completion: nil)
+        } else {
+            UIApplication.shared.visibleViewController?.present(controller, animated: true, completion: nil)
+        }
+    }
+    
+    public static func openNotificationCenter() {
+        let isChangeProfile = Utils.getSetProfile()
+        if !isChangeProfile {
+            let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
+            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
+                let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
+                let navigationController = UINavigationController(rootViewController: controller)
+                navigationController.modalPresentationStyle = .fullScreen
+                navigationController.navigationBar.tintColor = .white
+                navigationController.navigationBar.barTintColor = .mainColor
+                navigationController.navigationBar.isTranslucent = false
+                let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
+                navigationController.navigationBar.titleTextAttributes = textAttributes
+                navigationController.view.backgroundColor = .mainColor
+                if UIApplication.shared.visibleViewController?.navigationController != nil {
+                    UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
+                } else {
+                    UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
+                }
+            }))
+            if UIApplication.shared.visibleViewController?.navigationController != nil {
+                UIApplication.shared.visibleViewController?.navigationController?.present(alert, animated: true, completion: nil)
+            } else {
+                UIApplication.shared.visibleViewController?.present(alert, animated: true, completion: nil)
+            }
+            return
+        }
+        let controller = HistoryBroadcastViewController()
+        let navigationController = UINavigationController(rootViewController: controller)
+        navigationController.modalPresentationStyle = .fullScreen
+        navigationController.navigationBar.tintColor = .white
+        navigationController.navigationBar.barTintColor = .mainColor
+        navigationController.navigationBar.isTranslucent = false
+        let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
+        navigationController.navigationBar.titleTextAttributes = textAttributes
+        navigationController.view.backgroundColor = .mainColor
+        if UIApplication.shared.visibleViewController?.navigationController != nil {
+            UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
+        } else {
+            UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
+        }
+    }
+    
+    public static func openApp(id: String) {
+        print("openApp itms-apps://apple.com/app/\(id)")
+        let isChangeProfile = Utils.getSetProfile()
+        if !isChangeProfile {
+            let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
+            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
+                let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
+                let navigationController = UINavigationController(rootViewController: controller)
+                navigationController.modalPresentationStyle = .fullScreen
+                navigationController.navigationBar.tintColor = .white
+                navigationController.navigationBar.barTintColor = .mainColor
+                navigationController.navigationBar.isTranslucent = false
+                let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
+                navigationController.navigationBar.titleTextAttributes = textAttributes
+                navigationController.view.backgroundColor = .mainColor
+                if UIApplication.shared.visibleViewController?.navigationController != nil {
+                    UIApplication.shared.visibleViewController?.navigationController?.present(navigationController, animated: true, completion: nil)
+                } else {
+                    UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
+                }
+            }))
+            if UIApplication.shared.visibleViewController?.navigationController != nil {
+                UIApplication.shared.visibleViewController?.navigationController?.present(alert, animated: true, completion: nil)
+            } else {
+                UIApplication.shared.visibleViewController?.present(alert, animated: true, completion: nil)
+            }
+            return
+        }
+        if id == nil {
+            return
+        }
+        if let url = URL(string: "itms-apps://apple.com/app/\(id)") {
+            UIApplication.shared.open(url)
         }
     }
     

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

@@ -54,7 +54,7 @@ class BNIBookingWebView: UIViewController, WKNavigationDelegate, UIScrollViewDel
             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 = UserDefaults.standard.string(forKey: "app_builder_url_qms") ?? "https://sqbni.murni.id:4200/bnibookingonline/#/?userid="
+                var stringQMS = "https://sqbni.murni.id:4200/bnibookingonline/#/?userid="
                 if !customUrl.isEmpty {
                     stringQMS = customUrl
                 }