alqindiirsyam 2 жил өмнө
parent
commit
82ebe440d8

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

@@ -101,6 +101,7 @@ class FirstTabViewController: UIViewController, UIScrollViewDelegate, UIGestureR
             }
         }
         if let u = myURL {
+            self.webView.evaluateJavaScript("{window.localStorage.setItem('currentTab','\(ViewController.sURL)')}")
             if (dateRefresh == nil || Int(Date().timeIntervalSince(dateRefresh!)) >= 60 || FirstTabViewController.forceRefresh) && FirstTabViewController.atFirstPage {
                 let myRequest = URLRequest(url: u)
                 webView.load(myRequest)

+ 47 - 5
appbuilder-ios/AppBuilder/AppBuilder/FourthTabViewController.swift

@@ -147,18 +147,17 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
                         Item(icon: UIImage(systemName: "person.fill"), title: "Personal Information".localized()),
                         Item(icon: UIImage(systemName: "textformat.abc"), title: "Change Language".localized()),
                         Item(icon: UIImage(systemName: "person.crop.rectangle"), title: "Change Admin / Internal Password".localized()),
-//                        Item(icon: UIImage(systemName: "laptopcomputer.and.iphone"), title: "Login to Nexilis Web".localized()),
+                        Item(icon: UIImage(systemName: "laptopcomputer.and.iphone"), title: "Login to Web".localized()),
                     ]
                 } else if cursorUser.string(forColumnIndex: 0) == "23" || cursorUser.string(forColumnIndex: 0) == "24" {
                     Item.menus["Personal"] = [
                         Item(icon: UIImage(systemName: "person.fill"), title: "Personal Information".localized()),
                         Item(icon: UIImage(systemName: "textformat.abc"), title: "Change Language".localized()),
-//                        Item(icon: UIImage(systemName: "laptopcomputer.and.iphone"), title: "Login to Nexilis Web".localized()),
+                        Item(icon: UIImage(systemName: "laptopcomputer.and.iphone"), title: "Login to Web".localized()),
                     ]
                 } else {
                     Item.menus["Personal"] = [
                         Item(icon: UIImage(systemName: "person.fill"), title: "Personal Information".localized()),
-//                        Item(icon: UIImage(systemName: "laptopcomputer.and.iphone"), title: "Login to Nexilis Web".localized()),
                             Item(icon: UIImage(systemName: "textformat.abc"), title: "Change Language".localized()),
                         Item(icon: UIImage(systemName: "person.crop.rectangle"), title: "Access Admin / Internal Features".localized()),
                     ]
@@ -207,7 +206,6 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
             } else {
                 Item.menus["Personal"] = [
                     Item(icon: UIImage(systemName: "person.fill"), title: "Personal Information".localized()),
-//                        Item(icon: UIImage(systemName: "laptopcomputer.and.iphone"), title: "Login to Nexilis Web".localized()),
                         Item(icon: UIImage(systemName: "textformat.abc"), title: "Change Language".localized()),
                     Item(icon: UIImage(systemName: "person.crop.rectangle"), title: "Access Admin / Internal Features".localized()),
                     Item(icon: UIImage(systemName: "arrow.up.and.person.rectangle.portrait"), title: "Login".localized())
@@ -328,7 +326,7 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
                 cell.accessoryType = .disclosureIndicator
             case "Access Admin / Internal Features".localized():
                 cell.accessoryType = .disclosureIndicator
-            case "Login to Nexilis Web".localized():
+            case "Login to Web".localized():
                 cell.accessoryType = .disclosureIndicator
             case "Login".localized():
                 cell.accessoryType = .disclosureIndicator
@@ -516,6 +514,50 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
                 }
             }))
             self.present(alert, animated: true, completion: nil)
