alqindiirsyam 2 years ago
parent
commit
40d318872d

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

@@ -157,7 +157,7 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
                         Item(icon: UIImage(systemName: "person.crop.rectangle"), title: "Change Admin / Internal Password".localized()),
                         Item(icon: UIImage(systemName: "laptopcomputer.and.iphone"), title: "Sign-In to Web".localized()),
                     ]
-                } else if cursorUser.string(forColumnIndex: 0) == "23" || cursorUser.string(forColumnIndex: 0) == "24" {
+                } else if User.isInternal(userType: cursorUser.string(forColumnIndex: 0)!) || User.isCallCenter(userType: cursorUser.string(forColumnIndex: 0)!) || User.isVerified(official_account: cursorUser.string(forColumnIndex: 2)!) {
                     Item.menus["Personal"] = [
                         Item(icon: UIImage(systemName: "person.fill"), title: "Personal Information".localized()),
                         Item(icon: UIImage(systemName: "textformat.abc"), title: "Change Language".localized()),
@@ -268,6 +268,8 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
         navBarAppearance.configureWithTransparentBackground()
         navigationController?.navigationBar.standardAppearance = navBarAppearance
         navigationController?.navigationBar.scrollEdgeAppearance = navBarAppearance
+        let cancelButtonAttributes: [NSAttributedString.Key: Any] = [NSAttributedString.Key.foregroundColor: UIColor.black]
+        UIBarButtonItem.appearance().setTitleTextAttributes(cancelButtonAttributes, for: .normal)
         navigationController?.navigationBar.backgroundColor = .clear
         navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default)
         navigationController?.navigationBar.shadowImage = UIImage()

+ 30 - 4
appbuilder-ios/NexilisLite/NexilisLite/Source/Model/User.swift

@@ -6,6 +6,7 @@
 //
 
 import Foundation
+import FMDB
 
 public class User: Model {
     
@@ -86,13 +87,13 @@ public class User: Model {
         return UserDefaults.standard.string(forKey: "me")
     }
     
-    public static func getData(pin: String?) -> User? {
+    public static func getData(pin: String?, fmdb: FMDatabase? = nil) -> User? {
         guard let pin = pin else {
             return nil
         }
         var user: User?
-        Database.shared.database?.inTransaction({ fmdb, rollback in
-            if let cursor = Database.shared.getRecords(fmdb: fmdb, query: "select f_pin, first_name, last_name, image_id, user_type, privacy_flag, offline_mode, ex_block, device_id, official_account from BUDDY where f_pin = '\(pin)' OR device_id = '\(pin)'"), cursor.next() {
+        if fmdb != nil {
+            if let cursor = Database.shared.getRecords(fmdb: fmdb!, query: "select f_pin, first_name, last_name, image_id, user_type, privacy_flag, offline_mode, ex_block, device_id, official_account from BUDDY where f_pin = '\(pin)' OR device_id = '\(pin)'"), cursor.next() {
                 user = User(pin: cursor.string(forColumnIndex: 0) ?? "",
                             firstName: cursor.string(forColumnIndex: 1) ?? "",
                             lastName: cursor.string(forColumnIndex: 2) ?? "",
@@ -114,7 +115,32 @@ public class User: Model {
                             offline_mode: "",
                             ex_block: "")
             }
-        })
+        } else {
+            Database.shared.database?.inTransaction({ fmdb, rollback in
+                if let cursor = Database.shared.getRecords(fmdb: fmdb, query: "select f_pin, first_name, last_name, image_id, user_type, privacy_flag, offline_mode, ex_block, device_id, official_account from BUDDY where f_pin = '\(pin)' OR device_id = '\(pin)'"), cursor.next() {
+                    user = User(pin: cursor.string(forColumnIndex: 0) ?? "",
+                                firstName: cursor.string(forColumnIndex: 1) ?? "",
+                                lastName: cursor.string(forColumnIndex: 2) ?? "",
+                                thumb: cursor.string(forColumnIndex: 3) ?? "",
+                                userType: cursor.string(forColumnIndex: 4) ?? "",
+                                privacy_flag: cursor.string(forColumnIndex: 5) ?? "",
+                                offline_mode: cursor.string(forColumnIndex: 6) ?? "",
+                                ex_block: cursor.string(forColumnIndex: 7) ?? "",
+                                official: cursor.string(forColumnIndex: 9) ?? "",
+                                device_id: cursor.string(forColumnIndex: 8) ?? "")
+                    cursor.close()
+                } else {
+                    user = User(pin: pin,
+                                firstName: "User".localized(),
+                                lastName: "",
+                                thumb: "",
+                                userType: "",
+                                privacy_flag: "",
+                                offline_mode: "",
+                                ex_block: "")
+                }
+            })
+        }
         return user
     }
     

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

@@ -1682,7 +1682,7 @@ extension Nexilis: CallDelegate {
                         videoController.dataPerson.append(data)
                         videoController.isInisiator = false
                         if !onGoingCC.isEmpty {
-                            videoController.users.append(User.getData(pin: data["f_pin"]!!)!)
+                            videoController.users.append(User.getData(pin: data["f_pin"]!!, fmdb: fmdb)!)
                         }
                         let navigationController = UINavigationController(rootViewController: videoController)
                         navigationController.modalPresentationStyle = .fullScreen

+ 6 - 0
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Call/QmeraAudioViewController.swift

@@ -384,6 +384,12 @@ class QmeraAudioViewController: UIViewController {
     }
     
     @objc func didPressEnd(sender: Any?) {
+        let onGoingCC = UserDefaults.standard.string(forKey: "onGoingCC") ?? ""
+        if !onGoingCC.isEmpty {
+            self.isEndByMe = true
+            self.didEnd(sender: nil)
+            return
+        }
         let alert = UIAlertController(title: "End Audio Call".localized(), message: "Are you sure you want to end audio call?".localized(), preferredStyle: .alert)
         alert.addAction(UIAlertAction(title: "No".localized(), style: UIAlertAction.Style.default, handler: nil))
         alert.addAction(UIAlertAction(title: "Yes".localized(), style: UIAlertAction.Style.default, handler: {(_) in