alqindiirsyam před 2 roky
rodič
revize
94db8f9d60

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

@@ -555,6 +555,7 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
                                     var dataImage: [AnyHashable : Any] = [:]
                                     dataImage["name"] = ""
                                     NotificationCenter.default.post(name: NSNotification.Name(rawValue: "imageFBUpdate"), object: nil, userInfo: dataImage)
+                                    NotificationCenter.default.post(name: NSNotification.Name(rawValue: "reloadTabChats"), object: nil, userInfo: nil)
                                     self.makeMenu()
                                     self.tableView.reloadData()
                                     FirstTabViewController.forceRefresh = true

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

@@ -288,4 +288,4 @@
 "Are you sure want to unset" = "Apakah anda ingin menghapus";
 "from CS Account?" = "dari Akun CS";
 "from Internal Account?" = "dari Akun Internal";
-
+"Invalid Password" = "Kata sandi salah";

+ 41 - 31
appbuilder-ios/NexilisLite/NexilisLite/Source/Nexilis.swift

@@ -114,7 +114,7 @@ public class Nexilis: NSObject {
             Nexilis.dispatch?.wait()
             Nexilis.dispatch = nil
             
-            Nexilis.initiateAudio()
+//            Nexilis.initiateAudio()
             
             if(!id.isEmpty && (UserDefaults.standard.string(forKey: "me") == nil)){
                 if let response = Nexilis.writeSync(message: CoreMessage_TMessageBank.getSignUpApi(api: apiKey, p_pin: id), timeout: 30 * 1000){
@@ -425,7 +425,7 @@ public class Nexilis: NSObject {
 
     public static func setSpeaker(_ isEnabled: Bool) {
         do {
-            
+            API.adjustVolume(fValue: isEnabled ? 10.0: 3.0)
         } catch {
         }
     }
@@ -438,25 +438,25 @@ public class Nexilis: NSObject {
         }
     }
     
-    public static func startAudio(isVideo: Bool = true) {
-        do {
-            try AVAudioSession.sharedInstance().setCategory(.playAndRecord, options: .defaultToSpeaker)
-            try AVAudioSession.sharedInstance().setMode(.voiceChat)
-            try AVAudioSession.sharedInstance().overrideOutputAudioPort(isVideo ? .speaker : .none)
-            try AVAudioSession.sharedInstance().setActive(true)
-        } catch {
-        }
-    }
-    
-    public static func stopAudio() {
-        do {
-            try AVAudioSession.sharedInstance().setCategory(.soloAmbient)
-            try AVAudioSession.sharedInstance().setMode(.default)
-            try AVAudioSession.sharedInstance().overrideOutputAudioPort(.none)
-            try AVAudioSession.sharedInstance().setActive(true)
-        } catch {
-        }
-    }
+//    public static func startAudio(isVideo: Bool = true) {
+//        do {
+//            try AVAudioSession.sharedInstance().setCategory(.playAndRecord, options: .defaultToSpeaker)
+//            try AVAudioSession.sharedInstance().setMode(.voiceChat)
+//            try AVAudioSession.sharedInstance().overrideOutputAudioPort(isVideo ? .speaker : .none)
+//            try AVAudioSession.sharedInstance().setActive(true)
+//        } catch {
+//        }
+//    }
+//
+//    public static func stopAudio() {
+//        do {
+//            try AVAudioSession.sharedInstance().setCategory(.soloAmbient)
+//            try AVAudioSession.sharedInstance().setMode(.default)
+//            try AVAudioSession.sharedInstance().overrideOutputAudioPort(.none)
+//            try AVAudioSession.sharedInstance().setActive(true)
+//        } catch {
+//        }
+//    }
     
     public static func muteMicrophone(isMute: Bool!){
         do {
@@ -1663,7 +1663,6 @@ extension Nexilis: CallDelegate {
             }
             if (state == 21 && message.split(separator: ",")[1] != "joining Ac.room on channel 0") {
                 if onGoingCC.isEmpty {
-                    let backgroundTaskIdentifier = UIApplication.shared.beginBackgroundTask(expirationHandler: nil)
                     let data = User.getDataCanNil(pin: String(deviceId))
                     if data == nil {
                         DispatchQueue.main.asyncAfter(deadline: .now() + 0.5, execute: {
@@ -1671,10 +1670,21 @@ extension Nexilis: CallDelegate {
                         })
                         return
                     }
-                    uuidOngoing = UUID()
-                    self.displayIncomingCall(uuid: uuidOngoing, handle: String(deviceId), hasVideo: false) { error in
-                        UIApplication.shared.endBackgroundTask(backgroundTaskIdentifier)
+//                    let backgroundTaskIdentifier = UIApplication.shared.beginBackgroundTask(expirationHandler: nil)
+//                    uuidOngoing = UUID()
+//                    self.displayIncomingCall(uuid: uuidOngoing, handle: String(deviceId), hasVideo: false) { error in
+//                        UIApplication.shared.endBackgroundTask(backgroundTaskIdentifier)
+//                    }
+                    let controller = QmeraAudioViewController()
+                    controller.user = User.getData(pin: String(deviceId))
+                    controller.isOutgoing = false
+                    controller.modalPresentationStyle = .overCurrentContext
+                    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)
                     }
+//                    API.receiveCCall(sParty: String(deviceId))
                 } else {
                     DispatchQueue.main.asyncAfter(deadline: .now() + isShowAlert!, execute: {
                         let controller = QmeraAudioViewController()
@@ -1780,12 +1790,12 @@ extension Nexilis: CallDelegate {
                 }
             }
         } else if state == 22 {
-            if let call = callManager.call(with: String(r[1])) {
-                print("onStatusCall:answerCall")
-                DispatchQueue.main.async {
-                    call.answerCall()
-                }
-            }
+//            if let call = callManager.call(with: String(r[1])) {
+//                print("onStatusCall:answerCall")
+//                DispatchQueue.main.async {
+//                    call.answerCall()
+//                }
+//            }
         } else if state == 28 {
             DispatchQueue.main.async {
                 if QmeraAudioViewController().viewIfLoaded?.window == nil {

+ 22 - 20
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Call/QmeraAudioViewController.swift

@@ -176,7 +176,7 @@ class QmeraAudioViewController: UIViewController {
     
     let poweredByLabel: UILabel = {
         let label = UILabel()
-        label.text = "Powered by Nexilis"
+        label.text = "Powered by Nexilis".localized()
         return label
     }()
     
@@ -242,12 +242,12 @@ class QmeraAudioViewController: UIViewController {
         if let u = self.user {
             self.users.append(u)
             if isOutgoing {
-                let onGoingCC = UserDefaults.standard.string(forKey: "onGoingCC") ?? ""
-                if onGoingCC.isEmpty {
-                    Nexilis.shared.callManager.startCall(handle: u.pin)
-                } else {
+//                let onGoingCC = UserDefaults.standard.string(forKey: "onGoingCC") ?? ""
+//                if onGoingCC.isEmpty {
+//                    Nexilis.shared.callManager.startCall(handle: u.pin)
+//                } else {
                     API.initiateCCall(sParty: u.pin)
-                }
+//                }
             }
         }
         
@@ -396,7 +396,7 @@ class QmeraAudioViewController: UIViewController {
             DispatchQueue.main.async {
                 self.timer?.invalidate()
                 self.timer = nil
-                self.status.text = "Audio Call Ended"
+                self.status.text = "Audio Call Ended".localized()
                 self.end.isEnabled = false
                 self.invite.isEnabled = false
                 self.speaker.isEnabled = false
@@ -489,27 +489,28 @@ class QmeraAudioViewController: UIViewController {
                     UserDefaults.standard.removeObject(forKey: "startTimeCC")
                     UserDefaults.standard.removeObject(forKey: "waitingRequestCC")
                 }
-                if let user = self.user, let call = Nexilis.shared.callManager.call(with: user.pin) {
-                    Nexilis.shared.callManager.end(call: call)
-                } else {
+//                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)
-                }
+//                }
             }))
             self.present(alert, animated: true, completion: nil)
         } else {
             if isEndByMe {
-                for i in 0..<Nexilis.shared.callManager.calls.count {
-                    Nexilis.shared.callManager.end(call: Nexilis.shared.callManager.calls[i])
-                }
+//                for i in 0..<Nexilis.shared.callManager.calls.count {
+//                    Nexilis.shared.callManager.end(call: Nexilis.shared.callManager.calls[i])
+//                }
+                API.terminateCall(sParty: nil)
                 DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
                     self.dismiss(animated: false, completion: nil)
                 }
             } else {
-                if let user = self.user, let call = Nexilis.shared.callManager.call(with: user.pin) {
-                    Nexilis.shared.callManager.end(call: call)
-                } else {
+//                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)
-                }
+//                }
                 self.dismiss(animated: false, completion: nil)
             }
         }
@@ -528,6 +529,7 @@ class QmeraAudioViewController: UIViewController {
         UIView.animate(withDuration: 0.3, animations: {
             self.view.layoutIfNeeded()
         })
+        API.receiveCCall(sParty: user?.pin)
     }
     
     // MARK: - Communication
@@ -589,7 +591,7 @@ class QmeraAudioViewController: UIViewController {
                         self.timer?.fire()
                         self.firstCall = false
                         DispatchQueue.main.asyncAfter(deadline: .now() + 1, execute: {
-                            API.adjustVolume(fValue: 10.0)
+//                            API.adjustVolume(fValue: 10.0)
                         })
                     }
                 }
@@ -656,7 +658,7 @@ class QmeraAudioViewController: UIViewController {
                         DispatchQueue.main.async {
                             self.timer?.invalidate()
                             self.timer = nil
-                            self.status.text = "Audio Call Ended"
+                            self.status.text = "Audio Call Ended".localized()
                             self.end.isEnabled = false
                             self.invite.isEnabled = false
                             self.speaker.isEnabled = false

+ 3 - 3
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Call/QmeraVideoViewController.swift

@@ -77,7 +77,7 @@ class QmeraVideoViewController: UIViewController {
     
     let poweredByLabel: UILabel = {
         let label = UILabel()
-        label.text = "Powered by Nexilis"
+        label.text = "Powered by Nexilis".localized()
         return label
     }()
     
@@ -365,7 +365,7 @@ class QmeraVideoViewController: UIViewController {
         ])
         if isInisiator {
             labelIncomingOutgoing.text = "Outgoing video call".localized() + "..."
-            Nexilis.startAudio()
+//            Nexilis.startAudio()
             API.initiateCCall(sParty: dataPerson[0]["f_pin"]!, nCamIdx: 1, nResIdx: 2, nVQuality: 4, ivRemoteView: listRemoteViewFix, ivLocalView: cameraView, ivRemoteZ: zoomView)
         } else {
             let systemSoundID: SystemSoundID = 1254
@@ -537,7 +537,7 @@ class QmeraVideoViewController: UIViewController {
             } else if goVideoCall == -1 {
                 return
             }
-            Nexilis.startAudio()
+//            Nexilis.startAudio()
             API.receiveCCall(sParty: dataPerson[0]["f_pin"]!, nCamIdx: 1, nResIdx: 2, nVQuality: 4, ivRemoteView: listRemoteViewFix, ivLocalView: cameraView,ivRemoteZ: zoomView)
         }
         DispatchQueue.main.async {

+ 1 - 1
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Chat/EditorGroup.swift

@@ -2242,7 +2242,7 @@ extension EditorGroup: UIContextMenuInteractionDelegate {
                 let dataProfile = getDataProfile(f_pin: dataMessages[i]["f_pin"] as! String, message_id: dataMessages[i]["message_id"] as! String)
                 text = text + "\n\n*[\(formatterDate.string(from: date as Date)) \(formatterTime.string(from: date as Date))] \(dataProfile["name"]!):*\n\(dataMessages[i]["message_text"] as! String)"
             }
-            text = text + "\n\n\nchat powered by Nexilis"
+            text = text + "\n\n\nchat " + "Powered by Nexilis".localized()
             DispatchQueue.main.async {
                 UIPasteboard.general.string = text
                 self.showToast(message: "Text coppied to clipboard".localized(), font: UIFont.systemFont(ofSize: 12, weight: .medium), controller: self)

+ 1 - 1
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Chat/EditorPersonal.swift

@@ -3402,7 +3402,7 @@ extension EditorPersonal: UIContextMenuInteractionDelegate {
                     text = text + "\n\n*[\(formatterDate.string(from: date as Date)) \(formatterTime.string(from: date as Date))] \(dataProfile["name"]!):*\n\(dataMessages[i]["message_text"] as! String)"
                 }
             }
-            text = text + "\n\n\nchat powered by Nexilis"
+            text = text + "\n\n\nchat " + "Powered by Nexilis".localized()
             DispatchQueue.main.async {
                 UIPasteboard.general.string = text
                 self.showToast(message: "Text coppied to clipboard".localized(), font: UIFont.systemFont(ofSize: 12, weight: .medium), controller: self)

+ 1 - 1
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Chat/EditorStarMessages.swift

@@ -1045,7 +1045,7 @@ public class EditorStarMessages: UIViewController, UITableViewDataSource, UITabl
                     } else {
                         text = text + "\n\n*[\(formatterDate.string(from: date as Date)) \(formatterTime.string(from: date as Date))] \(dataProfile["name"]!):*\n\(dataMessages[indexPath!.row]["message_text"] as! String)"
                     }
-                    text = text + "\n\n\nchat powered by Nexilis"
+                    text = text + "\n\n\nchat " + "Powered by Nexilis".localized()
                     DispatchQueue.main.async {
                         UIPasteboard.general.string = text
                         self.showToast(message: "Text coppied to clipboard".localized(), font: UIFont.systemFont(ofSize: 12, weight: .medium), controller: self)

+ 5 - 0
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Control/ChangeNameTableViewController.swift

@@ -15,6 +15,11 @@ class ChangeNameTableViewController: UITableViewController {
     
     var data: String = ""
     
+    override func viewWillAppear(_ animated: Bool) {
+        let cancelButtonAttributes: [NSAttributedString.Key: Any] = [NSAttributedString.Key.foregroundColor: UIColor.black]
+        UIBarButtonItem.appearance().setTitleTextAttributes(cancelButtonAttributes, for: .normal)
+    }
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         

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

@@ -463,6 +463,7 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
                                     var dataImage: [AnyHashable : Any] = [:]
                                     dataImage["name"] = ""
                                     NotificationCenter.default.post(name: NSNotification.Name(rawValue: "imageFBUpdate"), object: nil, userInfo: dataImage)
+                                    NotificationCenter.default.post(name: NSNotification.Name(rawValue: "reloadTabChats"), object: nil, userInfo: nil)
                                     self.makeMenu()
                                     self.tableView.reloadData()
                                 })