Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3513657
D6872.id23032.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D6872.id23032.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
@@ -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
Details
Attached
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)
Attached To
Mode
D6872: [keyserver] Update notif prepare functions to take bag of params
Attached
Detach File
Event Timeline
Log In to Comment