Progression adds the step the way a stepper tap does — a weight off the increment grid keeps its offset (397 + 10 = 407, not 410; #175); the service worker closes the previous notification of the same kind before showing the next (#172)
This commit is contained in:
1 parent
06f1c007a7
commit
bff87930d8
4 files changed
+42
-6
No files matched your search
@@ -15,11 +15,16 @@ self.addEventListener('push', e => {
|
||||
e.waitUntil((async () => {
|
||||
let data = {}
|
||||
try { data = e.data ? e.data.json() : {} } catch { data = { body: (() => { try { return e.data.text() } catch { return '' } })() } }
|
||||
// One alert per kind: a new rest-timer push replaces the last one instead of stacking
|
||||
// up in the tray (issue #172). `tag` alone should do that, but iOS keeps every one, so
|
||||
// the previous notification with the same tag is closed by hand first.
|
||||
const tag = data.tag || 'opengym'
|
||||
try { for (const n of await self.registration.getNotifications({ tag })) n.close() } catch {}
|
||||
await self.registration.showNotification(data.title || 'openGym', {
|
||||
body: data.body || '',
|
||||
icon: 'icon-512.png',
|
||||
badge: 'icon-180.png',
|
||||
tag: data.tag || 'opengym',
|
||||
tag,
|
||||
renotify: true
|
||||
})
|
||||
})())
|
||||
|
||||
Reference in new issue
Block a user