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
Updated iOS app to work with the latest console app config
Michael Rademakerbaedc7a2c7e0
diff --git a/console/iOS/GenericApp/GenericApp.xcodeproj/project.pbxproj b/console/iOS/GenericApp/GenericApp.xcodeproj/project.pbxprojindex 69c4bc798..108376b51 100644--- a/console/iOS/GenericApp/GenericApp.xcodeproj/project.pbxproj+++ b/console/iOS/GenericApp/GenericApp.xcodeproj/project.pbxproj@@ -575,8 +575,27 @@APPLICATION_EXTENSION_API_ONLY = YES;CODE_SIGN_ENTITLEMENTS = NotificationService/NotificationService.entitlements;CODE_SIGN_STYLE = Automatic;- CURRENT_PROJECT_VERSION = 27;+ CURRENT_PROJECT_VERSION = 28;DEVELOPMENT_TEAM = 4AC88KZHJZ;+ FRAMEWORK_SEARCH_PATHS = (+ "$(inherited)",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/FirebaseCore\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/FirebaseCoreDiagnostics\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/FirebaseCrashlytics\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/FirebaseInstallations\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/FirebaseInstanceID\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/FirebaseMessaging\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/GoogleDataTransport\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/GoogleUtilities\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/PromisesObjC\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/nanopb\"",+ "\"${PODS_ROOT}/FirebaseAnalytics/Frameworks\"",+ "\"${PODS_ROOT}/GoogleAppMeasurement/Frameworks\"",+ "\"${PODS_XCFRAMEWORKS_BUILD_DIR}/FirebaseAnalytics\"",+ "\"${PODS_XCFRAMEWORKS_BUILD_DIR}/GoogleAppMeasurement\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/Popover\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/MaterialComponents\"",+ );INFOPLIST_FILE = NotificationService/Info.plist;IPHONEOS_DEPLOYMENT_TARGET = 13.2;LD_RUNPATH_SEARCH_PATHS = (@@ -584,7 +603,7 @@"@executable_path/Frameworks","@executable_path/../../Frameworks",);- MARKETING_VERSION = 1.0.4;+ MARKETING_VERSION = 1.0.5;PRODUCT_BUNDLE_IDENTIFIER = io.openremote.app.NotificationService;PRODUCT_NAME = "$(TARGET_NAME)";SKIP_INSTALL = YES;@@ -600,8 +619,27 @@APPLICATION_EXTENSION_API_ONLY = YES;CODE_SIGN_ENTITLEMENTS = NotificationService/NotificationService.entitlements;CODE_SIGN_STYLE = Automatic;- CURRENT_PROJECT_VERSION = 27;+ CURRENT_PROJECT_VERSION = 28;DEVELOPMENT_TEAM = 4AC88KZHJZ;+ FRAMEWORK_SEARCH_PATHS = (+ "$(inherited)",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/FirebaseCore\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/FirebaseCoreDiagnostics\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/FirebaseCrashlytics\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/FirebaseInstallations\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/FirebaseInstanceID\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/FirebaseMessaging\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/GoogleDataTransport\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/GoogleUtilities\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/PromisesObjC\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/nanopb\"",+ "\"${PODS_ROOT}/FirebaseAnalytics/Frameworks\"",+ "\"${PODS_ROOT}/GoogleAppMeasurement/Frameworks\"",+ "\"${PODS_XCFRAMEWORKS_BUILD_DIR}/FirebaseAnalytics\"",+ "\"${PODS_XCFRAMEWORKS_BUILD_DIR}/GoogleAppMeasurement\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/Popover\"",+ "\"${PODS_CONFIGURATION_BUILD_DIR}/MaterialComponents\"",+ );INFOPLIST_FILE = NotificationService/Info.plist;IPHONEOS_DEPLOYMENT_TARGET = 13.2;LD_RUNPATH_SEARCH_PATHS = (@@ -609,7 +647,7 @@"@executable_path/Frameworks","@executable_path/../../Frameworks",);- MARKETING_VERSION = 1.0.4;+ MARKETING_VERSION = 1.0.5;PRODUCT_BUNDLE_IDENTIFIER = io.openremote.app.NotificationService;PRODUCT_NAME = "$(TARGET_NAME)";SKIP_INSTALL = YES;diff --git a/console/iOS/GenericApp/GenericApp/UI/ProjectViewController.swift b/console/iOS/GenericApp/GenericApp/UI/ProjectViewController.swiftindex 804152afa..6e1603a6f 100644--- a/console/iOS/GenericApp/GenericApp/UI/ProjectViewController.swift+++ b/console/iOS/GenericApp/GenericApp/UI/ProjectViewController.swift@@ -75,7 +75,7 @@ extension ProjectViewController: UITextFieldDelegate {let url = project.isUrl() ? project.appending("/api/\(realm)") : "https://\(project).openremote.io/api/\(realm)"let apiManager = ApiManager(baseUrl: url)- apiManager.getAppConfig(callback: { statusCode, orAppConfig, error in+ apiManager.getAppConfig(realm: realm, callback: { statusCode, orAppConfig, error inDispatchQueue.main.async {if statusCode == 200 && error == nil {let userDefaults = UserDefaults(suiteName: DefaultsKey.groupEntitlement)diff --git a/console/iOS/GenericApp/GenericApp/UI/SplashViewController.swift b/console/iOS/GenericApp/GenericApp/UI/SplashViewController.swiftindex 5e51215ed..f8a14d796 100644--- a/console/iOS/GenericApp/GenericApp/UI/SplashViewController.swift+++ b/console/iOS/GenericApp/GenericApp/UI/SplashViewController.swift@@ -24,7 +24,7 @@ class SplashViewController: UIViewController {let url = host!.appending("/api/\(realm)")let apiManager = ApiManager(baseUrl: url)- apiManager.getAppConfig(callback: { statusCode, orAppConfig, error in+ apiManager.getAppConfig(realm: realm, callback: { statusCode, orAppConfig, error inDispatchQueue.main.async {if statusCode == 200 && error == nil {self.appconfig = orAppConfigdiff --git a/console/iOS/GenericApp/Podfile.lock b/console/iOS/GenericApp/Podfile.lockindex 3b8eb3a5f..b5566db2c 100644--- a/console/iOS/GenericApp/Podfile.lock+++ b/console/iOS/GenericApp/Podfile.lock@@ -197,4 +197,4 @@ SPEC CHECKSUMS:PODFILE CHECKSUM: 7cd5b9883b4c8ac0baef0967b6a31c84f8ce1e6c-COCOAPODS: 1.10.1+COCOAPODS: 1.11.2diff --git a/console/iOS/ORLib/ORLib.xcodeproj/project.pbxproj b/console/iOS/ORLib/ORLib.xcodeproj/project.pbxprojindex a8c008cc6..5f6ec5f3f 100644--- a/console/iOS/ORLib/ORLib.xcodeproj/project.pbxproj+++ b/console/iOS/ORLib/ORLib.xcodeproj/project.pbxproj@@ -44,8 +44,8 @@/* End PBXCopyFilesBuildPhase section *//* Begin PBXFileReference section */- 37A59C1C5EEB5A3027F557D0 /* Pods-ORLib.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ORLib.release.xcconfig"; path = "../../../michael/Documents/Projects/OpenRemote/k2/console/iOS/K2/Pods/Target Support Files/Pods-ORLib/Pods-ORLib.release.xcconfig"; sourceTree = "<group>"; };- 3F2140D7DCE68D42273B346B /* Pods-ORLib.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ORLib.debug.xcconfig"; path = "../../../michael/Documents/Projects/OpenRemote/k2/console/iOS/K2/Pods/Target Support Files/Pods-ORLib/Pods-ORLib.debug.xcconfig"; sourceTree = "<group>"; };+ 37A59C1C5EEB5A3027F557D0 /* Pods-ORLib.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ORLib.release.xcconfig"; path = "../../../Users/michael/Documents/OR/Code/openremote/console/iOS/GenericApp/Pods/Target Support Files/Pods-ORLib/Pods-ORLib.release.xcconfig"; sourceTree = "<group>"; };+ 3F2140D7DCE68D42273B346B /* Pods-ORLib.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ORLib.debug.xcconfig"; path = "../../../Users/michael/Documents/OR/Code/openremote/console/iOS/GenericApp/Pods/Target Support Files/Pods-ORLib/Pods-ORLib.debug.xcconfig"; sourceTree = "<group>"; };41E56A0D7E49334C15A35CB4 /* Pods_ORLib.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ORLib.framework; sourceTree = BUILT_PRODUCTS_DIR; };4C0E4A0F274BDCE0008CB352 /* ScannerOverlayPreviewLayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScannerOverlayPreviewLayer.swift; sourceTree = "<group>"; };4C0E4A11274BE411008CB352 /* QrScannerProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QrScannerProvider.swift; sourceTree = "<group>"; };diff --git a/console/iOS/ORLib/ORLib.xcodeproj/xcuserdata/michael.xcuserdatad/xcschemes/xcschememanagement.plist b/console/iOS/ORLib/ORLib.xcodeproj/xcuserdata/michael.xcuserdatad/xcschemes/xcschememanagement.plistindex 4ae04dc2b..a839ca752 100644--- a/console/iOS/ORLib/ORLib.xcodeproj/xcuserdata/michael.xcuserdatad/xcschemes/xcschememanagement.plist+++ b/console/iOS/ORLib/ORLib.xcodeproj/xcuserdata/michael.xcuserdatad/xcschemes/xcschememanagement.plist@@ -7,7 +7,7 @@<key>ORLib.xcscheme_^#shared#^_</key><dict><key>orderHint</key>- <integer>19</integer>+ <integer>21</integer></dict></dict></dict>diff --git a/console/iOS/ORLib/ORLib/Network/ApiManager.swift b/console/iOS/ORLib/ORLib/Network/ApiManager.swiftindex 69bf9ff90..aee9991cc 100644--- a/console/iOS/ORLib/ORLib/Network/ApiManager.swift+++ b/console/iOS/ORLib/ORLib/Network/ApiManager.swift@@ -47,8 +47,30 @@ public class ApiManager: NSObject {return decoder}()- public func getAppConfig(callback: ResponseBlock<ORAppConfig>?) {- self.get(pathComponents: ["app", "config"], callback: callback)+ public func getAppConfig(realm: String, callback: ResponseBlock<ORAppConfig>?) {+ var urlRequest = URLRequest(url: URL(string: "\(self.baseUrl.scheme!)://\(self.baseUrl.host!)/consoleappconfig/\(realm).json")!)+ urlRequest.httpMethod = HttpMethod.get.rawValue++ if let accessToken = ApiManager.accessToken {+ urlRequest.addValue("Bearer \(accessToken)", forHTTPHeaderField: "Authorization")+ }++ session.dataTask(with: urlRequest, completionHandler: { responseData, response, error in+ let httpStatusCode = (response as? HTTPURLResponse)?.statusCode ?? 500++ guard let responseData = responseData else {+ callback?(httpStatusCode, nil, error);+ return+ }++ guard let responseModel = try? self.decoder.decode(ORAppConfig.self, from: responseData) else {+ print("Couldn't parse response: \(String(data: responseData, encoding: .utf8)!)")+ callback?(httpStatusCode, nil, error);+ return;+ }++ callback?(httpStatusCode, responseModel, nil)+ }).resume()}//REST METHODS@@ -87,13 +109,6 @@ public class ApiManager: NSObject {callback?(httpStatusCode, nil, error);return}- do {- let i = try self.decoder.decode(T.self, from: responseData)- } catch {- print("Unexpected error: \(error).")- }--guard let responseModel = try? self.decoder.decode(T.self, from: responseData) else {print("Couldn't parse response: \(String(data: responseData, encoding: .utf8)!)")@@ -146,12 +161,6 @@ public class ApiManager: NSObject {callback?(httpStatusCode, nil, error);return}-//-// do {-// try self.decoder.decode(R.self, from: responseData)-// } catch let err {-// print(err)-// }guard let responseModel = try? self.decoder.decode(R.self, from: responseData) else {print("Couldn't parse response: \(String(data: responseData, encoding: .utf8)!)")