# iOS PWA Push Notification Testing

## The Problem
Web Push API does NOT work in Safari's browser tab on iOS. The `PushManager` object is unavailable in the browser context. Attempting to subscribe in Safari produces:

```
FAIL: No PushManager
```

This is NOT a bug in the code. It is an Apple-imposed limitation: `PushManager` is only exposed when the page runs inside an installed Home Screen PWA.

**The error message is misleading** — it looks like the browser doesn't support push at all. But iOS PWA mode has full push support via Apple Push Service (APNs).

## The Fix

### Step 1: Install the PWA
1. Open shark.iamgmb.com in Safari
2. Tap Share icon (square with arrow at bottom of Safari)
3. Scroll down → "Add to Home Screen"
4. Name it "Shark Game" → Add
5. Open from Home Screen (launches fullscreen, no URL bar)

### Step 2: Enable Notifications
1. Navigate to Settings tab or the push test page
2. Tap "Enable Push Notifications"
3. iOS shows a native permission dialog → Allow
4. Subscription is created with Apple Push Service at `web.push.apple.com/...`

### Verification
After subscribing, the endpoint URL starts with `https://web.push.apple.com/` — this confirms APNs is handling delivery.

## Confirmed Working (Jul 9, 2026)
Tested on iPhone with PWA installed from Home Screen:
- Service worker registration: ✅
- Permission granted: ✅
- Push subscribed: ✅ (endpoint: web.push.apple.com)
- Subscription saved to server: ✅
- Push sent (--sent: 1): ✅
- Notification received on device: ✅

## Desktop
No special handling needed. Chrome, Firefox, Edge all support Web Push natively in the browser. No PWA install required.
