From a564fc1a1f91faf2a418fd6affadbd42c98825d8 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sun, 19 Nov 2023 13:54:26 +0200 Subject: [PATCH 1/2] consistentcy and bugfix --- src/modules/notifications.js | 2 +- .../desktop_notification_utils/desktop_notification_utils.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/notifications.js b/src/modules/notifications.js index 9bd382206..c1f5a63e7 100644 --- a/src/modules/notifications.js +++ b/src/modules/notifications.js @@ -150,7 +150,7 @@ export const notifications = { id, credentials: rootState.users.currentUser.credentials }).then(() => { - closeDesktopNotification(rootState, id) + closeDesktopNotification(rootState, { id }) }) }, dismissNotificationLocal ({ rootState, commit }, { id }) { diff --git a/src/services/desktop_notification_utils/desktop_notification_utils.js b/src/services/desktop_notification_utils/desktop_notification_utils.js index bde9f18cb..80b8c6e0a 100644 --- a/src/services/desktop_notification_utils/desktop_notification_utils.js +++ b/src/services/desktop_notification_utils/desktop_notification_utils.js @@ -21,7 +21,7 @@ export const showDesktopNotification = (rootState, desktopNotificationOpts) => { } } -export const closeDesktopNotification = (rootState, id) => { +export const closeDesktopNotification = (rootState, { id }) => { if (!('Notification' in window && window.Notification.permission === 'granted')) return if (isSWSupported()) { @@ -33,6 +33,6 @@ export const closeAllDesktopNotifications = (rootState) => { if (!('Notification' in window && window.Notification.permission === 'granted')) return if (isSWSupported()) { - swCloseDesktopNotification() + swCloseDesktopNotification({}) } } From 2f90c629b8e765cbc2ab024aa856d9a3e810d8f5 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sun, 19 Nov 2023 13:57:47 +0200 Subject: [PATCH 2/2] fix messages from sw not really being acted upon on mainland --- src/services/sw/sw.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/sw/sw.js b/src/services/sw/sw.js index e28f91685..dd1edf617 100644 --- a/src/services/sw/sw.js +++ b/src/services/sw/sw.js @@ -88,7 +88,7 @@ export async function initServiceWorker (store) { navigator.serviceWorker.addEventListener('message', (event) => { const { dispatch } = store console.log('SW MESSAGE', event) - const { type, ...rest } = event + const { type, ...rest } = event.data switch (type) { case 'notificationClicked':