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
Fix for alert message in specific project
Michael Rademaker585dde2dd965
diff --git a/console/iOS/ORLib/ORLib/GeofenceProvider.swift b/console/iOS/ORLib/ORLib/GeofenceProvider.swiftindex 50bc7544b..68b61deae 100644--- a/console/iOS/ORLib/ORLib/GeofenceProvider.swift+++ b/console/iOS/ORLib/ORLib/GeofenceProvider.swift@@ -132,7 +132,11 @@ public class GeofenceProvider: NSObject, URLSessionDelegate {public func getLocation(callback:@escaping ([String: Any]) -> (Void)) {if CLLocationManager.authorizationStatus() == .denied {- callback([:])+ callback([+ DefaultsKey.actionKey: Actions.getLocation,+ DefaultsKey.providerKey: Providers.geofence,+ DefaultsKey.dataKey: nil+ ])} else {getLocationCallback = callbacklocationManager.startUpdatingLocation()diff --git a/console/iOS/ORLib/ORLib/ORViewController.swift b/console/iOS/ORLib/ORLib/ORViewController.swiftindex d4da1d6c8..b58db17b4 100644--- a/console/iOS/ORLib/ORLib/ORViewController.swift+++ b/console/iOS/ORLib/ORLib/ORViewController.swift@@ -260,8 +260,11 @@ extension ORViewcontroller: WKScriptMessageHandler {geofenceProvider?.refreshGeofences()case Actions.getLocation:geofenceProvider?.getLocation(callback: { locationData in- if locationData.isEmpty {- let alertController = UIAlertController(title: "Location Services disabled", message: "Please enable Location Services for this app", preferredStyle: .alert)+ if let coordinates = locationData["data"], coordinates == nil {//weird comparion needed for nil value in dict where key does exist.+ } else {+ let alertController = UIAlertController(title: NSLocalizedString(LocalizableString.LocationPermissionTitle, comment: ""),+ message: NSLocalizedString(LocalizableString.LocationPermissionMessage, comment: ""),+ preferredStyle: .alert)if let settingsUrl = URL(string: UIApplication.openSettingsURLString), UIApplication.shared.canOpenURL(settingsUrl) {alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: { alertAction inif UIApplication.shared.canOpenURL(settingsUrl) {@@ -270,7 +273,7 @@ extension ORViewcontroller: WKScriptMessageHandler {})}}))- alertController.addAction(UIAlertAction(title: "Not now", style: .cancel, handler: nil))+ alertController.addAction(UIAlertAction(title: NSLocalizedString(LocalizableString.LocationPermissionNotNow, comment: ""), style: .cancel, handler: nil))} else {alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))}diff --git a/console/iOS/ORLib/ORLib/ProjectConstants.swift b/console/iOS/ORLib/ORLib/ProjectConstants.swiftindex a17553434..754e12bcf 100644--- a/console/iOS/ORLib/ORLib/ProjectConstants.swift+++ b/console/iOS/ORLib/ORLib/ProjectConstants.swift@@ -54,3 +54,9 @@ extension UIColor {public static var mainColorAccent = UIColor(red:0.75, green:0.84, blue:0.18, alpha:1.0)}+public enum LocalizableString {+ public static var LocationPermissionTitle = "Location Services disabled"+ public static var LocationPermissionMessage = "Please enable Location Services for this app"+ public static var LocationPermissionNotNow = "Not now"+}+