diff --git a/lib/push/crypto.js b/lib/push/crypto.js --- a/lib/push/crypto.js +++ b/lib/push/crypto.js @@ -128,7 +128,6 @@ let unencryptedPayload = { ...rest, - aps: { sound }, merged: alert, badge, }; @@ -140,7 +139,7 @@ try { const unencryptedSerializedPayload = JSON.stringify(unencryptedPayload); - let encryptedNotifAps = { 'mutable-content': 1 }; + let encryptedNotifAps = { 'mutable-content': 1, sound }; if (codeVersion && codeVersion >= 254 && codeVersion % 2 === 0) { encryptedNotifAps = { ...encryptedNotifAps, diff --git a/lib/types/notif-types.js b/lib/types/notif-types.js --- a/lib/types/notif-types.js +++ b/lib/types/notif-types.js @@ -203,16 +203,27 @@ +'apns-push-type': 'background' | 'alert' | 'voip', }; +type EncryptedAPNsSilentNotificationsAps = { + +'mutable-content': number, + +'alert'?: { body: 'ENCRYPTED' }, +}; + export type EncryptedAPNsSilentNotification = $ReadOnly<{ ...SenderDeviceDescriptor, +headers: APNsNotificationHeaders, +encryptedPayload: string, +type: '1' | '0', - +aps: { +'mutable-content': number, +'alert'?: { body: 'ENCRYPTED' } }, + +aps: EncryptedAPNsSilentNotificationsAps, +}>; + +type EncryptedAPNsVisualNotificationAps = $ReadOnly<{ + ...EncryptedAPNsSilentNotificationsAps, + +sound?: string, }>; export type EncryptedAPNsVisualNotification = $ReadOnly<{ ...EncryptedAPNsSilentNotification, + +aps: EncryptedAPNsVisualNotificationAps, +id: string, }>;