From f38a47c13700283d6bcc301de9dffceaddfd0ed4 Mon Sep 17 00:00:00 2001 From: Aaron Liberatore Date: Tue, 20 Mar 2018 15:38:57 -0500 Subject: [PATCH 1/2] fix: calls ui apis on main thread --- .../internal/AuthorizationUIManager.swift | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/Source/BluemixAppID/internal/AuthorizationUIManager.swift b/Source/BluemixAppID/internal/AuthorizationUIManager.swift index c9ea168..ebfc2f5 100644 --- a/Source/BluemixAppID/internal/AuthorizationUIManager.swift +++ b/Source/BluemixAppID/internal/AuthorizationUIManager.swift @@ -27,21 +27,21 @@ public class AuthorizationUIManager { self.authorizationUrl = authorizationUrl self.redirectUri = redirectUri } - + public func launch() { AuthorizationUIManager.logger.debug(message: "Launching safari view") loginView = safariView(url: URL(string: authorizationUrl )!) loginView?.authorizationDelegate = authorizationDelegate - let rootView = UIApplication.shared.keyWindow?.rootViewController - let currentView = rootView?.presentedViewController - let view = currentView != nil ? currentView : rootView DispatchQueue.main.async { + let rootView = UIApplication.shared.keyWindow?.rootViewController + let currentView = rootView?.presentedViewController + let view = currentView != nil ? currentView : rootView view?.present(self.loginView!, animated: true, completion: nil) } } - + public func application(_ application: UIApplication, open url: URL, options :[UIApplicationOpenURLOptionsKey: Any]) -> Bool { - + func tokenRequest(code: String?, errMsg:String?) { loginView?.dismiss(animated: true, completion: { () -> Void in guard errMsg == nil else { @@ -53,11 +53,11 @@ public class AuthorizationUIManager { return } AuthorizationUIManager.logger.debug(message: "Obtaining tokens") - + self.oAuthManager.tokenManager?.obtainTokensAuthCode(code: unwrappedCode, authorizationDelegate: self.authorizationDelegate) }) } - + if let err = Utils.getParamFromQuery(url: url, paramName: "error") { loginView?.dismiss(animated: true, completion: { () -> Void in if err == "invalid_client" { @@ -104,12 +104,10 @@ public class AuthorizationUIManager { } return false } - + } - - - - -} + + +} From 222f242a5391d1ee0b851a4c1dfe921f5ce376a4 Mon Sep 17 00:00:00 2001 From: Aaron Liberatore Date: Wed, 21 Mar 2018 19:49:16 -0500 Subject: [PATCH 2/2] Updates travis to use xcode 8.3 --- .travis.yml | 2 +- README.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8682a00..0197a6a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: objective-c matrix: include: - - osx_image: xcode8.1 + - osx_image: xcode8.3 install: - gem install jazzy - gem install slather diff --git a/README.md b/README.md index 2a1fb1d..c16f3f3 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ [![GithubForks][img-github-forks]][url-github-forks] ## Requirements -* Xcode 8.1 or above +* Xcode 8.3 or above * CocoaPods 1.1.0 or higher * MacOS 10.11.5 or higher * iOS 9 or higher @@ -215,7 +215,7 @@ This API can be used only when the user is logged in using Cloud Directory ident AppID.sharedInstance.loginWidget?.launchChangePassword(delegate: delegate()) ``` - + ## Invoking protected resources Add the following imports to the file in which you want to invoke a protected resource request: ```swift @@ -248,8 +248,8 @@ This package contains code licensed under the Apache License, Version 2.0 (the " [img-github-forks]: https://img.shields.io/github/forks/ibm-cloud-security/appid-clientsdk-swift.svg?style=social&label=Fork [url-github-forks]: https://github.com/ibm-cloud-security/appid-clientsdk-swift/network -[img-travis-master]: https://travis-ci.org/ibm-cloud-security/appid-clientsdk-swift.svg -[url-travis-master]: https://travis-ci.org/ibm-cloud-security/appid-clientsdk-swift +[img-travis-master]: https://travis-ci.org/ibm-cloud-security/appid-clientsdk-swift.svg?branch=master +[url-travis-master]: https://travis-ci.org/ibm-cloud-security/appid-clientsdk-swift?branch=master [img-coveralls-master]: https://coveralls.io/repos/github/ibm-cloud-security/appid-clientsdk-swift/badge.svg [url-coveralls-master]: https://coveralls.io/github/ibm-cloud-security/appid-clientsdk-swift