mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
resolve getInitialNotification for local notifications with notification schema
Summary: Changelog: [Internal] In the past, local notifications were stored in the launch options as UILocalNotification, whereas remote notifications were stored as NSDict. This means that we had different handling in PushNotificationIOS.js. This condition was not handling the differences in local and remote notifications that JS expected, which I'm fixing here. Reviewed By: ingridwang Differential Revision: D53734086 fbshipit-source-id: 73ef436a232c16de3b72f7236db94012aafdc434
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3020747101
commit
2740491e32
@@ -535,13 +535,14 @@ RCT_EXPORT_METHOD(getInitialNotification
|
||||
if (self.initialNotification) {
|
||||
NSDictionary<NSString *, id> *notificationDict =
|
||||
RCTFormatUNNotificationContent(self.initialNotification.request.content);
|
||||
NSDictionary *userInfo = notificationDict[@"userInfo"];
|
||||
if (IsNotificationRemote(self.initialNotification)) {
|
||||
NSMutableDictionary<NSString *, id> *userInfoCopy = [userInfo mutableCopy];
|
||||
// For backwards compatibility, remote notifications only returns a userInfo dict.
|
||||
NSMutableDictionary<NSString *, id> *userInfoCopy = [notificationDict[@"userInfo"] mutableCopy];
|
||||
userInfoCopy[@"remote"] = @YES;
|
||||
resolve(userInfoCopy);
|
||||
} else {
|
||||
resolve(userInfo);
|
||||
// For backwards compatibility, local notifications return the notification.
|
||||
resolve(notificationDict);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user