Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3512462
D6872.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.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
@@ -174,15 +174,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,
@@ -200,16 +200,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],
@@ -507,15 +507,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);
@@ -569,16 +582,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
Sun, Dec 22, 7:52 PM (17 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2692329
Default Alt Text
D6872.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