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 @@ -262,6 +262,41 @@ deliveryPromises.push(deliveryPromise); } } + const macosVersionsToTokens = byPlatform.get('macos'); + if (macosVersionsToTokens) { + for (const [codeVersion, deviceTokens] of macosVersionsToTokens) { + const platformDetails = { platform: 'macos', codeVersion }; + const shimmedNewRawMessageInfos = shimUnsupportedRawMessageInfos( + newRawMessageInfos, + platformDetails, + ); + const deliveryPromise = (async () => { + const notification = await prepareAPNsNotification({ + allMessageInfos, + newRawMessageInfos: shimmedNewRawMessageInfos, + threadInfo, + collapseKey: notifInfo.collapseKey, + badgeOnly, + unreadCount: unreadCounts[userID], + platformDetails, + notifTargetUserInfo: { + id: userID, + username, + }, + }); + return await sendAPNsNotification( + 'macos', + notification, + [...deviceTokens], + { + ...notificationInfo, + codeVersion, + }, + ); + })(); + deliveryPromises.push(deliveryPromise); + } + } for (const newMessageInfo of remainingNewMessageInfos) { const newDBID = dbIDs.shift(); @@ -580,7 +615,11 @@ notifTargetUserInfo, getENSNames, ); - if (!badgeOnly) { + + // We don't include alert's body on macos because we + // handle displaying the notification ourselves and + // we don't want macOS to display it automatically. + if (!badgeOnly && platformDetails.platform !== 'macos') { notification.body = merged; notification.sound = 'default'; }