Skip to content

armgit / core

Public Imported from GitHub
0

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

iOS shell

William Balcaendef91fa8daf2
diff --git a/or-shell/iOS/or-shell.xcodeproj/project.pbxproj b/or-shell/iOS/or-shell.xcodeproj/project.pbxproj
index e65a187cb..d31e6d016 100644
--- a/or-shell/iOS/or-shell.xcodeproj/project.pbxproj
+++ b/or-shell/iOS/or-shell.xcodeproj/project.pbxproj
@@ -13,7 +13,6 @@
913873821E32262400CE92FE /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 913873801E32262400CE92FE /* Main.storyboard */; };
913873841E32262400CE92FE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 913873831E32262400CE92FE /* Assets.xcassets */; };
913873871E32262400CE92FE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 913873851E32262400CE92FE /* LaunchScreen.storyboard */; };
- FA5B1EFB1E40C438009E29F7 /* podfile in Resources */ = {isa = PBXBuildFile; fileRef = FA5B1EFA1E40C438009E29F7 /* podfile */; };
FA7551961E432EF5004A1C90 /* ORViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA7551951E432EF5004A1C90 /* ORViewController.swift */; };
FA9D0B1E1E434A16003BDB6A /* api in Resources */ = {isa = PBXBuildFile; fileRef = FA9D0B161E434A16003BDB6A /* api */; };
FA9D0B1F1E434A16003BDB6A /* bower_components in Resources */ = {isa = PBXBuildFile; fileRef = FA9D0B171E434A16003BDB6A /* bower_components */; };
@@ -36,7 +35,6 @@
913873881E32262400CE92FE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
979189EBB4126A1BC3087E0E /* Pods-or-shell.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-or-shell.debug.xcconfig"; path = "Pods/Target Support Files/Pods-or-shell/Pods-or-shell.debug.xcconfig"; sourceTree = "<group>"; };
CA5BD9579BAC5807FB562451 /* Pods-or-shell.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-or-shell.release.xcconfig"; path = "Pods/Target Support Files/Pods-or-shell/Pods-or-shell.release.xcconfig"; sourceTree = "<group>"; };
- FA5B1EFA1E40C438009E29F7 /* podfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = podfile; sourceTree = "<group>"; };
FA7551951E432EF5004A1C90 /* ORViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ORViewController.swift; sourceTree = "<group>"; };
FA9D0B161E434A16003BDB6A /* api */ = {isa = PBXFileReference; lastKnownFileType = folder; path = api; sourceTree = "<group>"; };
FA9D0B171E434A16003BDB6A /* bower_components */ = {isa = PBXFileReference; lastKnownFileType = folder; path = bower_components; sourceTree = "<group>"; };
@@ -72,7 +70,6 @@
913873701E32262400CE92FE = {
isa = PBXGroup;
children = (
- FA5B1EFA1E40C438009E29F7 /* podfile */,
9138737B1E32262400CE92FE /* or-shell */,
9138737A1E32262400CE92FE /* Products */,
144E366AC5ACA30FC384B59E /* Pods */,
@@ -194,7 +191,6 @@
FA9D0B251E434A16003BDB6A /* bower.json in Resources */,
913873871E32262400CE92FE /* LaunchScreen.storyboard in Resources */,
913873841E32262400CE92FE /* Assets.xcassets in Resources */,
- FA5B1EFB1E40C438009E29F7 /* podfile in Resources */,
FA9D0B221E434A16003BDB6A /* manifest.json in Resources */,
913873821E32262400CE92FE /* Main.storyboard in Resources */,
FA9D0B231E434A16003BDB6A /* service-worker.js in Resources */,
diff --git a/or-shell/iOS/or-shell/AppDelegate.swift b/or-shell/iOS/or-shell/AppDelegate.swift
index ab1006985..d4035e255 100644
--- a/or-shell/iOS/or-shell/AppDelegate.swift
+++ b/or-shell/iOS/or-shell/AppDelegate.swift
@@ -7,6 +7,7 @@
//
import UIKit
+import AeroGearOAuth2
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
@@ -41,6 +42,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
-
+ func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
+ let notification = Notification(name: Notification.Name(rawValue: AGAppLaunchedWithURLNotification), object:nil, userInfo:[UIApplicationLaunchOptionsKey.url:url])
+ NotificationCenter.default.post(notification)
+ return true
+ }
}
diff --git a/or-shell/iOS/or-shell/Info.plist b/or-shell/iOS/or-shell/Info.plist
index 627999ff2..35202a027 100644
--- a/or-shell/iOS/or-shell/Info.plist
+++ b/or-shell/iOS/or-shell/Info.plist
@@ -16,6 +16,17 @@
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
+ <key>CFBundleURLTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleTypeRole</key>
+ <string>Editor</string>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>org.openremote.or-shell</string>
+ </array>
+ </dict>
+ </array>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
diff --git a/or-shell/iOS/or-shell/ORViewController.swift b/or-shell/iOS/or-shell/ORViewController.swift
index a57c2880d..88ea5874c 100644
--- a/or-shell/iOS/or-shell/ORViewController.swift
+++ b/or-shell/iOS/or-shell/ORViewController.swift
@@ -39,17 +39,5 @@ class ORViewcontroller : UIViewController, WKUIDelegate, WKNavigationDelegate {
myWebView.frame = view.frame
myWebView.loadFileURL(myURL!, allowingReadAccessTo: myURL!)
}
-
- func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
- print("error")
- }
-
- func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
- print("finished")
- }
-
- func webView(_ webView: WKWebView, didCommit navigation: WKNavigation!) {
- print("receiving")
- }
}
diff --git a/or-shell/iOS/or-shell/ViewController.swift b/or-shell/iOS/or-shell/ViewController.swift
index a2cfa6766..73c721f70 100644
--- a/or-shell/iOS/or-shell/ViewController.swift
+++ b/or-shell/iOS/or-shell/ViewController.swift
@@ -11,38 +11,39 @@ import AeroGearOAuth2
import AeroGearHttp
class ViewController: UIViewController {
-
+
@IBOutlet weak var loginViewController: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
-
+
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
-
+
@IBAction func showLoginPage(_ sender: Any) {
let http = Http()
- let keycloakConfig = Config.init(base: "http://192.168.99.100:8080/auth", authzEndpoint: "realms/master/protocol/openid-connect/auth", redirectURL: "http://192.168.99.100:8080/master", accessTokenEndpoint: "realms/master/protocol/openid-connect/token", clientId: "or-manager", refreshTokenEndpoint: "realms/master/protocol/openid-connect/token", revokeTokenEndpoint: "realms/master/protocol/openid-connect/logout", isOpenIDConnect: true, userInfoEndpoint: nil, scopes: ["openid", "email", "profile"], clientSecret: nil, accountId: nil, isWebView: true)
+ let bundleString = Bundle.main.bundleIdentifier ?? "keycloak"
+ let keycloakConfig = Config.init(base: "http://192.168.99.100:8080/auth", authzEndpoint: "realms/master/protocol/openid-connect/auth", redirectURL: "\(bundleString)://oauth2Callback", accessTokenEndpoint: "realms/master/protocol/openid-connect/token", clientId: "or-manager", refreshTokenEndpoint: "realms/master/protocol/openid-connect/token", revokeTokenEndpoint: "realms/master/protocol/openid-connect/logout", isOpenIDConnect: true, userInfoEndpoint: "realms/master/protocol/openid-connect/userinfo", scopes: ["openid", "email", "profile"], clientSecret: nil, accountId: nil, isWebView: true)
/*let keycloakConfig = KeycloakConfig(
- clientId: "or-manager",
- host: "http://192.168.99.100:8080/",
- realm: "master",
- isOpenIDConnect: true)*/
- keycloakConfig.accountId = "admin"
+ clientId: "or-manager",
+ host: "http://192.168.99.100:8080/",
+ realm: "master",
+ isOpenIDConnect: true)*/
+ //keycloakConfig.accountId = "admin"
let oauth2Module = AccountManager.addAccountWith(config: keycloakConfig, moduleClass: OAuth2Module.self)
http.authzModule = oauth2Module
- oauth2Module.login {(accessToken: AnyObject?, claims: OpenIdClaim?, error: NSError?) in
+ oauth2Module.login {(accessToken: AnyObject?, claims: OpenIdClaim?, error: NSError?) in
if let userInfo = claims {
if let name = userInfo.name {
print("name ",name)
}
}
}
- }
+ }
}