From 8abd3ebec700aac42fa91994277a2a24ab5a598a Mon Sep 17 00:00:00 2001 From: Johann150 Date: Sun, 29 Jan 2023 12:38:38 +0100 Subject: [PATCH] client: remove notification forwarding to service worker This was an interim measure, but now that push notifications are always enabled, this should not be necessary any more and the service worker should receive all notifications automatically. --- packages/client/src/ui/_common_/common.vue | 8 -------- packages/sw/src/sw.ts | 3 --- 2 files changed, 11 deletions(-) diff --git a/packages/client/src/ui/_common_/common.vue b/packages/client/src/ui/_common_/common.vue index 3cec9b388..c7121d9d0 100644 --- a/packages/client/src/ui/_common_/common.vue +++ b/packages/client/src/ui/_common_/common.vue @@ -33,14 +33,6 @@ const dev: Ref = ref(_DEV_); const onNotification = (notification: { type: string; id: any; }): void => { if ($i?.mutingNotificationTypes.includes(notification.type)) return; - // if push notifications are enabled there is no need to pass the notification along - if (!instance.enableServiceWorker) { - // service worker is not enabled or set up on the server, pass the notification along - navigator.serviceWorker.ready.then(registration => { - registration.active.postMessage({ type: 'notification', body: notification }); - }); - } - sound.play('notification'); }; diff --git a/packages/sw/src/sw.ts b/packages/sw/src/sw.ts index 490c40b30..10cfc69d3 100644 --- a/packages/sw/src/sw.ts +++ b/packages/sw/src/sw.ts @@ -164,9 +164,6 @@ self.addEventListener('message', (ev: ServiceWorkerGlobalScopeEventMap['message' case 'initialize': swLang.setLang(ev.data.lang); break; - case 'notification': - createNotification(ev.data); - break; } } })());