Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The Expo / React Native player for iOS and Android, with its own `package.json`,
- **iOS uses the UIScene life cycle (`expo-build-properties` `ios.enableSceneSupport`).** Without it an iOS 27-SDK build is killed at launch on iOS 27; drop it with the SDK 58 upgrade, whose template does the same (TESTING.md).
- **OTA cannot reach native code.** The Live Activity card (Lock Screen, Dynamic Island, the Apple Watch Smart Stack) is SwiftUI under `targets/live-activity/` and `modules/live-activity/ios/`, so a change there ships only in a new binary, like a dependency, `patches/`, plugin or native `app.json` change; the JS that drives it (`src/hooks/useLiveActivity.ts`) is OTA-able. The same holds for the App Intents (Siri, Shortcuts): Swift under `targets/live-activity/_shared/` and `modules/app-intents/ios/`, JS under `src/intents/`. `SubwaveLiveAttributes.swift` is compiled into both and must stay byte-identical (`npm test` checks): a mismatch stops the card rendering instead of failing the build.
- **Android Auto's browse session is RNTP's own**, reached through the patch's `MediaBrowserBridge`; `modules/android-auto` only lists stations, and a pick reaches `service.ts` as `remote-play-id`. Play enforced against a TTS-reading app once (#477); TESTING.md has the history and the device check.
- **The CarPlay app is off unless `SUBWAVE_CARPLAY=1` is set at prebuild** (`plugins/withCarPlay.js`), because a device build can't be signed with the CarPlay entitlement until Apple grants it. Unset, the Info.plist and entitlements are unchanged (`npm test` checks). Its Swift is `targets/live-activity/_shared/SubwaveCarPlay.swift` (TESTING.md).
- **The CarPlay app is on only when `SUBWAVE_CARPLAY=1` is set at prebuild** (`plugins/withCarPlay.js`). Apple granted the CarPlay Audio entitlement on 2026-11-27, so `eas.json` sets it in every iOS profile's `ios.env`, never at profile level or for Android; a local `npx expo prebuild` without it builds the app with no CarPlay. A device build can't be signed with the entitlement unless the grant is on the App ID. Unset, the Info.plist and entitlements are unchanged (`npm test` checks both). Its Swift is `targets/live-activity/_shared/SubwaveCarPlay.swift` (TESTING.md).
- **The station password is not the station login** (#478). Every check is the fail-closed `POST /station-auth`, and only the controller's own answers count: a 200 with its `{ ok: true }` body is a right password and a 401 with its `{ ok: false }` body a wrong one, while anything else keeps a saved password and saves no typed one (`stationAuthResult`, #2143, #2164); the password rides the stream as `?auth=` so Cast works; `createApi` reads it through a getter because the feed reset and the Live Activity lifecycle key on the `api` object's identity, so rebuilding the client on unlock would reset both. While playback is stuck, `src/lib/stuck-password-check.ts` asks again after every answer but a denial, never within 120 s of the last check or before a 429's `Retry-After` runs out, capped at the route's own window: it allows a household's address 20 attempts per 15 minutes (#2141, #2164). When the gate's stop takes a tuned-in listener off the air, the right typed password tunes them back in with no second press (`src/lib/gate-resume.ts`, the twin of the web's `lib/gateResume.ts`), through `tune`, so it is a listener's own load in `stream-recovery.ts`. `useStationGate` outlives a station switch, so the hold names the `api` it was taken on, and `tune` toggles, so it never runs for a listener already tuned in.
- **Every stream reload goes through `src/lib/stream-recovery.ts` while the player is mounted** (#2114, #2139): one at a time, and never on a state event alone. A listener's own load (a tune-in, a retune, a Play from the lock screen, a headset, CarPlay or Bluetooth) always loads, queued behind one in flight. `service.ts` hands a remote Play to the mounted player (`src/lib/remote-play.ts`) and loads directly only when none is mounted, which Android's headless service allows; an App Intent's tune-in and station switch do the same (`src/intents/tune-flow.ts`), and so does an Android Auto pick. The watchdog, churn guard and error backoff each check the native media clock first, because a reload re-sends Icecast's burst and the listener hears audio twice; a regained link reads it through the pending check it brings forward, and with none pending reloads at once. Every load is checked even when it reports no state (iOS drops a repeated Loading, #2143), and an automatic reload is a failure until its item stays up, so a hung station backs off to 60 s. Playing resets that only provisionally: an item that fails after stopping within 4 s of its first Playing, judged from the moment it stopped, takes the reset back, and the reload after it waits at most 16 s, so a stream cut a moment in can't reload 35-60 times a minute. A stall never counts, however early, and stays on the 6 s watchdog: Icecast closes a stalled socket about 15 s after its source stops, so a longer wait hears that close as a failure, and a flapping source climbs to a minute of silence. A hold counts as the item's Playing, because JS can miss the real one. None of this runs during an iOS audio interruption (a call, Siri), which freezes the clock without a state event.
- **The idle skip changes only the native rate, never seeks or reloads** (#9, the port of web's `idleSkip.ts`, kept in step with it). It runs on an MP3 load in the foreground, reads `/state` only after that load's first Playing, and ends on any stall, pause, interruption or backgrounding, since JS timers can stop while the 8x would not. `loadAndPlay` resets the rate to 1x because RNTP carries it to the next item. What it shed reaches the feed as `leadTrimMs`, so the track clock and the DJ's lines move with the listener.
Expand Down
9 changes: 9 additions & 0 deletions docs/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ eas build --profile production --platform ios
eas submit --profile production --platform ios # submit config already in eas.json
```

The CarPlay app ships in every iOS profile: `eas.json` sets `SUBWAVE_CARPLAY=1`
under each profile's `ios.env` (never for Android), since Apple granted team
BU9RD766GN the CarPlay Audio entitlement on 2026-11-27. The flag drives
`plugins/withCarPlay.js`, so this is a binary change, not an OTA one. To cut a
build without CarPlay, drop it from that profile's `ios.env`. Signing needs
"CarPlay Audio App (CarPlay framework)" on the `com.getsubwave.app` App ID; EAS
regenerates the provisioning profile to include it. Details: [`TESTING.md`](./TESTING.md)
"CarPlay".

Optional metadata push (name/subtitle/description/keywords/review notes live in
[`store.config.json`](../store.config.json), owner-editable):

Expand Down
28 changes: 17 additions & 11 deletions docs/TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,25 +259,29 @@ head unit) should show the new title without unlocking.

### CarPlay — Now-Playing in the car (iOS only)

Every build today is **Tier 1**: control the *already-playing* stream from the dash (metadata,
artwork, play/pause/stop). There is **no launchable in-car app icon** — start the
stream in the phone app first, then connect the car. RNTP feeds the iOS surface
(`MPNowPlayingInfoCenter`), so CarPlay needs **no extra app-side wiring**.
**Tier 1**, in every build: control the *already-playing* stream from the dash (metadata,
artwork, play/pause/stop). RNTP feeds the iOS surface (`MPNowPlayingInfoCenter`), so
this needs **no extra app-side wiring**. A build without the CarPlay flag (below) has
only this: no in-car app icon, so start the stream in the phone app first.

- **iOS** — run on a device, or use the **CarPlay Simulator** (Simulator app →
**I/O → External Displays → CarPlay**). Start the stream, open the CarPlay
screen → SUB/WAVE shows under **Now Playing** with title/artist/album + artwork;
Play/Pause work; no scrubber (the `isLiveStream` track hides it). On iOS 26+
the Live Activity's `.small` card also appears on the CarPlay Dashboard.

**Tier 2, the CarPlay app, is built but switched off.** It puts SUB/WAVE in the
**Tier 2, the CarPlay app, is on in every EAS iOS build.** It puts SUB/WAVE in the
car's app grid: the saved stations as a list, tap one to tune in, then the system
Now Playing screen with a heart. It needs Apple's `com.apple.developer.carplay-audio`
entitlement, which Apple grants on request (developer.apple.com/carplay), and a
device build cannot be signed with it until the grant is on the App ID. So
`plugins/withCarPlay.js` does nothing unless `SUBWAVE_CARPLAY=1` is set at prebuild:
unset, the Info.plist and entitlements are what they were. Once the grant lands, set
it in `eas.json`'s `env` for the iOS profiles.
device build cannot be signed with it unless the grant is on the App ID. Apple
granted it to team BU9RD766GN on 2026-11-27, and "CarPlay Audio App (CarPlay
framework)" is on for `com.getsubwave.app`. `plugins/withCarPlay.js` still does
nothing unless `SUBWAVE_CARPLAY=1` is set at prebuild, so a build can leave CarPlay
out: unset, the Info.plist and entitlements are what they were without it.
`eas.json` sets it in each profile's `ios.env`, never at profile level, where it
would reach Android builds too (`npm test` checks). A plain local
`npx expo prebuild -p ios` has no CarPlay; add the flag to get it.

- **Swift draws, JS decides.** `targets/live-activity/_shared/SubwaveCarPlay.swift`
reads the stations the app already mirrors for Siri (`SavedStations`, App Group),
Expand Down Expand Up @@ -318,8 +322,10 @@ it in `eas.json`'s `env` for the iOS profiles.
second window (drag the app from the Dock) must close rather than open a player.
- **Verified so far (2026-11):** it builds with Xcode 27, a normal phone launch
goes through `SubwavePhoneSceneDelegate` (2026-10), and the plugin's plist edits
are under `npm test`. The CarPlay screens, the car-first launch and the iPad second
window are not yet run.
are under `npm test`. A signed Release device build (automatic signing,
`-allowProvisioningUpdates`) carries `com.apple.developer.carplay-audio` in its
profile and the app's entitlements (2026-11-27). The CarPlay screens, the
car-first launch and the iPad second window are not yet run.

### Android Auto — the station list in the car (Android only)

Expand Down
12 changes: 8 additions & 4 deletions eas.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,34 @@
"distribution": "internal",
"ios": {
"simulator": true,
"image": "macos-tahoe-26.6-xcode-27.1"
"image": "macos-tahoe-26.6-xcode-27.1",
"env": { "SUBWAVE_CARPLAY": "1" }
}
},
"development-device": {
"developmentClient": true,
"distribution": "internal",
"ios": {
"image": "macos-tahoe-26.6-xcode-27.1"
"image": "macos-tahoe-26.6-xcode-27.1",
"env": { "SUBWAVE_CARPLAY": "1" }
}
},
"preview": {
"distribution": "internal",
"channel": "preview",
"ios": {
"simulator": false,
"image": "macos-tahoe-26.6-xcode-27.1"
"image": "macos-tahoe-26.6-xcode-27.1",
"env": { "SUBWAVE_CARPLAY": "1" }
},
"android": { "buildType": "apk" }
},
"production": {
"autoIncrement": true,
"channel": "production",
"ios": {
"image": "macos-tahoe-26.6-xcode-27.1"
"image": "macos-tahoe-26.6-xcode-27.1",
"env": { "SUBWAVE_CARPLAY": "1" }
}
}
},
Expand Down
9 changes: 5 additions & 4 deletions plugins/withCarPlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
// plugin only switches it on:
//
// 1. `com.apple.developer.carplay-audio` in the entitlements. Apple grants
// it on request, and a DEVICE build cannot be signed with it until the
// grant is on the App ID, so it is opt-in: set SUBWAVE_CARPLAY=1 for a
// simulator build (the CarPlay simulator ignores provisioning) and, once
// the grant lands, in eas.json. Unset, the app is exactly as before.
// it on request, and a DEVICE build cannot be signed with it unless the
// grant is on the App ID. Team BU9RD766GN has it (2026-11-27), and
// eas.json sets SUBWAVE_CARPLAY=1 in every iOS profile's env. It stays a
// flag so a build can leave CarPlay out: unset, the app is exactly as
// it is without the plugin.
// 2. A CarPlay scene role in the scene manifest that `ios.enableSceneSupport`
// writes, multiple scenes on, and the phone role's delegate swapped for
// PhoneSceneDelegate, which adopts React Native when the car launched the
Expand Down
23 changes: 19 additions & 4 deletions scripts/carplay-plugin.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// plugins/withCarPlay.js switches the CarPlay app on only when SUBWAVE_CARPLAY=1
// is set at prebuild, because a device build cannot be signed with Apple's
// CarPlay entitlement until the grant is on the App ID. Unset, the Info.plist
// and entitlements must be what expo-build-properties alone writes: a stray
// CarPlay role or entitlement fails every store build's signing.
// is set at prebuild. eas.json sets it for every iOS build now that Apple has
// granted the entitlement; unset, a build must still be exactly what
// expo-build-properties alone writes, so a build can leave CarPlay out (a team
// without the grant, or a CarPlay regression to ship around).
//
// The two plugins run here in app.json's order, with their Info.plist and
// entitlements mods called directly on an empty plist, as prebuild calls them.
Expand Down Expand Up @@ -126,3 +126,18 @@ test('app.json lists the plugin before expo-build-properties', () => {
assert.ok(carPlay >= 0, 'withCarPlay is not in app.json');
assert.ok(carPlay < buildProperties, 'withCarPlay must come before expo-build-properties');
});

test('eas.json turns CarPlay on for every iOS build and never at the profile level', () => {
// Apple granted the entitlement (2026-11-27), so EAS builds carry it. It sits
// under each profile's ios.env, which a profile extending it inherits for iOS
// only: a profile-level env reaches Android builds too.
type Profile = { env?: Record<string, string>; ios?: { env?: Record<string, string> }; android?: { env?: Record<string, string> } };
const profiles: Record<string, Profile> = JSON.parse(readFileSync(path.join(ROOT, 'eas.json'), 'utf8')).build;
for (const name of ['development', 'development-device', 'preview', 'production']) {
assert.equal(profiles[name]?.ios?.env?.SUBWAVE_CARPLAY, '1', `${name} does not set SUBWAVE_CARPLAY=1 for iOS`);
}
for (const [name, profile] of Object.entries(profiles)) {
assert.equal(profile.env?.SUBWAVE_CARPLAY, undefined, `${name} sets SUBWAVE_CARPLAY for every platform`);
assert.equal(profile.android?.env?.SUBWAVE_CARPLAY, undefined, `${name} sets SUBWAVE_CARPLAY for Android`);
}
});
Loading