Skip to content

Commit ba6bc11

Browse files
authored
set userInteraction on initial notification (#220)
Currrently userInteraction is false even though the app is started via tapping the notification to start the app.
1 parent 0f3cd09 commit ba6bc11

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ios/RNCPushNotificationIOS.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,9 +621,15 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification
621621
self.bridge.launchOptions[UIApplicationLaunchOptionsLocalNotificationKey];
622622

623623
if (initialNotification) {
624+
initialNotification[@"userInteraction"] = [NSNumber numberWithInt:1];
624625
initialNotification[@"remote"] = @YES;
625626
resolve(initialNotification);
626627
} else if (initialLocalNotification) {
628+
NSMutableDictionary *userInfo = [content.userInfo mutableCopy];
629+
NSMutableDictionary *localInfo = [initialLocalNotification.userInfo mutableCopy];
630+
localInfo[@"userInteraction"] = [NSNumber numberWithInt:1];
631+
initialLocalNotification.userInfo = localInfo;
632+
initialLocalNotification[@"userInteraction"] = [NSNumber numberWithInt:1];
627633
resolve(RCTFormatLocalNotification(initialLocalNotification));
628634
} else {
629635
resolve((id)kCFNull);

0 commit comments

Comments
 (0)