Changeset View
Changeset View
Standalone View
Standalone View
keyserver/src/push/rescind.js
Show First 20 Lines • Show All 155 Lines • ▼ Show 20 Lines | |||||
function prepareIOSNotification( | function prepareIOSNotification( | ||||
iosID: string, | iosID: string, | ||||
unreadCount: number, | unreadCount: number, | ||||
threadID: string, | threadID: string, | ||||
codeVersion: ?number, | codeVersion: ?number, | ||||
): apn.Notification { | ): apn.Notification { | ||||
const notification = new apn.Notification(); | const notification = new apn.Notification(); | ||||
notification.contentAvailable = true; | |||||
notification.topic = getAPNsNotificationTopic({ | notification.topic = getAPNsNotificationTopic({ | ||||
platform: 'ios', | platform: 'ios', | ||||
codeVersion: codeVersion ?? undefined, | codeVersion: codeVersion ?? undefined, | ||||
}); | }); | ||||
// It was agreed to temporarily make even releases staff-only. This way | |||||
// we will be able to prevent shipping NSE functionality to public iOS | |||||
// users until it is thoroughly tested among staff members. | |||||
if (codeVersion && codeVersion > 1000 && codeVersion % 2 === 0) { | |||||
notification.mutableContent = true; | |||||
notification.pushType = 'alert'; | |||||
notification.badge = unreadCount; | |||||
} else { | |||||
notification.priority = 5; | notification.priority = 5; | ||||
notification.contentAvailable = true; | |||||
notification.pushType = 'background'; | notification.pushType = 'background'; | ||||
} | |||||
notification.payload = | notification.payload = | ||||
codeVersion && codeVersion > 135 | codeVersion && codeVersion > 135 | ||||
? { | ? { | ||||
backgroundNotifType: 'CLEAR', | backgroundNotifType: 'CLEAR', | ||||
notificationId: iosID, | notificationId: iosID, | ||||
setUnreadStatus: true, | setUnreadStatus: true, | ||||
threadID, | threadID, | ||||
} | } | ||||
Show All 26 Lines |