|
@@ -7,6 +7,7 @@
|
|
|
|
|
|
import UIKit
|
|
|
import NexilisLite
|
|
|
+import NotificationBannerSwift
|
|
|
|
|
|
struct AppFontName {
|
|
|
static let regular = "Poppins-Regular"
|
|
@@ -106,34 +107,41 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|
|
// Override point for customization after application launch.
|
|
|
// Nexilis.connect(apiKey: "09ED34439CFE435E5D528E73F2D3DC1B23307B56EAB28A4883700D47BB5ADE07", delegate: self, showButton: false)
|
|
|
// Nexilis.connect(apiKey: "E6FF534BDA45A78619488E44AC90592327DDF33ACF6213A58DB55B78300BA8EE", delegate: self, showButton: false)
|
|
|
- Nexilis.connect(apiKey: "***REPLACE***WITH***YOUR***ACCOUNT***", delegate: self, showButton: false)
|
|
|
- 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?]] {
|
|
|
- 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 !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 {
|
|
|
+ Nexilis.connect(apiKey: "***REPLACE***WITH***YOUR***ACCOUNT***", delegate: self, showButton: false)
|
|
|
+ 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?]] {
|
|
|
+ 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)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -150,7 +158,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|
|
if #available(iOS 15.0, *) {
|
|
|
UITabBar.appearance().scrollEdgeAppearance = tabBarAppearance
|
|
|
}
|
|
|
- Thread.sleep(forTimeInterval: 2.0)
|
|
|
return true
|
|
|
}
|
|
|
|