Commit 0fa14c8
committed
fix: enable push notifications by mounting ServiceWorkerRegistration
## Problem
Push notifications were not working when timer completed - only sound would play.
## Root Cause
ServiceWorkerRegistration component existed but was never mounted in the app, causing:
1. Service Worker never registered → navigator.serviceWorker.ready hangs
2. Permission state not synced to Zustand store → always shows 'default'
3. Notification condition fails silently even if user granted permission
## Solution
Mount ServiceWorkerRegistration component in page.tsx to:
- Register Service Worker on app load
- Sync notification permission from browser to Zustand store
- Enable notifications to be displayed via Service Worker
## Changes
- app/[locale]/page.tsx: Import and render ServiceWorkerRegistration
## Verification
✅ Service Worker registration logs confirmed in console
✅ Build and lint passing
✅ Timer completion flow tested
✅ Ready for manual notification testing in real browser
## Testing Notes
Full notification testing requires manual browser testing (not headless):
1. Open in regular browser
2. Grant notification permission
3. Complete timer
4. Verify notification + sound both trigger1 parent 7b57830 commit 0fa14c8
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
115 | 116 | | |
116 | 117 | | |
117 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
118 | 122 | | |
119 | 123 | | |
120 | 124 | | |
| |||
0 commit comments