浏览代码

update fb

alqindiirsyam 1 年之前
父节点
当前提交
c75c43eabf

+ 6 - 0
appbuilder-ios/AppBuilder/AppBuilder/FourthTabViewController.swift

@@ -557,6 +557,12 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
                                     imageView.tintColor = .white
                                     let banner = FloatingNotificationBanner(title: "Successfully Sign-Out".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
                                     banner.show()
+                                    if Nexilis.showFB {
+                                        Nexilis.floatingButton.removeFromSuperview()
+                                        Nexilis.floatingButton = FloatingButton()
+                                        let viewController = (UIApplication.shared.windows.first?.rootViewController)!
+                                        Nexilis.addFB(viewController: viewController, fromMAB: true)
+                                    }
                                     var dataImage: [AnyHashable : Any] = [:]
                                     dataImage["name"] = ""
                                     NotificationCenter.default.post(name: NSNotification.Name(rawValue: "imageFBUpdate"), object: nil, userInfo: dataImage)

+ 8 - 4
appbuilder-ios/DigiXLite/DigiXLite/Source/DigiX.swift

@@ -38,6 +38,8 @@ public class DigiX: NSObject {
     
     static var dispatch: DispatchGroup?
     
+    public static var showFB = false
+    
     let callManager = CallManager()
     
     var providerDelegate: CallProviderDelegate?
@@ -122,6 +124,8 @@ public class DigiX: NSObject {
     
     public static func connect(apiKey: String, delegate: ConnectDelegate, showButton: Bool = true, fromMAB: Bool = false) {
         do {
+            showFB = showButton
+            
             DigiX.shared.createDelegate()
             
             DigiX.sAPIKey = apiKey
@@ -255,16 +259,16 @@ public class DigiX: NSObject {
         }
     }
     
-    static func addFB(viewController: UIViewController, fromMAB: Bool) {
+    public static func addFB(viewController: UIViewController, fromMAB: Bool) {
+        if let keyWindow = UIApplication.shared.windows.first(where: { $0.isKeyWindow }) {
+            keyWindow.addSubview(floatingButton)
+        }
         if fromMAB {
             var vc = viewController
             if viewController is UINavigationController {
                 vc = (viewController as! UINavigationController).rootViewController!
             }
-            vc.view.addSubview(floatingButton)
             floatingButton.mySettingDelegate = vc as? any SettingMABDelegate
-        } else {
-            viewController.view.addSubview(floatingButton)
         }
     }
     

+ 3 - 3
appbuilder-ios/DigiXLite/DigiXLite/Source/FloatingButton/FloatingButton.swift

@@ -301,7 +301,7 @@ public class FloatingButton: UIView {
                         groupView.addArrangedSubview(newButton)
                         newButton.restorationIdentifier = package_id
                         newButton.accessibilityIdentifier = app_id
-                        newButton.addTarget(self, action: #selector(fbTap), for: .touchUpOutside)
+                        newButton.addTarget(self, action: #selector(fbTap), for: .touchUpInside)
                     }
                 }
                 return
@@ -380,7 +380,7 @@ public class FloatingButton: UIView {
                                         groupView.addArrangedSubview(newButton)
                                         newButton.restorationIdentifier = package_id
                                         newButton.accessibilityIdentifier = app_id
-                                        newButton.addTarget(self, action: #selector(fbTap), for: .touchUpOutside)
+                                        newButton.addTarget(self, action: #selector(fbTap), for: .touchUpInside)
                                     }
                                 }
                             }
@@ -437,7 +437,7 @@ public class FloatingButton: UIView {
             groupView.addArrangedSubview(newButton)
             newButton.restorationIdentifier = "default_fb\(data[i])"
             newButton.accessibilityIdentifier = ""
-            newButton.addTarget(self, action: #selector(fbTap), for: .touchUpOutside)
+            newButton.addTarget(self, action: #selector(fbTap), for: .touchUpInside)
         }
     }
     

+ 12 - 0
appbuilder-ios/DigiXLite/DigiXLite/Source/View/Control/ChangeDeviceViewController.swift

@@ -145,6 +145,12 @@ public class ChangeDeviceViewController: UIViewController {
                                     imageView.tintColor = .white
                                     let banner = FloatingNotificationBanner(title: "Successfully Sign-In".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
                                     banner.show()
+                                    if DigiX.showFB {
+                                        DigiX.floatingButton.removeFromSuperview()
+                                        DigiX.floatingButton = FloatingButton()
+                                        let viewController = (UIApplication.shared.windows.first?.rootViewController)!
+                                        DigiX.addFB(viewController: viewController, fromMAB: true)
+                                    }
                                     if self.fromChangeNamePass{
                                         var vc = self.navigationController?.presentingViewController
                                         while vc?.presentingViewController != nil {
@@ -259,6 +265,12 @@ public class ChangeDeviceViewController: UIViewController {
                                 imageView.tintColor = .white
                                 let banner = FloatingNotificationBanner(title: "Successfully Sign-In".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
                                 banner.show()
+                                if DigiX.showFB {
+                                    DigiX.floatingButton.removeFromSuperview()
+                                    DigiX.floatingButton = FloatingButton()
+                                    let viewController = (UIApplication.shared.windows.first?.rootViewController)!
+                                    DigiX.addFB(viewController: viewController, fromMAB: true)
+                                }
                                 NotificationCenter.default.post(name: NSNotification.Name(rawValue: "onRefreshWebView"), object: nil, userInfo: nil)
                                 if self.fromChangeNamePass{
                                     var vc = self.navigationController?.presentingViewController

+ 6 - 0
appbuilder-ios/DigiXLite/DigiXLite/Source/View/Control/SettingTableViewController.swift

@@ -486,6 +486,12 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
                                     imageView.tintColor = .white
                                     let banner = FloatingNotificationBanner(title: "Successfully Sign-Out".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
                                     banner.show()
+                                    if DigiX.showFB {
+                                        DigiX.floatingButton.removeFromSuperview()
+                                        DigiX.floatingButton = FloatingButton()
+                                        let viewController = (UIApplication.shared.windows.first?.rootViewController)!
+                                        DigiX.addFB(viewController: viewController, fromMAB: true)
+                                    }
                                     var dataImage: [AnyHashable : Any] = [:]
                                     dataImage["name"] = ""
                                     NotificationCenter.default.post(name: NSNotification.Name(rawValue: "imageFBUpdate"), object: nil, userInfo: dataImage)

+ 12 - 0
appbuilder-ios/DigiXLite/DigiXLite/Source/View/Control/SignUpSignIn.swift

@@ -153,6 +153,12 @@ public class SignUpSignIn: UIViewController {
                                     imageView.tintColor = .white
                                     let banner = FloatingNotificationBanner(title: "Successfully Sign-In".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
                                     banner.show()
+                                    if DigiX.showFB {
+                                        DigiX.floatingButton.removeFromSuperview()
+                                        DigiX.floatingButton = FloatingButton()
+                                        let viewController = (UIApplication.shared.windows.first?.rootViewController)!
+                                        DigiX.addFB(viewController: viewController, fromMAB: true)
+                                    }
                                     if self.fromChangeNamePass{
                                         var vc = self.navigationController?.presentingViewController
                                         while vc?.presentingViewController != nil {
@@ -292,6 +298,12 @@ public class SignUpSignIn: UIViewController {
                                     let banner = FloatingNotificationBanner(title: "Successfully Sign-In".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
                                     banner.show()
                                     NotificationCenter.default.post(name: NSNotification.Name(rawValue: "onRefreshWebView"), object: nil, userInfo: nil)
+                                    if DigiX.showFB {
+                                        DigiX.floatingButton.removeFromSuperview()
+                                        DigiX.floatingButton = FloatingButton()
+                                        let viewController = (UIApplication.shared.windows.first?.rootViewController)!
+                                        DigiX.addFB(viewController: viewController, fromMAB: true)
+                                    }
                                     if self.fromChangeNamePass{
                                         var vc = self.navigationController?.presentingViewController
                                         while vc?.presentingViewController != nil {

+ 3 - 3
appbuilder-ios/NexilisLite/NexilisLite/Source/FloatingButton/FloatingButton.swift

@@ -307,7 +307,7 @@ public class FloatingButton: UIView {
                         groupView.addArrangedSubview(newButton)
                         newButton.restorationIdentifier = package_id
                         newButton.accessibilityIdentifier = app_id
-                        newButton.addTarget(self, action: #selector(fbTap), for: .touchUpOutside)
+                        newButton.addTarget(self, action: #selector(fbTap), for: .touchUpInside)
                     }
                 }
                 return
@@ -386,7 +386,7 @@ public class FloatingButton: UIView {
                                         groupView.addArrangedSubview(newButton)
                                         newButton.restorationIdentifier = package_id
                                         newButton.accessibilityIdentifier = app_id
-                                        newButton.addTarget(self, action: #selector(fbTap), for: .touchUpOutside)
+                                        newButton.addTarget(self, action: #selector(fbTap), for: .touchUpInside)
                                     }
                                 }
                             }
@@ -443,7 +443,7 @@ public class FloatingButton: UIView {
             groupView.addArrangedSubview(newButton)
             newButton.restorationIdentifier = "default_fb\(data[i])"
             newButton.accessibilityIdentifier = ""
-            newButton.addTarget(self, action: #selector(fbTap), for: .touchUpOutside)
+            newButton.addTarget(self, action: #selector(fbTap), for: .touchUpInside)
         }
     }
     

+ 8 - 4
appbuilder-ios/NexilisLite/NexilisLite/Source/Nexilis.swift

@@ -38,6 +38,8 @@ public class Nexilis: NSObject {
     
     static var dispatch: DispatchGroup?
     
+    public static var showFB = false
+    
     let callManager = CallManager()
     
     var providerDelegate: CallProviderDelegate?
@@ -122,6 +124,8 @@ public class Nexilis: NSObject {
     
     public static func connect(apiKey: String, delegate: ConnectDelegate, showButton: Bool = true, fromMAB: Bool = false) {
         do {
+            showFB = showButton
+            
             Nexilis.shared.createDelegate()
             
             Nexilis.sAPIKey = apiKey
@@ -256,16 +260,16 @@ public class Nexilis: NSObject {
         }
     }
     
-    static func addFB(viewController: UIViewController, fromMAB: Bool) {
+    public static func addFB(viewController: UIViewController, fromMAB: Bool) {
+        if let keyWindow = UIApplication.shared.windows.first(where: { $0.isKeyWindow }) {
+            keyWindow.addSubview(floatingButton)
+        }
         if fromMAB {
             var vc = viewController
             if viewController is UINavigationController {
                 vc = (viewController as! UINavigationController).rootViewController!
             }
-            vc.view.addSubview(floatingButton)
             floatingButton.mySettingDelegate = vc as? any SettingMABDelegate
-        } else {
-            viewController.view.addSubview(floatingButton)
         }
     }
     

+ 12 - 0
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Control/ChangeDeviceViewController.swift

@@ -145,6 +145,12 @@ public class ChangeDeviceViewController: UIViewController {
                                     imageView.tintColor = .white
                                     let banner = FloatingNotificationBanner(title: "Successfully Sign-In".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
                                     banner.show()
+                                    if Nexilis.showFB {
+                                        Nexilis.floatingButton.removeFromSuperview()
+                                        Nexilis.floatingButton = FloatingButton()
+                                        let viewController = (UIApplication.shared.windows.first?.rootViewController)!
+                                        Nexilis.addFB(viewController: viewController, fromMAB: true)
+                                    }
                                     if self.fromChangeNamePass{
                                         var vc = self.navigationController?.presentingViewController
                                         while vc?.presentingViewController != nil {
@@ -259,6 +265,12 @@ public class ChangeDeviceViewController: UIViewController {
                                 imageView.tintColor = .white
                                 let banner = FloatingNotificationBanner(title: "Successfully Sign-In".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
                                 banner.show()
+                                if Nexilis.showFB {
+                                    Nexilis.floatingButton.removeFromSuperview()
+                                    Nexilis.floatingButton = FloatingButton()
+                                    let viewController = (UIApplication.shared.windows.first?.rootViewController)!
+                                    Nexilis.addFB(viewController: viewController, fromMAB: true)
+                                }
                                 NotificationCenter.default.post(name: NSNotification.Name(rawValue: "onRefreshWebView"), object: nil, userInfo: nil)
                                 if self.fromChangeNamePass{
                                     var vc = self.navigationController?.presentingViewController

+ 6 - 0
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Control/SettingTableViewController.swift

@@ -486,6 +486,12 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
                                     imageView.tintColor = .white
                                     let banner = FloatingNotificationBanner(title: "Successfully Sign-Out".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
                                     banner.show()
+                                    if Nexilis.showFB {
+                                        Nexilis.floatingButton.removeFromSuperview()
+                                        Nexilis.floatingButton = FloatingButton()
+                                        let viewController = (UIApplication.shared.windows.first?.rootViewController)!
+                                        Nexilis.addFB(viewController: viewController, fromMAB: true)
+                                    }
                                     var dataImage: [AnyHashable : Any] = [:]
                                     dataImage["name"] = ""
                                     NotificationCenter.default.post(name: NSNotification.Name(rawValue: "imageFBUpdate"), object: nil, userInfo: dataImage)

+ 12 - 0
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Control/SignUpSignIn.swift

@@ -153,6 +153,12 @@ public class SignUpSignIn: UIViewController {
                                     imageView.tintColor = .white
                                     let banner = FloatingNotificationBanner(title: "Successfully Sign-In".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
                                     banner.show()
+                                    if Nexilis.showFB {
+                                        Nexilis.floatingButton.removeFromSuperview()
+                                        Nexilis.floatingButton = FloatingButton()
+                                        let viewController = (UIApplication.shared.windows.first?.rootViewController)!
+                                        Nexilis.addFB(viewController: viewController, fromMAB: true)
+                                    }
                                     if self.fromChangeNamePass{
                                         var vc = self.navigationController?.presentingViewController
                                         while vc?.presentingViewController != nil {
@@ -291,6 +297,12 @@ public class SignUpSignIn: UIViewController {
                                     imageView.tintColor = .white
                                     let banner = FloatingNotificationBanner(title: "Successfully Sign-In".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .success, colors: nil, iconPosition: .center)
                                     banner.show()
+                                    if Nexilis.showFB {
+                                        Nexilis.floatingButton.removeFromSuperview()
+                                        Nexilis.floatingButton = FloatingButton()
+                                        let viewController = (UIApplication.shared.windows.first?.rootViewController)!
+                                        Nexilis.addFB(viewController: viewController, fromMAB: true)
+                                    }
                                     NotificationCenter.default.post(name: NSNotification.Name(rawValue: "onRefreshWebView"), object: nil, userInfo: nil)
                                     if self.fromChangeNamePass{
                                         var vc = self.navigationController?.presentingViewController