Skip to content

Instantly share code, notes, and snippets.

@timurbeg
Created December 6, 2018 12:59
Show Gist options
  • Save timurbeg/6a6a1a1b0e7fd025bd16a990f1c39249 to your computer and use it in GitHub Desktop.
Save timurbeg/6a6a1a1b0e7fd025bd16a990f1c39249 to your computer and use it in GitHub Desktop.
Handling push notification via Braze(Appboy) framework
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
if (!ABKPushUtils.isAppboyInternalRemoteNotification(userInfo)) {
Appboy.sharedInstance()?.register(application, didReceiveRemoteNotification: userInfo, fetchCompletionHandler: completionHandler)
switch application.applicationState {
case .active:
handlePushWhileInApp(userInfo as NSDictionary)
case .inactive, .background:
if let _ = userInfo["ab_uri"] as? String {
handleDeepLink(userInfo as NSDictionary)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment