forked from FoundKeyGang/FoundKey
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.
This commit is contained in:
parent
36031c083a
commit
8abd3ebec7
2 changed files with 0 additions and 11 deletions
|
@ -33,14 +33,6 @@ const dev: Ref<boolean> = ref(_DEV_);
|
||||||
const onNotification = (notification: { type: string; id: any; }): void => {
|
const onNotification = (notification: { type: string; id: any; }): void => {
|
||||||
if ($i?.mutingNotificationTypes.includes(notification.type)) return;
|
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');
|
sound.play('notification');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -164,9 +164,6 @@ self.addEventListener('message', (ev: ServiceWorkerGlobalScopeEventMap['message'
|
||||||
case 'initialize':
|
case 'initialize':
|
||||||
swLang.setLang(ev.data.lang);
|
swLang.setLang(ev.data.lang);
|
||||||
break;
|
break;
|
||||||
case 'notification':
|
|
||||||
createNotification(ev.data);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})());
|
})());
|
||||||
|
|
Loading…
Reference in a new issue