+        } else if item.title == "Login to Web".localized() {
+            var permissionCheck = -1
+            if AVCaptureDevice.authorizationStatus(for: .video) ==  .authorized {
+                permissionCheck = 1
+            } else if AVCaptureDevice.authorizationStatus(for: .video) ==  .denied {
+                permissionCheck = 0
+            } else {
+                AVCaptureDevice.requestAccess(for: .video, completionHandler: { (granted: Bool) -> Void in
+                    if granted == true {
+                        permissionCheck = 1
+                    } else {
+                        permissionCheck = 0
+                    }
+                })
+            }
+            
+            while permissionCheck == -1 {
+                sleep(1)
+            }
+            
+            if permissionCheck == 0 {
+                let alert = UIAlertController(title: "Attention!".localized(), message: "Please allow camera permission in your settings".localized(), preferredStyle: .alert)
+                alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: { _ in
+                    if let url = URL(string: UIApplication.openSettingsURLString), UIApplication.shared.canOpenURL(url) {
+                        UIApplication.shared.open(url, options: [:], completionHandler: nil)
+                    }
+                }))
+                if UIApplication.shared.visibleViewController?.navigationController != nil {
+                    UIApplication.shared.visibleViewController?.navigationController?.present(alert, animated: true, completion: nil)
+                } else {
+                    UIApplication.shared.visibleViewController?.present(alert, animated: true, completion: nil)
+                }
+                return
+            }
+            let controller = ScannerViewController()
+            let navigationController = UINavigationController(rootViewController: controller)
+            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
+            navigationController.modalPresentationStyle = .custom
+            self.present(navigationController, animated: true)
         }
     }
     

+ 2 - 0
appbuilder-ios/AppBuilder/AppBuilder/SecondTabViewController.swift

@@ -773,6 +773,8 @@ extension SecondTabViewController: UITableViewDelegate, UITableViewDataSource {
                 } else {
                     value = 1
                 }
+            } else {
+                value = fillteredData.count
             }
             return value
         }

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

