Skip to content

Commit

Permalink
chore: restore remote notifications handler
Browse files Browse the repository at this point in the history
  • Loading branch information
hansemannn committed Feb 3, 2024
1 parent cb008b6 commit d168575
Showing 1 changed file with 7 additions and 25 deletions.
32 changes: 7 additions & 25 deletions iphone/TitaniumKit/TitaniumKit/Sources/API/TiApp.m
Original file line number Diff line number Diff line change
Expand Up @@ -349,31 +349,6 @@ - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDiction
return YES;
}

// Handle URL-schemes / iOS < 9
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
[self tryToInvokeSelector:@selector(application:sourceApplication:annotation:)
withArguments:[NSOrderedSet orderedSetWithObjects:application, sourceApplication, annotation, nil]];

[launchOptions removeObjectForKey:UIApplicationLaunchOptionsURLKey];
[launchOptions setObject:[url absoluteString] forKey:@"url"];
[launchOptions removeObjectForKey:UIApplicationLaunchOptionsSourceApplicationKey];

if (sourceApplication != nil) {
[launchOptions setObject:sourceApplication forKey:@"source"];
} else {
[launchOptions removeObjectForKey:@"source"];
}

if (appBooted) {
[[NSNotificationCenter defaultCenter] postNotificationName:kTiApplicationLaunchedFromURL object:self userInfo:launchOptions];
} else {
[[self queuedBootEvents] setObject:launchOptions forKey:kTiApplicationLaunchedFromURL];
}

return YES;
}

#pragma mark Background Fetch

#ifdef USE_TI_FETCH
Expand Down Expand Up @@ -1147,6 +1122,7 @@ - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session op
// need to be mapepd from native to JS-types to be used by the client
NSURL *urlOptions = connectionOptions.URLContexts.allObjects.firstObject.URL;
NSString *sourceBundleId = connectionOptions.sourceApplication;
UNNotificationResponse *notification = connectionOptions.notificationResponse;
UIApplicationShortcutItem *shortcut = connectionOptions.shortcutItem;

// Map user activity if exists
Expand Down Expand Up @@ -1187,6 +1163,12 @@ - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session op
[launchOptions setObject:sourceBundleId forKey:@"source"];
}

// Generate remote notification of available
if (notification != nil && [notification.notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
[self generateNotification:@{ @"aps" : notification.notification.request.content.userInfo }];
}

// Save shortcut item for later
if (shortcut != nil) {
launchedShortcutItem = [shortcut retain];
}
Expand Down

0 comments on commit d168575

Please sign in to comment.