|
@@ -93,68 +93,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|
|
}
|
|
|
|
|
|
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
|
|
- if !CheckConnection.isConnectedToNetwork() {
|
|
|
- let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
|
|
|
- imageView.tintColor = .white
|
|
|
- let banner = FloatingNotificationBanner(title: "Check your connection".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .danger, colors: nil, iconPosition: .center)
|
|
|
- banner.show()
|
|
|
- } else {
|
|
|
- var showButton = false
|
|
|
- if PrefsUtil.getCpaasMode() == PrefsUtil.CPAAS_MODE_FLOATING || PrefsUtil.getCpaasMode() == PrefsUtil.CPAAS_MODE_MIX {
|
|
|
- showButton = true
|
|
|
- }
|
|
|
- Nexilis.connect(apiKey: "***REPLACE***WITH***YOUR***ACCOUNT***", delegate: self, showButton: showButton, fromMAB: true) //AA6164AA13F0A6262677AC7443C37E3F6F0A342E8BEE84B700CB59C876166FE0(AWS) //1C4FA430BC9F44484AFBE99C8974D70B68CE7891DBE83505CBF01205DE51FC18(CBN)
|
|
|
- if let response = Nexilis.writeSync(message: getPrefs(key: ""), timeout: 5000) {
|
|
|
- if response.mBodies[CoreMessage_TMessageKey.ERRCOD] == "00" {
|
|
|
- let data = response.getBody(key: CoreMessage_TMessageKey.DATA)
|
|
|
- if let json = try! JSONSerialization.jsonObject(with: data.data(using: String.Encoding.utf8)!, options: []) as? [[String: Any?]] {
|
|
|
- UserDefaults.standard.removeObject(forKey: "app_builder_url_first_tab")
|
|
|
- UserDefaults.standard.removeObject(forKey: "app_builder_url_third_tab")
|
|
|
- UserDefaults.standard.removeObject(forKey: "app_builder_custom_tab")
|
|
|
- UserDefaults.standard.removeObject(forKey: "app_builder_url_base")
|
|
|
- UserDefaults.standard.removeObject(forKey: "app_builder_url_qms")
|
|
|
- UserDefaults.standard.removeObject(forKey: "app_builder_icon_dock")
|
|
|
- UserDefaults.standard.removeObject(forKey: "app_builder_icon_ss")
|
|
|
- UserDefaults.standard.removeObject(forKey: "app_builder_background")
|
|
|
- UserDefaults.standard.removeObject(forKey: "app_builder_compressor")
|
|
|
- for j in json {
|
|
|
- if let firstTab = j["app_builder_url_first_tab"] as? String {
|
|
|
- PrefsUtil.setURLFirstTab(value: firstTab)
|
|
|
- ViewController.sURL = firstTab
|
|
|
- }
|
|
|
- if let thirdTab = j["app_builder_url_third_tab"] as? String {
|
|
|
- PrefsUtil.setURLThirdTab(value: thirdTab)
|
|
|
- ViewController.tab3 = thirdTab
|
|
|
- }
|
|
|
- if let customTab = j["app_builder_custom_tab"] as? String {
|
|
|
- PrefsUtil.setCustomTab(cust: customTab)
|
|
|
- }
|
|
|
- if let urlBase = j["app_builder_url_base"] as? String {
|
|
|
- PrefsUtil.setURLBase(value: urlBase)
|
|
|
- }
|
|
|
- if let urlQMS = j["app_builder_url_qms"] as? String {
|
|
|
- PrefsUtil.setURLQMS(value: urlQMS)
|
|
|
- }
|
|
|
- if let iconDock = j["app_builder_icon_dock"] as? String {
|
|
|
- PrefsUtil.setIconDock(value: iconDock)
|
|
|
- }
|
|
|
- if let iconSS = j["app_builder_icon_ss"] as? String {
|
|
|
- PrefsUtil.setIconSS(value: iconSS)
|
|
|
- }
|
|
|
- if let background = j["app_builder_background"] as? String {
|
|
|
- PrefsUtil.setBackground(value: background)
|
|
|
- }
|
|
|
- if let url_privacy_policy = j["app_builder_url_privacy_policy"] as? String {
|
|
|
- PrefsUtil.setURLPrivacyPolicy(value: url_privacy_policy)
|
|
|
- }
|
|
|
- if let enable_privacy_policy = j["app_builder_enable_privacy_policy"] as? String {
|
|
|
- PrefsUtil.setEnablePrivacyPolicy(value: enable_privacy_policy == "1" ? true : false)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ var showButton = false
|
|
|
+ if PrefsUtil.getCpaasMode() == PrefsUtil.CPAAS_MODE_FLOATING || PrefsUtil.getCpaasMode() == PrefsUtil.CPAAS_MODE_MIX {
|
|
|
+ showButton = true
|
|
|
}
|
|
|
+ Nexilis.connect(apiKey: "***REPLACE***WITH***YOUR***ACCOUNT***", delegate: self, showButton: showButton, fromMAB: true) //AA6164AA13F0A6262677AC7443C37E3F6F0A342E8BEE84B700CB59C876166FE0(AWS) //1C4FA430BC9F44484AFBE99C8974D70B68CE7891DBE83505CBF01205DE51FC18(CBN)
|
|
|
let tabBarAppearance: UITabBarAppearance = UITabBarAppearance()
|
|
|
tabBarAppearance.configureWithTransparentBackground()
|
|
|
if Bundle.main.displayName == "DigiNetS" {
|
|
@@ -190,16 +133,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|
|
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
|
|
|
}
|
|
|
|
|
|
- func getPrefs(key: String) -> TMessage {
|
|
|
- let tMessage = NexilisLite.TMessage()
|
|
|
- let me = UserDefaults.standard.string(forKey: "me")
|
|
|
- tMessage.mCode = "PPR"
|
|
|
- tMessage.mStatus = CoreMessage_TMessageUtil.getTID()
|
|
|
- tMessage.mBodies[CoreMessage_TMessageKey.F_PIN] = me
|
|
|
- tMessage.mBodies[CoreMessage_TMessageKey.KEY] = key
|
|
|
- return tMessage
|
|
|
- }
|
|
|
-
|
|
|
private func registerForPushNotifications() {
|
|
|
if #available(iOS 10.0, *) {
|
|
|
let center = UNUserNotificationCenter.current()
|