From 59c5edfe63ceeef614bc917e0fe5359fb52ff3d6 Mon Sep 17 00:00:00 2001 From: Phillip Pan Date: Tue, 13 Feb 2024 08:32:47 -0800 Subject: [PATCH] resolve getInitialNotification with userInfo dict instead of whole notification Summary: Changelog: [Internal] `getInitialNotification` only expect the user info dictionary of the dictionary, not the complete formatted notification. Reviewed By: cipolleschi Differential Revision: D53691569 fbshipit-source-id: 9a24629d2e50544c55ea5cd16097bd88dad950ec --- .../PushNotificationIOS/RCTPushNotificationManager.mm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm b/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm index a0d41469b6e..3f868f7708d 100644 --- a/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm +++ b/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm @@ -535,12 +535,13 @@ RCT_EXPORT_METHOD(getInitialNotification if (self.initialNotification) { NSDictionary *notificationDict = RCTFormatUNNotificationContent(self.initialNotification.request.content); + NSDictionary *userInfo = notificationDict[@"userInfo"]; if (IsNotificationRemote(self.initialNotification)) { - NSMutableDictionary *notificationDictCopy = [notificationDict mutableCopy]; - notificationDictCopy[@"remote"] = @YES; - resolve(notificationDictCopy); + NSMutableDictionary *userInfoCopy = [userInfo mutableCopy]; + userInfoCopy[@"remote"] = @YES; + resolve(userInfoCopy); } else { - resolve(notificationDict); + resolve(userInfo); } return; }