瀏覽代碼

update button tapped docked

kevin 3 年之前
父節點
當前提交
4c2aa0455f

+ 46 - 64
appbuilder-ios/AppBuilder/AppBuilder/ViewController.swift

@@ -368,17 +368,7 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
         print("ccTap")
         print("ccTap")
         if(ViewController.checkIsChangePerson()){
         if(ViewController.checkIsChangePerson()){
             show(b: false)
             show(b: false)
-            let controller = AppStoryBoard.Palio.instance.instantiateViewController(identifier: "editorPersonalVC") as! EditorPersonal
-            controller.isContactCenter = true
-            let navigationController = UINavigationController(rootViewController: controller)
-            navigationController.modalPresentationStyle = .custom
-            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
-            UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(navigationController, animated: true, completion: nil)
+            Nexilis.buttonClicked(index: 1)
         }
         }
     }
     }
     
     
@@ -386,15 +376,11 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
         print("streamTap")
         print("streamTap")
         if(ViewController.checkIsChangePerson()){
         if(ViewController.checkIsChangePerson()){
             show(b: false)
             show(b: false)
-            let navigationController = UINavigationController(rootViewController: QmeraCreateStreamingViewController())
-            navigationController.modalPresentationStyle = .custom
-            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
-            UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(navigationController, animated: true, completion: nil)
+            if Bundle.main.displayName == "DigiNetS" {
+                Nexilis.buttonClicked(index: 0, id: "id1471093490")
+            } else {
+                Nexilis.buttonClicked(index: 4)
+            }
         }
         }
     }
     }
     
     
@@ -402,16 +388,12 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
         print("callTap")
         print("callTap")
         if(ViewController.checkIsChangePerson()){
         if(ViewController.checkIsChangePerson()){
             show(b: false)
             show(b: false)
-            let callContact = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "contactSID")
-            let navigationController = UINavigationController(rootViewController: callContact)
-            navigationController.modalPresentationStyle = .custom
-            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
-            UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(navigationController, animated: true, completion: nil)
+            if Bundle.main.displayName == "DigiNetS" {
+                //open QMS
+                Nexilis.buttonClicked(index: 0, id: "openQMS")
+            } else {
+                Nexilis.buttonClicked(index: 3)
+            }
         }
         }
     }
     }
     
     
@@ -419,49 +401,49 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
         print("chatTap")
         print("chatTap")
         if(ViewController.checkIsChangePerson()){
         if(ViewController.checkIsChangePerson()){
             show(b: false)
             show(b: false)
-            let navigationController = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "contactChatNav") as! UINavigationController
-            navigationController.modalPresentationStyle = .custom
-            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
-            UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(navigationController, animated: true, completion: nil)
+            if Bundle.main.displayName == "DigiNetS" {
+                Nexilis.buttonClicked(index: 0, id: "id967205539")
+            } else {
+                Nexilis.buttonClicked(index: 2)
+            }
         }
         }
     }
     }
     
     
     @objc func postTap() {
     @objc func postTap() {
         if(ViewController.checkIsChangePerson()){
         if(ViewController.checkIsChangePerson()){
             show(b: false)
             show(b: false)
-            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
+            if Bundle.main.displayName == "DigiNetS" {
+                //open history cc
+                Nexilis.buttonClicked(index: 0, id: "openHistoryCC")
+            } 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
                     }
                     }
-                    j += 1
+                    i += 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 = "https://qmera.io/nexilis/pages/tab5-new-post?f_pin=\(me ?? "")"
-                    if let url = URL(string: address){
+                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)'")
                         self.thirdTab?.webView.evaluateJavaScript("window.location = '\(address)'")
-                    }
-                })
+                        
+                    })
+                }
             }
             }
         }
         }
         
         

+ 88 - 5
appbuilder-ios/NexilisLite/NexilisLite/Source/FloatingButton/FloatingButton.swift

