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 @@ -375,6 +375,7 @@ newRawMessageInfos: shimmedNewRawMessageInfos, threadID: threadInfo.id, collapseKey: notifInfo.collapseKey, + badgeOnly, unreadCount, platformDetails, dbID, @@ -905,6 +906,7 @@ +newRawMessageInfos: RawMessageInfo[], +threadID: string, +collapseKey: ?string, + +badgeOnly: boolean, +unreadCount: number, +platformDetails: PlatformDetails, }; @@ -915,27 +917,18 @@ newRawMessageInfos: t.list(rawMessageInfoValidator), threadID: tID, collapseKey: t.maybe(t.String), + badgeOnly: t.Boolean, unreadCount: t.Number, platformDetails: tPlatformDetails, }); -type APNsNotifInputData = { - ...CommonNativeNotifInputData, - +badgeOnly: boolean, -}; - -const apnsNotifInputDataValidator = tShape({ - ...commonNativeNotifInputDataValidator.meta.props, - badgeOnly: t.Boolean, -}); - async function prepareAPNsNotification( - inputData: APNsNotifInputData, + inputData: CommonNativeNotifInputData, devices: $ReadOnlyArray, ): Promise<$ReadOnlyArray> { const convertedData = await validateOutput( inputData.platformDetails, - apnsNotifInputDataValidator, + commonNativeNotifInputDataValidator, inputData, ); const { @@ -1183,6 +1176,7 @@ newRawMessageInfos, threadID, collapseKey, + badgeOnly, unreadCount, platformDetails, dbID, @@ -1231,7 +1225,7 @@ notification.data = { ...notification.data, id: notifID, - badgeOnly: '0', + badgeOnly: badgeOnly ? '1' : '0', }; const messageInfos = JSON.stringify(newRawMessageInfos);