undo all that crap
This commit is contained in:
parent
a3733eae60
commit
b59b6c132d
1 changed files with 13 additions and 8 deletions
|
@ -59,9 +59,10 @@ const setSettings = async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const showPushNotification = async (event) => {
|
const showPushNotification = async (event) => {
|
||||||
// const activeClients = await getWindowClients()
|
const activeClients = await getWindowClients()
|
||||||
await setSettings()
|
await setSettings()
|
||||||
// Only show push notifications if all tabs/windows are closed
|
// Only show push notifications if all tabs/windows are closed
|
||||||
|
if (activeClients.length === 0) {
|
||||||
const data = event.data.json()
|
const data = event.data.json()
|
||||||
|
|
||||||
const url = `${self.registration.scope}api/v1/notifications/${data.notification_id}`
|
const url = `${self.registration.scope}api/v1/notifications/${data.notification_id}`
|
||||||
|
@ -71,8 +72,12 @@ const showPushNotification = async (event) => {
|
||||||
|
|
||||||
const res = prepareNotificationObject(parsedNotification, i18n)
|
const res = prepareNotificationObject(parsedNotification, i18n)
|
||||||
|
|
||||||
|
if (state.allowedNotificationTypes.has(parsedNotification.type)) {
|
||||||
return self.registration.showNotification(res.title, res)
|
return self.registration.showNotification(res.title, res)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return Promise.resolve()
|
||||||
|
}
|
||||||
|
|
||||||
self.addEventListener('push', async (event) => {
|
self.addEventListener('push', async (event) => {
|
||||||
if (event.data) {
|
if (event.data) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue