From c864fc4eeaa4f27e91409ad110cdadce358c9dc2 Mon Sep 17 00:00:00 2001 From: Lucas Berger Date: Wed, 10 Jun 2026 14:39:46 -0400 Subject: [PATCH] fix(260610-ka9): restore audible Android push notifications - Add icon, badge, renotify:true, vibrate to showNotification options so reused-tag updates produce heads-up + sound/vibration on Android Chromium - Narrow cast (as NotificationOptions) to handle renotify/vibrate absent from this lib.dom version without suppressing other errors - Generalize ANDROID_STEPS first step to browser-agnostic (Chrome or Edge) --- apps/pwa/src/components/InstructionSheet.tsx | 2 +- apps/pwa/src/sw.ts | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/apps/pwa/src/components/InstructionSheet.tsx b/apps/pwa/src/components/InstructionSheet.tsx index ba5d8d5..4f49592 100644 --- a/apps/pwa/src/components/InstructionSheet.tsx +++ b/apps/pwa/src/components/InstructionSheet.tsx @@ -26,7 +26,7 @@ const IOS_STEPS = [ ] const ANDROID_STEPS = [ - 'Open Chrome on your phone', + 'Open your browser (Chrome or Edge) on your phone', 'Tap the three-dot menu → Settings', 'Tap Site Settings → Notifications', 'Find FamilySync and tap Allow', diff --git a/apps/pwa/src/sw.ts b/apps/pwa/src/sw.ts index 7b318d5..e0b0509 100644 --- a/apps/pwa/src/sw.ts +++ b/apps/pwa/src/sw.ts @@ -121,12 +121,21 @@ self.addEventListener('push', (event: PushEvent) => { // event.waitUntil() is MANDATORY: keeps the SW alive until the notification // is displayed. Without it the SW may be terminated before showNotification // resolves, resulting in a silent push (iOS subscription death). + // renotify and vibrate are valid NotificationOptions per spec but are absent + // from some lib.dom versions (TS strict check). Cast the extended object to + // NotificationOptions so only these two extra keys are affected — no blanket + // suppression of unrelated errors elsewhere in the file. + const options = { + body, + tag, + data: { url }, + icon: '/icon-192.png', + badge: '/icon-192.png', + renotify: true, + vibrate: [200, 100, 200], + } as NotificationOptions event.waitUntil( - self.registration.showNotification(title, { - body, - tag, - data: { url }, - }), + self.registration.showNotification(title, options), ) })