alqindiirsyam 2 år sedan
förälder
incheckning
598443c6f9

+ 1 - 1
appbuilder-ios/AppBuilder/AppBuilder/AppDelegate.swift

@@ -117,7 +117,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
             if PrefsUtil.getCpaasMode() == PrefsUtil.CPAAS_MODE_FLOATING || PrefsUtil.getCpaasMode() == PrefsUtil.CPAAS_MODE_MIX {
                 showButton = true
             }
-            Nexilis.connect(apiKey: "***REPLACE***WITH***YOUR***ACCOUNT***", delegate: self, showButton: showButton) //AA6164AA13F0A6262677AC7443C37E3F6F0A342E8BEE84B700CB59C876166FE0(AWS) //36BCB99AA3885165E64ECC50591C4DA5072A25B2E7BAADA5A1B57E18737FF88C(CBN)
+            Nexilis.connect(apiKey: "***REPLACE***WITH***YOUR***ACCOUNT***", delegate: self, showButton: showButton, fromMAB: true) //AA6164AA13F0A6262677AC7443C37E3F6F0A342E8BEE84B700CB59C876166FE0(AWS) //36BCB99AA3885165E64ECC50591C4DA5072A25B2E7BAADA5A1B57E18737FF88C(CBN)
             if let response = Nexilis.writeSync(message: getPrefs(key: ""), timeout: 5000) {
                 if response.mBodies[CoreMessage_TMessageKey.ERRCOD] == "00" {
                     let data = response.getBody(key: CoreMessage_TMessageKey.DATA)

+ 8 - 3
appbuilder-ios/AppBuilder/AppBuilder/FourthTabViewController.swift

@@ -24,6 +24,8 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
     @IBOutlet weak var tableView: UITableView!
     @IBOutlet weak var backgroundImage: UIImageView!
     
+    var notInTab = false
+    
     public override func viewDidLoad() {
         super.viewDidLoad()
         
@@ -33,8 +35,6 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
 //        tableView.separatorColor = .gray
         tableView.separatorStyle = .none
         
-        self.navigationController?.navigationBar.topItem?.title = "Settings".localized();
-        
         switchVibrateMode.tintColor = .gray
         switchSaveToGallery.tintColor = .gray
         switchAutoDownload.tintColor = .gray
@@ -247,7 +247,12 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
     
     override public func viewWillAppear(_ animated: Bool) {
         backgroundImage.backgroundColor = .white
-        self.navigationController?.navigationBar.topItem?.title = "Settings".localized();
+        if notInTab {
+            self.title = "Settings".localized()
+            self.navigationController?.navigationBar.topItem?.title = ""
+        } else {
+            self.navigationController?.navigationBar.topItem?.title = "Settings".localized()
+        }
         self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.black]
         navigationController?.setNavigationBarHidden(false, animated: false)
         navigationController?.navigationBar.backgroundColor = .clear

+ 27 - 6
appbuilder-ios/AppBuilder/AppBuilder/ViewController.swift

@@ -14,7 +14,7 @@ import Speech
 import Alamofire
 import WebKit
 
-class ViewController: UITabBarController, UITabBarControllerDelegate {
+class ViewController: UITabBarController, UITabBarControllerDelegate, SettingMABDelegate {
     let playerController = AVPlayerViewController()
     static var sURL = "https://www.google.com"
     static var tab3 = "0"
@@ -50,6 +50,8 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
     let term = "Terms of Service.".localized()
     var firstLoad = true
     
+    var notDoubleCall: Date?
+    
     public static var def: ViewController?
 
     override func viewDidLoad() {
@@ -150,8 +152,6 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
 //            navigationController?.setNavigationBarHidden(true, animated: false)
 //        }
         
-        
-        
         self.setViewControllers(tabs, animated: false)
         if(cpaasMode == PrefsUtil.CPAAS_MODE_DOCKED || cpaasMode == PrefsUtil.CPAAS_MODE_MIX){
             if(customTab.count == 3){
@@ -174,6 +174,17 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
         tabBar.frame.origin.y = view.frame.height - 65
     }
     
+    func settingDelegate() {
+        if notDoubleCall != nil && Int(Date().timeIntervalSince(notDoubleCall!)) < 1 {
+            return
+        }
+        notDoubleCall = Date()
+        if let vc = fourthTab == nil ? storyboard?.instantiateViewController(withIdentifier: "fourthTabVC") as? FourthTabViewController : fourthTab {
+            vc.notInTab = true
+            self.navigationController?.show(vc, sender: nil)
+        }
+    }
+    
     public static func checkIsChangePerson() -> Bool {
         let isChangeProfile = Utils.getSetProfile()
         if !isChangeProfile {
@@ -195,9 +206,19 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
                 ViewController.def?.show(b: false)
                 ViewController.def?.thirdTab?.webView?.evaluateJavaScript("{if(pauseAll){pauseAll();}}")
                 ViewController.def?.firstTab?.webView?.evaluateJavaScript("{if(pauseAll){pauseAll();}}")
-                UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(navigationController, animated: true, completion: nil)
-                }))
-            UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController?.present(alert, animated: true, completion: nil)
+                let rootVC = UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController
+                if rootVC?.presentedViewController == nil {
+                    rootVC?.present(navigationController, animated: true, completion: nil)
+                } else {
+                    rootVC?.presentedViewController?.present(navigationController, animated: true, completion: nil)
+                }
+            }))
+            let rootVC = UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController
+            if rootVC?.presentedViewController == nil {
+                rootVC?.present(alert, animated: true, completion: nil)
+            } else {
+                rootVC?.presentedViewController?.present(alert, animated: true, completion: nil)
+            }
             return false
         }
         return true

+ 1 - 1
appbuilder-ios/NexilisLite/NexilisLite/Resource/id.lproj/Localizable.strings

@@ -184,4 +184,4 @@
 "Your verification code has been sent to" = "Kode verifikasi telah dikirim ke";
 "Please check your email and enter the code sent" = "Harap periksa email anda dan masukkan kode yang tertera";
 "Expired OTP" = "OTP telah kadaluarsa";
-"Invalid OTP" = "OTP tidak valid"
+"Invalid OTP" = "OTP tidak valid";

+ 19 - 9
appbuilder-ios/NexilisLite/NexilisLite/Source/FloatingButton/FloatingButton.swift

@@ -36,6 +36,8 @@ public class FloatingButton: UIView {
     
     var panGesture: UIPanGestureRecognizer?
     
+    public weak var mySettingDelegate: SettingMABDelegate?
+    
     public var isShow: Bool = false
     
     override init(frame: CGRect) {
@@ -734,15 +736,19 @@ public class FloatingButton: UIView {
     }
     
     @objc func qmeraLongPress() {
-        let navigationController = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "settingNav") 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
-        UIApplication.shared.rootViewController?.present(navigationController, animated: true, completion: nil)
+        if mySettingDelegate != nil {
+            mySettingDelegate?.settingDelegate()
+        } else {
+            let navigationController = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "settingNav") 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
+            UIApplication.shared.rootViewController?.present(navigationController, animated: true, completion: nil)
+        }
         hideButton()
     }
     
@@ -792,3 +798,7 @@ public class FloatingButton: UIView {
         }
     }
 }
+
+public protocol SettingMABDelegate: AnyObject {
+    func settingDelegate()
+}

+ 12 - 2
appbuilder-ios/NexilisLite/NexilisLite/Source/Nexilis.swift

@@ -63,7 +63,7 @@ public class Nexilis: NSObject {
         providerDelegate = CallProviderDelegate(callManager: callManager)
     }
     
-    public static func connect(apiKey: String, delegate: ConnectDelegate, showButton: Bool = true) {
+    public static func connect(apiKey: String, delegate: ConnectDelegate, showButton: Bool = true, fromMAB: Bool = false) {
         do {
             Nexilis.shared.createDelegate()
             
@@ -163,7 +163,17 @@ public class Nexilis: NSObject {
                                 notNull = true
                             }
                         }
-                        viewController?.view.addSubview(FloatingButton())
+                        let fb = FloatingButton()
+                        if fromMAB {
+                            var vc = viewController
+                            if viewController is UINavigationController {
+                                vc = (viewController as! UINavigationController).rootViewController
+                            }
+                            vc?.view.addSubview(fb)
+                            fb.mySettingDelegate = vc as? any SettingMABDelegate
+                        } else {
+                            viewController?.view.addSubview(fb)
+                        }
                     }
                 }
             }