Push: reminders owed within 15 minutes still arrive, the subscription heals itself on every boot, rest-timer alerts belong to the device that started the rest
- reminder tick: a due reminder is sent for up to 15 minutes after its time (once per local date) instead of only on the exact minute — a restart across that minute used to lose the day; state files are stat'ed and re-read only when they changed - sendPush prunes 403 (stale VAPID key) like 404/410; optional device targeting - POST /api/push/subscribe is an upsert that keeps created and stores a deviceId; GET /api/push/status says whether the server holds an endpoint - rest timers keyed per user+device; cancel without a device id keeps the old account-wide behaviour - sw.js: payload parsed inside waitUntil (never a silent push), pushsubscriptionchange re-subscribes and registers the new endpoint - lib/push.js: syncPushSubscription() (called once per signed-in boot from App.jsx and when Settings opens) re-registers a lost row, replaces a subscription made against another key, pushSupported() is false off https; deviceId() per browser - Settings: the notifications switch shows what the server holds - tests: server-reminder (window, dedupe, trained day), server-push-status (upsert, status, per-device timers), lib/push.test.js
This commit is contained in:
1 parent
c92cfc372a
commit
477fc07f8b
10 files changed
+534
-44
No files matched your search
@@ -10,6 +10,8 @@ import { initBackButton } from './lib/back.js'
|
||||
import { useWakeLock } from './lib/wakelock.js'
|
||||
import { installViewportGuard } from './lib/viewport-guard.js'
|
||||
import { installChipDrag } from './lib/hchips.js'
|
||||
import { syncPushSubscription } from './lib/push.js'
|
||||
import { MOBILE } from './lib/mobile.js'
|
||||
import { startFlow } from './sheets.jsx'
|
||||
import Icon from './components/Icon.jsx'
|
||||
import TabBar from './components/TabBar.jsx'
|
||||
@@ -84,6 +86,13 @@ function Shell() {
|
||||
// Click-drag a horizontal chip strip to scroll it sideways (lib/hchips.js) — on a desktop
|
||||
// browser there's otherwise no way to reach the filters past the edge.
|
||||
useEffect(() => installChipDrag(), [])
|
||||
// Once per signed-in boot, hand the server this browser's push subscription again (see
|
||||
// lib/push.js): a subscription the instance lost is back before the next reminder is due,
|
||||
// with nobody having to visit Settings. Web only — the APK has no service worker.
|
||||
useEffect(() => {
|
||||
if (MOBILE || !user || !ready) return
|
||||
syncPushSubscription().catch(() => {})
|
||||
}, [user?.id, ready])
|
||||
useEffect(() => {
|
||||
const onScroll = () => {
|
||||
// Modals pins the body while a sheet is open; scrollY is 0 then, not a position.
|
||||
|
||||
Reference in new issue
Block a user