@@ -141,7 +141,7 @@ public class FloatingButton: UIView {
                                             button_fb1.heightAnchor.constraint(equalToConstant: 40).isActive = true
                                             button_fb1.heightAnchor.constraint(equalToConstant: 40).isActive = true
                                             button_fb1.translatesAutoresizingMaskIntoConstraints = false
                                             button_fb1.translatesAutoresizingMaskIntoConstraints = false
                                             DispatchQueue.global().async {
                                             DispatchQueue.global().async {
-                                                let data = try? Data(contentsOf: URL(string: "https://qmera.io/filepalio/image/\(json["icon"]!!)")!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
+                                                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
                                                 DispatchQueue.main.async { [self] in
                                                     if data != nil {
                                                     if data != nil {
                                                         button_fb1.setImage(UIImage(data: data!), for: .normal)
                                                         button_fb1.setImage(UIImage(data: data!), for: .normal)
@@ -155,7 +155,7 @@ public class FloatingButton: UIView {
                                             button_fb2.heightAnchor.constraint(equalToConstant: 40).isActive = true
                                             button_fb2.heightAnchor.constraint(equalToConstant: 40).isActive = true
                                             button_fb2.translatesAutoresizingMaskIntoConstraints = false
                                             button_fb2.translatesAutoresizingMaskIntoConstraints = false
                                             DispatchQueue.global().async {
                                             DispatchQueue.global().async {
-                                                let data = try? Data(contentsOf: URL(string: "https://qmera.io/filepalio/image/\(json["icon"]!!)")!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
+                                                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
                                                 DispatchQueue.main.async { [self] in
                                                     if data != nil {
                                                     if data != nil {
                                                         button_fb2.setImage(UIImage(data: data!), for: .normal)
                                                         button_fb2.setImage(UIImage(data: data!), for: .normal)
@@ -170,7 +170,7 @@ public class FloatingButton: UIView {
                                             button_fb3.heightAnchor.constraint(equalToConstant: 40).isActive = true
                                             button_fb3.heightAnchor.constraint(equalToConstant: 40).isActive = true
                                             button_fb3.translatesAutoresizingMaskIntoConstraints = false
                                             button_fb3.translatesAutoresizingMaskIntoConstraints = false
                                             DispatchQueue.global().async {
                                             DispatchQueue.global().async {
-                                                let data = try? Data(contentsOf: URL(string: "https://qmera.io/filepalio/image/\(json["icon"]!!)")!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
+                                                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
                                                 DispatchQueue.main.async { [self] in
                                                     if data != nil {
                                                     if data != nil {
                                                         button_fb3.setImage(UIImage(data: data!), for: .normal)
                                                         button_fb3.setImage(UIImage(data: data!), for: .normal)
@@ -185,7 +185,7 @@ public class FloatingButton: UIView {
                                             button_fb4.translatesAutoresizingMaskIntoConstraints = false
                                             button_fb4.translatesAutoresizingMaskIntoConstraints = false
                                             iconCC = json["icon"] as! String
                                             iconCC = json["icon"] as! String
                                             DispatchQueue.global().async {
                                             DispatchQueue.global().async {
-                                                let data = try? Data(contentsOf: URL(string: "https://qmera.io/filepalio/image/\(self.iconCC)")!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
+                                                let data = try? Data(contentsOf: URL(string: "https://\(Nexilis.ADDRESS)/filepalio/image/\(self.iconCC)")!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
                                                 DispatchQueue.main.async { [self] in
                                                 DispatchQueue.main.async { [self] in
                                                     if data != nil {
                                                     if data != nil {
                                                         button_fb4.setImage(UIImage(data: data!), for: .normal)
                                                         button_fb4.setImage(UIImage(data: data!), for: .normal)
@@ -200,7 +200,7 @@ public class FloatingButton: UIView {
                                             newButton.heightAnchor.constraint(equalToConstant: 40).isActive = true
                                             newButton.heightAnchor.constraint(equalToConstant: 40).isActive = true
                                             newButton.translatesAutoresizingMaskIntoConstraints = false
                                             newButton.translatesAutoresizingMaskIntoConstraints = false
                                             DispatchQueue.global().async {
                                             DispatchQueue.global().async {
-                                                let data = try? Data(contentsOf: URL(string: "https://qmera.io/filepalio/image/\(json["icon"]!!)")!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
+                                                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 {
                                                 DispatchQueue.main.async {
                                                     if data != nil {
                                                     if data != nil {
                                                         newButton.setImage(UIImage(data: data!), for: .normal)
                                                         newButton.setImage(UIImage(data: data!), for: .normal)
@@ -584,6 +584,89 @@ public class FloatingButton: UIView {
         }
         }
         hideButton()
         hideButton()
     }
     }
+
+    @objc func bniBookingTap() {
+        let isChangeProfile = UserDefaults.standard.bool(forKey: "is_change_profile")
+        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 = .custom
+                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.modalPresentationStyle = .custom
+        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 = UserDefaults.standard.bool(forKey: "is_change_profile")
+        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 = .custom
+                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 = .custom
+        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 qmeraLongPress() {
     @objc func qmeraLongPress() {
         let navigationController = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "settingNav") as! UINavigationController
         let navigationController = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "settingNav") as! UINavigationController

+ 22 - 1
appbuilder-ios/NexilisLite/NexilisLite/Source/Nexilis.swift

@@ -469,6 +469,27 @@ public class Nexilis: NSObject {
             print(error)
             print(error)
         }
         }
     }
     }
+
+    public static func buttonClicked(index: Int, id: String = "") {
+        let fb = FloatingButton()
+        if index == 1 {
+            fb.fb1Tap()
+        } else if index == 2 {
+            fb.fb2Tap()
+        } else if index == 3 {
+            fb.fb3Tap()
+        } else if index == 4 {
+            fb.fb4Tap()
+        } else if id == "openQMS" {
+            fb.bniBookingTap()
+        } else if id == "openHistoryCC" {
+            fb.historyBroadcastTap()
+        } else {
+            let idButton = UIButton()
+            idButton.restorationIdentifier = id
+            fb.tapMoreApp(idButton)
+        }
+    }
     
     
     private static var groupWait = DispatchGroup()
     private static var groupWait = DispatchGroup()
     
     
@@ -1491,7 +1512,7 @@ extension Nexilis: MessageDelegate {
                         }
                         }
                     } else if fileType == BroadcastViewController.FILE_TYPE_VIDEO {
                     } else if fileType == BroadcastViewController.FILE_TYPE_VIDEO {
                         //https://qmera.io/filepalio/image/
                         //https://qmera.io/filepalio/image/
-                        let player = AVPlayer(url: URL(string: "https://qmera.io/filepalio/image/\(video)")!)
+                        let player = AVPlayer(url: URL(string: "https://\(Nexilis.ADDRESS)/filepalio/image/\(video)")!)
                         let playerVC = AVPlayerViewController()
                         let playerVC = AVPlayerViewController()
                         playerVC.player = player
                         playerVC.player = player
                         playerVC.modalPresentationStyle = .custom
                         playerVC.modalPresentationStyle = .custom

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

@@ -32,7 +32,7 @@ class BNIBookingWebView: UIViewController, WKNavigationDelegate, UIScrollViewDel
             let idMe = UserDefaults.standard.string(forKey: "me") as String?
             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() {
             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)
                 let name = c.string(forColumnIndex: 0)!.trimmingCharacters(in: .whitespacesAndNewlines)
-                let url = URL(string: "https://sqappointment.murni.id:4200/bookingonline/#/?userid=\(name)")!
+                let url = URL(string: "https://sqbni.murni.id:4200/bookingonline/#/?userid=\(name)")!
                 webView.load(URLRequest(url: url))
                 webView.load(URLRequest(url: url))
                 c.close()
                 c.close()
             }
             }