Skip to content

Commit 799412f

Browse files
committed
include notifications url for merged payloads
1 parent e1e3a24 commit 799412f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sw/eventListener.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import ServiceWorkerStorage from 'serviceworker-storage'
22
import { numWithUnits } from '@/lib/format'
33
import { CLEAR_NOTIFICATIONS, clearAppBadge, setAppBadge } from '@/lib/badge'
44
import { ACTION_PORT, DELETE_SUBSCRIPTION, MESSAGE_PORT, STORE_OS, STORE_SUBSCRIPTION, SYNC_SUBSCRIPTION } from '@/components/serviceworker'
5-
// import { getLogger } from '@/lib/logger'
5+
import { getLogger } from '@/lib/logger'
66

77
// we store existing push subscriptions to keep them in sync with server
88
const storage = new ServiceWorkerStorage('sw:storage', 1)
@@ -97,6 +97,7 @@ const mergeNotification = (event, sw, payload, currentNotifications, tag, nid) =
9797
// currentNotifications.reduce causes iOS to sum n notifications + initialAmount which is already n notifications
9898
const mergedPayload = {
9999
...incomingData,
100+
url: '/notifications', // when merged we should always go to the notifications page
100101
amount: initialAmount + 1,
101102
sats: initialSats + incomingData.sats
102103
}
@@ -131,7 +132,7 @@ const mergeNotification = (event, sw, payload, currentNotifications, tag, nid) =
131132
}
132133
// logger.info(`[sw:push] ${nid} - calculated title: ${title}`)
133134

134-
const options = { icon: payload.options?.icon, tag, data: { url: '/notifications', ...mergedPayload } }
135+
const options = { icon: payload.options?.icon, tag, data: { ...mergedPayload } }
135136
// logger.info(`[sw:push] ${nid} - show notification with title "${title}"`)
136137
return { title, options } // send the new, merged, payload
137138
}

0 commit comments

Comments
 (0)