@@ -108,6 +108,7 @@ class ThirdTabViewController: UIViewController, UIScrollViewDelegate, UIGestureR
         }
         print(address)
         if let u = myURL{
+            self.webView.evaluateJavaScript("{window.localStorage.setItem('currentTab','\(ViewController.tab3)')}")
             if (dateRefresh == nil || Int(Date().timeIntervalSince(dateRefresh!)) >= 60 || ThirdTabViewController.forceRefresh) && ThirdTabViewController.atFirstPage {
                 let myRequest = URLRequest(url: u)
                 webView.load(myRequest)

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

@@ -186,3 +186,4 @@
 "Expired OTP" = "OTP telah kadaluarsa";
 "Invalid OTP" = "OTP tidak valid";
 "Successfully add friend" = "Berhasil menambahkan teman";
+"Login to Web" = "Masuk ke Web";

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

@@ -83,7 +83,7 @@ extension UIApplication {
         return UIApplication.shared.windows.filter {$0.isKeyWindow}.first?.rootViewController
     }
     
-    var visibleViewController: UIViewController? {
+    public var visibleViewController: UIViewController? {
         let keyWindow = UIApplication.shared.windows.filter {$0.isKeyWindow}.first
         if var topController = keyWindow?.rootViewController {
             while let presentedViewController = topController.presentedViewController {

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

@@ -92,10 +92,10 @@ public class EditorGroup: UIViewController {
         viewButton.layer.shadowRadius = 3
         
 //        buttonVoice.setImage(resizeImage(image: UIImage(named: "Voice-Record", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)), for: .normal)
-        buttonSendImage.setImage(resizeImage(image: UIImage(named: "Send-Image", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withTintColor(.black), for: .normal)
-        buttonSendPhoto.setImage(resizeImage(image: UIImage(named: "Camera", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withTintColor(.black), for: .normal)
-        buttonSendSticker.setImage(resizeImage(image: UIImage(named: "Sticker---Emoji", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withTintColor(.black), for: .normal)
-        buttonSendFile.setImage(resizeImage(image: UIImage(named: "File---Documents", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withTintColor(.black), for: .normal)
+        buttonSendImage.setImage(resizeImage(image: UIImage(named: "Send-Image", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withTintColor(.mainColor), for: .normal)
+        buttonSendPhoto.setImage(resizeImage(image: UIImage(named: "Camera", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withTintColor(.mainColor), for: .normal)
+        buttonSendSticker.setImage(resizeImage(image: UIImage(named: "Sticker---Emoji", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withTintColor(.mainColor), for: .normal)
+        buttonSendFile.setImage(resizeImage(image: UIImage(named: "File---Documents", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withTintColor(.mainColor), for: .normal)
         
         buttonSendChat.setImage(resizeImage(image: UIImage(named: "Send-(White)", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withRenderingMode(.alwaysOriginal), for: .normal)
         

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

@@ -110,10 +110,10 @@ public class EditorPersonal: UIViewController, ImageVideoPickerDelegate, UIGestu
         viewButton.layer.shadowRadius = 3
         
 //        buttonVoice.setImage(resizeImage(image: UIImage(named: "Voice-Record", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)), for: .normal)
-        buttonSendImage.setImage(resizeImage(image: UIImage(named: "Send-Image", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withTintColor(.black), for: .normal)
-        buttonSendPhoto.setImage(resizeImage(image: UIImage(named: "Camera", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withTintColor(.black), for: .normal)
-        buttonSendSticker.setImage(resizeImage(image: UIImage(named: "Sticker---Emoji", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withTintColor(.black), for: .normal)
-        buttonSendFile.setImage(resizeImage(image: UIImage(named: "File---Documents", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withTintColor(.black), for: .normal)
+        buttonSendImage.setImage(resizeImage(image: UIImage(named: "Send-Image", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withTintColor(.mainColor), for: .normal)
+        buttonSendPhoto.setImage(resizeImage(image: UIImage(named: "Camera", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withTintColor(.mainColor), for: .normal)
+        buttonSendSticker.setImage(resizeImage(image: UIImage(named: "Sticker---Emoji", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withTintColor(.mainColor), for: .normal)
+        buttonSendFile.setImage(resizeImage(image: UIImage(named: "File---Documents", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withTintColor(.mainColor), for: .normal)
         
         buttonSendChat.setImage(resizeImage(image: UIImage(named: "Send-(White)", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 30, height: 30)).withRenderingMode(.alwaysOriginal), for: .normal)
         
@@ -4531,6 +4531,14 @@ extension EditorPersonal: UITableViewDelegate, UITableViewDataSource {
     }
     
     @objc func tapAck(_ sender: ObjectGesture) {
+        if blocking == "1" {
+            self.view.makeToast("You blocked this user".localized())
+            return
+        }
+        if blocking == "-1" {
+            self.view.makeToast("You have been blocked by this user".localized())
+            return
+        }
         let indexPath = sender.indexPath
         let dataMessages = self.dataMessages.filter({ $0["chat_date"] as! String == dataDates[indexPath.section]})
         if dataMessages[indexPath.row]["status"] as! String == "8" {

+ 5 - 3
appbuilder-ios/NexilisLite/NexilisLite/Source/View/Control/ContactChatViewController.swift

@@ -517,7 +517,7 @@ extension ContactChatViewController {
                 var sects = 0
                 var sect = indexPath.section
                 var id = group.id
-                if let e = groupMap[id] {
+                if let _ = groupMap[id] {
                     var loooop = true
                     repeat {
                         let c = sect + 1
@@ -649,7 +649,7 @@ extension ContactChatViewController {
             if segment.selectedSegmentIndex == 2, let groups = fillteredData as? [Group] {
                 let group = groups[section]
                 if group.isSelected {
-                    if let g = groupMap[group.id] {
+                    if let _ = groupMap[group.id] {
                         value = 1
                     }
                     else {
@@ -658,6 +658,8 @@ extension ContactChatViewController {
                 } else {
                     value = 1
                 }
+            } else {
+                value = fillteredData.count
             }
             return value
         }
@@ -669,7 +671,7 @@ extension ContactChatViewController {
         case 2:
             let group = groups[section]
             if group.isSelected {
-                if let g = groupMap[group.id] {
+                if let _ = groupMap[group.id] {
                     value = 1
                 }
                 else {

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

@@ -10,7 +10,7 @@ import UIKit
 import NotificationBannerSwift
 import nuSDKService
 
-class ScannerViewController: UIViewController, QRScannerViewDelegate {
+public class ScannerViewController: UIViewController, QRScannerViewDelegate {
     
     var scannerView: QRScannerView = {
         let scannerView = QRScannerView()
@@ -26,14 +26,14 @@ class ScannerViewController: UIViewController, QRScannerViewDelegate {
         return titleInfo
     }()
     
-    override func viewDidDisappear(_ animated: Bool) {
+    public override func viewDidDisappear(_ animated: Bool) {
         if scannerView.isRunning {
             scannerView.stopScanning()
         }
         self.navigationController?.navigationBar.topItem?.title = nil
     }
 
-    override func viewDidLoad() {
+    public override func viewDidLoad() {
         super.viewDidLoad()
         
         self.view.backgroundColor = .white
@@ -53,7 +53,7 @@ class ScannerViewController: UIViewController, QRScannerViewDelegate {
         navigationController?.dismiss(animated: true, completion: nil)
     }
     
-    override func viewDidAppear(_ animated: Bool) {
+    public override func viewDidAppear(_ animated: Bool) {
         scannerView.startScanning()
     }