Skip to content

Commit

Permalink
feat(mobile): handle deepLink when app is killed
Browse files Browse the repository at this point in the history
Signed-off-by: Sacha Froment <sfroment42@gmail.com>
  • Loading branch information
sfroment committed Feb 28, 2019
1 parent b5b65c8 commit b89ec93
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions client/react-native/ios/Berty/AppDelegate.swift
Expand Up @@ -79,6 +79,24 @@ class AppDelegate: AppDelegateObjC {
logger.format("unable to set storage path: %@", level: .error, error.userInfo.description)
return false
}

let deadlineTime = DispatchTime.now() + .seconds(10)

DispatchQueue.global(qos: .background).asyncAfter(deadline: deadlineTime) {
if let remoteNotifPayload = launchOptions?[UIApplicationLaunchOptionsKey.localNotification] as? UILocalNotification {
if let data = remoteNotifPayload.userInfo as? [String: String] {
if let url = data["url"] {
if url.count > 0 {
super.application(application, open: URL.init(string: url)!, options: [
UIApplicationOpenURLOptionsKey.sourceApplication: Bundle.main.bundleIdentifier!,
UIApplicationOpenURLOptionsKey.openInPlace: false
])
}
}
}
}
}

return true
}

Expand Down

0 comments on commit b89ec93

Please sign in to comment.