move comment back to right place, and explain we we do it after

This commit is contained in:
Bruno Windels 2021-03-25 10:23:43 +01:00
parent 889ca05506
commit b3680af342

View file

@ -261,13 +261,16 @@ async function handlePushNotification(n) {
} }
body = n.content?.body || "New message"; body = n.content?.body || "New message";
} }
// close any previous notifications for this room
await self.registration.showNotification(label, { await self.registration.showNotification(label, {
body, body,
data: {sessionId, roomId, multi}, data: {sessionId, roomId, multi},
tag: NOTIF_TAG_NEW_MESSAGE, tag: NOTIF_TAG_NEW_MESSAGE,
badge: NOTIFICATION_BADGE_ICON badge: NOTIFICATION_BADGE_ICON
}); });
// close any previous notifications for this room
// AFTER showing the new notification as on Android
// where we can only show 1 notification, this creates
// a smoother transition
if (notifsToClose) { if (notifsToClose) {
for (const notif of notifsToClose) { for (const notif of notifsToClose) {
console.log("close previous notification"); console.log("close previous notification");