|
@@ -86,6 +86,16 @@ public class APIS: NSObject {
|
|
APIS.showChangeProfile()
|
|
APIS.showChangeProfile()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ if !Nexilis.checkingAccess(key: "call_center") {
|
|
|
|
+ if Nexilis.checkingAccessAlert(key: "call_center") != "|" && !Nexilis.checkingAccessAlert(key: "call_center").isEmpty {
|
|
|
|
+ let title = Nexilis.checkingAccessAlert(key: "call_center").components(separatedBy: "|")[0]
|
|
|
|
+ let message = Nexilis.checkingAccessAlert(key: "call_center").components(separatedBy: "|")[1]
|
|
|
|
+ APIS.nexilisShowAlertWithHTMLMessage(on: UIApplication.shared.visibleViewController ?? UIViewController(), title: title, message: message)
|
|
|
|
+ } else {
|
|
|
|
+ UIApplication.shared.visibleViewController?.view.makeToast("Feature disabled".localized(), duration: 5)
|
|
|
|
+ }
|
|
|
|
+ return
|
|
|
|
+ }
|
|
if User.isCallCenter(userType: (User.getData(pin: User.getMyPin())?.userType)!) {
|
|
if User.isCallCenter(userType: (User.getData(pin: User.getMyPin())?.userType)!) {
|
|
let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "myHistoryCC") as! HistoryCCViewController
|
|
let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "myHistoryCC") as! HistoryCCViewController
|
|
controller.isOfficer = true
|
|
controller.isOfficer = true
|
|
@@ -168,6 +178,10 @@ public class APIS: NSObject {
|
|
APIS.showChangeProfile()
|
|
APIS.showChangeProfile()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ if !Nexilis.checkingAccess(key: "notification_center") {
|
|
|
|
+ UIApplication.shared.visibleViewController?.view.makeToast("Feature disabled".localized(), duration: 5)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
let controller = HistoryBroadcastViewController()
|
|
let controller = HistoryBroadcastViewController()
|
|
let navigationController = CustomNavigationController(rootViewController: controller)
|
|
let navigationController = CustomNavigationController(rootViewController: controller)
|
|
navigationController.defaultStyle()
|
|
navigationController.defaultStyle()
|
|
@@ -267,6 +281,16 @@ public class APIS: NSObject {
|
|
APIS.showChangeProfile()
|
|
APIS.showChangeProfile()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ if !Nexilis.checkingAccess(key: "live_streaming") {
|
|
|
|
+ if Nexilis.checkingAccessAlert(key: "live_streaming") != "|" && !Nexilis.checkingAccessAlert(key: "live_streaming").isEmpty {
|
|
|
|
+ let title = Nexilis.checkingAccessAlert(key: "live_streaming").components(separatedBy: "|")[0]
|
|
|
|
+ let message = Nexilis.checkingAccessAlert(key: "live_streaming").components(separatedBy: "|")[1]
|
|
|
|
+ APIS.nexilisShowAlertWithHTMLMessage(on: UIApplication.shared.visibleViewController ?? UIViewController(), title: title, message: message)
|
|
|
|
+ } else {
|
|
|
|
+ UIApplication.shared.visibleViewController?.view.makeToast("Feature disabled".localized(), duration: 5)
|
|
|
|
+ }
|
|
|
|
+ return
|
|
|
|
+ }
|
|
let navigationController = CustomNavigationController(rootViewController: QmeraCreateStreamingViewController())
|
|
let navigationController = CustomNavigationController(rootViewController: QmeraCreateStreamingViewController())
|
|
navigationController.defaultStyle()
|
|
navigationController.defaultStyle()
|
|
if UIApplication.shared.visibleViewController?.navigationController != nil {
|
|
if UIApplication.shared.visibleViewController?.navigationController != nil {
|
|
@@ -282,6 +306,16 @@ public class APIS: NSObject {
|
|
APIS.showChangeProfile()
|
|
APIS.showChangeProfile()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ if !Nexilis.checkingAccess(key: "vconf_room") {
|
|
|
|
+ if Nexilis.checkingAccessAlert(key: "vconf_room") != "|" && !Nexilis.checkingAccessAlert(key: "vconf_room").isEmpty {
|
|
|
|
+ let title = Nexilis.checkingAccessAlert(key: "vconf_room").components(separatedBy: "|")[0]
|
|
|
|
+ let message = Nexilis.checkingAccessAlert(key: "vconf_room").components(separatedBy: "|")[1]
|
|
|
|
+ APIS.nexilisShowAlertWithHTMLMessage(on: UIApplication.shared.visibleViewController ?? UIViewController(), title: title, message: message)
|
|
|
|
+ } else {
|
|
|
|
+ UIApplication.shared.visibleViewController?.view.makeToast("Feature disabled".localized(), duration: 5)
|
|
|
|
+ }
|
|
|
|
+ return
|
|
|
|
+ }
|
|
let navigationController = CustomNavigationController(rootViewController: CreateSeminarViewController())
|
|
let navigationController = CustomNavigationController(rootViewController: CreateSeminarViewController())
|
|
navigationController.defaultStyle()
|
|
navigationController.defaultStyle()
|
|
if UIApplication.shared.visibleViewController?.navigationController != nil {
|
|
if UIApplication.shared.visibleViewController?.navigationController != nil {
|
|
@@ -297,6 +331,10 @@ public class APIS: NSObject {
|
|
APIS.showChangeProfile()
|
|
APIS.showChangeProfile()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ if !Nexilis.checkingAccess(key: "audio_call") {
|
|
|
|
+ UIApplication.shared.visibleViewController?.view.makeToast("Feature disabled".localized(), duration: 5)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
let callContact = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "contactSID") as! ContactCallViewController
|
|
let callContact = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "contactSID") as! ContactCallViewController
|
|
callContact.onlyAudioOrVideo = 1
|
|
callContact.onlyAudioOrVideo = 1
|
|
let navigationController = CustomNavigationController(rootViewController: callContact)
|
|
let navigationController = CustomNavigationController(rootViewController: callContact)
|
|
@@ -313,6 +351,10 @@ public class APIS: NSObject {
|
|
UIApplication.shared.visibleViewController?.view.makeToast("92:Username is empty".localized(), duration: 3)
|
|
UIApplication.shared.visibleViewController?.view.makeToast("92:Username is empty".localized(), duration: 3)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ if !Nexilis.checkingAccess(key: "audio_call") {
|
|
|
|
+ UIApplication.shared.visibleViewController?.view.makeToast("Feature disabled".localized(), duration: 5)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
let user = User.getDataFromNameCanNil(name: name)
|
|
let user = User.getDataFromNameCanNil(name: name)
|
|
if user == nil {
|
|
if user == nil {
|
|
UIApplication.shared.visibleViewController?.view.makeToast("91:Invalid name or you must add Username to your contact first".localized(), duration: 3)
|
|
UIApplication.shared.visibleViewController?.view.makeToast("91:Invalid name or you must add Username to your contact first".localized(), duration: 3)
|
|
@@ -342,6 +384,10 @@ public class APIS: NSObject {
|
|
APIS.showChangeProfile()
|
|
APIS.showChangeProfile()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ if !Nexilis.checkingAccess(key: "video_call") {
|
|
|
|
+ UIApplication.shared.visibleViewController?.view.makeToast("Feature disabled".localized(), duration: 5)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
let callContact = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "contactSID") as! ContactCallViewController
|
|
let callContact = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "contactSID") as! ContactCallViewController
|
|
callContact.onlyAudioOrVideo = 2
|
|
callContact.onlyAudioOrVideo = 2
|
|
let navigationController = CustomNavigationController(rootViewController: callContact)
|
|
let navigationController = CustomNavigationController(rootViewController: callContact)
|
|
@@ -358,6 +404,10 @@ public class APIS: NSObject {
|
|
UIApplication.shared.visibleViewController?.view.makeToast("92:Username is empty".localized(), duration: 3)
|
|
UIApplication.shared.visibleViewController?.view.makeToast("92:Username is empty".localized(), duration: 3)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ if !Nexilis.checkingAccess(key: "video_call") {
|
|
|
|
+ UIApplication.shared.visibleViewController?.view.makeToast("Feature disabled".localized(), duration: 5)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
let user = User.getDataFromNameCanNil(name: name)
|
|
let user = User.getDataFromNameCanNil(name: name)
|
|
if user == nil {
|
|
if user == nil {
|
|
UIApplication.shared.visibleViewController?.view.makeToast("91:Invalid name or you must add Username to your contact first".localized(), duration: 3)
|
|
UIApplication.shared.visibleViewController?.view.makeToast("91:Invalid name or you must add Username to your contact first".localized(), duration: 3)
|
|
@@ -395,6 +445,10 @@ public class APIS: NSObject {
|
|
APIS.showChangeProfile()
|
|
APIS.showChangeProfile()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ if !Nexilis.checkingAccess(key: "broadcast_message") {
|
|
|
|
+ UIApplication.shared.visibleViewController?.view.makeToast("Feature disabled".localized(), duration: 5)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
let controller = AppStoryBoard.Palio.instance.instantiateViewController(identifier: "broadcastNav")
|
|
let controller = AppStoryBoard.Palio.instance.instantiateViewController(identifier: "broadcastNav")
|
|
if UIApplication.shared.visibleViewController?.navigationController != nil {
|
|
if UIApplication.shared.visibleViewController?.navigationController != nil {
|
|
UIApplication.shared.visibleViewController?.navigationController?.present(controller, animated: true, completion: nil)
|
|
UIApplication.shared.visibleViewController?.navigationController?.present(controller, animated: true, completion: nil)
|
|
@@ -494,14 +548,13 @@ public class APIS: NSObject {
|
|
closeButton.backgroundColor = .lightGray.withAlphaComponent(0.1)
|
|
closeButton.backgroundColor = .lightGray.withAlphaComponent(0.1)
|
|
let config = UIImage.SymbolConfiguration(pointSize: 18, weight: .semibold)
|
|
let config = UIImage.SymbolConfiguration(pointSize: 18, weight: .semibold)
|
|
closeButton.setImage(UIImage(systemName: "xmark", withConfiguration: config), for: .normal)
|
|
closeButton.setImage(UIImage(systemName: "xmark", withConfiguration: config), for: .normal)
|
|
- closeButton.actionHandle(controlEvents: .touchUpInside,
|
|
|
|
- ForAction:{() -> Void in
|
|
|
|
|
|
+ closeButton.addAction(UIAction { _ in
|
|
startedNewCommunity.dismiss(animated: true)
|
|
startedNewCommunity.dismiss(animated: true)
|
|
- })
|
|
|
|
|
|
+ }, for: .touchUpInside)
|
|
|
|
|
|
let imageComm = UIImageView(image: UIImage(named: "pb_community_social", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!)
|
|
let imageComm = UIImageView(image: UIImage(named: "pb_community_social", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!)
|
|
containerView.addSubview(imageComm)
|
|
containerView.addSubview(imageComm)
|
|
- imageComm.anchor(top: closeButton.bottomAnchor, paddingTop: -40, centerX: containerView.centerXAnchor, width: 380, height: 250)
|
|
|
|
|
|
+ imageComm.anchor(top: closeButton.bottomAnchor, paddingTop: -40, centerX: containerView.centerXAnchor, width: 350, height: 250)
|
|
|
|
|
|
let titleComm = UILabel()
|
|
let titleComm = UILabel()
|
|
containerView.addSubview(titleComm)
|
|
containerView.addSubview(titleComm)
|
|
@@ -530,6 +583,12 @@ public class APIS: NSObject {
|
|
buttonComm.setTitle("Get started".localized(), for: .normal)
|
|
buttonComm.setTitle("Get started".localized(), for: .normal)
|
|
buttonComm.setTitleColor(.white, for: .normal)
|
|
buttonComm.setTitleColor(.white, for: .normal)
|
|
buttonComm.titleLabel?.font = .systemFont(ofSize: 16, weight: .medium)
|
|
buttonComm.titleLabel?.font = .systemFont(ofSize: 16, weight: .medium)
|
|
|
|
+ buttonComm.addAction(UIAction { _ in
|
|
|
|
+ startedNewCommunity.dismiss(animated: true) {
|
|
|
|
+ let navigationController = UINavigationController(rootViewController: CommunityNew())
|
|
|
|
+ UIApplication.shared.visibleViewController?.present(navigationController, animated: true, completion: nil)
|
|
|
|
+ }
|
|
|
|
+ }, for: .touchUpInside)
|
|
}
|
|
}
|
|
startedNewCommunity.modalPresentationStyle = .overCurrentContext
|
|
startedNewCommunity.modalPresentationStyle = .overCurrentContext
|
|
if UIApplication.shared.visibleViewController?.navigationController != nil {
|
|
if UIApplication.shared.visibleViewController?.navigationController != nil {
|
|
@@ -1608,6 +1667,7 @@ public class APIS: NSObject {
|
|
FileEncryption.shared.aesKey = nil
|
|
FileEncryption.shared.aesKey = nil
|
|
FileEncryption.shared.aesIV = nil
|
|
FileEncryption.shared.aesIV = nil
|
|
}
|
|
}
|
|
|
|
+ FloatingButton.datePull = nil
|
|
}
|
|
}
|
|
|
|
|
|
public static var notifTimer = Timer()
|
|
public static var notifTimer = Timer()
|
|
@@ -1639,20 +1699,20 @@ public class APIS: NSObject {
|
|
checkDataForShareExtension()
|
|
checkDataForShareExtension()
|
|
UIApplication.shared.applicationIconBadgeNumber = 0
|
|
UIApplication.shared.applicationIconBadgeNumber = 0
|
|
UNUserNotificationCenter.current().removeAllDeliveredNotifications()
|
|
UNUserNotificationCenter.current().removeAllDeliveredNotifications()
|
|
- DispatchQueue.global().async {
|
|
|
|
- while API.nGetCLXConnState() == 0 {
|
|
|
|
- Thread.sleep(forTimeInterval: 0.5)
|
|
|
|
- }
|
|
|
|
- if let vers = Nexilis.writeAndWait(message: CoreMessage_TMessageBank.checkVersion()) {
|
|
|
|
- let dataVersion = vers.getBody(key: CoreMessage_TMessageKey.DATA)
|
|
|
|
- let type = vers.getBody(key: CoreMessage_TMessageKey.TYPE)
|
|
|
|
- if dataVersion != "1" {
|
|
|
|
- DispatchQueue.main.async {
|
|
|
|
- showExpiredVersion(mandatory: type == "1")
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+// DispatchQueue.global().async {
|
|
|
|
+// while API.nGetCLXConnState() == 0 {
|
|
|
|
+// Thread.sleep(forTimeInterval: 0.5)
|
|
|
|
+// }
|
|
|
|
+// if let vers = Nexilis.writeAndWait(message: CoreMessage_TMessageBank.checkVersion()) {
|
|
|
|
+// let dataVersion = vers.getBody(key: CoreMessage_TMessageKey.DATA)
|
|
|
|
+// let type = vers.getBody(key: CoreMessage_TMessageKey.TYPE)
|
|
|
|
+// if dataVersion != "1" {
|
|
|
|
+// DispatchQueue.main.async {
|
|
|
|
+// showExpiredVersion(mandatory: type == "1")
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|
|
if Utils.getSecureFolderOffline() == "0" && afterEnterBackground && Database.shared.database == nil && Utils.getSetProfile() {
|
|
if Utils.getSecureFolderOffline() == "0" && afterEnterBackground && Database.shared.database == nil && Utils.getSetProfile() {
|
|
Database.recreateInstance()
|
|
Database.recreateInstance()
|
|
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "disconnected_nexilis"), object: nil, userInfo: nil)
|
|
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "disconnected_nexilis"), object: nil, userInfo: nil)
|
|
@@ -1692,6 +1752,25 @@ public class APIS: NSObject {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static func nexilisShowAlertWithHTMLMessage(on viewController: UIViewController, title: String, message: String = "<b>Bold</b> and <i>italic</i> text in an alert") {
|
|
|
|
+ let alert = UIAlertController(title: title, message: "", preferredStyle: .alert)
|
|
|
|
+
|
|
|
|
+ let titleFont = UIFont.boldSystemFont(ofSize: 16)
|
|
|
|
+ let titleAttributes = [NSAttributedString.Key.font: titleFont]
|
|
|
|
+ alert.setValue(NSAttributedString(string: title, attributes: titleAttributes), forKey: "attributedTitle")
|
|
|
|
+
|
|
|
|
+ var message = message
|
|
|
|
+ message = message.replacingOccurrences(of: "<b>", with: "*")
|
|
|
|
+ message = message.replacingOccurrences(of: "</b>", with: "*")
|
|
|
|
+ message = message.replacingOccurrences(of: "<i>", with: "_")
|
|
|
|
+ message = message.replacingOccurrences(of: "</i>", with: "_")
|
|
|
|
+
|
|
|
|
+ alert.setValue(message.richText(fontSize: 14), forKey: "attributedMessage")
|
|
|
|
+
|
|
|
|
+ alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
|
|
|
|
+ viewController.present(alert, animated: true, completion: nil)
|
|
|
|
+ }
|
|
|
|
+
|
|
private static func showEnableNotificationsAlert() {
|
|
private static func showEnableNotificationsAlert() {
|
|
guard !isAlertPresented else { return }
|
|
guard !isAlertPresented else { return }
|
|
isAlertPresented = true
|
|
isAlertPresented = true
|