Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3398496
D8589.id29437.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D8589.id29437.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
@@ -23,6 +23,7 @@
rawThreadInfoFromServerThreadInfo,
threadInfoFromRawThreadInfo,
} from 'lib/shared/thread-utils.js';
+import { FUTURE_CODE_VERSION } from 'lib/shared/version-utils.js';
import type { Platform, PlatformDetails } from 'lib/types/device-types.js';
import { messageTypes } from 'lib/types/message-types-enum.js';
import {
@@ -54,6 +55,7 @@
} from './types.js';
import {
apnPush,
+ blobServiceUpload,
fcmPush,
getUnreadCounts,
apnMaxNotificationPayloadByteSize,
@@ -875,10 +877,45 @@
);
}
- const notifsWithoutMessageInfos = await prepareEncryptedAndroidNotifications(
- devicesWithSizeViolation,
- notification,
- );
+ const canQueryBlobService = codeVersion && codeVersion >= FUTURE_CODE_VERSION;
+ let blobHash, encryptionKey, blobUploadError;
+ if (canQueryBlobService) {
+ ({
+ blobHash: blobHash,
+ encryptionKey: encryptionKey,
+ blobUploadError: blobUploadError,
+ } = await blobServiceUpload(JSON.stringify(copyWithMessageInfos.data)));
+ }
+
+ if (blobUploadError) {
+ console.warn(
+ `Failed to upload payload of notification: ${notifID} ` +
+ `due to error: ${blobUploadError}`,
+ );
+ }
+
+ let notifsWithoutMessageInfos;
+ if (!blobHash || !encryptionKey) {
+ notifsWithoutMessageInfos = await prepareEncryptedAndroidNotifications(
+ devicesWithSizeViolation,
+ notification,
+ );
+ } else {
+ notifsWithoutMessageInfos = await prepareEncryptedAndroidNotifications(
+ devicesWithSizeViolation,
+ {
+ data: {
+ id: notifID,
+ badge: unreadCount.toString(),
+ badgeOnly: badgeOnly ? '1' : '0',
+ threadID,
+ blobHash,
+ encryptionKey,
+ ...rest,
+ },
+ },
+ );
+ }
const targetedNotifsWithMessageInfos = notifsWithMessageInfos
.filter(({ payloadSizeViolated }) => !payloadSizeViolated)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 2, 11:11 PM (19 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2609221
Default Alt Text
D8589.id29437.diff (2 KB)
Attached To
Mode
D8589: Upload Android notification payload to blob service if its size exceeds limits
Attached
Detach File
Event Timeline
Log In to Comment