Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3372910
D4601.id15273.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D4601.id15273.diff
View Options
diff --git a/keyserver/src/push/send.js b/keyserver/src/push/send.js
--- a/keyserver/src/push/send.js
+++ b/keyserver/src/push/send.js
@@ -3,6 +3,7 @@
import apn from '@parse/node-apn';
import type { ResponseFailure } from '@parse/node-apn';
import invariant from 'invariant';
+import _cloneDeep from 'lodash/fp/cloneDeep';
import _flow from 'lodash/fp/flow';
import _mapValues from 'lodash/fp/mapValues';
import _pickBy from 'lodash/fp/pickBy';
@@ -40,7 +41,12 @@
import { fetchUserInfos } from '../fetchers/user-fetchers';
import type { Viewer } from '../session/viewer';
import { getAPNsNotificationTopic } from './providers';
-import { apnPush, fcmPush, getUnreadCounts } from './utils';
+import {
+ apnPush,
+ fcmPush,
+ getUnreadCounts,
+ apnMaxNotificationPayloadByteSize,
+} from './utils';
type Device = {
+deviceType: DeviceType,
@@ -492,13 +498,21 @@
notification.pushType = 'alert';
notification.payload.id = uniqueID;
notification.payload.threadID = threadInfo.id;
- notification.payload.messageInfos = JSON.stringify(newRawMessageInfos);
if (codeVersion > 1000) {
notification.mutableContent = true;
}
if (collapseKey) {
notification.collapseId = collapseKey;
}
+ const messageInfos = JSON.stringify(newRawMessageInfos);
+ const copyWithMessageInfos = _cloneDeep(notification);
+ copyWithMessageInfos.payload = {
+ ...copyWithMessageInfos.payload,
+ messageInfos,
+ };
+ if (copyWithMessageInfos.length() <= apnMaxNotificationPayloadByteSize) {
+ notification.payload.messageInfos = messageInfos;
+ }
return notification;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 8:14 AM (7 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2589581
Default Alt Text
D4601.id15273.diff (1 KB)
Attached To
Mode
D4601: Remove messageInfos fileds from iOS notification if its size exceeds defined limit
Attached
Detach File
Event Timeline
Log In to Comment