Changeset View
Changeset View
Standalone View
Standalone View
keyserver/src/push/rescind.js
Show First 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | for (const delivery of deliveries) { | ||||
} else if (delivery.androidID) { | } else if (delivery.androidID) { | ||||
// Old Android | // Old Android | ||||
const notification = prepareAndroidNotification( | const notification = prepareAndroidNotification( | ||||
row.collapse_key ? row.collapse_key : id, | row.collapse_key ? row.collapse_key : id, | ||||
row.unread_count, | row.unread_count, | ||||
threadID, | threadID, | ||||
); | ); | ||||
deliveryPromises[id] = fcmPush({ | deliveryPromises[id] = fcmPush({ | ||||
targetedNotifications: delivery.androidDeviceTokens.map( | |||||
deviceToken => ({ | |||||
deviceToken, | |||||
notification, | notification, | ||||
deviceTokens: delivery.androidDeviceTokens, | }), | ||||
), | |||||
codeVersion: null, | codeVersion: null, | ||||
}); | }); | ||||
} else if (delivery.deviceType === 'ios') { | } else if (delivery.deviceType === 'ios') { | ||||
// New iOS | // New iOS | ||||
const { iosID, deviceTokens, codeVersion } = delivery; | const { iosID, deviceTokens, codeVersion } = delivery; | ||||
const notification = prepareIOSNotification( | const notification = prepareIOSNotification( | ||||
iosID, | iosID, | ||||
row.unread_count, | row.unread_count, | ||||
Show All 12 Lines | for (const delivery of deliveries) { | ||||
// New Android | // New Android | ||||
const { deviceTokens, codeVersion } = delivery; | const { deviceTokens, codeVersion } = delivery; | ||||
const notification = prepareAndroidNotification( | const notification = prepareAndroidNotification( | ||||
row.collapse_key ? row.collapse_key : id, | row.collapse_key ? row.collapse_key : id, | ||||
row.unread_count, | row.unread_count, | ||||
threadID, | threadID, | ||||
); | ); | ||||
deliveryPromises[id] = fcmPush({ | deliveryPromises[id] = fcmPush({ | ||||
targetedNotifications: deviceTokens.map(deviceToken => ({ | |||||
deviceToken, | |||||
notification, | notification, | ||||
deviceTokens, | })), | ||||
codeVersion, | codeVersion, | ||||
}); | }); | ||||
} | } | ||||
} | } | ||||
rescindedIDs.push(row.id); | rescindedIDs.push(row.id); | ||||
} | } | ||||
const numRescinds = Object.keys(deliveryPromises).length; | const numRescinds = Object.keys(deliveryPromises).length; | ||||
▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines |