From 3e19f3bd46c5ccc453d7e716506ccb29a7405a1e Mon Sep 17 00:00:00 2001 From: Scott Jungwirth Date: Mon, 10 May 2021 19:00:26 -0700 Subject: [PATCH] fix: set userInteraction on initial local notification --- ios/RNCPushNotificationIOS.m | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ios/RNCPushNotificationIOS.m b/ios/RNCPushNotificationIOS.m index 89adf61d9..962d19a57 100644 --- a/ios/RNCPushNotificationIOS.m +++ b/ios/RNCPushNotificationIOS.m @@ -371,7 +371,14 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification initialNotification[@"remote"] = @YES; resolve(initialNotification); } else if (initialLocalNotification) { - resolve([RCTConvert RCTFormatLocalNotification:initialLocalNotification]); + NSMutableDictionary *formattedInitialLocalNotification = [[RCTConvert RCTFormatLocalNotification:initialLocalNotification] mutableCopy]; + if ([formattedInitialLocalNotification objectForKey:@"userInfo"] == nil) { + formattedInitialLocalNotification[@"userInfo"] = [NSMutableDictionary dictionary]; + } else { + formattedInitialLocalNotification[@"userInfo"] = [formattedInitialLocalNotification[@"userInfo"] mutableCopy] + } + formattedInitialLocalNotification[@"userInfo"][@"userInteraction"] = [NSNumber numberWithInt:1]; + resolve(formattedInitialLocalNotification); } else { resolve((id)kCFNull); }