Page MenuHomePhabricator

D9429.id31812.diff
No OneTemporary

D9429.id31812.diff

diff --git a/native/ios/Comm/AppDelegate.mm b/native/ios/Comm/AppDelegate.mm
--- a/native/ios/Comm/AppDelegate.mm
+++ b/native/ios/Comm/AppDelegate.mm
@@ -337,11 +337,13 @@
TemporaryMessageStorage *temporaryStorage =
[[TemporaryMessageStorage alloc] init];
NSArray<NSString *> *messages = [temporaryStorage readAndClearMessages];
+
+ if (sendBackgroundMessagesInfosToJS && messages.count) {
+ [CommIOSNotifications
+ didReceiveBackgroundMessageInfos:@{@"messageInfosArray" : messages}];
+ }
+
for (NSString *message in messages) {
- if (sendBackgroundMessagesInfosToJS) {
- [CommIOSNotifications
- didReceiveBackgroundMessageInfos:@{@"messageInfos" : message}];
- }
std::string messageInfos = std::string([message UTF8String]);
comm::GlobalDBSingleton::instance.scheduleOrRun([messageInfos]() mutable {
comm::MessageOperationsUtilities::storeMessageInfos(messageInfos);
diff --git a/native/push/ios.js b/native/push/ios.js
--- a/native/push/ios.js
+++ b/native/push/ios.js
@@ -81,7 +81,9 @@
remoteNotificationsRegistrationFailed: [void],
notificationReceivedForeground: [CoreIOSNotificationData],
notificationOpened: [CoreIOSNotificationData],
- notificationReceivedBackground: [{ +messageInfos: ?string }],
+ notificationReceivedBackground: [
+ { +messageInfosArray: ?$ReadOnlyArray<string> },
+ ],
}>,
> {
return new NativeEventEmitter(CommIOSNotifications);
diff --git a/native/push/push-handler.react.js b/native/push/push-handler.react.js
--- a/native/push/push-handler.react.js
+++ b/native/push/push-handler.react.js
@@ -540,11 +540,16 @@
};
iosBackgroundNotificationReceived = backgroundData => {
- const convertedMessageInfos = convertNotificationMessageInfoToNewIDSchema(
- backgroundData.messageInfos,
- );
+ if (!backgroundData.messageInfosArray) {
+ return;
+ }
+
+ const convertedMessageInfos = backgroundData.messageInfosArray
+ .map(convertNotificationMessageInfoToNewIDSchema)
+ .filter(Boolean)
+ .flat();
- if (!convertedMessageInfos) {
+ if (!convertedMessageInfos.length) {
return;
}

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 26, 8:28 AM (19 h, 3 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2584021
Default Alt Text
D9429.id31812.diff (2 KB)

Event Timeline