100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
iOS console : code cleaning
William Balcaenf84e230afc1b
diff --git a/console/iOS/console/ORViewController.swift b/console/iOS/console/ORViewController.swiftindex f5bfbc223..0e49f42cc 100644--- a/console/iOS/console/ORViewController.swift+++ b/console/iOS/console/ORViewController.swift@@ -198,7 +198,6 @@ class ORViewcontroller : UIViewController, URLSessionDelegate, WKScriptMessageHaself.showError(error: error)} else {print(response.debugDescription)- _ = self.myWebView?.load(data!, mimeType: "text/html", characterEncodingName: "utf8", baseURL: URL(string:Server.apiTestResource)!)}}})diff --git a/console/iOS/console/TokenManager.swift b/console/iOS/console/TokenManager.swiftindex 72efd5a1a..a6728bdca 100644--- a/console/iOS/console/TokenManager.swift+++ b/console/iOS/console/TokenManager.swift@@ -184,6 +184,24 @@ class TokenManager:NSObject, WKScriptMessageHandler, WKUIDelegate, WKNavigationD}func sendDeviceId() {+ func showError(error : Error) {+ NSLog("showing error %@",error as NSError)+ let topWindow = UIWindow(frame: UIScreen.main.bounds)+ topWindow.rootViewController = UIViewController()+ topWindow.windowLevel = UIWindowLevelAlert + 1+ let alertVC = UIAlertController(title: "Error", message: error.localizedDescription, preferredStyle: UIAlertControllerStyle.alert)+ let alertAction = UIAlertAction(title: "Done", style: .cancel) { (action) in+ self.viewController.dismiss(animated: true, completion: nil)+ topWindow.isHidden = true+ }++ alertVC.addAction(alertAction)+ DispatchQueue.main.async {+ topWindow.makeKeyAndVisible()+ topWindow.rootViewController?.present(alertVC, animated: true, completion: nil)+ }+ }+func getAccessToken(callback: @escaping (AccesTokenResult<String>) -> ()) {guard let tkurlRequest = URL(string: String(format:"https://%@/auth/realms/%@/protocol/openid-connect/token",Server.hostURL,Server.realm)) else { return }let tkRequest = NSMutableURLRequest(url: tkurlRequest)diff --git a/console/iOS/console/ViewController.swift b/console/iOS/console/ViewController.swiftindex 2bedc6680..4e9c31b35 100644--- a/console/iOS/console/ViewController.swift+++ b/console/iOS/console/ViewController.swift@@ -42,6 +42,20 @@ class ViewController: UIViewController {TokenManager.sharedInstance.didLogOut = falseshowLoginPage()}+ func login() {+ self.loginButton.removeFromSuperview()+ self.showLoginPage()+ }++ func loadUrl(url: URL) {+ if (self.presentedViewController?.isMember(of: ORViewcontroller.self))! {+ self.orViewController.loadURL(url: url)+ }+ }++ func updateAssetAttribute(assetId : String, attributeName : String, rawJson : String) {+ self.orViewController.updateAssetAttribute(assetId: assetId, attributeName: attributeName, rawJson: rawJson)+ }}