Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Respond to URI scheme links
- func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
- // pass the url to the handle deep link call
- if PushIOManager.sharedInstance().open(url, sourceApplication: sourceApplication, annotation: annotation) {
- return true
- }
- if Branch.getInstance().handleDeepLink(url) {
- return true
- }
- // do other deep link routing for the Facebook SDK, Pinterest SDK, etc
- return true
- }
- func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
- PushIOManager.sharedInstance().didRegisterForRemoteNotifications(withDeviceToken: deviceToken)
- if Helpers.isLoggedIn() {
- guard let userInfo = GTDBClient.getLoggedInUserInfo() else { return }
- PushIOManager.sharedInstance().registerUserID(userInfo.email)
- }
- GTMAnalytics.pushNotificationEvent(Constants.Prepermission.GTMEventCategory.OptInEventCategory, eventAction: Constants.Prepermission.GTMEventAction.TappedYes, eventLabel: GTMOptinLabel)
- GTMOptinLabel = ""
- }
- func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
- PushIOManager.sharedInstance().didFailToRegisterForRemoteNotificationsWithError(error)
- }
- func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {
- PushIOManager.sharedInstance().didReceiveRemoteNotification(userInfo)
- //iOS 9
- guard let urlString = userInfo["p_dl"] as? String else {
- return
- }
- var userInfoObject = userInfo
- userInfoObject["branch"] = urlString
- Branch.getInstance().handlePushNotification(userInfoObject)
- }
- @available(iOS 10.0, *)
- func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
- var userInfo = response.notification.request.content.userInfo
- guard let urlString = userInfo["p_dl"] as? String else {
- return
- }
- userInfo["branch"] = urlString
- Branch.getInstance().handlePushNotification(userInfo)
- }
- @available(iOS 10.0, *)
- func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
- // PushIOManager.sharedInstance().userNotificationCenter(center, willPresent: notification, withCompletionHandler: completionHandler)
- }
- func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
- PushIOManager.sharedInstance().didReceiveRemoteNotification(userInfo, fetchCompletionResult: .newData, fetchCompletionHandler: completionHandler)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement