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 : the link to open will probably be an anchor
William Balcaen726db39919a6
diff --git a/console/iOS/NotificationExtension/Constants.swift b/console/iOS/NotificationExtension/Constants.swiftindex 649d3a9d6..c23c16d07 100644--- a/console/iOS/NotificationExtension/Constants.swift+++ b/console/iOS/NotificationExtension/Constants.swift@@ -19,8 +19,8 @@ struct AppGroup {}enum Server {- static let hostURL = "192.168.0.173"- static let initialPath = String(format:"console/%@/index.html",Server.realm)+ static let hostURL = "192.168.0.177"+ static let initialPath = String(format:"console/%@/",Server.realm)static let realm = "blok61"static let apiTestResource = String(format:"https://%@/%@/notification/alert",Server.hostURL,Server.realm)}diff --git a/console/iOS/console/AppDelegate.swift b/console/iOS/console/AppDelegate.swiftindex 02689f2d5..417ad6ab1 100644--- a/console/iOS/console/AppDelegate.swift+++ b/console/iOS/console/AppDelegate.swift@@ -114,8 +114,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDswitch response.actionIdentifier {case ActionType.ACTION_DEEP_LINK :// open url- let urlToOpen = response.notification.request.content.userInfo["appUrl"] as! String- (self.window?.rootViewController as! ViewController).loadUrl(url: URL(string: urlToOpen)!)+ let urlToOpen = response.notification.request.content.userInfo["appUrl"] as! String // until now we are considering anchor name (without the #)+ (self.window?.rootViewController as! ViewController).loadUrl(url: URL(string: String(format: "https://%@/%@%@", Server.hostURL, Server.navigationPath,urlToOpen))!)NSLog("Action asked : %@",response.actionIdentifier)case ActionType.ACTION_ACTUATOR :NSLog("Action asked : %@",response.actionIdentifier)diff --git a/console/iOS/console/Constants.swift b/console/iOS/console/Constants.swiftindex 70d1cc201..23635833d 100644--- a/console/iOS/console/Constants.swift+++ b/console/iOS/console/Constants.swift@@ -16,9 +16,12 @@ enum AccesTokenResult<String>enum Server {static let hostURL = "192.168.0.177"- static let initialPath = String(format:"console/%@/index.html",Server.realm)+ static let initialPath = String(format:"console/%@/",Server.realm)+ static let navigationPath = String(format:"console/%@/#/",Server.realm)static let realm = "blok61"static let apiTestResource = String(format:"https://%@/%@/notification/alert",Server.hostURL,Server.realm)+// static let apiTestResource = String(format:"https://%@/%@/asset/user/current",Server.hostURL,Server.realm)+static let registerDeviceResource = String(format:"https://%@/%@/notification/token",Server.hostURL,Server.realm)}diff --git a/console/iOS/console/ORViewController.swift b/console/iOS/console/ORViewController.swiftindex 0e49f42cc..f1cdf5df8 100644--- a/console/iOS/console/ORViewController.swift+++ b/console/iOS/console/ORViewController.swift@@ -84,7 +84,7 @@ class ORViewcontroller : UIViewController, URLSessionDelegate, WKScriptMessageHalet request = NSMutableURLRequest(url: urlRequest)request.httpMethod = "GET" // post to create a notification alert, get to get a list of notification alertsrequest.addValue("application/json", forHTTPHeaderField: "Content-Type")- request.httpBody = "{\"title\" :\" notif alert title\",\"message\" : \"notif alert message\",\"appUrl\" : \"http://www.openremote.org\",\"actions\": [ {\"title\" : \"Open link\" , \"type\": \"ACTION_DEEP_LINK\"},{\"title\" : \"background call\" , \"type\": \"ACTION_ACTUATOR\" , \"assetId\" : \"9sGrlb-CSZWgOeUCTYZ9Yw\", \"attributeName\" : \"targetTemp\", \"rawJson\" : \"45\" } ]}".data(using: .utf8)+ request.httpBody = "{\"title\" :\" notif alert title\",\"message\" : \"notif alert message\",\"appUrl\" : \"Veilig\",\"actions\": [ {\"title\" : \"Open link\" , \"type\": \"ACTION_DEEP_LINK\"},{\"title\" : \"background call\" , \"type\": \"ACTION_ACTUATOR\" , \"assetId\" : \"2E2vrICRSEa6mfzOquZzxA\", \"attributeName\" : \"targetTemp\", \"rawJson\" : \"18\" } ]}".data(using: .utf8)request.addValue(String(format:"Bearer %@", accessToken!), forHTTPHeaderField: "Authorization")let sessionConfiguration = URLSessionConfiguration.defaultlet session = URLSession(configuration: sessionConfiguration, delegate: self, delegateQueue : nil)diff --git a/console/iOS/console/ViewController.swift b/console/iOS/console/ViewController.swiftindex 3667ae232..019d7dc89 100644--- a/console/iOS/console/ViewController.swift+++ b/console/iOS/console/ViewController.swift@@ -68,13 +68,11 @@ class ViewController: UIViewController {}func loadUrl(url: URL) {- if (self.presentedViewController?.isMember(of: ORViewcontroller.self))! {- self.orViewController.loadURL(url: url)- }+ self.orViewController.loadURL(url: url)}func updateAssetAttribute(assetId : String, attributeName : String, rawJson : String) {- self.orViewController.updateAssetAttribute(assetId: assetId, attributeName: attributeName, rawJson: rawJson)+ self.orViewController.updateAssetAttribute(assetId: assetId, attributeName: attributeName, rawJson: rawJson)}}