@@ -11,6 +11,7 @@ const storage = new ServiceWorkerStorage('sw:storage', 1)
11
11
let messageChannelPort
12
12
let actionChannelPort
13
13
14
+ // TODO 756.2 Fix iOS check, initialValue isn't updated if iOS is true
14
15
// operating system. the value will be received via a STORE_OS message from app since service workers don't have access to window.navigator
15
16
let os = ''
16
17
const iOS = ( ) => os === 'iOS'
@@ -131,7 +132,7 @@ const mergeAndShowNotification = async (sw, payload, currentNotifications, tag,
131
132
}
132
133
const newPayload = { ...data , amount : newAmount , sats : newSats }
133
134
return newPayload
134
- } , { ...incomingData , amount : initialAmount } )
135
+ } , { ...incomingData , amount : 1 } ) // 1 is hard coded to test iOS scenario, should be initialValue
135
136
136
137
log ( `[sw:push] ${ nid } - merged payload: ${ JSON . stringify ( mergedPayload ) } ` )
137
138
@@ -142,7 +143,7 @@ const mergeAndShowNotification = async (sw, payload, currentNotifications, tag,
142
143
if ( compareTag === 'REPLY' ) {
143
144
title = `you have ${ amount } new replies`
144
145
} else if ( compareTag === 'MENTION' ) {
145
- title = `you were mentioned ${ amount } times`
146
+ title = `you were mentioned ${ amount } times` // PROPOSAL: url should be notifications page
146
147
} else if ( compareTag === 'ITEM_MENTION' ) {
147
148
title = `your items were mentioned ${ amount } times`
148
149
} else if ( compareTag === 'REFERRAL' ) {
@@ -175,6 +176,9 @@ const mergeAndShowNotification = async (sw, payload, currentNotifications, tag,
175
176
return await sw . registration . showNotification ( title , options )
176
177
}
177
178
179
+ // TODO 756.3 sometimes you get sent to very old threads, this is because the notification is not updated
180
+ // PROPOSAL close all notifications with the same tag
181
+
178
182
export function onNotificationClick ( sw ) {
179
183
return ( event ) => {
180
184
const url = event . notification . data ?. url
0 commit comments