Files
hermes-skills/skills/software-development/shark-game-development/references/push-notification-ios-pwa-pitfalls.md
T

22 lines
1.2 KiB
Markdown

# Push Notification Testing Findings (Jul 9, 2026)
## iOS Safari: PushManager not available in browser tab
- Safari on iPhone does NOT expose `PushManager` in normal browsing mode
- `FAIL: No PushManager` is expected
- User must install the PWA: Share icon -> Add to Home Screen
- Then open from home screen (fullscreen PWA mode)
- APNs endpoint: `https://web.push.apple.com/...`
- Chrome/Edge/Firefox on desktop work natively
## Common bugs fixed:
1. **Banner hidden**: `display:none` in HTML, JS must set `style.display='block'`
2. **user_id NULL**: Foreign key constraint on `push_subscriptions.user_id` means test/no-auth subscriptions fail. Column must allow NULL or skip auth requirement on the subscribe endpoint
3. **Silent failure**: `send_push_notification()` used `except: pass` — changed to print the error
4. **Import missing**: `import json` was missing and `webpush()` needs it for `json.dumps()` payload
5. **Wrong venv**: `pywebpush` must be installed in the same venv the systemd service uses
## Trigger flow for scoring pushes:
- `send_push_notification(user_id, title, body, icon)` is called after score events
- Currently only works for authed users with subscriptions
- No quiet hours check yet in the push function itself (only in settings toggle)