Skip to content

Commit

Permalink
Fix open trust:// crash (trustwallet#639)
Browse files Browse the repository at this point in the history
* replace deprecated open url delegate

* Fix swiftlint warnings
  • Loading branch information
hewigovens authored and vikmeup committed Apr 17, 2018
1 parent 87f5873 commit 6be3990
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Trust/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
// }

// Respond to URI scheme links
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
return urlNavigatorCoordinator.application(application, open: url, sourceApplication: sourceApplication, annotation: annotation)
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey: Any] = [:]) -> Bool {
return urlNavigatorCoordinator.application(app, open: url, options: options)
}

// Respond to Universal Links
Expand Down
4 changes: 4 additions & 0 deletions Trust/Core/Coordinators/BranchCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,8 @@ class BranchCoordinator {
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
return Branch.getInstance().application(application, open: url, sourceApplication: sourceApplication, annotation: annotation)
}

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey: Any] = [:]) -> Bool {
return Branch.getInstance().application(app, open: url, options: options)
}
}
4 changes: 2 additions & 2 deletions Trust/Core/Coordinators/URLNavigatorCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ struct URLNavigatorCoordinator {
let branch = BranchCoordinator()
let navigator = Navigator()

func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
var handled = branch.application(application, open: url, sourceApplication: sourceApplication, annotation: annotation)
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey: Any] = [:]) -> Bool {
var handled = branch.application(app, open: url, options: options)
if !handled {
handled = navigator.open(url)
}
Expand Down

0 comments on commit 6be3990

Please sign in to comment.