Skip to content

Commit

Permalink
updated deep link handling code
Browse files Browse the repository at this point in the history
  • Loading branch information
edjiang committed Sep 13, 2016
1 parent 0d52df7 commit 66e144a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ When a user finishes their log in flow, Facebook or Google will redirect back in
```Swift
import Simplicity

func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
func application(_ app: UIApplication, openURL url: URL, options: [UIApplicationOpenURLOptionsKey: Any]) -> Bool {
return Simplicity.application(app, openURL: url, options: options)
}

func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
func application(_ application: UIApplication, openURL url: URL, sourceApplication: String?, annotation: Any) -> Bool {
return Simplicity.application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
}
```
Expand Down
2 changes: 2 additions & 0 deletions Simplicity.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -298,6 +299,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand Down
8 changes: 4 additions & 4 deletions Simplicity/Simplicity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ public final class Simplicity {
self.currentLoginProvider = loginProvider
self.callback = callback

presentSafariView(loginProvider.authorizationURL as URL)
presentSafariView(loginProvider.authorizationURL)
}

/// Deep link handler (iOS9)
public static func application(_ app: UIApplication, openURL url: URL, options: [String : AnyObject]) -> Bool {
public static func application(_ app: UIApplication, openURL url: URL, options: [UIApplicationOpenURLOptionsKey: Any]) -> Bool {
safari?.dismiss(animated: true, completion: nil)
guard let callback = callback, url.scheme == currentLoginProvider?.urlScheme else {
return false
Expand All @@ -47,8 +47,8 @@ public final class Simplicity {
}

/// Deep link handler (<iOS9)
public static func application(_ application: UIApplication, openURL url: URL, sourceApplication: String?, annotation: AnyObject) -> Bool {
return self.application(application, openURL: url, options: [String: AnyObject]())
public static func application(_ application: UIApplication, openURL url: URL, sourceApplication: String?, annotation: Any) -> Bool {
return self.application(application, openURL: url, options: [UIApplicationOpenURLOptionsKey: Any]())
}

private static func presentSafariView(_ url: URL) {
Expand Down

0 comments on commit 66e144a

Please sign in to comment.