Page MenuHomePhabricator

D6872.id23032.diff
No OneTemporary

D6872.id23032.diff

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
@@ -173,15 +173,15 @@
{ platform: 'ios', codeVersion },
);
const deliveryPromise = (async () => {
- const notification = await prepareIOSNotification(
+ const notification = await prepareIOSNotification({
allMessageInfos,
- shimmedNewRawMessageInfos,
+ newRawMessageInfos: shimmedNewRawMessageInfos,
threadInfo,
- notifInfo.collapseKey,
+ collapseKey: notifInfo.collapseKey,
badgeOnly,
- unreadCounts[userID],
+ unreadCount: unreadCounts[userID],
codeVersion,
- );
+ });
return await sendIOSNotification(notification, [...deviceTokens], {
...notificationInfo,
codeVersion,
@@ -199,16 +199,16 @@
{ platform: 'android', codeVersion },
);
const deliveryPromise = (async () => {
- const notification = await prepareAndroidNotification(
+ const notification = await prepareAndroidNotification({
allMessageInfos,
- shimmedNewRawMessageInfos,
+ newRawMessageInfos: shimmedNewRawMessageInfos,
threadInfo,
- notifInfo.collapseKey,
+ collapseKey: notifInfo.collapseKey,
badgeOnly,
- unreadCounts[userID],
- dbID,
+ unreadCount: unreadCounts[userID],
codeVersion,
- );
+ dbID,
+ });
return await sendAndroidNotification(
notification,
[...deviceTokens],
@@ -481,15 +481,28 @@
return byDeviceType;
}
+type IOSNotifInputData = {
+ +allMessageInfos: MessageInfo[],
+ +newRawMessageInfos: RawMessageInfo[],
+ +threadInfo: ThreadInfo,
+ +collapseKey: ?string,
+ +badgeOnly: boolean,
+ +unreadCount: number,
+ +codeVersion: number,
+};
async function prepareIOSNotification(
- allMessageInfos: MessageInfo[],
- newRawMessageInfos: RawMessageInfo[],
- threadInfo: ThreadInfo,
- collapseKey: ?string,
- badgeOnly: boolean,
- unreadCount: number,
- codeVersion: number,
+ inputData: IOSNotifInputData,
): Promise<apn.Notification> {
+ const {
+ allMessageInfos,
+ newRawMessageInfos,
+ threadInfo,
+ collapseKey,
+ badgeOnly,
+ unreadCount,
+ codeVersion,
+ } = inputData;
+
const uniqueID = uuidv4();
const notification = new apn.Notification();
notification.topic = getAPNsNotificationTopic(codeVersion);
@@ -543,16 +556,24 @@
return notification;
}
+type AndroidNotifInputData = {
+ ...IOSNotifInputData,
+ +dbID: string,
+};
async function prepareAndroidNotification(
- allMessageInfos: MessageInfo[],
- newRawMessageInfos: RawMessageInfo[],
- threadInfo: ThreadInfo,
- collapseKey: ?string,
- badgeOnly: boolean,
- unreadCount: number,
- dbID: string,
- codeVersion: number,
+ inputData: AndroidNotifInputData,
): Promise<Object> {
+ const {
+ allMessageInfos,
+ newRawMessageInfos,
+ threadInfo,
+ collapseKey,
+ badgeOnly,
+ unreadCount,
+ codeVersion,
+ dbID,
+ } = inputData;
+
const notifID = collapseKey ? collapseKey : dbID;
const { merged, ...rest } = await notifTextsForMessageInfo(
allMessageInfos,

File Metadata

Mime Type
text/plain
Expires
Mon, Dec 23, 1:09 AM (18 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2693084
Default Alt Text
D6872.id23032.diff (3 KB)

Event Timeline