alqindiirsyam 2 jaren geleden
bovenliggende
commit
cbb676efe4

+ 4 - 1
appbuilder-ios/AppBuilder/AppBuilder/FirstTabViewController.swift

@@ -110,10 +110,12 @@ class FirstTabViewController: UIViewController, UIScrollViewDelegate, UIGestureR
             FirstTabViewController.forceRefresh = false
             self.webView.evaluateJavaScript("if(resumeAll){resumeAll();}")
         }
-        self.navigationController?.navigationBar.topItem?.title = Bundle.main.displayName
         let cpaasMode = PrefsUtil.getCpaasMode()
         let isBurger = cpaasMode == PrefsUtil.CPAAS_MODE_BURGER
         navigationController?.setNavigationBarHidden(!isBurger, animated: false)
+        if isBurger {
+            self.navigationController?.navigationBar.topItem?.title = Bundle.main.displayName
+        }
     }
     
     override func viewDidAppear(_ animated: Bool) {
@@ -513,6 +515,7 @@ extension FirstTabViewController: WKUIDelegate, WKNavigationDelegate {
                 if urlStr.contains("nexilis/pages/tab1-main-only") || urlStr.contains("nexilis/pages/tab3-main-only") || urlStr.contains("nexilis/pages/tab1-main") || urlStr.contains("nexilis/pages/tab3-commerce") || urlStr.contains("nexilis/pages/tab1-video") || urlStr.contains("nexilis/pages/tab3-main") {
                     ViewController.alwaysHideButton = false
                     showTabBar()
+                    FirstTabViewController.atFirstPage = true
                 } else if isUsingMyWebview() {
                     ViewController.alwaysHideButton = true
                     hideTabBar()

+ 9 - 12
appbuilder-ios/AppBuilder/AppBuilder/FourthTabViewController.swift

@@ -82,6 +82,7 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
     }
     
     public override func viewDidAppear(_ animated: Bool) {
+        self.navigationController?.navigationBar.topItem?.title = "Settings".localized()
         DispatchQueue.main.asyncAfter(deadline: .now() + 0.2, execute: {
             var viewController = UIApplication.shared.windows.first!.rootViewController
             if !(viewController is ViewController) {
@@ -258,6 +259,14 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
     }
     
     override public func viewWillAppear(_ animated: Bool) {
+        self.navigationController?.navigationBar.topItem?.title = ""
+        self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.black]
+        navigationController?.navigationBar.backgroundColor = .clear
+        navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
+        navigationController?.navigationBar.shadowImage = UIImage()
+        navigationController?.navigationBar.isTranslucent = true
+        navigationController?.setNavigationBarHidden(false, animated: false)
+        navigationController?.navigationBar.tintColor = .black
         tabBarController?.navigationItem.leftBarButtonItem = nil
         tabBarController?.navigationItem.searchController = nil
         tabBarController?.navigationItem.rightBarButtonItem = nil
@@ -280,18 +289,6 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
                 }
             }
         }
-        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
-        navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
-        navigationController?.navigationBar.shadowImage = UIImage()
-        navigationController?.navigationBar.isTranslucent = true
         makeMenu()
         tableView.reloadData()
     }

+ 7 - 5
appbuilder-ios/AppBuilder/AppBuilder/SecondTabViewController.swift

@@ -275,6 +275,7 @@ class SecondTabViewController: UIViewController, UIScrollViewDelegate, UIGesture
     }
     
     override func viewDidAppear(_ animated: Bool) {
+        self.navigationController?.navigationBar.topItem?.title = "Chats".localized() + " & " + "Groups".localized()
         DispatchQueue.main.asyncAfter(deadline: .now() + 0.2, execute: {
             var viewController = UIApplication.shared.windows.first!.rootViewController
             if !(viewController is ViewController) {
@@ -302,7 +303,6 @@ class SecondTabViewController: UIViewController, UIScrollViewDelegate, UIGesture
     
     override func viewWillAppear(_ animated: Bool) {
 //        tabBarController?.navigationItem.leftBarButtonItem = cancelSearchButton
-        self.navigationController?.navigationBar.topItem?.title = "Chats".localized() + " & " + "Groups".localized()
         self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.black]
         navigationController?.navigationBar.backgroundColor = .clear
         navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
@@ -1051,10 +1051,12 @@ extension SecondTabViewController: UITableViewDelegate, UITableViewDataSource {
                 content.image = image
             }
             cell.contentConfiguration = content
-            if group.level != "-1" && Int(group.level)! < 7 {
-                cell.contentView.layoutMargins = .init(top: 0.0, left: CGFloat(25 * Int(group.level)!), bottom: 0.0, right: 0)
-            } else if Int(group.level)! > 6 {
-                cell.contentView.layoutMargins = .init(top: 0.0, left: CGFloat(25 * (Int(group.level)! - 6)), bottom: 0.0, right: 0)
+            if !group.level.isEmpty {
+                if group.level != "-1" && Int(group.level)! < 7 {
+                    cell.contentView.layoutMargins = .init(top: 0.0, left: CGFloat(25 * Int(group.level)!), bottom: 0.0, right: 0)
+                } else if Int(group.level)! > 6 {
+                    cell.contentView.layoutMargins = .init(top: 0.0, left: CGFloat(25 * (Int(group.level)! - 6)), bottom: 0.0, right: 0)
+                }
             }
         default:
             cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifierContact", for: indexPath)

+ 4 - 2
appbuilder-ios/AppBuilder/AppBuilder/ThirdTabViewController.swift

@@ -117,11 +117,12 @@ class ThirdTabViewController: UIViewController, UIScrollViewDelegate, UIGestureR
             ThirdTabViewController.forceRefresh = false
             self.webView.evaluateJavaScript("if(resumeAll){resumeAll();}")
         }
-        self.navigationController?.navigationBar.topItem?.title = Bundle.main.displayName
         let cpaasMode = PrefsUtil.getCpaasMode()
         let isBurger = cpaasMode == PrefsUtil.CPAAS_MODE_BURGER
-//        navigationController?.navigationBar.backgroundColor = .white
         navigationController?.setNavigationBarHidden(!isBurger, animated: false)
+        if isBurger {
+            self.navigationController?.navigationBar.topItem?.title = Bundle.main.displayName
+        }
     }
     
     override func viewDidAppear(_ animated: Bool) {
@@ -526,6 +527,7 @@ extension ThirdTabViewController: WKUIDelegate {
                 if urlStr.contains("nexilis/pages/tab1-main-only") || urlStr.contains("nexilis/pages/tab3-main-only") || urlStr.contains("nexilis/pages/tab1-main") || urlStr.contains("nexilis/pages/tab3-commerce") || urlStr.contains("nexilis/pages/tab1-video") || urlStr.contains("nexilis/pages/tab3-main") {
                     ViewController.alwaysHideButton = false
                     showTabBar()
+                    ThirdTabViewController.atFirstPage = true
                 } else if isUsingMyWebview() {
                     ViewController.alwaysHideButton = true
                     hideTabBar()

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

@@ -192,3 +192,5 @@
 "Not found" = "Tidak ditemukan";
 "Suggestions" = "Saran";
 "Search groups name" = "Cari nama grup";
+"Title" = "Judul";
+"Start Call" = "Mulai Panggilan";

+ 11 - 0
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Call/CallManager.swift

@@ -40,6 +40,17 @@ final class CallManager: NSObject, ObservableObject {
         requestTransaction(transaction)
     }
     
+    func startGroupCall(uuid1: UUID) {
+        let call1UUID = calls[0].uuid
+        let call2UUID = uuid1
+        let mergeCallAction = CXSetGroupCallAction(call: call1UUID, callUUIDToGroupWith: call2UUID)
+
+        let transaction = CXTransaction()
+        transaction.addAction(mergeCallAction)
+        
+        requestTransaction(transaction)
+    }
+    
     private func requestTransaction(_ transaction: CXTransaction) {
         callController.request(transaction) { error in
             if let error = error {

+ 9 - 2
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Call/CallProviderDelegate.swift

@@ -16,8 +16,8 @@ class CallProviderDelegate: NSObject {
     
     static let providerConfiguration: CXProviderConfiguration = {
         let providerConfiguration = CXProviderConfiguration()
-        providerConfiguration.maximumCallsPerCallGroup = 4
-        providerConfiguration.maximumCallGroups = 5
+        providerConfiguration.maximumCallsPerCallGroup = 10
+        providerConfiguration.maximumCallGroups = 10
         providerConfiguration.supportsVideo = true
         providerConfiguration.supportedHandleTypes = [.phoneNumber]
         //        providerConfiguration.ringtoneSound = "call_in.mp3"
@@ -89,6 +89,7 @@ extension CallProviderDelegate: CXProviderDelegate {
         print("JUMLAH START CALL \(self.callManager.calls.count)")
         self.callManager.addCall(call)
         if self.callManager.calls.count > 1 {
+            Nexilis.shared.callManager.startGroupCall(uuid1: call.uuid)
             API.initiateCCall(sParty: call.handle)
         }
     }
@@ -185,6 +186,12 @@ extension CallProviderDelegate: CXProviderDelegate {
         }
     }
     
+    func provider(_ provider: CXProvider, perform action: CXSetGroupCallAction) {
+        print("CXGroupCallAction...\(action.callUUID)")
+        // perform merge call here where you merge ports of two call audio i/o
+        action.fulfill()
+    }
+    
     func provider(_ provider: CXProvider, didDeactivate audioSession: AVAudioSession) {
         print("Received", #function)
         

+ 24 - 11
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Call/QmeraAudioViewController.swift

@@ -25,6 +25,8 @@ class QmeraAudioViewController: UIViewController {
     var user: User?
     
     var isAddCall = ""
+    
+    private var isEndByMe = false
         
     private var users: [User] = [] {
         didSet {
@@ -298,7 +300,7 @@ class QmeraAudioViewController: UIViewController {
         view.addSubview(end)
         end.anchor(bottom: view.bottomAnchor, paddingBottom: 60, centerX: view.centerXAnchor, width: buttonSize, height: buttonSize)
         
-        end.addTarget(self, action: #selector(didEnd(sender:)), for: .touchUpInside)
+        end.addTarget(self, action: #selector(didPressEnd(sender:)), for: .touchUpInside)
     }
     
     private func incomingView() {
@@ -331,7 +333,7 @@ class QmeraAudioViewController: UIViewController {
         stack.addArrangedSubview(speaker)
         
         invite.addTarget(self, action: #selector(didInvite(sender:)), for: .touchUpInside)
-        end.addTarget(self, action: #selector(didEnd(sender:)), for: .touchUpInside)
+        end.addTarget(self, action: #selector(didPressEnd(sender:)), for: .touchUpInside)
         speaker.addTarget(self, action: #selector(didSpeaker(sender:)), for: .touchUpInside)
         
         self.view.addSubview(poweredByView)
@@ -388,6 +390,11 @@ class QmeraAudioViewController: UIViewController {
         present(UINavigationController(rootViewController: controller), animated: true, completion: nil)
     }
     
+    @objc func didPressEnd(sender: Any?) {
+        isEndByMe = true
+        self.didEnd(sender: nil)
+    }
+    
     @objc func didEnd(sender: Any?) {
         poweredByView.isHidden = true
         let onGoingCC = UserDefaults.standard.string(forKey: "onGoingCC") ?? ""
@@ -478,10 +485,16 @@ class QmeraAudioViewController: UIViewController {
             }))
             self.present(alert, animated: true, completion: nil)
         } else {
-            if let user = self.user, let call = Nexilis.shared.callManager.call(with: user.pin) {
-                Nexilis.shared.callManager.end(call: call)
+            if isEndByMe {
+                for i in 0..<Nexilis.shared.callManager.calls.count {
+                    Nexilis.shared.callManager.end(call: Nexilis.shared.callManager.calls[i])
+                }
             } else {
-                API.terminateCall(sParty: nil)
+                if let user = self.user, let call = Nexilis.shared.callManager.call(with: user.pin) {
+                    Nexilis.shared.callManager.end(call: call)
+                } else {
+                    API.terminateCall(sParty: nil)
+                }
             }
             dismiss(animated: false, completion: nil)
         }
@@ -621,7 +634,7 @@ class QmeraAudioViewController: UIViewController {
                             self.didEnd(sender: true)
                         }
                         return
-                    } else {
+                    } else if users.count == 0 {
                         DispatchQueue.main.async {
                             self.timer?.invalidate()
                             self.timer = nil
@@ -634,11 +647,11 @@ class QmeraAudioViewController: UIViewController {
                         return
                     }
                 }
-                if users.count == 0 {
-                    DispatchQueue.main.async {
-                        self.dismiss(animated: false, completion: nil)
-                    }
-                }
+//                if users.count == 0 {
+//                    DispatchQueue.main.async {
+//                        self.dismiss(animated: false, completion: nil)
+//                    }
+//                }
             } else if state == -3 { // Offline
                 let onGoingCC = UserDefaults.standard.string(forKey: "onGoingCC") ?? ""
                 if let pin = arrayMessage.first, let index = users.firstIndex(of: User(pin: String(pin))) {

+ 3 - 2
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Contact/ContactCallViewController.swift

@@ -42,7 +42,7 @@ class ContactCallViewController: UIViewController {
     
     override func viewDidLoad() {
         super.viewDidLoad()
-        title = "Start Call"
+        title = "Start Call".localized()
         let attributes = [NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 16.0), NSAttributedString.Key.foregroundColor: UIColor.white]
         self.navigationController?.navigationBar.titleTextAttributes = attributes
         if (isAddParticipantVideo) {
@@ -77,7 +77,7 @@ class ContactCallViewController: UIViewController {
                     self.navigationController?.show(editorStaredVC, sender: nil)
                 }),
             ])
-            let cancel = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(didTapCancel(sender:)))
+            let cancel = UIBarButtonItem(title: "Cancel".localized(), style: .plain, target: self, action: #selector(didTapCancel(sender:)))
             let addImage = UIImage(systemName: "plus")
             let broadcastImage = UIImage(systemName: "video.bubble.left")
             let buttonAdd = UIBarButtonItem(image: addImage, menu: menu)
@@ -96,6 +96,7 @@ class ContactCallViewController: UIViewController {
         searchController.searchBar.barTintColor = .secondaryColor
         searchController.searchBar.searchTextField.backgroundColor = .secondaryColor
         searchController.obscuresBackgroundDuringPresentation = false
+        searchController.searchBar.placeholder = "Search".localized()
         
         navigationItem.searchController = searchController
         navigationItem.hidesSearchBarWhenScrolling = true

+ 7 - 4
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Control/ContactChatViewController.swift

@@ -140,6 +140,7 @@ class ContactChatViewController: UITableViewController {
         searchController.searchBar.barTintColor = .secondaryColor
         searchController.searchBar.searchTextField.backgroundColor = .secondaryColor
         searchController.obscuresBackgroundDuringPresentation = false
+        searchController.searchBar.placeholder = "Search".localized()
         
         navigationItem.searchController = searchController
         navigationItem.hidesSearchBarWhenScrolling = true
@@ -938,10 +939,12 @@ extension ContactChatViewController {
                 content.image = image
             }
             cell.contentConfiguration = content
-            if group.level != "-1" && Int(group.level)! < 7 {
-                cell.contentView.layoutMargins = .init(top: 0.0, left: CGFloat(25 * Int(group.level)!), bottom: 0.0, right: 0)
-            } else if Int(group.level)! > 6 {
-                cell.contentView.layoutMargins = .init(top: 0.0, left: CGFloat(25 * (Int(group.level)! - 6)), bottom: 0.0, right: 0)
+            if !group.level.isEmpty {
+                if group.level != "-1" && Int(group.level)! < 7 {
+                    cell.contentView.layoutMargins = .init(top: 0.0, left: CGFloat(25 * Int(group.level)!), bottom: 0.0, right: 0)
+                } else if Int(group.level)! > 6 {
+                    cell.contentView.layoutMargins = .init(top: 0.0, left: CGFloat(25 * (Int(group.level)! - 6)), bottom: 0.0, right: 0)
+                }
             }
         default:
             cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifierContact", for: indexPath)