Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Restructured iOS code to make it possible to create custom apps with the same code base

Michael Rademakerf9d879b27658
diff --git a/console/iOS/GenericApp/GenericApp.xcodeproj/project.pbxproj b/console/iOS/GenericApp/GenericApp.xcodeproj/project.pbxproj
index 91c793557..93653527e 100644
--- a/console/iOS/GenericApp/GenericApp.xcodeproj/project.pbxproj
+++ b/console/iOS/GenericApp/GenericApp.xcodeproj/project.pbxproj
@@ -7,34 +7,12 @@
objects = {
/* Begin PBXBuildFile section */
- 4C1FF8B6255044210085B2D0 /* Window+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C1FF8B5255044210085B2D0 /* Window+Utils.swift */; };
4C81AA642546B251006ED5DD /* ProjectViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C81AA632546B251006ED5DD /* ProjectViewController.swift */; };
- 4C81AADD2546EB28006ED5DD /* ORTextInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C81AADC2546EB28006ED5DD /* ORTextInput.swift */; };
- 4C81AAE62547124D006ED5DD /* UIColor+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C81AAE52547124D006ED5DD /* UIColor+Utils.swift */; };
- 4C81AB2D25472C7F006ED5DD /* String+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C81AB2C25472C7F006ED5DD /* String+Utils.swift */; };
+ 4C8BA085271460B1001084A4 /* libORLib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C8BA084271460B1001084A4 /* libORLib.a */; };
+ 4C8BA087271461C7001084A4 /* libORLib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C8BA086271461C7001084A4 /* libORLib.a */; };
4CEDA25D25405B1E00C47E3B /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 4CEDA25C25405B1E00C47E3B /* GoogleService-Info.plist */; };
- 4CEDA27B2540690300C47E3B /* ApiManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CEDA27A2540690300C47E3B /* ApiManager.swift */; };
- 4CEDA27E25406A4400C47E3B /* ORAppConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CEDA27D25406A4400C47E3B /* ORAppConfig.swift */; };
- 4CEDA28125406C1700C47E3B /* ORLinkConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CEDA28025406C1700C47E3B /* ORLinkConfig.swift */; };
- 4CEDA2852540740C00C47E3B /* ORNotificationResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CEDA2832540740B00C47E3B /* ORNotificationResource.swift */; };
- 4CEDA28B2540742900C47E3B /* ORPushNotificationButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CEDA28A2540742900C47E3B /* ORPushNotificationButton.swift */; };
- 4CEDA28C2540742900C47E3B /* ORPushNotificationAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CEDA2892540742900C47E3B /* ORPushNotificationAction.swift */; };
- 4CEDA2922540747D00C47E3B /* GeofenceProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CEDA28F2540747D00C47E3B /* GeofenceProvider.swift */; };
- 4CEDA2932540747D00C47E3B /* PushNotificationProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CEDA2902540747D00C47E3B /* PushNotificationProvider.swift */; };
- 4CEDA2942540747D00C47E3B /* StorageProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CEDA2912540747D00C47E3B /* StorageProvider.swift */; };
- 4CEDA29A2540748C00C47E3B /* ErrorManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CEDA2992540748C00C47E3B /* ErrorManager.swift */; };
- 4CEDA29E254074A500C47E3B /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CEDA29D254074A500C47E3B /* Constants.swift */; };
- 4CEDA2A1254074AB00C47E3B /* Reachability.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CEDA2A0254074AB00C47E3B /* Reachability.swift */; };
- 4CEDA2A4254074B900C47E3B /* ORViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CEDA2A3254074B900C47E3B /* ORViewController.swift */; };
4CEDA2A7254074D100C47E3B /* Storyboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4CEDA2A6254074D100C47E3B /* Storyboard.storyboard */; };
4CEDA2CE254075D400C47E3B /* SplashViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CEDA2CD254075D400C47E3B /* SplashViewController.swift */; };
- 4CEDA2D02540765D00C47E3B /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CEDA29D254074A500C47E3B /* Constants.swift */; };
- 4CEDA2D22540768700C47E3B /* ORLinkConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CEDA28025406C1700C47E3B /* ORLinkConfig.swift */; };
- 4CEDA2D32540768700C47E3B /* ORPushNotificationAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CEDA2892540742900C47E3B /* ORPushNotificationAction.swift */; };
- 4CEDA2D42540768700C47E3B /* ORAppConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CEDA27D25406A4400C47E3B /* ORAppConfig.swift */; };
- 4CEDA2D52540768700C47E3B /* ORPushNotificationButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CEDA28A2540742900C47E3B /* ORPushNotificationButton.swift */; };
- 4CEDA2E72540768B00C47E3B /* ORNotificationResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CEDA2832540740B00C47E3B /* ORNotificationResource.swift */; };
- 4CEDA2E92540770200C47E3B /* GeofenceProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CEDA28F2540747D00C47E3B /* GeofenceProvider.swift */; };
5952998DA2B50AFF73DDCAE1 /* Pods_NotificationService.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 570B5A477F4AA747A62A45EF /* Pods_NotificationService.framework */; };
756FA8BF24545CB0CC18CA6E /* Pods_GenericApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E012F268F107177E6B242E8 /* Pods_GenericApp.framework */; };
878D2D0D249A490300011484 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 878D2D0C249A490300011484 /* AppDelegate.swift */; };
@@ -72,27 +50,12 @@
/* Begin PBXFileReference section */
3B0E05618605D241D5A82AA3 /* Pods-NotificationService.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NotificationService.debug.xcconfig"; path = "Target Support Files/Pods-NotificationService/Pods-NotificationService.debug.xcconfig"; sourceTree = "<group>"; };
46FD90D41833A0E2C4C7DDA6 /* Pods-NotificationService.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NotificationService.release.xcconfig"; path = "Target Support Files/Pods-NotificationService/Pods-NotificationService.release.xcconfig"; sourceTree = "<group>"; };
- 4C1FF8B5255044210085B2D0 /* Window+Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Window+Utils.swift"; sourceTree = "<group>"; };
4C38E9C02548089A00E381C6 /* OpenRemote.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = OpenRemote.entitlements; sourceTree = "<group>"; };
4C38E9C12548090200E381C6 /* NotificationService.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = NotificationService.entitlements; sourceTree = "<group>"; };
4C81AA632546B251006ED5DD /* ProjectViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProjectViewController.swift; sourceTree = "<group>"; };
- 4C81AADC2546EB28006ED5DD /* ORTextInput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ORTextInput.swift; sourceTree = "<group>"; };
- 4C81AAE52547124D006ED5DD /* UIColor+Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+Utils.swift"; sourceTree = "<group>"; };
- 4C81AB2C25472C7F006ED5DD /* String+Utils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Utils.swift"; sourceTree = "<group>"; };
+ 4C8BA084271460B1001084A4 /* libORLib.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libORLib.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ 4C8BA086271461C7001084A4 /* libORLib.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libORLib.a; sourceTree = BUILT_PRODUCTS_DIR; };
4CEDA25C25405B1E00C47E3B /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
- 4CEDA27A2540690300C47E3B /* ApiManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApiManager.swift; sourceTree = "<group>"; };
- 4CEDA27D25406A4400C47E3B /* ORAppConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ORAppConfig.swift; sourceTree = "<group>"; };
- 4CEDA28025406C1700C47E3B /* ORLinkConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ORLinkConfig.swift; sourceTree = "<group>"; };
- 4CEDA2832540740B00C47E3B /* ORNotificationResource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ORNotificationResource.swift; sourceTree = "<group>"; };
- 4CEDA2892540742900C47E3B /* ORPushNotificationAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ORPushNotificationAction.swift; sourceTree = "<group>"; };
- 4CEDA28A2540742900C47E3B /* ORPushNotificationButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ORPushNotificationButton.swift; sourceTree = "<group>"; };
- 4CEDA28F2540747D00C47E3B /* GeofenceProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeofenceProvider.swift; sourceTree = "<group>"; };
- 4CEDA2902540747D00C47E3B /* PushNotificationProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PushNotificationProvider.swift; sourceTree = "<group>"; };
- 4CEDA2912540747D00C47E3B /* StorageProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StorageProvider.swift; sourceTree = "<group>"; };
- 4CEDA2992540748C00C47E3B /* ErrorManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorManager.swift; sourceTree = "<group>"; };
- 4CEDA29D254074A500C47E3B /* Constants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
- 4CEDA2A0254074AB00C47E3B /* Reachability.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Reachability.swift; sourceTree = "<group>"; };
- 4CEDA2A3254074B900C47E3B /* ORViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ORViewController.swift; sourceTree = "<group>"; };
4CEDA2A6254074D100C47E3B /* Storyboard.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Storyboard.storyboard; sourceTree = "<group>"; };
4CEDA2CD254075D400C47E3B /* SplashViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SplashViewController.swift; sourceTree = "<group>"; };
4E012F268F107177E6B242E8 /* Pods_GenericApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_GenericApp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -116,6 +79,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 4C8BA085271460B1001084A4 /* libORLib.a in Frameworks */,
756FA8BF24545CB0CC18CA6E /* Pods_GenericApp.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -124,6 +88,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ 4C8BA087271461C7001084A4 /* libORLib.a in Frameworks */,
5952998DA2B50AFF73DDCAE1 /* Pods_NotificationService.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -131,48 +96,6 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
- 4CEDA264254068D700C47E3B /* Models */ = {
- isa = PBXGroup;
- children = (
- 4CEDA27D25406A4400C47E3B /* ORAppConfig.swift */,
- 4CEDA28025406C1700C47E3B /* ORLinkConfig.swift */,
- 4CEDA2892540742900C47E3B /* ORPushNotificationAction.swift */,
- 4CEDA28A2540742900C47E3B /* ORPushNotificationButton.swift */,
- );
- path = Models;
- sourceTree = "<group>";
- };
- 4CEDA279254068DD00C47E3B /* Network */ = {
- isa = PBXGroup;
- children = (
- 4CEDA27A2540690300C47E3B /* ApiManager.swift */,
- 4CEDA2832540740B00C47E3B /* ORNotificationResource.swift */,
- );
- path = Network;
- sourceTree = "<group>";
- };
- 4CEDA28E2540747400C47E3B /* ConsoleProviders */ = {
- isa = PBXGroup;
- children = (
- 4CEDA2912540747D00C47E3B /* StorageProvider.swift */,
- 4CEDA28F2540747D00C47E3B /* GeofenceProvider.swift */,
- 4CEDA2902540747D00C47E3B /* PushNotificationProvider.swift */,
- );
- path = ConsoleProviders;
- sourceTree = "<group>";
- };
- 4CEDA29C2540749B00C47E3B /* Utils */ = {
- isa = PBXGroup;
- children = (
- 4CEDA2A0254074AB00C47E3B /* Reachability.swift */,
- 4CEDA29D254074A500C47E3B /* Constants.swift */,
- 4C81AAE52547124D006ED5DD /* UIColor+Utils.swift */,
- 4C81AB2C25472C7F006ED5DD /* String+Utils.swift */,
- 4C1FF8B5255044210085B2D0 /* Window+Utils.swift */,
- );
- path = Utils;
- sourceTree = "<group>";
- };
6E621588C821060939F236DC /* Pods */ = {
isa = PBXGroup;
children = (
@@ -208,10 +131,6 @@
isa = PBXGroup;
children = (
4C38E9C02548089A00E381C6 /* OpenRemote.entitlements */,
- 4CEDA29C2540749B00C47E3B /* Utils */,
- 4CEDA28E2540747400C47E3B /* ConsoleProviders */,
- 4CEDA279254068DD00C47E3B /* Network */,
- 4CEDA264254068D700C47E3B /* Models */,
4CEDA25C25405B1E00C47E3B /* GoogleService-Info.plist */,
878D2D34249A50E500011484 /* UI */,
878D2D0C249A490300011484 /* AppDelegate.swift */,
@@ -245,11 +164,8 @@
878D2D34249A50E500011484 /* UI */ = {
isa = PBXGroup;
children = (
- 4CEDA2992540748C00C47E3B /* ErrorManager.swift */,
- 4CEDA2A3254074B900C47E3B /* ORViewController.swift */,
4CEDA2CD254075D400C47E3B /* SplashViewController.swift */,
4C81AA632546B251006ED5DD /* ProjectViewController.swift */,
- 4C81AADC2546EB28006ED5DD /* ORTextInput.swift */,
);
path = UI;
sourceTree = "<group>";
@@ -257,6 +173,8 @@
E76367874E329A8C268BC128 /* Frameworks */ = {
isa = PBXGroup;
children = (
+ 4C8BA086271461C7001084A4 /* libORLib.a */,
+ 4C8BA084271460B1001084A4 /* libORLib.a */,
878D2D30249A4D3700011484 /* ORLib.framework */,
4E012F268F107177E6B242E8 /* Pods_GenericApp.framework */,
570B5A477F4AA747A62A45EF /* Pods_NotificationService.framework */,
@@ -434,26 +352,9 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 4CEDA2922540747D00C47E3B /* GeofenceProvider.swift in Sources */,
- 4CEDA29E254074A500C47E3B /* Constants.swift in Sources */,
4C81AA642546B251006ED5DD /* ProjectViewController.swift in Sources */,
878D2D0D249A490300011484 /* AppDelegate.swift in Sources */,
- 4CEDA29A2540748C00C47E3B /* ErrorManager.swift in Sources */,
- 4CEDA2932540747D00C47E3B /* PushNotificationProvider.swift in Sources */,
4CEDA2CE254075D400C47E3B /* SplashViewController.swift in Sources */,
- 4CEDA28125406C1700C47E3B /* ORLinkConfig.swift in Sources */,
- 4CEDA2942540747D00C47E3B /* StorageProvider.swift in Sources */,
- 4C81AAE62547124D006ED5DD /* UIColor+Utils.swift in Sources */,
- 4C81AADD2546EB28006ED5DD /* ORTextInput.swift in Sources */,
- 4CEDA2A4254074B900C47E3B /* ORViewController.swift in Sources */,
- 4C81AB2D25472C7F006ED5DD /* String+Utils.swift in Sources */,
- 4C1FF8B6255044210085B2D0 /* Window+Utils.swift in Sources */,
- 4CEDA27E25406A4400C47E3B /* ORAppConfig.swift in Sources */,
- 4CEDA28B2540742900C47E3B /* ORPushNotificationButton.swift in Sources */,
- 4CEDA28C2540742900C47E3B /* ORPushNotificationAction.swift in Sources */,
- 4CEDA27B2540690300C47E3B /* ApiManager.swift in Sources */,
- 4CEDA2A1254074AB00C47E3B /* Reachability.swift in Sources */,
- 4CEDA2852540740C00C47E3B /* ORNotificationResource.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -461,14 +362,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 4CEDA2E92540770200C47E3B /* GeofenceProvider.swift in Sources */,
- 4CEDA2D22540768700C47E3B /* ORLinkConfig.swift in Sources */,
878D2D27249A498900011484 /* NotificationService.swift in Sources */,
- 4CEDA2D02540765D00C47E3B /* Constants.swift in Sources */,
- 4CEDA2D52540768700C47E3B /* ORPushNotificationButton.swift in Sources */,
- 4CEDA2E72540768B00C47E3B /* ORNotificationResource.swift in Sources */,
- 4CEDA2D32540768700C47E3B /* ORPushNotificationAction.swift in Sources */,
- 4CEDA2D42540768700C47E3B /* ORAppConfig.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/console/iOS/GenericApp/GenericApp/AppDelegate.swift b/console/iOS/GenericApp/GenericApp/AppDelegate.swift
index 9f052782b..1d5d2fc66 100644
--- a/console/iOS/GenericApp/GenericApp/AppDelegate.swift
+++ b/console/iOS/GenericApp/GenericApp/AppDelegate.swift
@@ -10,6 +10,7 @@ import UIKit
import Firebase
import CoreLocation
import IQKeyboardManagerSwift
+import ORLib
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, URLSessionDelegate {
@@ -40,7 +41,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, URLSessionDelegate {
// create new GeofenceProvider which creates a CLLocationManager that will receive the location update
geofenceProvider = GeofenceProvider()
if CLLocationManager.authorizationStatus() == .authorizedAlways {
- geofenceProvider?.locationManager.startMonitoringSignificantLocationChanges()
+ geofenceProvider?.startMonitoringSignificantLocationChanges()
}
} else if let remoteNotifcation = launchOptions?[UIApplication.LaunchOptionsKey.remoteNotification] as? [AnyHashable: Any] {
NSLog("%@", "App started from remote notification")
@@ -49,7 +50,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, URLSessionDelegate {
geofenceProvider = GeofenceProvider()
geofenceProvider?.refreshGeofences()
if CLLocationManager.authorizationStatus() == .authorizedAlways {
- geofenceProvider?.locationManager.startMonitoringSignificantLocationChanges()
+ geofenceProvider?.startMonitoringSignificantLocationChanges()
}
}
}
diff --git a/console/iOS/GenericApp/GenericApp/Storyboard.storyboard b/console/iOS/GenericApp/GenericApp/Storyboard.storyboard
index d731578c4..aa108bab0 100644
--- a/console/iOS/GenericApp/GenericApp/Storyboard.storyboard
+++ b/console/iOS/GenericApp/GenericApp/Storyboard.storyboard
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17156" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="oDU-zF-Uvs">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="oDU-zF-Uvs">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17126"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -48,7 +48,7 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
- <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BlP-aM-prv" customClass="ORTextInput" customModule="OpenRemote" customModuleProvider="target">
+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BlP-aM-prv" customClass="ORTextInput" customModule="ORLib">
<rect key="frame" x="30" y="413" width="354" height="40"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
@@ -58,7 +58,7 @@
<userDefinedRuntimeAttribute type="string" keyPath="setPlaceholderText" value="Project"/>
</userDefinedRuntimeAttributes>
</view>
- <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2fd-Z9-umb" customClass="ORTextInput" customModule="OpenRemote" customModuleProvider="target">
+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2fd-Z9-umb" customClass="ORTextInput" customModule="ORLib">
<rect key="frame" x="30" y="483" width="354" height="40"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
@@ -109,7 +109,7 @@
<!--Viewcontroller-->
<scene sceneID="liA-xA-sIe">
<objects>
- <viewController id="HSA-l5-YFF" customClass="ORViewcontroller" customModule="OpenRemote" customModuleProvider="target" sceneMemberID="viewController">
+ <viewController id="HSA-l5-YFF" customClass="ORViewcontroller" customModule="ORLib" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="iMh-t6-rOs">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
diff --git a/console/iOS/GenericApp/GenericApp/UI/ProjectViewController.swift b/console/iOS/GenericApp/GenericApp/UI/ProjectViewController.swift
index fb386b6c0..7a0e483ce 100644
--- a/console/iOS/GenericApp/GenericApp/UI/ProjectViewController.swift
+++ b/console/iOS/GenericApp/GenericApp/UI/ProjectViewController.swift
@@ -8,6 +8,7 @@
import UIKit
import MaterialComponents.MaterialTextFields
+import ORLib
class ProjectViewController: UIViewController {
diff --git a/console/iOS/GenericApp/GenericApp/UI/SplashViewController.swift b/console/iOS/GenericApp/GenericApp/UI/SplashViewController.swift
index 8d86b343a..53107cd1e 100644
--- a/console/iOS/GenericApp/GenericApp/UI/SplashViewController.swift
+++ b/console/iOS/GenericApp/GenericApp/UI/SplashViewController.swift
@@ -7,6 +7,7 @@
//
import UIKit
+import ORLib
class SplashViewController: UIViewController {
diff --git a/console/iOS/GenericApp/GenericApp/Utils/Constants.swift b/console/iOS/GenericApp/GenericApp/Utils/Constants.swift
deleted file mode 100644
index e7fb7616f..000000000
--- a/console/iOS/GenericApp/GenericApp/Utils/Constants.swift
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2017, OpenRemote Inc.
- *
- * See the CONTRIBUTORS.txt file in the distribution for a
- * full listing of individual contributors.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-import Foundation
-import UIKit
-
-public enum DefaultsKey {
- static let groupEntitlement = "group.io.openremote.app"
- static let projectKey = "PROJECT"
- static let realmKey = "REALM"
- static let refreshTokenKey = "REFRESH_TOKEN"
- static let fcmTokenKey = "FCM_TOKEN_KEY"
- static let fcmDeviceIdKey = "FCM_DEVICE_ID_KEY"
- static let actionKey = "action"
- static let buttonsKey = "buttons"
- static let providerKey = "provider"
- static let versionKey = "version"
- static let requiresPermissionKey = "requiresPermission"
- static let hasPermissionKey = "hasPermission"
- static let successKey = "success"
- static let dataKey = "data"
- static let enabledKey = "enabled"
- static let disabledKey = "disabled"
-}
-
-public enum Actions {
- static let providerInit = "PROVIDER_INIT"
- static let providerEnable = "PROVIDER_ENABLE"
- static let providerDisable = "PROVIDER_DISABLE"
- static let geofenceRefresh = "GEOFENCE_REFRESH"
- static let store = "STORE"
- static let retrieve = "RETRIEVE"
- static let getLocation = "GET_LOCATION"
-}
-
-public enum Providers {
- static let push = "push"
- static let geofence = "geofence"
- static let storage = "storage"
-}
-
-public enum NotificationsNames {
- static let isAuthenticated = "isAuthenticated"
- static let isdeviceIdSent = "isdeviceIdSent"
-}
-
-public enum Notifications {
- static let needsReachabilityCheck = Notification.Name("NeedsReachabilityCheck")
- static let fullScreenShown = Notification.Name("fullScreenShown")
- static let fullScreenHidden = Notification.Name("fullScreenHidden")
- static let idleTimerFired = Notification.Name("idleTimerFired")
-}
-
-public enum ActionType {
- static let actions = "actions"
- static let aps = "aps"
- static let alert = "alert"
- static let title = "title"
- static let type = "type"
- static let appUrl = "appUrl"
- static let silent = "silent"
- static let httpMethod = "httpMethod"
- static let openInBrowser = "openInBrowser"
- static let notificationId = "notification-id"
- static let ACTION_DEEP_LINK = "LINK"
- static let ACTION_ACTUATOR = "ACTUATOR"
-}
diff --git a/console/iOS/GenericApp/NotificationService/NotificationService.swift b/console/iOS/GenericApp/NotificationService/NotificationService.swift
index f4e9ff1d4..c1a05b29c 100644
--- a/console/iOS/GenericApp/NotificationService/NotificationService.swift
+++ b/console/iOS/GenericApp/NotificationService/NotificationService.swift
@@ -7,6 +7,7 @@
//
import UserNotifications
+import ORLib
class NotificationService: UNNotificationServiceExtension {
diff --git a/console/iOS/GenericApp/Podfile b/console/iOS/GenericApp/Podfile
index b9d612a4f..edfaaa85e 100644
--- a/console/iOS/GenericApp/Podfile
+++ b/console/iOS/GenericApp/Podfile
@@ -4,22 +4,29 @@ platform :ios, '13.0'
use_frameworks!
def shared_pods
- pod 'Firebase/Messaging'
- pod 'Firebase/Crashlytics'
- pod 'Firebase/Analytics'
+ pod 'Popover'
+ pod 'MaterialComponents/TextFields'
+ pod 'MaterialComponents/Buttons'
end
target 'GenericApp' do
project 'GenericApp'
shared_pods
- pod 'MaterialComponents/TextFields'
- pod 'MaterialComponents/Buttons'
- pod 'Popover'
+ pod 'Firebase/Messaging'
+ pod 'Firebase/Crashlytics'
+ pod 'Firebase/Analytics'
pod 'IQKeyboardManagerSwift'
end
target 'NotificationService' do
+ pod 'Firebase/Messaging'
+ pod 'Firebase/Crashlytics'
+ pod 'Firebase/Analytics'
project 'GenericApp'
+end
+
+target 'ORLib' do
shared_pods
+ project '../ORLib/ORLib'
end
diff --git a/console/iOS/GenericApp/Podfile.lock b/console/iOS/GenericApp/Podfile.lock
index 005fb0de8..3b8eb3a5f 100644
--- a/console/iOS/GenericApp/Podfile.lock
+++ b/console/iOS/GenericApp/Podfile.lock
@@ -195,6 +195,6 @@ SPEC CHECKSUMS:
Popover: 10e1d9528f81d9504df984b7b3f491292bc1822d
PromisesObjC: 3113f7f76903778cf4a0586bd1ab89329a0b7b97
-PODFILE CHECKSUM: 7b48d167316e7a8edd6cc4cfebe5494b9dbe1f4a
+PODFILE CHECKSUM: 7cd5b9883b4c8ac0baef0967b6a31c84f8ce1e6c
COCOAPODS: 1.10.1
diff --git a/console/iOS/ORLib/ORLib.xcodeproj/project.pbxproj b/console/iOS/ORLib/ORLib.xcodeproj/project.pbxproj
index 0f84570d1..1756bbe22 100644
--- a/console/iOS/ORLib/ORLib.xcodeproj/project.pbxproj
+++ b/console/iOS/ORLib/ORLib.xcodeproj/project.pbxproj
@@ -3,154 +3,192 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 48;
+ objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
- 4C33B4772209D10200681732 /* StorageProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C33B4762209D10200681732 /* StorageProvider.swift */; };
- 4C4C2FB81FD8044A0071CBDA /* ORNotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C4C2FB71FD8044A0071CBDA /* ORNotificationService.swift */; };
- 4C56E5E520C583FB004483C7 /* ORAssetResoure.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C56E5E420C583FB004483C7 /* ORAssetResoure.swift */; };
- 4C77278520BC13E800322CBC /* PushNotificationProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C77278320BC13E800322CBC /* PushNotificationProvider.swift */; };
- 4C77278620BC13E800322CBC /* GeofenceProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C77278420BC13E800322CBC /* GeofenceProvider.swift */; };
- 4C82D74A1FC58F4E009DE853 /* ORViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C82D7451FC58F4E009DE853 /* ORViewController.swift */; };
- 4C82D74B1FC58F4E009DE853 /* ORAppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C82D7461FC58F4E009DE853 /* ORAppDelegate.swift */; };
- 4C82D74C1FC58F4E009DE853 /* ProjectConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C82D7471FC58F4E009DE853 /* ProjectConstants.swift */; };
- 4C82D74D1FC58F4E009DE853 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C82D7481FC58F4E009DE853 /* Constants.swift */; };
- 4C82D74E1FC58F4E009DE853 /* ORLoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C82D7491FC58F4E009DE853 /* ORLoginViewController.swift */; };
- 4C82D7581FC590FB009DE853 /* ErrorManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C82D7531FC590FB009DE853 /* ErrorManager.swift */; };
- 4C82D7591FC590FB009DE853 /* TokenManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C82D7541FC590FB009DE853 /* TokenManager.swift */; };
- 4C9FC2F2211B2F8100D8FD18 /* ORPushNotificationButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C9FC2EF211B2F8000D8FD18 /* ORPushNotificationButton.swift */; };
- 4C9FC2F3211B2F8100D8FD18 /* ORPushNotificationAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C9FC2F0211B2F8100D8FD18 /* ORPushNotificationAction.swift */; };
- 4C9FC2F4211B2F8100D8FD18 /* ORNotificationResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4C9FC2F1211B2F8100D8FD18 /* ORNotificationResource.swift */; };
- 4CBC0D471FD6DDA1000BE8B1 /* Reachability.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CBC0D461FD6DDA1000BE8B1 /* Reachability.swift */; };
- 7CCC2ED6D141AFD5DC9E5EC1 /* Pods_ORLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 978B95045017E64853668497 /* Pods_ORLib.framework */; };
+ 4CF5D04B27143EEC00D705BE /* ORLib.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D04A27143EEC00D705BE /* ORLib.swift */; };
+ 4CF5D06927143F2000D705BE /* StorageProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05227143F1F00D705BE /* StorageProvider.swift */; };
+ 4CF5D06A27143F2000D705BE /* GeofenceProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05327143F1F00D705BE /* GeofenceProvider.swift */; };
+ 4CF5D06B27143F2000D705BE /* PushNotificationProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05427143F1F00D705BE /* PushNotificationProvider.swift */; };
+ 4CF5D06D27143F2000D705BE /* ORTextInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05727143F1F00D705BE /* ORTextInput.swift */; };
+ 4CF5D06E27143F2000D705BE /* ORViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05827143F1F00D705BE /* ORViewController.swift */; };
+ 4CF5D07027143F2000D705BE /* ErrorManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05A27143F1F00D705BE /* ErrorManager.swift */; };
+ 4CF5D07127143F2000D705BE /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05C27143F1F00D705BE /* Constants.swift */; };
+ 4CF5D07227143F2000D705BE /* Window+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05D27143F1F00D705BE /* Window+Utils.swift */; };
+ 4CF5D07327143F2000D705BE /* UIColor+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05E27143F1F00D705BE /* UIColor+Utils.swift */; };
+ 4CF5D07427143F2000D705BE /* Reachability.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D05F27143F1F00D705BE /* Reachability.swift */; };
+ 4CF5D07527143F2000D705BE /* String+Utils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D06027143F1F00D705BE /* String+Utils.swift */; };
+ 4CF5D07627143F2000D705BE /* ORAppConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D06227143F1F00D705BE /* ORAppConfig.swift */; };
+ 4CF5D07727143F2000D705BE /* ORLinkConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D06327143F1F00D705BE /* ORLinkConfig.swift */; };
+ 4CF5D07827143F2000D705BE /* ORPushNotificationButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D06427143F1F00D705BE /* ORPushNotificationButton.swift */; };
+ 4CF5D07927143F2000D705BE /* ORPushNotificationAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D06527143F1F00D705BE /* ORPushNotificationAction.swift */; };
+ 4CF5D07A27143F2000D705BE /* ORNotificationResource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D06727143F1F00D705BE /* ORNotificationResource.swift */; };
+ 4CF5D07B27143F2000D705BE /* ApiManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CF5D06827143F1F00D705BE /* ApiManager.swift */; };
+ ABD81191A88B3D7A8B2E66B6 /* Pods_ORLib.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 41E56A0D7E49334C15A35CB4 /* Pods_ORLib.framework */; };
/* End PBXBuildFile section */
+/* Begin PBXCopyFilesBuildPhase section */
+ 4CF5D04527143EEC00D705BE /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "include/$(PRODUCT_NAME)";
+ dstSubfolderSpec = 16;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
/* Begin PBXFileReference section */
- 4C33B4762209D10200681732 /* StorageProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StorageProvider.swift; sourceTree = "<group>"; };
- 4C4C2FB71FD8044A0071CBDA /* ORNotificationService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ORNotificationService.swift; sourceTree = "<group>"; };
- 4C56E5E420C583FB004483C7 /* ORAssetResoure.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ORAssetResoure.swift; path = ../../GenericApp/GenericApp/Network/ORAssetResoure.swift; sourceTree = "<group>"; };
- 4C77278320BC13E800322CBC /* PushNotificationProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PushNotificationProvider.swift; sourceTree = "<group>"; };
- 4C77278420BC13E800322CBC /* GeofenceProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeofenceProvider.swift; sourceTree = "<group>"; };
- 4C82D73A1FC58ED2009DE853 /* ORLib.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = ORLib.framework; sourceTree = BUILT_PRODUCTS_DIR; };
- 4C82D73E1FC58ED2009DE853 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
- 4C82D7451FC58F4E009DE853 /* ORViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ORViewController.swift; sourceTree = "<group>"; };
- 4C82D7461FC58F4E009DE853 /* ORAppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ORAppDelegate.swift; sourceTree = "<group>"; };
- 4C82D7471FC58F4E009DE853 /* ProjectConstants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProjectConstants.swift; sourceTree = "<group>"; };
- 4C82D7481FC58F4E009DE853 /* Constants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
- 4C82D7491FC58F4E009DE853 /* ORLoginViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ORLoginViewController.swift; sourceTree = "<group>"; };
- 4C82D7531FC590FB009DE853 /* ErrorManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ErrorManager.swift; sourceTree = "<group>"; };
- 4C82D7541FC590FB009DE853 /* TokenManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokenManager.swift; sourceTree = "<group>"; };
- 4C9FC2EF211B2F8000D8FD18 /* ORPushNotificationButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ORPushNotificationButton.swift; sourceTree = "<group>"; };
- 4C9FC2F0211B2F8100D8FD18 /* ORPushNotificationAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ORPushNotificationAction.swift; sourceTree = "<group>"; };
- 4C9FC2F1211B2F8100D8FD18 /* ORNotificationResource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ORNotificationResource.swift; path = ../../GenericApp/GenericApp/Network/ORNotificationResource.swift; sourceTree = "<group>"; };
- 4CBC0D461FD6DDA1000BE8B1 /* Reachability.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Reachability.swift; sourceTree = "<group>"; };
- 572EED7F064AF79DDABE9FC8 /* Pods-ORLib.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ORLib.release.xcconfig"; path = "../GenericApp/Pods/Target Support Files/Pods-ORLib/Pods-ORLib.release.xcconfig"; sourceTree = "<group>"; };
- 978B95045017E64853668497 /* Pods_ORLib.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ORLib.framework; sourceTree = BUILT_PRODUCTS_DIR; };
- C641D9E59892499E90E68616 /* Pods-ORLib.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ORLib.debug.xcconfig"; path = "../GenericApp/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 = "../../../Documents/AppBriek/OpenRemote/Code/k2/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 = "../../../Documents/AppBriek/OpenRemote/Code/k2/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; };
+ 4CF5D04727143EEC00D705BE /* libORLib.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libORLib.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ 4CF5D04A27143EEC00D705BE /* ORLib.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ORLib.swift; sourceTree = "<group>"; };
+ 4CF5D05227143F1F00D705BE /* StorageProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StorageProvider.swift; sourceTree = "<group>"; };
+ 4CF5D05327143F1F00D705BE /* GeofenceProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeofenceProvider.swift; sourceTree = "<group>"; };
+ 4CF5D05427143F1F00D705BE /* PushNotificationProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PushNotificationProvider.swift; sourceTree = "<group>"; };
+ 4CF5D05727143F1F00D705BE /* ORTextInput.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ORTextInput.swift; sourceTree = "<group>"; };
+ 4CF5D05827143F1F00D705BE /* ORViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ORViewController.swift; sourceTree = "<group>"; };
+ 4CF5D05A27143F1F00D705BE /* ErrorManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ErrorManager.swift; sourceTree = "<group>"; };
+ 4CF5D05C27143F1F00D705BE /* Constants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
+ 4CF5D05D27143F1F00D705BE /* Window+Utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Window+Utils.swift"; sourceTree = "<group>"; };
+ 4CF5D05E27143F1F00D705BE /* UIColor+Utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIColor+Utils.swift"; sourceTree = "<group>"; };
+ 4CF5D05F27143F1F00D705BE /* Reachability.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Reachability.swift; sourceTree = "<group>"; };
+ 4CF5D06027143F1F00D705BE /* String+Utils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+Utils.swift"; sourceTree = "<group>"; };
+ 4CF5D06227143F1F00D705BE /* ORAppConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ORAppConfig.swift; sourceTree = "<group>"; };
+ 4CF5D06327143F1F00D705BE /* ORLinkConfig.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ORLinkConfig.swift; sourceTree = "<group>"; };
+ 4CF5D06427143F1F00D705BE /* ORPushNotificationButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ORPushNotificationButton.swift; sourceTree = "<group>"; };
+ 4CF5D06527143F1F00D705BE /* ORPushNotificationAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ORPushNotificationAction.swift; sourceTree = "<group>"; };
+ 4CF5D06727143F1F00D705BE /* ORNotificationResource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ORNotificationResource.swift; sourceTree = "<group>"; };
+ 4CF5D06827143F1F00D705BE /* ApiManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApiManager.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
- 4C82D7361FC58ED2009DE853 /* Frameworks */ = {
+ 4CF5D04427143EEC00D705BE /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 7CCC2ED6D141AFD5DC9E5EC1 /* Pods_ORLib.framework in Frameworks */,
+ ABD81191A88B3D7A8B2E66B6 /* Pods_ORLib.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
- 4C82D7301FC58ED2009DE853 = {
+ 15E46D9A67E43A8180E89721 /* Pods */ = {
isa = PBXGroup;
children = (
- 4C82D73C1FC58ED2009DE853 /* ORLib */,
- 4C82D73B1FC58ED2009DE853 /* Products */,
- 8B937E998158FCCA944454DF /* Pods */,
- 659E47451ADA08D6BAAF1568 /* Frameworks */,
+ 3F2140D7DCE68D42273B346B /* Pods-ORLib.debug.xcconfig */,
+ 37A59C1C5EEB5A3027F557D0 /* Pods-ORLib.release.xcconfig */,
);
+ name = Pods;
+ path = ../../../../../../../../../Desktop/K2/Pods;
sourceTree = "<group>";
};
- 4C82D73B1FC58ED2009DE853 /* Products */ = {
+ 4CF5D03E27143EEB00D705BE = {
isa = PBXGroup;
children = (
- 4C82D73A1FC58ED2009DE853 /* ORLib.framework */,
+ 4CF5D04927143EEC00D705BE /* ORLib */,
+ 4CF5D04827143EEC00D705BE /* Products */,
+ 15E46D9A67E43A8180E89721 /* Pods */,
+ 717C35290053DAF6024CFEA7 /* Frameworks */,
+ );
+ sourceTree = "<group>";
+ };
+ 4CF5D04827143EEC00D705BE /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 4CF5D04727143EEC00D705BE /* libORLib.a */,
);
name = Products;
sourceTree = "<group>";
};
- 4C82D73C1FC58ED2009DE853 /* ORLib */ = {
+ 4CF5D04927143EEC00D705BE /* ORLib */ = {
isa = PBXGroup;
children = (
- 4CC3FD8E210F63650025579A /* ConsoleProviders */,
- 4C82D7531FC590FB009DE853 /* ErrorManager.swift */,
- 4C82D7541FC590FB009DE853 /* TokenManager.swift */,
- 4CBC0D461FD6DDA1000BE8B1 /* Reachability.swift */,
- 4C82D7461FC58F4E009DE853 /* ORAppDelegate.swift */,
- 4C9FC2F1211B2F8100D8FD18 /* ORNotificationResource.swift */,
- 4C9FC2F0211B2F8100D8FD18 /* ORPushNotificationAction.swift */,
- 4C9FC2EF211B2F8000D8FD18 /* ORPushNotificationButton.swift */,
- 4C82D7481FC58F4E009DE853 /* Constants.swift */,
- 4C82D7451FC58F4E009DE853 /* ORViewController.swift */,
- 4C82D7471FC58F4E009DE853 /* ProjectConstants.swift */,
- 4C82D7491FC58F4E009DE853 /* ORLoginViewController.swift */,
- 4C82D73E1FC58ED2009DE853 /* Info.plist */,
- 4C4C2FB71FD8044A0071CBDA /* ORNotificationService.swift */,
- 4C56E5E420C583FB004483C7 /* ORAssetResoure.swift */,
+ 4CF5D05127143F1F00D705BE /* ConsoleProviders */,
+ 4CF5D06127143F1F00D705BE /* Models */,
+ 4CF5D06627143F1F00D705BE /* Network */,
+ 4CF5D05527143F1F00D705BE /* UI */,
+ 4CF5D05B27143F1F00D705BE /* Utils */,
+ 4CF5D04A27143EEC00D705BE /* ORLib.swift */,
);
path = ORLib;
sourceTree = "<group>";
};
- 4CC3FD8E210F63650025579A /* ConsoleProviders */ = {
+ 4CF5D05127143F1F00D705BE /* ConsoleProviders */ = {
isa = PBXGroup;
children = (
- 4C33B4762209D10200681732 /* StorageProvider.swift */,
- 4C77278420BC13E800322CBC /* GeofenceProvider.swift */,
- 4C77278320BC13E800322CBC /* PushNotificationProvider.swift */,
+ 4CF5D05227143F1F00D705BE /* StorageProvider.swift */,
+ 4CF5D05327143F1F00D705BE /* GeofenceProvider.swift */,
+ 4CF5D05427143F1F00D705BE /* PushNotificationProvider.swift */,
);
- name = ConsoleProviders;
+ path = ConsoleProviders;
sourceTree = "<group>";
};
- 659E47451ADA08D6BAAF1568 /* Frameworks */ = {
+ 4CF5D05527143F1F00D705BE /* UI */ = {
isa = PBXGroup;
children = (
- 978B95045017E64853668497 /* Pods_ORLib.framework */,
+ 4CF5D05727143F1F00D705BE /* ORTextInput.swift */,
+ 4CF5D05827143F1F00D705BE /* ORViewController.swift */,
+ 4CF5D05A27143F1F00D705BE /* ErrorManager.swift */,
);
- name = Frameworks;
+ path = UI;
sourceTree = "<group>";
};
- 8B937E998158FCCA944454DF /* Pods */ = {
+ 4CF5D05B27143F1F00D705BE /* Utils */ = {
isa = PBXGroup;
children = (
- C641D9E59892499E90E68616 /* Pods-ORLib.debug.xcconfig */,
- 572EED7F064AF79DDABE9FC8 /* Pods-ORLib.release.xcconfig */,
+ 4CF5D05C27143F1F00D705BE /* Constants.swift */,
+ 4CF5D05D27143F1F00D705BE /* Window+Utils.swift */,
+ 4CF5D05E27143F1F00D705BE /* UIColor+Utils.swift */,
+ 4CF5D05F27143F1F00D705BE /* Reachability.swift */,
+ 4CF5D06027143F1F00D705BE /* String+Utils.swift */,
);
- name = Pods;
+ path = Utils;
sourceTree = "<group>";
};
-/* End PBXGroup section */
-
-/* Begin PBXHeadersBuildPhase section */
- 4C82D7371FC58ED2009DE853 /* Headers */ = {
- isa = PBXHeadersBuildPhase;
- buildActionMask = 2147483647;
- files = (
+ 4CF5D06127143F1F00D705BE /* Models */ = {
+ isa = PBXGroup;
+ children = (
+ 4CF5D06227143F1F00D705BE /* ORAppConfig.swift */,
+ 4CF5D06327143F1F00D705BE /* ORLinkConfig.swift */,
+ 4CF5D06427143F1F00D705BE /* ORPushNotificationButton.swift */,
+ 4CF5D06527143F1F00D705BE /* ORPushNotificationAction.swift */,
);
- runOnlyForDeploymentPostprocessing = 0;
+ path = Models;
+ sourceTree = "<group>";
+ };
+ 4CF5D06627143F1F00D705BE /* Network */ = {
+ isa = PBXGroup;
+ children = (
+ 4CF5D06727143F1F00D705BE /* ORNotificationResource.swift */,
+ 4CF5D06827143F1F00D705BE /* ApiManager.swift */,
+ );
+ path = Network;
+ sourceTree = "<group>";
};
-/* End PBXHeadersBuildPhase section */
+ 717C35290053DAF6024CFEA7 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 41E56A0D7E49334C15A35CB4 /* Pods_ORLib.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
/* Begin PBXNativeTarget section */
- 4C82D7391FC58ED2009DE853 /* ORLib */ = {
+ 4CF5D04627143EEC00D705BE /* ORLib */ = {
isa = PBXNativeTarget;
- buildConfigurationList = 4C82D7421FC58ED2009DE853 /* Build configuration list for PBXNativeTarget "ORLib" */;
+ buildConfigurationList = 4CF5D04E27143EEC00D705BE /* Build configuration list for PBXNativeTarget "ORLib" */;
buildPhases = (
- 4DCB6F19236B769A719A2323 /* [CP] Check Pods Manifest.lock */,
- 4C82D7351FC58ED2009DE853 /* Sources */,
- 4C82D7361FC58ED2009DE853 /* Frameworks */,
- 4C82D7371FC58ED2009DE853 /* Headers */,
- 4C82D7381FC58ED2009DE853 /* Resources */,
+ 8FD1291A07546E0F98084666 /* [CP] Check Pods Manifest.lock */,
+ 4CF5D04327143EEC00D705BE /* Sources */,
+ 4CF5D04427143EEC00D705BE /* Frameworks */,
+ 4CF5D04527143EEC00D705BE /* CopyFiles */,
);
buildRules = (
);
@@ -158,54 +196,43 @@
);
name = ORLib;
productName = ORLib;
- productReference = 4C82D73A1FC58ED2009DE853 /* ORLib.framework */;
- productType = "com.apple.product-type.framework";
+ productReference = 4CF5D04727143EEC00D705BE /* libORLib.a */;
+ productType = "com.apple.product-type.library.static";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
- 4C82D7311FC58ED2009DE853 /* Project object */ = {
+ 4CF5D03F27143EEC00D705BE /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0930;
- ORGANIZATIONNAME = "Open Remote Inc.";
+ LastSwiftUpdateCheck = 1250;
+ LastUpgradeCheck = 1250;
TargetAttributes = {
- 4C82D7391FC58ED2009DE853 = {
- CreatedOnToolsVersion = 9.1;
- LastSwiftMigration = 1020;
- ProvisioningStyle = Automatic;
+ 4CF5D04627143EEC00D705BE = {
+ CreatedOnToolsVersion = 12.5.1;
};
};
};
- buildConfigurationList = 4C82D7341FC58ED2009DE853 /* Build configuration list for PBXProject "ORLib" */;
- compatibilityVersion = "Xcode 8.0";
+ buildConfigurationList = 4CF5D04227143EEC00D705BE /* Build configuration list for PBXProject "ORLib" */;
+ compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
+ Base,
);
- mainGroup = 4C82D7301FC58ED2009DE853;
- productRefGroup = 4C82D73B1FC58ED2009DE853 /* Products */;
+ mainGroup = 4CF5D03E27143EEB00D705BE;
+ productRefGroup = 4CF5D04827143EEC00D705BE /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
- 4C82D7391FC58ED2009DE853 /* ORLib */,
+ 4CF5D04627143EEC00D705BE /* ORLib */,
);
};
/* End PBXProject section */
-/* Begin PBXResourcesBuildPhase section */
- 4C82D7381FC58ED2009DE853 /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXResourcesBuildPhase section */
-
/* Begin PBXShellScriptBuildPhase section */
- 4DCB6F19236B769A719A2323 /* [CP] Check Pods Manifest.lock */ = {
+ 8FD1291A07546E0F98084666 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
@@ -230,33 +257,35 @@
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
- 4C82D7351FC58ED2009DE853 /* Sources */ = {
+ 4CF5D04327143EEC00D705BE /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 4C33B4772209D10200681732 /* StorageProvider.swift in Sources */,
- 4C77278620BC13E800322CBC /* GeofenceProvider.swift in Sources */,
- 4C9FC2F2211B2F8100D8FD18 /* ORPushNotificationButton.swift in Sources */,
- 4C56E5E520C583FB004483C7 /* ORAssetResoure.swift in Sources */,
- 4C77278520BC13E800322CBC /* PushNotificationProvider.swift in Sources */,
- 4C4C2FB81FD8044A0071CBDA /* ORNotificationService.swift in Sources */,
- 4C9FC2F4211B2F8100D8FD18 /* ORNotificationResource.swift in Sources */,
- 4C9FC2F3211B2F8100D8FD18 /* ORPushNotificationAction.swift in Sources */,
- 4C82D7581FC590FB009DE853 /* ErrorManager.swift in Sources */,
- 4C82D74E1FC58F4E009DE853 /* ORLoginViewController.swift in Sources */,
- 4C82D74C1FC58F4E009DE853 /* ProjectConstants.swift in Sources */,
- 4C82D74B1FC58F4E009DE853 /* ORAppDelegate.swift in Sources */,
- 4CBC0D471FD6DDA1000BE8B1 /* Reachability.swift in Sources */,
- 4C82D74A1FC58F4E009DE853 /* ORViewController.swift in Sources */,
- 4C82D74D1FC58F4E009DE853 /* Constants.swift in Sources */,
- 4C82D7591FC590FB009DE853 /* TokenManager.swift in Sources */,
+ 4CF5D07027143F2000D705BE /* ErrorManager.swift in Sources */,
+ 4CF5D07227143F2000D705BE /* Window+Utils.swift in Sources */,
+ 4CF5D07727143F2000D705BE /* ORLinkConfig.swift in Sources */,
+ 4CF5D06E27143F2000D705BE /* ORViewController.swift in Sources */,
+ 4CF5D07327143F2000D705BE /* UIColor+Utils.swift in Sources */,
+ 4CF5D06D27143F2000D705BE /* ORTextInput.swift in Sources */,
+ 4CF5D07A27143F2000D705BE /* ORNotificationResource.swift in Sources */,
+ 4CF5D07827143F2000D705BE /* ORPushNotificationButton.swift in Sources */,
+ 4CF5D06A27143F2000D705BE /* GeofenceProvider.swift in Sources */,
+ 4CF5D06927143F2000D705BE /* StorageProvider.swift in Sources */,
+ 4CF5D07127143F2000D705BE /* Constants.swift in Sources */,
+ 4CF5D07B27143F2000D705BE /* ApiManager.swift in Sources */,
+ 4CF5D04B27143EEC00D705BE /* ORLib.swift in Sources */,
+ 4CF5D06B27143F2000D705BE /* PushNotificationProvider.swift in Sources */,
+ 4CF5D07527143F2000D705BE /* String+Utils.swift in Sources */,
+ 4CF5D07427143F2000D705BE /* Reachability.swift in Sources */,
+ 4CF5D07627143F2000D705BE /* ORAppConfig.swift in Sources */,
+ 4CF5D07927143F2000D705BE /* ORPushNotificationAction.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
- 4C82D7401FC58ED2009DE853 /* Debug */ = {
+ 4CF5D04C27143EEC00D705BE /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
@@ -266,6 +295,7 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
@@ -281,15 +311,14 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@@ -307,18 +336,18 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 11.1;
- MTL_ENABLE_DEBUG_INFO = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.2;
+ MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
+ MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
+ OTHER_LDFLAGS = "$(inherited)";
SDKROOT = iphoneos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
- VERSIONING_SYSTEM = "apple-generic";
- VERSION_INFO_PREFIX = "";
};
name = Debug;
};
- 4C82D7411FC58ED2009DE853 /* Release */ = {
+ 4CF5D04D27143EEC00D705BE /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
@@ -328,6 +357,7 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
@@ -343,15 +373,14 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -363,98 +392,46 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
- IPHONEOS_DEPLOYMENT_TARGET = 11.1;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.2;
MTL_ENABLE_DEBUG_INFO = NO;
+ MTL_FAST_MATH = YES;
+ OTHER_LDFLAGS = "$(inherited)";
SDKROOT = iphoneos;
- SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
+ SWIFT_COMPILATION_MODE = wholemodule;
+ SWIFT_OPTIMIZATION_LEVEL = "-O";
VALIDATE_PRODUCT = YES;
- VERSIONING_SYSTEM = "apple-generic";
- VERSION_INFO_PREFIX = "";
};
name = Release;
};
- 4C82D7431FC58ED2009DE853 /* Debug */ = {
+ 4CF5D04F27143EEC00D705BE /* Debug */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = C641D9E59892499E90E68616 /* Pods-ORLib.debug.xcconfig */;
+ baseConfigurationReference = 3F2140D7DCE68D42273B346B /* Pods-ORLib.debug.xcconfig */;
buildSettings = {
- CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
- CLANG_ENABLE_MODULES = YES;
- CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
- DEFINES_MODULE = YES;
- DEVELOPMENT_TEAM = MD7Q2M7GWA;
- DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 1;
- DYLIB_INSTALL_NAME_BASE = "@rpath";
- HEADER_SEARCH_PATHS = (
- "$(inherited)",
- "${PODS_ROOT}/Firebase/Core/Sources",
+ DEVELOPMENT_TEAM = 4AC88KZHJZ;
+ OTHER_LDFLAGS = (
+ "-ObjC",
"$(inherited)",
- "\"${PODS_ROOT}/Headers/Public\"",
- "\"${PODS_ROOT}/Headers/Public/Firebase\"",
- "\"${PODS_ROOT}/Headers/Public/FirebaseAnalytics\"",
- "\"${PODS_ROOT}/Headers/Public/FirebaseCore\"",
- "\"${PODS_ROOT}/Headers/Public/FirebaseInstanceID\"",
- "\"${PODS_ROOT}/Headers/Public/FirebaseMessaging\"",
- "\"$(SRCROOT)/Library\"",
);
- INFOPLIST_FILE = ORLib/Info.plist;
- INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
- IPHONEOS_DEPLOYMENT_TARGET = 11.2;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
- LIBRARY_SEARCH_PATHS = "";
- MODULEMAP_FILE = "";
- ONLY_ACTIVE_ARCH = YES;
- OTHER_LDFLAGS = "$(inherited)";
- PRODUCT_BUNDLE_IDENTIFIER = org.openremote.ORLib;
- PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
+ PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
- SWIFT_INCLUDE_PATHS = "";
- SWIFT_OBJC_BRIDGING_HEADER = "";
- SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
- 4C82D7441FC58ED2009DE853 /* Release */ = {
+ 4CF5D05027143EEC00D705BE /* Release */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = 572EED7F064AF79DDABE9FC8 /* Pods-ORLib.release.xcconfig */;
+ baseConfigurationReference = 37A59C1C5EEB5A3027F557D0 /* Pods-ORLib.release.xcconfig */;
buildSettings = {
- CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
- CLANG_ENABLE_MODULES = YES;
- CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Automatic;
- DEFINES_MODULE = YES;
- DEVELOPMENT_TEAM = MD7Q2M7GWA;
- DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 1;
- DYLIB_INSTALL_NAME_BASE = "@rpath";
- HEADER_SEARCH_PATHS = (
- "$(inherited)",
- "${PODS_ROOT}/Firebase/Core/Sources",
+ DEVELOPMENT_TEAM = 4AC88KZHJZ;
+ OTHER_LDFLAGS = (
+ "-ObjC",
"$(inherited)",
- "\"${PODS_ROOT}/Headers/Public\"",
- "\"${PODS_ROOT}/Headers/Public/Firebase\"",
- "\"${PODS_ROOT}/Headers/Public/FirebaseAnalytics\"",
- "\"${PODS_ROOT}/Headers/Public/FirebaseCore\"",
- "\"${PODS_ROOT}/Headers/Public/FirebaseInstanceID\"",
- "\"${PODS_ROOT}/Headers/Public/FirebaseMessaging\"",
- "\"$(SRCROOT)/Library\"",
);
- INFOPLIST_FILE = ORLib/Info.plist;
- INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
- IPHONEOS_DEPLOYMENT_TARGET = 11.2;
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
- LIBRARY_SEARCH_PATHS = "";
- MODULEMAP_FILE = "";
- ONLY_ACTIVE_ARCH = NO;
- OTHER_LDFLAGS = "$(inherited)";
- PRODUCT_BUNDLE_IDENTIFIER = org.openremote.ORLib;
- PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
+ PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
- SWIFT_INCLUDE_PATHS = "";
- SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
@@ -463,25 +440,25 @@
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
- 4C82D7341FC58ED2009DE853 /* Build configuration list for PBXProject "ORLib" */ = {
+ 4CF5D04227143EEC00D705BE /* Build configuration list for PBXProject "ORLib" */ = {
isa = XCConfigurationList;
buildConfigurations = (
- 4C82D7401FC58ED2009DE853 /* Debug */,
- 4C82D7411FC58ED2009DE853 /* Release */,
+ 4CF5D04C27143EEC00D705BE /* Debug */,
+ 4CF5D04D27143EEC00D705BE /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
- 4C82D7421FC58ED2009DE853 /* Build configuration list for PBXNativeTarget "ORLib" */ = {
+ 4CF5D04E27143EEC00D705BE /* Build configuration list for PBXNativeTarget "ORLib" */ = {
isa = XCConfigurationList;
buildConfigurations = (
- 4C82D7431FC58ED2009DE853 /* Debug */,
- 4C82D7441FC58ED2009DE853 /* Release */,
+ 4CF5D04F27143EEC00D705BE /* Debug */,
+ 4CF5D05027143EEC00D705BE /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
- rootObject = 4C82D7311FC58ED2009DE853 /* Project object */;
+ rootObject = 4CF5D03F27143EEC00D705BE /* Project object */;
}
diff --git a/console/iOS/ORLib/ORLib.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/console/iOS/ORLib/ORLib.xcodeproj/project.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 000000000..919434a62
--- /dev/null
+++ b/console/iOS/ORLib/ORLib.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:">
+ </FileRef>
+</Workspace>
diff --git a/console/iOS/ORLib/ORLib.xcodeproj/xcuserdata/nuc.xcuserdatad/xcschemes/xcschememanagement.plist b/console/iOS/ORLib/ORLib.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
similarity index 55%
rename from console/iOS/ORLib/ORLib.xcodeproj/xcuserdata/nuc.xcuserdatad/xcschemes/xcschememanagement.plist
rename to console/iOS/ORLib/ORLib.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
index 7eee96b8d..18d981003 100644
--- a/console/iOS/ORLib/ORLib.xcodeproj/xcuserdata/nuc.xcuserdatad/xcschemes/xcschememanagement.plist
+++ b/console/iOS/ORLib/ORLib.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -2,13 +2,7 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
- <key>SchemeUserState</key>
- <dict>
- <key>ORLib.xcscheme_^#shared#^_</key>
- <dict>
- <key>orderHint</key>
- <integer>0</integer>
- </dict>
- </dict>
+ <key>IDEDidComputeMac32BitWarning</key>
+ <true/>
</dict>
</plist>
diff --git a/console/iOS/ORLib/ORLib.xcodeproj/project.xcworkspace/xcuserdata/michael.xcuserdatad/UserInterfaceState.xcuserstate b/console/iOS/ORLib/ORLib.xcodeproj/project.xcworkspace/xcuserdata/michael.xcuserdatad/UserInterfaceState.xcuserstate
index faa583618..cefd4c665 100644
Binary files a/console/iOS/ORLib/ORLib.xcodeproj/project.xcworkspace/xcuserdata/michael.xcuserdatad/UserInterfaceState.xcuserstate and b/console/iOS/ORLib/ORLib.xcodeproj/project.xcworkspace/xcuserdata/michael.xcuserdatad/UserInterfaceState.xcuserstate differ
diff --git a/console/iOS/ORLib/ORLib.xcodeproj/xcshareddata/xcschemes/ORLib.xcscheme b/console/iOS/ORLib/ORLib.xcodeproj/xcshareddata/xcschemes/ORLib.xcscheme
deleted file mode 100644
index e1381086f..000000000
--- a/console/iOS/ORLib/ORLib.xcodeproj/xcshareddata/xcschemes/ORLib.xcscheme
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Scheme
- LastUpgradeVersion = "1020"
- version = "1.3">
- <BuildAction
- parallelizeBuildables = "YES"
- buildImplicitDependencies = "YES">
- <BuildActionEntries>
- <BuildActionEntry
- buildForTesting = "YES"
- buildForRunning = "YES"
- buildForProfiling = "YES"
- buildForArchiving = "YES"
- buildForAnalyzing = "YES">
- <BuildableReference
- BuildableIdentifier = "primary"
- BlueprintIdentifier = "4C82D7391FC58ED2009DE853"
- BuildableName = "ORLib.framework"
- BlueprintName = "ORLib"
- ReferencedContainer = "container:ORLib.xcodeproj">
- </BuildableReference>
- </BuildActionEntry>
- </BuildActionEntries>
- </BuildAction>
- <TestAction
- buildConfiguration = "Debug"
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
- shouldUseLaunchSchemeArgsEnv = "YES">
- <Testables>
- </Testables>
- <AdditionalOptions>
- </AdditionalOptions>
- </TestAction>
- <LaunchAction
- buildConfiguration = "Debug"
- selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
- selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
- launchStyle = "0"
- useCustomWorkingDirectory = "NO"
- ignoresPersistentStateOnLaunch = "NO"
- debugDocumentVersioning = "YES"
- debugServiceExtension = "internal"
- allowLocationSimulation = "YES">
- <MacroExpansion>
- <BuildableReference
- BuildableIdentifier = "primary"
- BlueprintIdentifier = "4C82D7391FC58ED2009DE853"
- BuildableName = "ORLib.framework"
- BlueprintName = "ORLib"
- ReferencedContainer = "container:ORLib.xcodeproj">
- </BuildableReference>
- </MacroExpansion>
- <AdditionalOptions>
- </AdditionalOptions>
- </LaunchAction>
- <ProfileAction
- buildConfiguration = "Release"
- shouldUseLaunchSchemeArgsEnv = "YES"
- savedToolIdentifier = ""
- useCustomWorkingDirectory = "NO"
- debugDocumentVersioning = "YES">
- <MacroExpansion>
- <BuildableReference
- BuildableIdentifier = "primary"
- BlueprintIdentifier = "4C82D7391FC58ED2009DE853"
- BuildableName = "ORLib.framework"
- BlueprintName = "ORLib"
- ReferencedContainer = "container:ORLib.xcodeproj">
- </BuildableReference>
- </MacroExpansion>
- </ProfileAction>
- <AnalyzeAction
- buildConfiguration = "Debug">
- </AnalyzeAction>
- <ArchiveAction
- buildConfiguration = "Release"
- revealArchiveInOrganizer = "YES">
- </ArchiveAction>
-</Scheme>
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.plist
index 7eee96b8d..4ae04dc2b 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>0</integer>
+ <integer>19</integer>
</dict>
</dict>
</dict>
diff --git a/console/iOS/GenericApp/GenericApp/ConsoleProviders/GeofenceProvider.swift b/console/iOS/ORLib/ORLib/ConsoleProviders/GeofenceProvider.swift
similarity index 97%
rename from console/iOS/GenericApp/GenericApp/ConsoleProviders/GeofenceProvider.swift
rename to console/iOS/ORLib/ORLib/ConsoleProviders/GeofenceProvider.swift
index 3d155de43..2bd49b795 100644
--- a/console/iOS/GenericApp/GenericApp/ConsoleProviders/GeofenceProvider.swift
+++ b/console/iOS/ORLib/ORLib/ConsoleProviders/GeofenceProvider.swift
@@ -3,10 +3,10 @@ import CoreLocation
public class GeofenceProvider: NSObject, URLSessionDelegate {
- static let baseUrlKey = "baseUrl"
- static let consoleIdKey = "consoleId"
- static let geoPostUrlsKey = "geoPostUrls"
- static let geoDisabledKey = "geoDisabled"
+ public static let baseUrlKey = "baseUrl"
+ public static let consoleIdKey = "consoleId"
+ public static let geoPostUrlsKey = "geoPostUrls"
+ public static let geoDisabledKey = "geoDisabled"
let version = "ORConsole"
let geofenceFetchEndpoint = "rules/geofences/"
@@ -336,4 +336,8 @@ extension GeofenceProvider: CLLocationManagerDelegate {
locationManager.stopUpdatingLocation()
}
}
+
+ public func startMonitoringSignificantLocationChanges() {
+ locationManager.startMonitoringSignificantLocationChanges()
+ }
}
diff --git a/console/iOS/GenericApp/GenericApp/ConsoleProviders/PushNotificationProvider.swift b/console/iOS/ORLib/ORLib/ConsoleProviders/PushNotificationProvider.swift
similarity index 98%
rename from console/iOS/GenericApp/GenericApp/ConsoleProviders/PushNotificationProvider.swift
rename to console/iOS/ORLib/ORLib/ConsoleProviders/PushNotificationProvider.swift
index b74e71709..793a6b690 100644
--- a/console/iOS/GenericApp/GenericApp/ConsoleProviders/PushNotificationProvider.swift
+++ b/console/iOS/ORLib/ORLib/ConsoleProviders/PushNotificationProvider.swift
@@ -14,7 +14,7 @@ public class PushNotificationProvider: NSObject {
let userdefaults = UserDefaults(suiteName: DefaultsKey.groupEntitlement)
let version = "fcm"
public var consoleId: String = ""
- static let pushDisabledKey = "pushDisabled"
+ public static let pushDisabledKey = "pushDisabled"
public override init() {
super.init()
diff --git a/console/iOS/GenericApp/GenericApp/ConsoleProviders/StorageProvider.swift b/console/iOS/ORLib/ORLib/ConsoleProviders/StorageProvider.swift
similarity index 97%
rename from console/iOS/GenericApp/GenericApp/ConsoleProviders/StorageProvider.swift
rename to console/iOS/ORLib/ORLib/ConsoleProviders/StorageProvider.swift
index 0502e4d08..2ccc41546 100644
--- a/console/iOS/GenericApp/GenericApp/ConsoleProviders/StorageProvider.swift
+++ b/console/iOS/ORLib/ORLib/ConsoleProviders/StorageProvider.swift
@@ -7,7 +7,7 @@
import UIKit
-class StorageProvider: NSObject {
+public class StorageProvider: NSObject {
let userdefaults = UserDefaults(suiteName: DefaultsKey.groupEntitlement)
diff --git a/console/iOS/ORLib/ORLib/ErrorManager.swift b/console/iOS/ORLib/ORLib/ErrorManager.swift
deleted file mode 100644
index 25718461f..000000000
--- a/console/iOS/ORLib/ORLib/ErrorManager.swift
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2017, OpenRemote Inc.
- *
- * See the CONTRIBUTORS.txt file in the distribution for a
- * full listing of individual contributors.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-import Foundation
-import UIKit
-
-public class ErrorManager : NSObject {
-
- static func showError(error : Error) {
- DispatchQueue.main.async {
- NSLog("showing error %@",error as NSError)
- let topWindow = UIWindow(frame: UIScreen.main.bounds)
- topWindow.rootViewController = UIViewController()
- topWindow.windowLevel = UIWindow.Level.alert + 1
- let alertVC = UIAlertController(title: "Error", message: error.localizedDescription, preferredStyle: UIAlertController.Style.alert)
- let alertAction = UIAlertAction(title: "Done", style: .cancel) { (action) in
- topWindow.rootViewController?.presentedViewController?.dismiss(animated: true, completion: nil)
- topWindow.isHidden = true
- }
-
- alertVC.addAction(alertAction)
- DispatchQueue.main.async {
- topWindow.makeKeyAndVisible()
- topWindow.rootViewController?.present(alertVC, animated: true, completion: nil)
- }
- }
-
- }
-}
diff --git a/console/iOS/ORLib/ORLib/GeofenceProvider.swift b/console/iOS/ORLib/ORLib/GeofenceProvider.swift
deleted file mode 100644
index 68b61deae..000000000
--- a/console/iOS/ORLib/ORLib/GeofenceProvider.swift
+++ /dev/null
@@ -1,339 +0,0 @@
-import UIKit
-import CoreLocation
-
-public class GeofenceProvider: NSObject, URLSessionDelegate {
-
- static let baseUrlKey = "baseUrl"
- static let consoleIdKey = "consoleId"
- static let geoPostUrlsKey = "geoPostUrls"
- static let geoDisabledKey = "geoDisabled"
-
- let version = "ORConsole"
- let geofenceFetchEndpoint = "rules/geofences/"
- let locationManager = CLLocationManager()
- let userdefaults = UserDefaults(suiteName: ORAppGroup.entitlement)
- var geoPostUrls = [String:[String]]()
- var enableCallback : (([String: Any]) -> (Void))?
- var getLocationCallback : (([String: Any]) -> (Void))?
-
- public var baseURL: String = ""
- public var consoleId: String = ""
-
- private var enteredLocation: (String, [String : Any]?)? = nil
- private var exitedLocation: (String, [String : Any]?)? = nil
- private var sendQueued = false
-
- public override init() {
- super.init()
- locationManager.delegate = self
- locationManager.allowsBackgroundLocationUpdates = true
- locationManager.pausesLocationUpdatesAutomatically = false
- locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters
- self.baseURL = userdefaults?.string(forKey: GeofenceProvider.baseUrlKey) ?? ""
- self.consoleId = userdefaults?.string(forKey: GeofenceProvider.consoleIdKey) ?? ""
- self.geoPostUrls = userdefaults?.value(forKey: GeofenceProvider.geoPostUrlsKey) as? [String:[String]] ?? [String:[String]]()
- }
-
- public func initialize() -> [String: Any] {
- return [
- DefaultsKey.actionKey: Actions.providerInit,
- DefaultsKey.providerKey: Providers.geofence,
- DefaultsKey.versionKey: version,
- DefaultsKey.requiresPermissionKey: true,
- DefaultsKey.hasPermissionKey: checkPermission(),
- DefaultsKey.successKey: true,
- DefaultsKey.enabledKey: false,
- DefaultsKey.disabledKey: userdefaults?.bool(forKey: GeofenceProvider.geoDisabledKey) ?? false
- ]
- }
-
- private func checkPermission() -> Bool {
- if CLLocationManager.locationServicesEnabled() {
- if CLLocationManager.authorizationStatus() == .authorizedAlways {
- return true
- }
- }
- return false
- }
-
- private func registerPermissions() {
- locationManager.requestAlwaysAuthorization()
- }
-
- public func addGeofence(geofence: GeofenceDefinition) {
- let region = CLCircularRegion(center: CLLocationCoordinate2DMake(geofence.lat, geofence.lng), radius: geofence.radius, identifier:geofence.id)
- locationManager.startMonitoring(for: region)
- geoPostUrls[geofence.id] = [geofence.httpMethod, geofence.url]
- userdefaults?.set(geoPostUrls, forKey: GeofenceProvider.geoPostUrlsKey)
- userdefaults?.synchronize()
- }
-
- public func removeGeofence(id: String) {
- for region in locationManager.monitoredRegions {
- guard let circularRegion = region as? CLCircularRegion, circularRegion.identifier == id else {continue}
- locationManager.stopMonitoring(for: circularRegion)
- geoPostUrls.removeValue(forKey: circularRegion.identifier)
- userdefaults?.set(geoPostUrls, forKey: GeofenceProvider.geoPostUrlsKey)
- userdefaults?.synchronize()
- break
- }
- }
-
- public func clearAllRegions() {
- for region in locationManager.monitoredRegions {
- locationManager.stopMonitoring(for: region)
- }
- geoPostUrls = [String:[String]]()
- userdefaults?.set(geoPostUrls, forKey: GeofenceProvider.geoPostUrlsKey)
- userdefaults?.synchronize()
- }
-
- public func enable(baseUrl: String, consoleId: String, callback:@escaping ([String: Any]) ->(Void)) {
- self.baseURL = baseUrl
- self.consoleId = consoleId
- userdefaults?.set(self.baseURL, forKey: GeofenceProvider.baseUrlKey)
- userdefaults?.set(self.consoleId, forKey: GeofenceProvider.consoleIdKey)
- userdefaults?.removeObject(forKey: GeofenceProvider.geoDisabledKey)
- userdefaults?.synchronize()
- enableCallback = callback
- if checkPermission() {
- self.locationManager.startMonitoringSignificantLocationChanges()
- enableCallback?([
- DefaultsKey.actionKey: Actions.providerEnable,
- DefaultsKey.providerKey: Providers.geofence,
- DefaultsKey.hasPermissionKey: checkPermission(),
- DefaultsKey.successKey: true
- ])
- } else {
- if CLLocationManager.authorizationStatus() == .notDetermined {
- registerPermissions()
- } else {
- enableCallback?([
- DefaultsKey.actionKey: Actions.providerEnable,
- DefaultsKey.providerKey: Providers.geofence,
- DefaultsKey.hasPermissionKey: false,
- DefaultsKey.successKey: true
- ])
- }
- }
- }
-
- public func disable()-> [String: Any] {
- locationManager.stopMonitoringSignificantLocationChanges()
- userdefaults?.set(true, forKey: GeofenceProvider.geoDisabledKey)
- userdefaults?.removeObject(forKey: GeofenceProvider.baseUrlKey)
- userdefaults?.removeObject(forKey: GeofenceProvider.consoleIdKey)
- userdefaults?.synchronize()
- return [
- DefaultsKey.actionKey: Actions.providerDisable,
- DefaultsKey.providerKey: Providers.geofence
- ]
- }
-
- public func getLocation(callback:@escaping ([String: Any]) -> (Void)) {
- if CLLocationManager.authorizationStatus() == .denied {
- callback([
- DefaultsKey.actionKey: Actions.getLocation,
- DefaultsKey.providerKey: Providers.geofence,
- DefaultsKey.dataKey: nil
- ])
- } else {
- getLocationCallback = callback
- locationManager.startUpdatingLocation()
- }
- }
-
- public func refreshGeofences() {
- fetchGeofences()
- }
-
- func fetchGeofences(callback: (([GeofenceDefinition]) -> ())? = nil) {
- if let tkurlRequest = URL(string: "\(baseURL)/\(geofenceFetchEndpoint)\(consoleId)") {
- let tkRequest = NSMutableURLRequest(url: tkurlRequest)
- tkRequest.httpMethod = "GET"
- let sessionConfiguration = URLSessionConfiguration.default
- let session = URLSession(configuration: sessionConfiguration, delegate: self, delegateQueue: nil)
- let req = session.dataTask(with: tkRequest as URLRequest, completionHandler: { (data, response, error) in
- if (data != nil){
- guard let geofences = try? JSONDecoder().decode([GeofenceDefinition].self, from: data!) else {
- callback?([])
- return
- }
- self.clearAllRegions()
- NSLog("%@", "Geofences count: \(geofences.count)")
- print("Geofences count: \(geofences.count)")
- for geofence in geofences {
- self.addGeofence(geofence: geofence)
- }
- callback?(geofences)
- } else {
- NSLog("error %@", (error! as NSError).localizedDescription)
- let error = NSError(domain: "", code: 0, userInfo: [
- NSLocalizedDescriptionKey : NSLocalizedString("NoDataReceived", value: "Did not receive any data", comment: "")
- ])
- NSLog("%@", error)
- callback?([])
- }
- })
- req.resume()
- } else {
- callback?([])
- }
- }
-
- private func queueSendLocation(geofenceId: String, data:[String: Any]?) {
- synced(lock: self) {
- if let locationData = data {
- enteredLocation = (geofenceId, locationData)
- } else {
- exitedLocation = (geofenceId, nil)
-
- if enteredLocation?.0 == geofenceId {
- enteredLocation = nil
- }
- }
-
- if !sendQueued {
- sendQueued = true
- DispatchQueue.global().asyncAfter(deadline: .now() + .seconds(2)) {
- self.doSendLocation()
- }
- }
- }
- }
-
- private func doSendLocation() {
- synced(lock: self) {
- var success = false
-
- if exitedLocation != nil {
- if sendLocation(geofenceId: exitedLocation!.0, data: exitedLocation!.1) {
- exitedLocation = nil
- success = true
- }
- } else if enteredLocation != nil {
- if sendLocation(geofenceId: enteredLocation!.0, data: enteredLocation!.1) {
- enteredLocation = nil
- success = true
- }
- }
-
- if exitedLocation != nil || enteredLocation != nil {
- // Schedule another send
- let delay = success ? 5 : 10
- DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(delay)) {
- self.doSendLocation()
- }
- } else {
- sendQueued = false
- }
- }
- }
-
- private func sendLocation(geofenceId: String, data: [String : Any]?)-> Bool {
- return synced(lock: self) {
- var succes = false
-
- guard let urlData = geoPostUrls[geofenceId] else {
- return succes
- }
- guard let url = URL(string: "\(baseURL)\(urlData[1])") else { return succes}
-
- let request = NSMutableURLRequest(url: url)
- request.addValue("application/json", forHTTPHeaderField:"Content-Type");
- request.httpMethod = urlData[0]
-
- if (data != nil) {
- if let postBody = try? JSONSerialization.data(withJSONObject: data!, options: []) {
- request.httpBody = postBody
- }
- } else {
- request.httpBody = "null".data(using: .utf8)
- }
-
- let semaphore = DispatchSemaphore(value: 0)
- let sessionConfiguration = URLSessionConfiguration.default
- let session = URLSession(configuration: sessionConfiguration, delegate: self, delegateQueue: nil)
- let req = session.dataTask(with: request as URLRequest, completionHandler: { (responseData, response, error) in
- if let httpResponse = response as? HTTPURLResponse, httpResponse.statusCode == 204 {
- NSLog("%@", "sendLocation succeded with data: \(String(describing: data))")
- succes = true
- } else {
- NSLog("%@", "sendLocation failed")
- if let err = error as NSError? {
- NSLog("%@", err)
- }
- }
- semaphore.signal()
- })
- req.resume()
- semaphore.wait()
- return succes
- }
- }
-
- private func synced<T>(lock: Any, closure: () throws -> T) rethrows -> T {
- objc_sync_enter(lock)
- defer {
- objc_sync_exit(lock)
- }
-
- return try closure()
- }
-
- public class GeofenceDefinition: NSObject, Decodable {
- public var id: String = ""
- public var lat: Double = 0.0
- public var lng: Double = 0.0
- public var radius: Double = 0.0
- public var httpMethod: String = ""
- public var url: String = ""
- }
-}
-
-extension GeofenceProvider: CLLocationManagerDelegate {
- public func locationManager(_ manager: CLLocationManager, didEnterRegion region: CLRegion) {
- NSLog("%@", "Entered geofence with id: \(region.identifier)")
-
- guard let circularRegion = region as? CLCircularRegion else {return}
-
- let postData = [
- "type": "Point",
- "coordinates": [circularRegion.center.longitude, circularRegion.center.latitude]
- ] as [String : Any]
-
- queueSendLocation(geofenceId: circularRegion.identifier, data: postData)
- }
-
- public func locationManager(_ manager: CLLocationManager, didExitRegion region: CLRegion) {
- NSLog("%@", "Exited geofence with id: \(region.identifier)")
-
- guard let circularRegion = region as? CLCircularRegion else {return}
-
- queueSendLocation(geofenceId: circularRegion.identifier, data: nil)
- }
-
- public func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) {
- if status != .notDetermined {
- enableCallback?([
- DefaultsKey.actionKey: Actions.providerEnable,
- DefaultsKey.providerKey: Providers.geofence,
- DefaultsKey.hasPermissionKey: checkPermission(),
- DefaultsKey.successKey: true
- ])
- } else if status == .authorizedAlways {
- self.locationManager.startMonitoringSignificantLocationChanges()
- }
- }
-
- public func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
- if let lastLocation = locations.last {
- getLocationCallback?([
- DefaultsKey.actionKey: Actions.getLocation,
- DefaultsKey.providerKey: Providers.geofence,
- DefaultsKey.dataKey: ["latitude": lastLocation.coordinate.latitude, "longitude": lastLocation.coordinate.longitude]
- ])
- locationManager.stopUpdatingLocation()
- }
- }
-}
diff --git a/console/iOS/ORLib/ORLib/Info.plist b/console/iOS/ORLib/ORLib/Info.plist
deleted file mode 100644
index 1007fd9dd..000000000
--- a/console/iOS/ORLib/ORLib/Info.plist
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDevelopmentRegion</key>
- <string>$(DEVELOPMENT_LANGUAGE)</string>
- <key>CFBundleExecutable</key>
- <string>$(EXECUTABLE_NAME)</string>
- <key>CFBundleIdentifier</key>
- <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundleName</key>
- <string>$(PRODUCT_NAME)</string>
- <key>CFBundlePackageType</key>
- <string>FMWK</string>
- <key>CFBundleShortVersionString</key>
- <string>1.0</string>
- <key>CFBundleVersion</key>
- <string>$(CURRENT_PROJECT_VERSION)</string>
- <key>NSPrincipalClass</key>
- <string></string>
-</dict>
-</plist>
diff --git a/console/iOS/GenericApp/GenericApp/Models/ORAppConfig.swift b/console/iOS/ORLib/ORLib/Models/ORAppConfig.swift
similarity index 92%
rename from console/iOS/GenericApp/GenericApp/Models/ORAppConfig.swift
rename to console/iOS/ORLib/ORLib/Models/ORAppConfig.swift
index 0c6ddcbb1..99f4c9dd6 100644
--- a/console/iOS/GenericApp/GenericApp/Models/ORAppConfig.swift
+++ b/console/iOS/ORLib/ORLib/Models/ORAppConfig.swift
@@ -8,7 +8,7 @@
import UIKit
-struct ORAppConfig: Codable {
+public struct ORAppConfig: Codable {
let id: Int32
let realm: String
let initialUrl: String
diff --git a/console/iOS/GenericApp/GenericApp/Models/ORLinkConfig.swift b/console/iOS/ORLib/ORLib/Models/ORLinkConfig.swift
similarity index 85%
rename from console/iOS/GenericApp/GenericApp/Models/ORLinkConfig.swift
rename to console/iOS/ORLib/ORLib/Models/ORLinkConfig.swift
index ed2469298..7d9141a7b 100644
--- a/console/iOS/GenericApp/GenericApp/Models/ORLinkConfig.swift
+++ b/console/iOS/ORLib/ORLib/Models/ORLinkConfig.swift
@@ -8,7 +8,7 @@
import UIKit
-struct ORLinkConfig: Codable {
+public struct ORLinkConfig: Codable {
let displayText: String
let pageLink: String
}
diff --git a/console/iOS/GenericApp/GenericApp/Models/ORPushNotificationAction.swift b/console/iOS/ORLib/ORLib/Models/ORPushNotificationAction.swift
similarity index 100%
rename from console/iOS/GenericApp/GenericApp/Models/ORPushNotificationAction.swift
rename to console/iOS/ORLib/ORLib/Models/ORPushNotificationAction.swift
diff --git a/console/iOS/GenericApp/GenericApp/Models/ORPushNotificationButton.swift b/console/iOS/ORLib/ORLib/Models/ORPushNotificationButton.swift
similarity index 100%
rename from console/iOS/GenericApp/GenericApp/Models/ORPushNotificationButton.swift
rename to console/iOS/ORLib/ORLib/Models/ORPushNotificationButton.swift
diff --git a/console/iOS/GenericApp/GenericApp/Network/ApiManager.swift b/console/iOS/ORLib/ORLib/Network/ApiManager.swift
similarity index 94%
rename from console/iOS/GenericApp/GenericApp/Network/ApiManager.swift
rename to console/iOS/ORLib/ORLib/Network/ApiManager.swift
index e8efe6832..33704c881 100644
--- a/console/iOS/GenericApp/GenericApp/Network/ApiManager.swift
+++ b/console/iOS/ORLib/ORLib/Network/ApiManager.swift
@@ -8,7 +8,7 @@
import UIKit
-typealias ResponseBlock<T: Codable> = (_ statusCode: Int, _ object: T?, _ error: Error?) -> ()
+public typealias ResponseBlock<T: Codable> = (_ statusCode: Int, _ object: T?, _ error: Error?) -> ()
enum HttpMethod: String {
case get = "GET"
@@ -18,16 +18,16 @@ enum HttpMethod: String {
case batch = "BATCH"
}
-class ApiManager: NSObject {
+public class ApiManager: NSObject {
private let baseUrl: URL;
- init(baseUrl: String) {
+ public init(baseUrl: String) {
self.baseUrl = URL(string: baseUrl)!
super.init()
}
- static var accessToken: String?
+ public static var accessToken: String?
let session: URLSession = {
let config = URLSessionConfiguration.default
@@ -47,7 +47,7 @@ class ApiManager: NSObject {
return decoder
}()
- func getAppConfig(callback: ResponseBlock<ORAppConfig>?) {
+ public func getAppConfig(callback: ResponseBlock<ORAppConfig>?) {
self.get(pathComponents: ["app", "config"], callback: callback)
}
diff --git a/console/iOS/GenericApp/GenericApp/Network/ORNotificationResource.swift b/console/iOS/ORLib/ORLib/Network/ORNotificationResource.swift
similarity index 100%
rename from console/iOS/GenericApp/GenericApp/Network/ORNotificationResource.swift
rename to console/iOS/ORLib/ORLib/Network/ORNotificationResource.swift
diff --git a/console/iOS/ORLib/ORLib/ORAppDelegate.swift b/console/iOS/ORLib/ORLib/ORAppDelegate.swift
deleted file mode 100644
index f6480ec8e..000000000
--- a/console/iOS/ORLib/ORLib/ORAppDelegate.swift
+++ /dev/null
@@ -1,362 +0,0 @@
-/*
- * Copyright 2017, OpenRemote Inc.
- *
- * See the CONTRIBUTORS.txt file in the distribution for a
- * full listing of individual contributors.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-import UIKit
-import UserNotifications
-import FirebaseCore
-import FirebaseMessaging
-import FirebaseInstanceID
-import CoreLocation
-
-@UIApplicationMain
-open class ORAppDelegate: UIResponder, UIApplicationDelegate, URLSessionDelegate {
-
- public var window: UIWindow?
- public let gcmMessageIDKey = "gcm.message_id"
- public var reachabilityAlert : UIAlertController?
- public var reachabilityAlertShown = false
- public let internetReachability = Reachability()
-
- private var geofenceProvider : GeofenceProvider?
-
- open func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
- UNUserNotificationCenter.current().delegate = self
- // if the app was launched because of geofencing
-
- let paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)
- let documentsDirectory = paths[0]
- let fileName = "\(Date()).log"
- let logFilePath = (documentsDirectory as NSString).appendingPathComponent(fileName)
- freopen(logFilePath.cString(using: String.Encoding.ascii)!, "a+", stderr)
-
- if launchOptions?[UIApplication.LaunchOptionsKey.location] != nil {
- NSLog("%@", "App started from location update")
- // create new GeofenceProvider which creates a CLLocationManager that will receive the location update
- geofenceProvider = GeofenceProvider()
- if CLLocationManager.authorizationStatus() == .authorizedAlways {
- geofenceProvider?.locationManager.startMonitoringSignificantLocationChanges()
- }
- } else if let remoteNotifcation = launchOptions?[UIApplication.LaunchOptionsKey.remoteNotification] as? [AnyHashable: Any] {
- NSLog("%@", "App started from remote notification")
- if let action = remoteNotifcation[DefaultsKey.actionKey] as? String {
- if action == Actions.geofenceRefresh {
- geofenceProvider = GeofenceProvider()
- geofenceProvider?.refreshGeofences()
- if CLLocationManager.authorizationStatus() == .authorizedAlways {
- geofenceProvider?.locationManager.startMonitoringSignificantLocationChanges()
- }
- }
- }
- } else {
- FirebaseApp.configure()
- Messaging.messaging().delegate = self
-
- NotificationCenter.default.addObserver(self,
- selector: #selector(self.reachabilityChanged(note:)),
- name: NSNotification.Name.reachabilityChanged,
- object: internetReachability)
- do {
- try internetReachability?.startNotifier()
- self.updateReachabilityStatus(reachability: internetReachability!)
- } catch {
- NSLog("%@", "Unable to start notifier")
- }
- }
- return true
- }
-
- open func applicationWillResignActive(_ application: UIApplication) {
- // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
- // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
- reachabilityAlert?.dismiss(animated: true, completion: nil)
- reachabilityAlertShown = false
- internetReachability?.stopNotifier()
- }
-
- open func applicationDidEnterBackground(_ application: UIApplication) {
- // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
- // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
- reachabilityAlert?.dismiss(animated: true, completion: nil)
- reachabilityAlertShown = false
- internetReachability?.stopNotifier()
- }
-
- open func applicationWillEnterForeground(_ application: UIApplication) {
- // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
- DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
- do {
- try self.internetReachability?.startNotifier()
- self.updateReachabilityStatus(reachability: self.internetReachability!)
- } catch {
- NSLog("%@", "Unable to start notifier")
- }
- }
- }
-
- open func applicationDidBecomeActive(_ application: UIApplication) {
- // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
- DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
- do {
- try self.internetReachability?.startNotifier()
- self.updateReachabilityStatus(reachability: self.internetReachability!)
- } catch {
- NSLog("%@", "Unable to start notifier")
- }
- }
- }
-
- open func applicationWillTerminate(_ application: UIApplication) {
- // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
- reachabilityAlert?.dismiss(animated: true, completion: nil)
- reachabilityAlertShown = false
- internetReachability?.stopNotifier()
- }
-
- open func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
- Messaging.messaging().apnsToken = deviceToken
- InstanceID.instanceID().getID { (result, error) in
- if let error = error {
- print("Error fetching remote instange ID: \(error)")
- }
- InstanceID.instanceID().instanceID { (tokenResult, tokenError) in
- if let tResult = tokenResult, let deviceId = result {
- TokenManager.sharedInstance.storeDeviceId(token: tResult.token, deviceId: deviceId)
- }
- }
- }
- }
-
- open func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
- if let action = userInfo[DefaultsKey.actionKey] as? String {
- if action == Actions.geofenceRefresh {
- if let controllerGeofenceProvider = (self.window?.rootViewController as! ORViewcontroller).geofenceProvider {
- controllerGeofenceProvider.refreshGeofences()
- } else if let delegateGeofenceProvider = geofenceProvider {
- delegateGeofenceProvider.refreshGeofences()
- } else {
- geofenceProvider = GeofenceProvider()
- geofenceProvider!.refreshGeofences()
- }
- } else if action == Actions.store {
- if let data = userInfo[DefaultsKey.dataKey] as? [String: String] {
- if let key = data["key"] {
- if let storageProvider = (self.window?.rootViewController as! ORViewcontroller).storageProvider {
- storageProvider.store(key: key, data: data["value"])
- }
- }
- }
- }
- }
-
- if let notificationIdString = userInfo[ActionType.notificationId] as? String, let notificationId = Int64(notificationIdString) {
- if let defaults = UserDefaults(suiteName: ORAppGroup.entitlement), let consoleId = defaults.string(forKey: GeofenceProvider.consoleIdKey) {
- ORNotificationResource.sharedInstance.notificationDelivered(notificationId: notificationId, targetId: consoleId)
- }
- }
- completionHandler(UIBackgroundFetchResult.newData)
- }
-
- open func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
- return true
- }
-
- @objc open func reachabilityChanged(note: NSNotification) {
- if let reachability = note.object as? Reachability {
- updateReachabilityStatus(reachability: reachability)
- }
- }
-
- private func updateReachabilityStatus(reachability: Reachability) {
- if reachability.connection == .none {
- if (!reachabilityAlertShown) {
- let topWindow = UIWindow(frame: UIScreen.main.bounds)
- topWindow.rootViewController = UIViewController()
- topWindow.windowLevel = UIWindow.Level.alert + 1
-
- reachabilityAlert = UIAlertController(title: "Network Error", message: "Your device seems to be offline", preferredStyle: .alert)
- let reachabilityRetryAction = UIAlertAction(title: "Retry", style: .default, handler: { (action) in
- self.reachabilityAlertShown = false
- self.updateReachabilityStatus(reachability: self.internetReachability!)
- topWindow.isHidden = true
- })
- let reachabilityCancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: { (action) in
- self.reachabilityAlertShown = false
- self.reachabilityAlert?.dismiss(animated: true, completion: nil)
- topWindow.isHidden = true
- })
- reachabilityAlert?.addAction(reachabilityRetryAction)
- reachabilityAlert?.addAction(reachabilityCancelAction)
- topWindow.makeKeyAndVisible()
- topWindow.rootViewController?.present(reachabilityAlert!, animated: true, completion: nil)
- reachabilityAlertShown = true
- }
- } else {
- if (reachabilityAlertShown) {
- reachabilityAlert?.dismiss(animated: true, completion: nil)
- reachabilityAlertShown = false
- }
- }
- }
-
- open func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
- if (challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust) {
- if challenge.protectionSpace.host == ORServer.hostURL {
- completionHandler(.useCredential, URLCredential(trust: challenge.protectionSpace.serverTrust!))
- } else {
- completionHandler(.performDefaultHandling, nil)
- }
- }
- }
-}
-
-extension ORAppDelegate : UNUserNotificationCenterDelegate {
-
- open func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
- let userInfo = notification.request.content.userInfo
- var notificationId : Int64? = nil
-
- if let notificationIdString = userInfo[ActionType.notificationId] as? String{
- notificationId = Int64(notificationIdString)
- }
- if let notiId = notificationId, let defaults = UserDefaults(suiteName: ORAppGroup.entitlement), let consoleId = defaults.string(forKey: GeofenceProvider.consoleIdKey) {
- ORNotificationResource.sharedInstance.notificationDelivered(notificationId: notiId, targetId: consoleId)
- }
-
- completionHandler([.alert, .sound])
- }
-
- open func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
-
- let userInfo = response.notification.request.content.userInfo
- var notificationId : Int64? = nil
- var consoleId : String?
-
- if let notificationIdString = userInfo[ActionType.notificationId] as? String{
- notificationId = Int64(notificationIdString)
- }
-
- if let defaults = UserDefaults(suiteName: ORAppGroup.entitlement) {
- consoleId = defaults.string(forKey: GeofenceProvider.consoleIdKey);
- }
-
- NSLog("%@", "Action chosen: \(response.actionIdentifier)")
-
- switch response.actionIdentifier {
- case UNNotificationDefaultActionIdentifier:
- if let urlToOpen = userInfo[ActionType.appUrl] as? String, !urlToOpen.isEmpty {
- let urlRequest: URL?
- if urlToOpen.hasPrefix("http") || urlToOpen.hasPrefix("https") {
- urlRequest = URL(string:urlToOpen)
- } else {
- urlRequest = URL(string:String(format: "%@://%@/%@%@", ORServer.scheme, ORServer.hostURL, ORServer.navigationPath, urlToOpen))
- }
- if let url = urlRequest{
- if let openInBrowser = userInfo[ActionType.openInBrowser] as? Bool, openInBrowser {
- NSLog("%@", "Open in browser: \(url)")
- UIApplication.shared.open(url)
- } else {
- NSLog("%@", "Open in app: \(url)")
- (self.window?.rootViewController as! ORViewcontroller).loadURL(url:url)
- }
- }
- }
- case UNNotificationDismissActionIdentifier,
- "declineAction":
- if let notiId = notificationId, let conId = consoleId {
- ORNotificationResource.sharedInstance.notificationAcknowledged(notificationId: notiId, targetId: conId, acknowledgement: response.actionIdentifier)
- }
- default :
- if let notiId = notificationId, let conId = consoleId {
- ORNotificationResource.sharedInstance.notificationAcknowledged(notificationId: notiId, targetId: conId, acknowledgement: response.actionIdentifier)
- }
- if let buttonsString = userInfo[DefaultsKey.buttonsKey] as? String {
- if let buttonsData = buttonsString.data(using: .utf8) {
- if let buttons = try? JSONDecoder().decode([ORPushNotificationButton].self, from: buttonsData) {
- for button in buttons {
- if button.title == response.actionIdentifier {
- if let action = button.action {
- let urlRequest: URL?
- if action.url.hasPrefix("http") || action.url.hasPrefix("https") {
- urlRequest = URL(string:action.url)
- } else {
- urlRequest = URL(string:String(format: "%@://%@/%@%@", ORServer.scheme, ORServer.hostURL, ORServer.navigationPath, action.url))
- }
- if let url = urlRequest {
- if action.silent {
- let request = NSMutableURLRequest(url: url)
- request.httpMethod = action.httpMethod ?? "GET"
- if let body = action.data {
- request.httpBody = body.data(using: .utf8)
- request.addValue("application/json", forHTTPHeaderField: "Content-Type")
- }
- let session = URLSession(configuration: URLSessionConfiguration.default, delegate: nil, delegateQueue : nil)
- let reqDataTask = session.dataTask(with: request as URLRequest, completionHandler:{ data, response, error in
- if (error != nil) {
- NSLog("error %@", (error! as NSError).localizedDescription)
- }
- })
- reqDataTask.resume()
- } else if action.openInBrowser {
- NSLog("%@", "Open in browser: \(url)")
- UIApplication.shared.open(url)
- } else {
- NSLog("%@", "Open in app: \(url)")
- (self.window?.rootViewController as! ORViewcontroller).loadURL(url:url)
- }
- }
- }
- break
- }
- }
- }
- }
- }
- }
- completionHandler()
- }
-}
-
-extension ORAppDelegate : MessagingDelegate {
- open func messaging(_ messaging: Messaging, didRefreshRegistrationToken fcmToken: String) {
- print("Firebase registration token: \(fcmToken)")
- InstanceID.instanceID().getID { (result, error) in
- if let error = error {
- print("Error fetching remote instange ID: \(error)")
- }
- if let deviceId = result {
- TokenManager.sharedInstance.storeDeviceId(token: fcmToken, deviceId: deviceId)
- }
- }
- }
-
- open func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) {
- print("Firebase registration token: \(fcmToken)")
- InstanceID.instanceID().getID { (result, error) in
- if let error = error {
- print("Error fetching remote instange ID: \(error)")
- }
-
- if let deviceId = result {
- TokenManager.sharedInstance.storeDeviceId(token: fcmToken, deviceId: deviceId)
- }
- }
- }
-}
-
diff --git a/console/iOS/ORLib/ORLib/ORLib.swift b/console/iOS/ORLib/ORLib/ORLib.swift
new file mode 100644
index 000000000..0e78f7827
--- /dev/null
+++ b/console/iOS/ORLib/ORLib/ORLib.swift
@@ -0,0 +1,10 @@
+//
+// ORLib.swift
+// ORLib
+//
+// Created by Michael Rademaker on 11/10/2021.
+//
+
+class ORLib {
+
+}
diff --git a/console/iOS/ORLib/ORLib/ORLoginViewController.swift b/console/iOS/ORLib/ORLib/ORLoginViewController.swift
deleted file mode 100644
index 167c13148..000000000
--- a/console/iOS/ORLib/ORLib/ORLoginViewController.swift
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright 2017, OpenRemote Inc.
- *
- * See the CONTRIBUTORS.txt file in the distribution for a
- * full listing of individual contributors.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-import UIKit
-
-open class ORLoginViewController: UIViewController {
- public var isInError : Bool = false
- public let loginButton = UIButton(type: .roundedRect)
- public let orViewController = ORViewcontroller()
-
- @IBOutlet weak var loginViewController: UIWebView!
-
- open override func viewDidLoad() {
- super.viewDidLoad()
- let deviceIdSentName = Notification.Name(NotificationsNames.isdeviceIdSent)
- NotificationCenter.default.addObserver(self, selector: #selector(isdeviceIdSent), name: deviceIdSentName, object: nil)
- }
-
- open override func viewWillAppear(_ animated: Bool) {
- super.viewWillAppear(animated)
- if isInError {
- loginButton.isHidden = false
- } else {
- loginButton.isHidden = true
- }
- }
-
- open override func viewDidAppear(_ animated: Bool) {
- super.viewDidAppear(animated)
- if (!isInError) {
- showLoginPage()
- } else {
- loginButton.setTitle("Login", for: .normal)
- loginButton.addTarget(self, action: #selector(login), for: .touchUpInside)
- loginButton.frame = self.view.frame
- self.view.addSubview(loginButton)
- }
- }
-
- open func showLoginPage() {
- // This is some leftover from the initial way the app was architected, must be eventually cleaned up
-
- if (self.presentedViewController == nil) {
- self.present(orViewController, animated: true, completion: {
- self.orViewController.login()
- })
- }
- }
-
- @objc open func isdeviceIdSent() {
- showLoginPage()
- }
-
- @objc open func login() {
- self.loginButton.removeFromSuperview()
- self.showLoginPage()
- }
-
- open func loadUrl(url: URL) {
- self.orViewController.loadURL(url: url)
- }
-
- open func updateAttribute(assetId : String, attributeName : String, rawJson : String) {
- self.orViewController.updateAttribute(assetId: assetId, attributeName: attributeName, rawJson: rawJson)
- }
-}
diff --git a/console/iOS/ORLib/ORLib/ORNotificationService.swift b/console/iOS/ORLib/ORLib/ORNotificationService.swift
deleted file mode 100644
index a2837666e..000000000
--- a/console/iOS/ORLib/ORLib/ORNotificationService.swift
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright 2017, OpenRemote Inc.
- *
- * See the CONTRIBUTORS.txt file in the distribution for a
- * full listing of individual contributors.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-import UserNotifications
-
-open class ORNotificationService: UNNotificationServiceExtension {
-
- public var contentHandler: ((UNNotificationContent) -> Void)?
- public var bestAttemptContent: UNMutableNotificationContent?
-
- open override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
- self.contentHandler = contentHandler
- bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
-
- if let bestAttemptContent = bestAttemptContent {
-
- let categoryName = "openremoteNotification"
- bestAttemptContent.categoryIdentifier = categoryName
-
- //Buttons
- if let buttonsString = bestAttemptContent.userInfo[DefaultsKey.buttonsKey] as? String {
- if let buttonsData = buttonsString.data(using: .utf8) {
- if let buttons = try? JSONDecoder().decode([ORPushNotificationButton].self, from: buttonsData) {
-
- var notificationActions = [UNNotificationAction]()
-
- for button in buttons {
- if button.action != nil {
- notificationActions.append(UNNotificationAction(identifier: button.title, title: button.title, options: UNNotificationActionOptions.foreground))
- } else {
- notificationActions.append(UNNotificationAction(identifier: "declineAction", title: button.title, options: UNNotificationActionOptions.destructive))
- }
- }
-
- let category = UNNotificationCategory(identifier: categoryName, actions: notificationActions, intentIdentifiers: [], options: [])
- let categories : Set = [category]
- UNUserNotificationCenter.current().setNotificationCategories(categories)
- }
- }
- }
- //Actions
- if let actionString = bestAttemptContent.userInfo[DefaultsKey.actionKey] as? String {
- if let actionsData = actionString.data(using: .utf8){
- if let action = try? JSONDecoder().decode(ORPushNotificationAction.self, from: actionsData) {
-
- bestAttemptContent.userInfo[ActionType.appUrl] = action.url
- bestAttemptContent.userInfo[ActionType.silent] = action.silent
- bestAttemptContent.userInfo[ActionType.openInBrowser] = action.openInBrowser
- bestAttemptContent.userInfo[ActionType.httpMethod] = action.httpMethod ?? "GET"
- bestAttemptContent.userInfo[DefaultsKey.dataKey] = action.data ?? "null"
- }
- }
- }
-
- if let notificationIdString = bestAttemptContent.userInfo[ActionType.notificationId] as? String, let notificationId = Int64(notificationIdString) {
- if let defaults = UserDefaults(suiteName: ORAppGroup.entitlement), let consoleId = defaults.string(forKey: GeofenceProvider.consoleIdKey) {
- ORNotificationResource.sharedInstance.notificationDelivered(notificationId: notificationId, targetId: consoleId)
- }
- }
-
- contentHandler(bestAttemptContent.copy() as! UNNotificationContent)
- }
- }
-
-
- open override func serviceExtensionTimeWillExpire() {
- // Called just before the extension will be terminated by the system.
- // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
- NSLog("NotifExtension Time has expired")
- if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
- //Actions
- if let actionString = bestAttemptContent.userInfo[DefaultsKey.actionKey] as? String {
- if let actionsData = actionString.data(using: .utf8){
- if let action = try? JSONDecoder().decode(ORPushNotificationAction.self, from: actionsData) {
-
- bestAttemptContent.userInfo[ActionType.appUrl] = action.url
- bestAttemptContent.userInfo[ActionType.silent] = action.silent
- bestAttemptContent.userInfo[ActionType.openInBrowser] = action.openInBrowser
- bestAttemptContent.userInfo[ActionType.httpMethod] = action.httpMethod ?? "GET"
- bestAttemptContent.userInfo[DefaultsKey.dataKey] = action.data ?? "null"
- }
- }
- }
- contentHandler(bestAttemptContent)
- }
- }
-}
-
diff --git a/console/iOS/ORLib/ORLib/ORPushNotificationAction.swift b/console/iOS/ORLib/ORLib/ORPushNotificationAction.swift
deleted file mode 100644
index c173d16b1..000000000
--- a/console/iOS/ORLib/ORLib/ORPushNotificationAction.swift
+++ /dev/null
@@ -1,16 +0,0 @@
-//
-// ORPushNotificationAction.swift
-// ORLib
-//
-// Created by Michael Rademaker on 01/08/2018.
-//
-
-import UIKit
-
-public struct ORPushNotificationAction: Decodable {
- public let url: String
- public let httpMethod: String?
- public let data: String?
- public let silent: Bool
- public let openInBrowser: Bool
-}
diff --git a/console/iOS/ORLib/ORLib/ORPushNotificationButton.swift b/console/iOS/ORLib/ORLib/ORPushNotificationButton.swift
deleted file mode 100644
index 9ebdcc485..000000000
--- a/console/iOS/ORLib/ORLib/ORPushNotificationButton.swift
+++ /dev/null
@@ -1,13 +0,0 @@
-//
-// ORPushNotificationButton.swift
-// ORLib
-//
-// Created by Michael Rademaker on 07/08/2018.
-//
-
-import UIKit
-
-public struct ORPushNotificationButton: Decodable {
- public let title: String
- public let action: ORPushNotificationAction?
-}
diff --git a/console/iOS/ORLib/ORLib/ORViewController.swift b/console/iOS/ORLib/ORLib/ORViewController.swift
deleted file mode 100644
index 085bb9ea9..000000000
--- a/console/iOS/ORLib/ORLib/ORViewController.swift
+++ /dev/null
@@ -1,441 +0,0 @@
-/*
- * Copyright 2017, OpenRemote Inc.
- *
- * See the CONTRIBUTORS.txt file in the distribution for a
- * full listing of individual contributors.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-import Foundation
-import UIKit
-import WebKit
-
-open class ORViewcontroller : UIViewController {
-
- public var data : Data?
- public var myWebView : WKWebView?
- public var webProgressBar: UIProgressView?
- public var defaults : UserDefaults?
- public var webCfg : WKWebViewConfiguration?
- public var isLoading = false
-
- var geofenceProvider: GeofenceProvider?
- var pushProvider: PushNotificationProvider?
- var storageProvider: StorageProvider?
-
- open override func viewDidLoad() {
- super.viewDidLoad()
- view.backgroundColor = UIColor.white
- }
-
- open override func viewWillAppear(_ animated: Bool) {
- super.viewWillAppear(animated)
- self.configureAccess()
- }
-
- open func login() {
- guard let request = URL(string: String(format:"\(ORServer.scheme)://%@/%@", ORServer.hostURL, ORServer.initialPath)) else { return }
- UIApplication.shared.isNetworkActivityIndicatorVisible = true
- _ = self.myWebView?.load(URLRequest(url: request))
- isLoading = true
- }
-
- open func sendData(data: [String: Any?]) {
- if let theJSONData = try? JSONSerialization.data(
- withJSONObject: data,
- options: []) {
- let theJSONText = String(data: theJSONData,
- encoding: .utf8)
- let returnMessage = "OpenRemoteConsole._handleProviderResponse('\(theJSONText ?? "null")')"
- DispatchQueue.main.async {
- self.myWebView?.evaluateJavaScript("\(returnMessage)", completionHandler: { (any, error) in
- print("JSON string = \(theJSONText!)")
- })
- }
- }
- }
-
- open func configureAccess() {
- let webCfg:WKWebViewConfiguration = WKWebViewConfiguration()
- let userController:WKUserContentController = WKUserContentController()
-
- userController.add(self, name: "int")
-
- let exec_template : String? = ""
- let userScript:WKUserScript = WKUserScript(source: exec_template!, injectionTime: .atDocumentStart, forMainFrameOnly: true)
- userController.addUserScript(userScript)
-
- webCfg.userContentController = userController;
- let sbHeight: CGFloat
- if #available(iOS 11.0, *) {
- sbHeight = UIApplication.shared.keyWindow?.safeAreaInsets.top ?? UIApplication.shared.statusBarFrame.height
- } else {
- sbHeight = UIApplication.shared.statusBarFrame.height
- }
- let webFrame = CGRect(x: 0, y: sbHeight, width: view.frame.size.width, height: view.frame.size.height - sbHeight)
- myWebView = WKWebView(frame: webFrame, configuration: webCfg)
- myWebView?.autoresizingMask = [.flexibleWidth, .flexibleHeight];
- myWebView?.navigationDelegate = self;
- //add observer to get estimated progress value
- myWebView?.addObserver(self, forKeyPath: "estimatedProgress", options: .new, context: nil);
-
- webProgressBar = UIProgressView(progressViewStyle: .bar)
- webProgressBar?.progressTintColor = UIColor.mainColorAccent
-
- view.addSubview(myWebView!)
- view.addSubview(webProgressBar!)
- view.bringSubviewToFront(webProgressBar!)
-
- webProgressBar?.translatesAutoresizingMaskIntoConstraints = false
- webProgressBar?.leadingAnchor.constraint(equalTo: myWebView!.leadingAnchor).isActive = true
- webProgressBar?.trailingAnchor.constraint(equalTo: myWebView!.trailingAnchor).isActive = true
- webProgressBar?.topAnchor.constraint(equalTo: myWebView!.topAnchor, constant: -2).isActive = true
- webProgressBar?.heightAnchor.constraint(equalToConstant: 2).isActive = true
- }
-
- override open func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
- if keyPath == "estimatedProgress" {
- if let webView = myWebView {
- webProgressBar?.progress = Float(webView.estimatedProgress);
- }
- }
- }
-
- func showProgressView() {
- if let progressBar = webProgressBar {
- UIView.animate(withDuration: 0.5, delay: 0, options: .curveEaseInOut, animations: {
- progressBar.alpha = 1
- }, completion: nil)
- }
- }
-
- func hideProgressView() {
- if let progressBar = webProgressBar {
- UIView.animate(withDuration: 0.5, delay: 0, options: .curveEaseInOut, animations: {
- progressBar.alpha = 0
- }, completion: nil)
- }
- }
-
- open func loadURL(url : URL) {
- UIApplication.shared.isNetworkActivityIndicatorVisible = true
- _ = self.myWebView?.load(URLRequest(url:url))
- isLoading = true
- }
-
- internal func handleError(errorCode: Int, description: String, failingUrl: String, isForMainFrame: Bool) {
- NSLog("%@", "Error requesting '\(failingUrl)': \(errorCode) (\(description))")
-
- // This will be the URL loaded into the webview itself (false for images etc. of the main page)
- if isForMainFrame {
-
- // Check page load error URL
- let errorUrl = ORServer.errorUrl
- if let errorURL = URL(string: errorUrl), ORServer.errorUrl != failingUrl {
- NSLog("%@", "Loading error URL: \(errorUrl)")
- loadURL(url: errorURL)
- }
- } else {
-
- if ORServer.ignorePageErrors {
- return;
- }
-
- let error = NSError(domain: "", code: 0, userInfo: [
- NSLocalizedDescriptionKey : NSLocalizedString("HTTPErrorReturned", value: "Connection Error", comment: "Error requesting '\(failingUrl)': \(errorCode) (\(description))")
- ])
- if let vc = self.presentingViewController as? ORLoginViewController {
- vc.isInError = true
- }
- self.dismiss(animated: true) {
- ErrorManager.showError(error:error)
- }
- }
- }
-
- open func updateAttribute(assetId : String, attributeName : String, rawJson : String) {
- UIApplication.shared.isNetworkActivityIndicatorVisible = true
- TokenManager.sharedInstance.getAccessToken { (accessTokenResult) in
- switch accessTokenResult {
- case .Failure(let error) :
- UIApplication.shared.isNetworkActivityIndicatorVisible = false
- self.handleError(errorCode: 0, description: error!.localizedDescription, failingUrl: "", isForMainFrame: false)
- case .Success(let accessToken) :
- guard let urlRequest = URL(string: String(String(format: "\(ORServer.scheme)://%@/%@/asset/%@/attribute/%@", ORServer.hostURL, ORServer.realm, assetId, attributeName))) else { return }
- let request = NSMutableURLRequest(url: urlRequest)
- request.httpMethod = "PUT"
- request.addValue("application/json", forHTTPHeaderField: "Content-Type")
- request.httpBody = rawJson.data(using: .utf8)
- request.addValue(String(format:"Bearer %@", accessToken!), forHTTPHeaderField: "Authorization")
- let sessionConfiguration = URLSessionConfiguration.default
- let session = URLSession(configuration: sessionConfiguration, delegate: self, delegateQueue : nil)
- let reqDataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) in
- DispatchQueue.main.async {
- UIApplication.shared.isNetworkActivityIndicatorVisible = false
- if (error != nil) {
- self.handleError(errorCode: 0, description: error!.localizedDescription, failingUrl: "", isForMainFrame: false)
- }
- }
- })
- reqDataTask.resume()
- }
- }
- }
-}
-
-extension ORViewcontroller: URLSessionDelegate {
- open func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
- if (challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust) {
- if challenge.protectionSpace.host == ORServer.hostURL {
- completionHandler(.useCredential, URLCredential(trust: challenge.protectionSpace.serverTrust!))
- } else {
- completionHandler(.performDefaultHandling, nil)
- }
- }
- }
-}
-
-extension ORViewcontroller: WKScriptMessageHandler {
- open func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
- let jsonDictionnary = message.body as? [String : Any]
- if let type = jsonDictionnary?["type"] as? String {
- switch (type) {
- case "provider":
- if let postMessageDict = jsonDictionnary?[DefaultsKey.dataKey] as? [String: Any] {
- if let action = postMessageDict[DefaultsKey.actionKey] as? String {
- if let provider = postMessageDict[DefaultsKey.providerKey] as? String {
- switch (provider) {
- case Providers.push:
- switch(action) {
- case Actions.providerInit:
- pushProvider = PushNotificationProvider()
- pushProvider!.initialize(callback: { initalizeData in
- self.sendData(data: initalizeData)
- })
- case Actions.providerEnable:
- if let consoleId = postMessageDict[GeofenceProvider.consoleIdKey] as? String {
- pushProvider?.enable(consoleId: consoleId, callback: { enableData in
- self.sendData(data: enableData)
- })
- }
- case Actions.providerDisable:
- if let disableData = pushProvider?.disable() {
- sendData(data: disableData)
- }
- default:
- print("Wrong action \(action) for \(provider)")
- }
- case Providers.geofence:
- switch(action) {
- case Actions.providerInit:
- geofenceProvider = GeofenceProvider()
- let initializeData = geofenceProvider!.initialize()
- sendData(data: initializeData)
- case Actions.providerEnable:
- if let consoleId = postMessageDict[GeofenceProvider.consoleIdKey] as? String {
- geofenceProvider?.enable(baseUrl: "\(ORServer.baseUrl)api/\(ORServer.realm)", consoleId: consoleId, callback: { enableData in
- self.sendData(data: enableData)
- DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(5)) {
- self.geofenceProvider?.fetchGeofences()
- }
- })
- }
- case Actions.providerDisable:
- if let disableData = geofenceProvider?.disable() {
- sendData(data: disableData)
- }
- case Actions.geofenceRefresh:
- geofenceProvider?.refreshGeofences()
- case Actions.getLocation:
- geofenceProvider?.getLocation(callback: { locationData in
- if (locationData["data"] as? [String:Any]) == nil {
- 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 in
- if UIApplication.shared.canOpenURL(settingsUrl) {
- UIApplication.shared.open(settingsUrl, completionHandler: { (success) in
- print("Settings opened: \(success)") // Prints true
- })
- }
- }))
- alertController.addAction(UIAlertAction(title: NSLocalizedString(LocalizableString.LocationPermissionNotNow, comment: ""), style: .cancel, handler: nil))
- } else {
- alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
- }
- self.present(alertController, animated: true, completion: nil)
- }
- self.sendData(data: locationData)
- })
- default:
- print("Wrong action \(action) for \(provider)")
- }
- case Providers.storage:
- switch(action) {
- case Actions.providerInit:
- storageProvider = StorageProvider()
- let initializeData = storageProvider!.initialize()
- sendData(data: initializeData)
- case Actions.providerEnable:
- if let enableData = storageProvider?.enable() {
- sendData(data: enableData)
- }
- case Actions.providerDisable:
- if let disableData = storageProvider?.disable() {
- sendData(data: disableData)
- }
- case Actions.store:
- if let key = postMessageDict["key"] as? String {
- storageProvider?.store(key: key, data: postMessageDict["value"] as? String)
- }
- case Actions.retrieve:
- if let key = postMessageDict["key"] as? String {
- if let retrieveData = storageProvider?.retrieve(key: key) {
- sendData(data: retrieveData)
- }
- }
- default:
- print("Wrong action \(action) for \(provider)")
- }
- default:
- print("Unknown provider type: \(provider )")
- }
- }
- }
- }
- default:
- print("Unknown message type: \(type )")
- }
- }
- }
-}
-
-extension ORViewcontroller: WKNavigationDelegate {
- open func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping () -> Void) {
- NSLog("error %@", message)
- TokenManager.sharedInstance.resetTokenAndAuthenticate()
- self.dismiss(animated: true, completion: nil)
- completionHandler()
- }
-
- public func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
- showProgressView()
- }
-
- open func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
- if (navigationAction.request.url?.absoluteString.contains("logout"))! {
- TokenManager.sharedInstance.logout()
- decisionHandler(.cancel)
- self.dismiss(animated: false, completion: nil)
- } else if (navigationAction.request.url?.absoluteString.starts(with: "webbrowser"))! {
- if let url = navigationAction.request.url, var components = URLComponents(url: url, resolvingAgainstBaseURL: false) {
- components.scheme = "https"
- if let newUrl = components.url {
- UIApplication.shared.open(newUrl)
- }
- }
- decisionHandler(.cancel)
- } else {
- let app = UIApplication.shared
- if navigationAction.targetFrame == nil, let url = navigationAction.request.url{
- if app.canOpenURL(url) {
- app.open(url, options: convertToUIApplicationOpenExternalURLOptionsKeyDictionary([:]), completionHandler: nil)
- decisionHandler(.cancel)
- }
- } else {
- decisionHandler(.allow)
- }
- }
- isLoading = false
- }
-
- open func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) {
- if let response = navigationResponse.response as? HTTPURLResponse {
- if response.statusCode != 200 && response.statusCode != 204 {
- decisionHandler(.cancel)
-
- if response.url?.lastPathComponent == "token" && response.statusCode == 400 {
- TokenManager.sharedInstance.resetToken()
- }
-
- isLoading = false
- handleError(errorCode: response.statusCode, description: "Error in request", failingUrl: response.url?.absoluteString ?? "", isForMainFrame: true)
- return
- }
- }
- isLoading = false
- decisionHandler(.allow)
- }
-
- open func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
- NSLog("error %@", error.localizedDescription)
- UIApplication.shared.isNetworkActivityIndicatorVisible = false
- if let err = error as? URLError {
-
- let httpCode: Int
- switch(err.code) {
- case .cannotFindHost:
- httpCode = 404
- default:
- httpCode = 500
- }
-
- handleError(errorCode: httpCode, description: err.localizedDescription, failingUrl: err.failureURLString ?? "", isForMainFrame: true)
- } else {
- handleError(errorCode: 0, description: error.localizedDescription, failingUrl: webView.url?.absoluteString ?? "", isForMainFrame: true)
- }
- }
-
- open func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
- if (challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust) {
- if challenge.protectionSpace.host == ORServer.hostURL {
- completionHandler(.useCredential, URLCredential(trust: challenge.protectionSpace.serverTrust!))
- } else {
- completionHandler(.performDefaultHandling, nil)
- }
- }
- }
-
- open func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
- UIApplication.shared.isNetworkActivityIndicatorVisible = false
- hideProgressView()
- }
-
- public func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
- NSLog("error %@", error.localizedDescription)
- UIApplication.shared.isNetworkActivityIndicatorVisible = false
- if let err = error as? URLError {
-
- let httpCode: Int
- switch(err.code) {
- case .cannotFindHost:
- httpCode = 404
- default:
- httpCode = 500
- }
-
- handleError(errorCode: httpCode, description: err.localizedDescription, failingUrl: err.failureURLString ?? "", isForMainFrame: true)
- } else {
- handleError(errorCode: 0, description: error.localizedDescription, failingUrl: webView.url?.absoluteString ?? "", isForMainFrame: true)
- }
- hideProgressView()
- }
-}
-
-// Helper function inserted by Swift 4.2 migrator.
-fileprivate func convertToUIApplicationOpenExternalURLOptionsKeyDictionary(_ input: [String: Any]) -> [UIApplication.OpenExternalURLOptionsKey: Any] {
- return Dictionary(uniqueKeysWithValues: input.map { key, value in (UIApplication.OpenExternalURLOptionsKey(rawValue: key), value)})
-}
diff --git a/console/iOS/ORLib/ORLib/ProjectConstants.swift b/console/iOS/ORLib/ORLib/ProjectConstants.swift
deleted file mode 100644
index 754e12bcf..000000000
--- a/console/iOS/ORLib/ORLib/ProjectConstants.swift
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2017, OpenRemote Inc.
- *
- * See the CONTRIBUTORS.txt file in the distribution for a
- * full listing of individual contributors.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-import Foundation
-import UIKit
-
-public enum ORServer {
- public static var scheme = "https"
- public static var hostURL = "openremote.io"
- public static var initialPath = "console/\(ORServer.realm)/"
- public static var navigationPath = "console/\(ORServer.realm)/"
- public static var realm = "openremote"
- public static var baseUrl = "\(ORServer.scheme)://\(ORServer.hostURL)/"
- public static var apiTestResource = String(format:"\(ORServer.scheme)://%@/%@/notification/alert",ORServer.hostURL,ORServer.realm)
- public static var errorUrl = ""
- public static var ignorePageErrors = false
-
- public static var registerDeviceResource = String(format:"\(ORServer.scheme)://%@/%@/notification/token",ORServer.hostURL,ORServer.realm)
- public static var deleteNotifiedAlertResource = String(format:"\(ORServer.scheme)://%@/%@/notification/alert/",ORServer.hostURL,ORServer.realm)
-}
-
-public enum ORClient {
- public static var clientId = "openremote"
-}
-
-public enum ORFCM {
- public static var serverKey = "Dummy"
-}
-
-public enum ORAppGroup {
- public static var entitlement = "group.org.openremote.console"
-}
-
-extension UIColor {
- public static var mainColor = UIColor(red:0.22, green:0.30, blue:0.31, alpha:1.0)
- public static var mainColorDark = UIColor(red:0.15, green:0.20, blue:0.22, alpha:1.0)
- 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"
-}
-
diff --git a/console/iOS/ORLib/ORLib/PushNotificationProvider.swift b/console/iOS/ORLib/ORLib/PushNotificationProvider.swift
deleted file mode 100644
index 30a437c78..000000000
--- a/console/iOS/ORLib/ORLib/PushNotificationProvider.swift
+++ /dev/null
@@ -1,126 +0,0 @@
-//
-// PushNotificationProvider.swift
-// Eindhoven
-//
-// Created by Michael Rademaker on 25/05/2018.
-// Copyright © 2018 OpenRemote Inc. All rights reserved.
-//
-
-import UIKit
-import UserNotifications
-
-public class PushNotificationProvider: NSObject {
-
- let userdefaults = UserDefaults(suiteName: ORAppGroup.entitlement)
- let version = "fcm"
- public var consoleId: String = ""
- static let pushDisabledKey = "pushDisabled"
-
- public override init() {
- super.init()
- }
-
- public func initialize(callback:@escaping ([String: Any?]) ->(Void)) {
- UNUserNotificationCenter.current().getNotificationSettings { (settings) in
- switch settings.authorizationStatus {
-
- case .authorized, .provisional:
- callback( [
- DefaultsKey.actionKey: Actions.providerInit,
- DefaultsKey.providerKey: Providers.push,
- DefaultsKey.versionKey: self.version,
- DefaultsKey.hasPermissionKey: true,
- DefaultsKey.requiresPermissionKey: true,
- DefaultsKey.successKey: true,
- DefaultsKey.enabledKey: false,
- DefaultsKey.disabledKey: self.userdefaults?.bool(forKey: PushNotificationProvider.pushDisabledKey) ?? false
- ])
-
- case .denied:
- callback( [
- DefaultsKey.actionKey: Actions.providerInit,
- DefaultsKey.providerKey: Providers.push,
- DefaultsKey.versionKey: self.version,
- DefaultsKey.hasPermissionKey: false,
- DefaultsKey.requiresPermissionKey: true,
- DefaultsKey.successKey: true,
- DefaultsKey.enabledKey: false,
- DefaultsKey.disabledKey: self.userdefaults?.bool(forKey: PushNotificationProvider.pushDisabledKey) ?? false
- ])
-
- default:
- callback( [
- DefaultsKey.actionKey: Actions.providerInit,
- DefaultsKey.providerKey: Providers.push,
- DefaultsKey.versionKey: self.version,
- DefaultsKey.hasPermissionKey: nil,
- DefaultsKey.requiresPermissionKey: true,
- DefaultsKey.successKey: true,
- DefaultsKey.enabledKey: false,
- DefaultsKey.disabledKey: self.userdefaults?.bool(forKey: PushNotificationProvider.pushDisabledKey) ?? false
- ])
- }
- }
- }
-
- public func enable(consoleId: String, callback:@escaping ([String: Any]) ->(Void)) {
- self.consoleId = consoleId
- userdefaults?.set(self.consoleId, forKey: GeofenceProvider.consoleIdKey)
- userdefaults?.removeObject(forKey: PushNotificationProvider.pushDisabledKey)
- userdefaults?.synchronize()
- UNUserNotificationCenter.current().getNotificationSettings { (settings) in
-
- switch settings.authorizationStatus {
- case .authorized, .provisional:
- DispatchQueue.main.async {
- UIApplication.shared.registerForRemoteNotifications()
- }
- callback([
- DefaultsKey.actionKey: Actions.providerEnable,
- DefaultsKey.providerKey: Providers.push,
- DefaultsKey.hasPermissionKey: true,
- DefaultsKey.successKey: true,
- DefaultsKey.dataKey: ["token": self.userdefaults?.string(forKey: DefaultsKey.fcmTokenKey)]
- ])
-
- case .denied:
- callback([
- DefaultsKey.actionKey: Actions.providerEnable,
- DefaultsKey.providerKey: Providers.push,
- DefaultsKey.hasPermissionKey: false,
- DefaultsKey.successKey: true,
- DefaultsKey.dataKey: ["token": self.userdefaults?.string(forKey: DefaultsKey.fcmTokenKey)]
- ])
-
- default:
- UNUserNotificationCenter.current().requestAuthorization(
- options: [.alert, .badge, .sound],
- completionHandler: {granted, _ in
- if granted {
- DispatchQueue.main.async {
- UIApplication.shared.registerForRemoteNotifications()
- }
- }
-
- callback([
- DefaultsKey.actionKey: Actions.providerEnable,
- DefaultsKey.providerKey: Providers.push,
- DefaultsKey.hasPermissionKey: granted,
- DefaultsKey.successKey: true,
- DefaultsKey.dataKey: ["token": self.userdefaults?.string(forKey: DefaultsKey.fcmTokenKey)]
- ])
- })
-
- }
- }
- }
-
- public func disable()-> [String: Any] {
- userdefaults?.set(true, forKey: PushNotificationProvider.pushDisabledKey)
- userdefaults?.synchronize()
- return [
- DefaultsKey.actionKey: Actions.providerDisable,
- DefaultsKey.providerKey: Providers.push
- ]
- }
-}
diff --git a/console/iOS/ORLib/ORLib/Reachability.swift b/console/iOS/ORLib/ORLib/Reachability.swift
deleted file mode 100644
index 8022c8371..000000000
--- a/console/iOS/ORLib/ORLib/Reachability.swift
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- Copyright (c) 2014, Ashley Mills
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- */
-
-import SystemConfiguration
-import Foundation
-
-public enum ReachabilityError: Error {
- case FailedToCreateWithAddress(sockaddr_in)
- case FailedToCreateWithHostname(String)
- case UnableToSetCallback
- case UnableToSetDispatchQueue
-}
-
-@available(*, unavailable, renamed: "Notification.Name.reachabilityChanged")
-public let ReachabilityChangedNotification = NSNotification.Name("ReachabilityChangedNotification")
-
-extension Notification.Name {
- public static let reachabilityChanged = Notification.Name("reachabilityChanged")
-}
-
-func callback(reachability:SCNetworkReachability, flags: SCNetworkReachabilityFlags, info: UnsafeMutableRawPointer?) {
-
- guard let info = info else { return }
-
- let reachability = Unmanaged<Reachability>.fromOpaque(info).takeUnretainedValue()
- reachability.reachabilityChanged()
-}
-
-public class Reachability {
-
- public typealias NetworkReachable = (Reachability) -> ()
- public typealias NetworkUnreachable = (Reachability) -> ()
-
- @available(*, unavailable, renamed: "Conection")
- public enum NetworkStatus: CustomStringConvertible {
- case notReachable, reachableViaWiFi, reachableViaWWAN
- public var description: String {
- switch self {
- case .reachableViaWWAN: return "Cellular"
- case .reachableViaWiFi: return "WiFi"
- case .notReachable: return "No Connection"
- }
- }
- }
-
- public enum Connection: CustomStringConvertible {
- case none, wifi, cellular
- public var description: String {
- switch self {
- case .cellular: return "Cellular"
- case .wifi: return "WiFi"
- case .none: return "No Connection"
- }
- }
- }
-
- public var whenReachable: NetworkReachable?
- public var whenUnreachable: NetworkUnreachable?
-
- @available(*, deprecated: 4.0, renamed: "allowsCellularConnection")
- public let reachableOnWWAN: Bool = true
-
- /// Set to `false` to force Reachability.connection to .none when on cellular connection (default value `true`)
- public var allowsCellularConnection: Bool
-
- // The notification center on which "reachability changed" events are being posted
- public var notificationCenter: NotificationCenter = NotificationCenter.default
-
- @available(*, deprecated: 4.0, renamed: "connection.description")
- public var currentReachabilityString: String {
- return "\(connection)"
- }
-
- @available(*, unavailable, renamed: "connection")
- public var currentReachabilityStatus: Connection {
- return connection
- }
-
- public var connection: Connection {
-
- guard isReachableFlagSet else { return .none }
-
- // If we're reachable, but not on an iOS device (i.e. simulator), we must be on WiFi
- guard isRunningOnDevice else { return .wifi }
-
- var connection = Connection.none
-
- if !isConnectionRequiredFlagSet {
- connection = .wifi
- }
-
- if isConnectionOnTrafficOrDemandFlagSet {
- if !isInterventionRequiredFlagSet {
- connection = .wifi
- }
- }
-
- if isOnWWANFlagSet {
- if !allowsCellularConnection {
- connection = .none
- } else {
- connection = .cellular
- }
- }
-
- return connection
- }
-
- fileprivate var previousFlags: SCNetworkReachabilityFlags?
-
- fileprivate var isRunningOnDevice: Bool = {
- #if targetEnvironment(simulator)
- return false
- #else
- return true
- #endif
- }()
-
- fileprivate var notifierRunning = false
- fileprivate let reachabilityRef: SCNetworkReachability
-
- fileprivate let reachabilitySerialQueue = DispatchQueue(label: "uk.co.ashleymills.reachability")
-
- required public init(reachabilityRef: SCNetworkReachability) {
- allowsCellularConnection = true
- self.reachabilityRef = reachabilityRef
- }
-
- public convenience init?(hostname: String) {
-
- guard let ref = SCNetworkReachabilityCreateWithName(nil, hostname) else { return nil }
-
- self.init(reachabilityRef: ref)
- }
-
- public convenience init?() {
-
- var zeroAddress = sockaddr()
- zeroAddress.sa_len = UInt8(MemoryLayout<sockaddr>.size)
- zeroAddress.sa_family = sa_family_t(AF_INET)
-
- guard let ref = SCNetworkReachabilityCreateWithAddress(nil, &zeroAddress) else { return nil }
-
- self.init(reachabilityRef: ref)
- }
-
- deinit {
- stopNotifier()
- }
-}
-
-public extension Reachability {
-
- // MARK: - *** Notifier methods ***
- func startNotifier() throws {
-
- guard !notifierRunning else { return }
-
- var context = SCNetworkReachabilityContext(version: 0, info: nil, retain: nil, release: nil, copyDescription: nil)
- context.info = UnsafeMutableRawPointer(Unmanaged<Reachability>.passUnretained(self).toOpaque())
- if !SCNetworkReachabilitySetCallback(reachabilityRef, callback, &context) {
- stopNotifier()
- throw ReachabilityError.UnableToSetCallback
- }
-
- if !SCNetworkReachabilitySetDispatchQueue(reachabilityRef, reachabilitySerialQueue) {
- stopNotifier()
- throw ReachabilityError.UnableToSetDispatchQueue
- }
-
- // Perform an initial check
- reachabilitySerialQueue.async {
- self.reachabilityChanged()
- }
-
- notifierRunning = true
- }
-
- func stopNotifier() {
- defer { notifierRunning = false }
-
- SCNetworkReachabilitySetCallback(reachabilityRef, nil, nil)
- SCNetworkReachabilitySetDispatchQueue(reachabilityRef, nil)
- }
-
- // MARK: - *** Connection test methods ***
- @available(*, deprecated: 4.0, message: "Please use `connection != .none`")
- var isReachable: Bool {
-
- guard isReachableFlagSet else { return false }
-
- if isConnectionRequiredAndTransientFlagSet {
- return false
- }
-
- if isRunningOnDevice {
- if isOnWWANFlagSet && !reachableOnWWAN {
- // We don't want to connect when on cellular connection
- return false
- }
- }
-
- return true
- }
-
- @available(*, deprecated: 4.0, message: "Please use `connection == .cellular`")
- var isReachableViaWWAN: Bool {
- // Check we're not on the simulator, we're REACHABLE and check we're on WWAN
- return isRunningOnDevice && isReachableFlagSet && isOnWWANFlagSet
- }
-
- @available(*, deprecated: 4.0, message: "Please use `connection == .wifi`")
- var isReachableViaWiFi: Bool {
-
- // Check we're reachable
- guard isReachableFlagSet else { return false }
-
- // If reachable we're reachable, but not on an iOS device (i.e. simulator), we must be on WiFi
- guard isRunningOnDevice else { return true }
-
- // Check we're NOT on WWAN
- return !isOnWWANFlagSet
- }
-
- var description: String {
-
- let W = isRunningOnDevice ? (isOnWWANFlagSet ? "W" : "-") : "X"
- let R = isReachableFlagSet ? "R" : "-"
- let c = isConnectionRequiredFlagSet ? "c" : "-"
- let t = isTransientConnectionFlagSet ? "t" : "-"
- let i = isInterventionRequiredFlagSet ? "i" : "-"
- let C = isConnectionOnTrafficFlagSet ? "C" : "-"
- let D = isConnectionOnDemandFlagSet ? "D" : "-"
- let l = isLocalAddressFlagSet ? "l" : "-"
- let d = isDirectFlagSet ? "d" : "-"
-
- return "\(W)\(R) \(c)\(t)\(i)\(C)\(D)\(l)\(d)"
- }
-}
-
-fileprivate extension Reachability {
-
- func reachabilityChanged() {
- guard previousFlags != flags else { return }
-
- let block = connection != .none ? whenReachable : whenUnreachable
-
- DispatchQueue.main.async {
- block?(self)
- self.notificationCenter.post(name: .reachabilityChanged, object:self)
- }
-
- previousFlags = flags
- }
-
- var isOnWWANFlagSet: Bool {
- #if os(iOS)
- return flags.contains(.isWWAN)
- #else
- return false
- #endif
- }
- var isReachableFlagSet: Bool {
- return flags.contains(.reachable)
- }
- var isConnectionRequiredFlagSet: Bool {
- return flags.contains(.connectionRequired)
- }
- var isInterventionRequiredFlagSet: Bool {
- return flags.contains(.interventionRequired)
- }
- var isConnectionOnTrafficFlagSet: Bool {
- return flags.contains(.connectionOnTraffic)
- }
- var isConnectionOnDemandFlagSet: Bool {
- return flags.contains(.connectionOnDemand)
- }
- var isConnectionOnTrafficOrDemandFlagSet: Bool {
- return !flags.intersection([.connectionOnTraffic, .connectionOnDemand]).isEmpty
- }
- var isTransientConnectionFlagSet: Bool {
- return flags.contains(.transientConnection)
- }
- var isLocalAddressFlagSet: Bool {
- return flags.contains(.isLocalAddress)
- }
- var isDirectFlagSet: Bool {
- return flags.contains(.isDirect)
- }
- var isConnectionRequiredAndTransientFlagSet: Bool {
- return flags.intersection([.connectionRequired, .transientConnection]) == [.connectionRequired, .transientConnection]
- }
-
- var flags: SCNetworkReachabilityFlags {
- var flags = SCNetworkReachabilityFlags()
- if SCNetworkReachabilityGetFlags(reachabilityRef, &flags) {
- return flags
- } else {
- return SCNetworkReachabilityFlags()
- }
- }
-}
-
diff --git a/console/iOS/ORLib/ORLib/StorageProvider.swift b/console/iOS/ORLib/ORLib/StorageProvider.swift
deleted file mode 100644
index 2ccbe67a7..000000000
--- a/console/iOS/ORLib/ORLib/StorageProvider.swift
+++ /dev/null
@@ -1,59 +0,0 @@
-//
-// StorageProvider.swift
-// GoogleToolboxForMac
-//
-// Created by Michael Rademaker on 05/02/2019.
-//
-
-import UIKit
-
-class StorageProvider: NSObject {
-
- let userdefaults = UserDefaults(suiteName: ORAppGroup.entitlement)
-
- public func initialize() -> [String: Any] {
- return [
- DefaultsKey.actionKey: Actions.providerInit,
- DefaultsKey.providerKey: Providers.storage,
- DefaultsKey.versionKey: "1.0.0",
- DefaultsKey.requiresPermissionKey: false,
- DefaultsKey.hasPermissionKey: true,
- DefaultsKey.successKey: true,
- DefaultsKey.enabledKey: true
- ]
- }
-
- public func enable() -> [String: Any] {
- return [
- DefaultsKey.actionKey: Actions.providerEnable,
- DefaultsKey.providerKey: Providers.storage,
- DefaultsKey.hasPermissionKey: true,
- DefaultsKey.successKey: true,
- ]
- }
-
- public func store(key: String, data: String?) {
- if let dataToStore = data {
- userdefaults?.set(dataToStore, forKey: key)
- } else {
- userdefaults?.removeObject(forKey: key)
- }
- userdefaults?.synchronize()
- }
-
- public func retrieve(key: String) -> [String: Any] {
- return [
- DefaultsKey.actionKey: Actions.retrieve,
- DefaultsKey.providerKey: Providers.storage,
- "key": key,
- "value": userdefaults?.string(forKey:key) ?? "null"
- ]
- }
-
- public func disable()-> [String: Any] {
- return [
- DefaultsKey.actionKey: Actions.providerDisable,
- DefaultsKey.providerKey: Providers.storage
- ]
- }
-}
diff --git a/console/iOS/ORLib/ORLib/TokenManager.swift b/console/iOS/ORLib/ORLib/TokenManager.swift
deleted file mode 100644
index e02b5388e..000000000
--- a/console/iOS/ORLib/ORLib/TokenManager.swift
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- * Copyright 2017, OpenRemote Inc.
- *
- * See the CONTRIBUTORS.txt file in the distribution for a
- * full listing of individual contributors.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-import Foundation
-import UIKit
-import WebKit
-
-public class TokenManager:NSObject, URLSessionDelegate {
-
- let defaults = UserDefaults(suiteName: ORAppGroup.entitlement)
-
- public static let sharedInstance = TokenManager()
-
- public func logout() {
- resetToken()
- }
-
- public func resetToken() {
- defaults?.removeObject(forKey: DefaultsKey.fcmDeviceIdKey)
- defaults?.removeObject(forKey: DefaultsKey.refreshTokenKey)
- defaults?.removeObject(forKey: DefaultsKey.fcmTokenKey)
- }
-
- public func resetTokenAndAuthenticate() {
- resetToken()
- }
-
- public func storeDeviceId(token : String, deviceId: String) {
- defaults?.set(token, forKey: DefaultsKey.fcmTokenKey)
- defaults?.set(deviceId, forKey: DefaultsKey.fcmDeviceIdKey)
- sendDeviceId()
- }
-
- private func sendDeviceId() {
- if let fcmToken = defaults?.string(forKey: DefaultsKey.fcmTokenKey), let deviceId = defaults?.string(forKey: DefaultsKey.fcmDeviceIdKey) {
- UIApplication.shared.isNetworkActivityIndicatorVisible = true
- self.getAccessToken { (accessTokenResult) in
- switch accessTokenResult {
- case .Failure(let error) :
- UIApplication.shared.isNetworkActivityIndicatorVisible = false
- ErrorManager.showError(error: error!)
- case .Success(let accessToken) :
- guard let urlRequest = URL(string: String(ORServer.registerDeviceResource)) else { return }
- let request = NSMutableURLRequest(url: urlRequest)
- request.addValue("application/x-www-form-urlencoded", forHTTPHeaderField:"Content-Type");
- request.httpMethod = "PUT"
- let postString = String(format:"token=%@&device_id=%@", fcmToken, deviceId)
- request.httpBody = postString.data(using: .utf8)
- request.addValue(String(format:"Bearer %@", accessToken!), forHTTPHeaderField: "Authorization")
- let sessionConfiguration = URLSessionConfiguration.default
- let session = URLSession(configuration: sessionConfiguration, delegate: self, delegateQueue: nil)
- let reqDataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) in
- DispatchQueue.main.async {
- UIApplication.shared.isNetworkActivityIndicatorVisible = false
- if (error != nil) {
- NSLog("error %@", (error! as NSError).localizedDescription)
- let error = NSError(domain: "", code: 0, userInfo: [
- NSLocalizedDescriptionKey : NSLocalizedString("ErrorCallingAPI", value: "Could not get data", comment: "")
- ])
- ErrorManager.showError(error: error)
- } else {
- if let httpStatus = response as? HTTPURLResponse , httpStatus.statusCode != 204 {
- NSLog("Device not registred ",response.debugDescription)
- let error = NSError(domain: "", code: 0, userInfo: [
- NSLocalizedDescriptionKey : NSLocalizedString("ErrorSendingDeviceId", value: "Could not register your device for notifications", comment: "")
- ])
- ErrorManager.showError(error: error)
- } else {
- NSLog("Device registred with token %@",postString)
- let notificationName = Notification.Name(NotificationsNames.isdeviceIdSent)
- NotificationCenter.default.post(name: notificationName, object: nil)
- }
- }
- }
- })
- reqDataTask.resume()
- }
- }
- }
- }
-
- public func getAccessToken(callback: @escaping (AccesTokenResult<String>) -> ()) {
- guard let tkurlRequest = URL(string: String(format:"\(ORServer.scheme)://%@/auth/realms/%@/protocol/openid-connect/token", ORServer.hostURL, ORServer.realm)) else { return }
-
- guard let refreshToken = defaults?.string(forKey: DefaultsKey.refreshTokenKey) else { return }
-
- let tkRequest = NSMutableURLRequest(url: tkurlRequest)
- tkRequest.addValue("application/x-www-form-urlencoded", forHTTPHeaderField:"Content-Type");
- tkRequest.httpMethod = "POST"
- let postString = String(format:"grant_type=refresh_token&refresh_token=%@&client_id=%@", refreshToken, ORClient.clientId)
-
- tkRequest.httpBody = postString.data(using: .utf8)
- let sessionConfiguration = URLSessionConfiguration.default
- let session = URLSession(configuration: sessionConfiguration, delegate: self, delegateQueue: nil)
- let req = session.dataTask(with: tkRequest as URLRequest, completionHandler: { (data, response, error) in
- if (data != nil){
- do {
- let jsonDictionnary: Dictionary = try JSONSerialization.jsonObject(with: data!, options: []) as! [String:Any]
- if ((jsonDictionnary["access_token"]) != nil) {
- callback(AccesTokenResult.Success(jsonDictionnary["access_token"] as? String))
- } else {
- if let httpResponse = response as? HTTPURLResponse {
- NSLog("error %@", httpResponse)
- self.resetToken()
- let error = NSError(domain: "", code: httpResponse.statusCode, userInfo: [
- NSLocalizedDescriptionKey : NSLocalizedString("ErrorCallingAPI", value: "Could not get data", comment: "")
- ])
- callback(AccesTokenResult.Failure(error))
- } else {
- if (error != nil) {
- NSLog("error %@", (error! as NSError).localizedDescription as String)
- }
- self.resetToken()
- let error = NSError(domain: "", code: 0, userInfo: [
- NSLocalizedDescriptionKey : NSLocalizedString("ErrorCallingAPI", value: "Could not get data", comment: "")
- ])
- callback(AccesTokenResult.Failure(error))
- }
- }
- }
- catch let error as NSError {
- NSLog("error %@", error.localizedDescription)
- let error = NSError(domain: "", code: 0, userInfo: [
- NSLocalizedDescriptionKey : NSLocalizedString("ErrorDeserializingJSON", value: "Could not convert received data", comment: "")
- ])
- callback(AccesTokenResult.Failure(error))
- }
- } else {
- NSLog("error %@", (error! as NSError).localizedDescription)
- let error = NSError(domain: "", code: 0, userInfo: [
- NSLocalizedDescriptionKey : NSLocalizedString("NoDataReceived", value: "Did not receive any data", comment: "")
- ])
- callback(AccesTokenResult.Failure(error))
- }
- })
- req.resume()
- }
-
- public func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
- if (challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust) {
- if challenge.protectionSpace.host == ORServer.hostURL {
- completionHandler(.useCredential, URLCredential(trust: challenge.protectionSpace.serverTrust!))
- } else {
- completionHandler(.performDefaultHandling, nil)
- }
- }
- }
-}
diff --git a/console/iOS/GenericApp/GenericApp/UI/ErrorManager.swift b/console/iOS/ORLib/ORLib/UI/ErrorManager.swift
similarity index 100%
rename from console/iOS/GenericApp/GenericApp/UI/ErrorManager.swift
rename to console/iOS/ORLib/ORLib/UI/ErrorManager.swift
diff --git a/console/iOS/GenericApp/GenericApp/UI/ORTextInput.swift b/console/iOS/ORLib/ORLib/UI/ORTextInput.swift
similarity index 93%
rename from console/iOS/GenericApp/GenericApp/UI/ORTextInput.swift
rename to console/iOS/ORLib/ORLib/UI/ORTextInput.swift
index 2fe4aa1e2..ec29aebf0 100644
--- a/console/iOS/GenericApp/GenericApp/UI/ORTextInput.swift
+++ b/console/iOS/ORLib/ORLib/UI/ORTextInput.swift
@@ -10,7 +10,7 @@ import UIKit
import MaterialComponents.MaterialTextFields
@IBDesignable // Lets you change a UIView instance in storyboard to this class, so you can visualize it and add constraints to it
-class ORTextInput: UIView {
+public class ORTextInput: UIView {
private var textInput: MDCTextField!
private var controller: MDCTextInputControllerFilled!
@@ -27,13 +27,13 @@ class ORTextInput: UIView {
}
}
- var textField: UITextField? {
+ public var textField: UITextField? {
get {
return textInput
}
}
- override func layoutSubviews() {
+ public override func layoutSubviews() {
setupInputView()
setupContoller()
}
diff --git a/console/iOS/GenericApp/GenericApp/UI/ORViewController.swift b/console/iOS/ORLib/ORLib/UI/ORViewController.swift
similarity index 92%
rename from console/iOS/GenericApp/GenericApp/UI/ORViewController.swift
rename to console/iOS/ORLib/ORLib/UI/ORViewController.swift
index 48e1f10ec..5663db8d3 100644
--- a/console/iOS/GenericApp/GenericApp/UI/ORViewController.swift
+++ b/console/iOS/ORLib/ORLib/UI/ORViewController.swift
@@ -24,7 +24,7 @@ import WebKit
import MaterialComponents.MaterialButtons
import Popover
-class ORViewcontroller : UIViewController {
+open class ORViewcontroller : UIViewController {
var data : Data?
var menuButton: MDCFloatingButton?
@@ -33,25 +33,25 @@ class ORViewcontroller : UIViewController {
var webProgressBar: UIProgressView?
var defaults : UserDefaults?
var webCfg : WKWebViewConfiguration?
- var appConfig: ORAppConfig?
+ public var appConfig: ORAppConfig?
var popover: Popover?
- var geofenceProvider: GeofenceProvider?
- var pushProvider: PushNotificationProvider?
- var storageProvider: StorageProvider?
+ public var geofenceProvider: GeofenceProvider?
+ public var pushProvider: PushNotificationProvider?
+ public var storageProvider: StorageProvider?
var popoverOptions: [PopoverOption]?
- override func viewDidLoad() {
+ open override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = UIColor.white
}
- override func viewWillAppear(_ animated: Bool) {
+ open override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.configureAccess()
}
- override func viewDidAppear(_ animated: Bool) {
+ open override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
if let applicationConfig = appConfig {
loadURL(url: URL(string: applicationConfig.initialUrl.stringByURLEncoding()!)!)
@@ -182,7 +182,7 @@ class ORViewcontroller : UIViewController {
self.popover!.show(tableView, fromView: self.menuButton!)
}
- override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
+ public override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
if keyPath == "estimatedProgress" {
if let webView = myWebView {
webProgressBar?.progress = Float(webView.estimatedProgress);
@@ -206,7 +206,7 @@ class ORViewcontroller : UIViewController {
}
}
- func loadURL(url : URL) {
+ public func loadURL(url : URL) {
_ = self.myWebView?.load(URLRequest(url:url))
}
@@ -225,23 +225,23 @@ class ORViewcontroller : UIViewController {
extension ORViewcontroller: UITableViewDelegate {
- func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+ public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
self.popover?.dismiss()
loadURL(url: URL(string: appConfig!.links![indexPath.row].pageLink.stringByURLEncoding()!)!)
}
- func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
+ public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 60
}
}
extension ORViewcontroller: UITableViewDataSource {
- func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
+ public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
return appConfig?.links?.count ?? 0
}
- func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+ public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = UITableViewCell(style: .default, reuseIdentifier: nil)
cell.textLabel?.text = appConfig!.links![indexPath.row].displayText
return cell
@@ -249,7 +249,7 @@ extension ORViewcontroller: UITableViewDataSource {
}
extension ORViewcontroller: WKScriptMessageHandler {
- func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
+ public func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
let jsonDictionnary = message.body as? [String : Any]
if let type = jsonDictionnary?["type"] as? String {
switch (type) {
@@ -374,7 +374,7 @@ extension ORViewcontroller: WKNavigationDelegate {
showProgressView()
}
- func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
+ public func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
if (navigationAction.request.url?.absoluteString.starts(with: "webbrowser"))! {
if let url = navigationAction.request.url, var components = URLComponents(url: url, resolvingAgainstBaseURL: false) {
components.scheme = "https"
@@ -402,7 +402,7 @@ extension ORViewcontroller: WKNavigationDelegate {
}
}
- func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) {
+ public func webView(_ webView: WKWebView, decidePolicyFor navigationResponse: WKNavigationResponse, decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) {
if let response = navigationResponse.response as? HTTPURLResponse {
if response.statusCode != 200 && response.statusCode != 204 {
decisionHandler(.cancel)
@@ -414,7 +414,7 @@ extension ORViewcontroller: WKNavigationDelegate {
decisionHandler(.allow)
}
- func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
+ public func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) {
NSLog("error %@", error.localizedDescription)
if let err = error as? URLError {
@@ -432,7 +432,7 @@ extension ORViewcontroller: WKNavigationDelegate {
}
}
- func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
+ public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
hideProgressView()
}
diff --git a/console/iOS/GenericApp/GenericApp/Utils/Reachability.swift b/console/iOS/ORLib/ORLib/Utils/Reachability.swift
similarity index 100%
rename from console/iOS/GenericApp/GenericApp/Utils/Reachability.swift
rename to console/iOS/ORLib/ORLib/Utils/Reachability.swift
diff --git a/console/iOS/GenericApp/GenericApp/Utils/String+Utils.swift b/console/iOS/ORLib/ORLib/Utils/String+Utils.swift
similarity index 100%
rename from console/iOS/GenericApp/GenericApp/Utils/String+Utils.swift
rename to console/iOS/ORLib/ORLib/Utils/String+Utils.swift
diff --git a/console/iOS/GenericApp/GenericApp/Utils/UIColor+Utils.swift b/console/iOS/ORLib/ORLib/Utils/UIColor+Utils.swift
similarity index 100%
rename from console/iOS/GenericApp/GenericApp/Utils/UIColor+Utils.swift
rename to console/iOS/ORLib/ORLib/Utils/UIColor+Utils.swift
diff --git a/console/iOS/GenericApp/GenericApp/Utils/Window+Utils.swift b/console/iOS/ORLib/ORLib/Utils/Window+Utils.swift
similarity index 91%
rename from console/iOS/GenericApp/GenericApp/Utils/Window+Utils.swift
rename to console/iOS/ORLib/ORLib/Utils/Window+Utils.swift
index 8cf6e4df6..80713308b 100644
--- a/console/iOS/GenericApp/GenericApp/Utils/Window+Utils.swift
+++ b/console/iOS/ORLib/ORLib/Utils/Window+Utils.swift
@@ -11,7 +11,7 @@ import UIKit
extension UIWindow {
- var topController : UIViewController? {
+ public var topController : UIViewController? {
guard let rootViewController = self.rootViewController else {
return nil