Repository navigation
feat(app): Siri, Shortcuts, Control Center and Spotlight for the iOS app - #14
Merged
Merged
Conversation
Ported from perminder-klair/subwave#2113, rebased onto stream recovery (#2114/#2139) and the idle skip (#9).
… read One announcer for the tune-out, station-switch and like subscribers; one on-air state set for the intent tune-in, usePlayer's mount-time adoption and "what's playing"; one store-and-credentials read for StationContext and the intents; one usePlayer tune-out for RemotePause, an intent and a vanished route. StreamRecovery.adopt's doc names the intent path.
A Siri, Shortcuts, Spotlight or Control tune-in loaded the stream itself even with the player mounted, outside stream-recovery.ts: beside a backoff's queued reload, with no idle skip, and on a switch with a teardown recovery could read as a failure and answer by reloading the old station. Every tune-in now goes over service.ts's own claim (playOnMountedPlayer) and loads directly only when no player is mounted. A switch with the player mounted writes the store and arms a tune-in for the new base (tuneInOnArrival); usePlayer takes it when StationContext hands it the new station and tunes in through StreamRecovery in place of the stop. The decisions move to tune-flow.ts so scripts/intent-tune.test.ts can drive them. Intent tune-ins and tune-outs set the Control's on-air state for when no player is mounted, log to the playback log, and cut their waits to a deadline the bridge will send (deadline.ts, a conservative fallback until then).
The bridge gives up on JS 20 s after an intent starts, up to 10 s of it spent on a cold boot, while a song request could spend 16 s on its POST and 10 s more polling: Siri said the app didn't respond for a request the station took, and the listener asked again. The bridge now sends its deadline with each request and the module passes it to JS, which keeps a margin for the reply (deadline.ts). The song request races its POST and each poll against it and stops polling an interval early; a POST still out at the deadline is said as sent, since an error would queue it twice. The tune-in's waits were cut to it in the previous commit. Also: intent actions are an enum on the Swift side and a union in JS, and the module's dedupe set keeps only the last 32 tokens.
After an idle skip the listener is nearer the live edge by what it shed, up to about 17 s on a 22 s buffer, but heardTrack measured "what's playing" and "like this song" from the whole buffer and named the previous song for that long. usePlayer now writes the trim to heard-track.ts beside PlayerScreen's leadTrimMs, loadAndPlay clears it, and on-air.ts and useStationFeed both take the lead from listenerLeadMs.
perminder-klair
added a commit
that referenced
this pull request
Nov 27, 2026
A pick from the car's list, a voice search and a prepared pick's Play all tune in through tune-flow.ts, as Siri's do: handed to the mounted player, and so to StreamRecovery, whenever one is mounted, and loaded directly only with none (tuneInByName sits in tune-flow since the rebase onto the fixed #14). TESTING.md's Android Auto check now covers a pick with the phone app open; CLAUDE.md names the car beside the App Intents.
The like intent ignored the deadline: its /now-playing and /state reads and POST /like could each run 16 s, past the bridge's window, so Siri said the app didn't respond. likeHeard (on-air-reply.ts, pure and tested) races both steps against the deadline and aborts the reads there. A station too slow to say what's on gets no like. A like still unanswered at the deadline is a failure that asks for a repeat, unlike the song request: a repeat like counts once (alreadyLiked), where saying "liked" for one that never landed would lose it.
perminder-klair
added a commit
that referenced
this pull request
Nov 27, 2026
A pick from the car's list, a voice search and a prepared pick's Play all tune in through tune-flow.ts, as Siri's do: handed to the mounted player, and so to StreamRecovery, whenever one is mounted, and loaded directly only with none (tuneInByName sits in tune-flow since the rebase onto the fixed #14). TESTING.md's Android Auto check now covers a pick with the phone app open; CLAUDE.md names the car beside the App Intents.
… late like "What's playing" now races its /now-playing and /state reads against the deadline the bridge sends, aborts them when it passes, and says the station is slow to answer, the way "like this song" already did. Both go through one inTime helper in on-air-reply.ts. likeCurrent takes an optional abort signal, so POST /like is cancelled at the deadline instead of finishing in the background. The reply is still "didn't confirm": the station may have counted it before the cancel, and a repeat answers alreadyLiked.
perminder-klair
added a commit
that referenced
this pull request
Nov 27, 2026
A pick from the car's list, a voice search and a prepared pick's Play all tune in through tune-flow.ts, as Siri's do: handed to the mounted player, and so to StreamRecovery, whenever one is mounted, and loaded directly only with none (tuneInByName sits in tune-flow since the rebase onto the fixed #14). TESTING.md's Android Auto check now covers a pick with the phone app open; CLAUDE.md names the car beside the App Intents.
perminder-klair
marked this pull request as ready for review
November 27, 2026 18:37
perminder-klair
added a commit
that referenced
this pull request
Nov 27, 2026
A pick from the car's list, a voice search and a prepared pick's Play all tune in through tune-flow.ts, as Siri's do: handed to the mounted player, and so to StreamRecovery, whenever one is mounted, and loaded directly only with none (tuneInByName sits in tune-flow since the rebase onto the fixed #14). TESTING.md's Android Auto check now covers a pick with the phone app open; CLAUDE.md names the car beside the App Intents.
perminder-klair
added a commit
that referenced
this pull request
Nov 27, 2026
* feat(app): Android Auto station list Ported from perminder-klair/subwave#2136. * fix(app): Android Auto review fixes: dead session token, caller check, prepare - MediaBrowserBridge clears its token when MusicService is destroyed and tells browse services through a ready/ended listener; a browse service still holding a released session's token (MediaBrowserServiceCompat takes one) answers no root, so the car's next bind gets a fresh one. - SubwaveBrowseService gives a root only to the car, the Assistant and the system (CarCallers, after Google's media sample's PackageValidator). - A prepare (playWhenReady false) no longer plays: the patch passes the flag and src/intents/car-picks.ts holds the pick until the next Play. - A refused or failed car pick is a plog line instead of a swallowed error. - npm test checks the car-connect task name and matchStations' generic words and shortest term against their native twins. - TESTING.md: the bridge and the background-setup bypass in the architecture-critical section; a session-restart and release-build check in the Android Auto checklist. * test(app): Android Auto picks reach the mounted player through tune-flow A pick from the car's list, a voice search and a prepared pick's Play all tune in through tune-flow.ts, as Siri's do: handed to the mounted player, and so to StreamRecovery, whenever one is mounted, and loaded directly only with none (tuneInByName sits in tune-flow since the rebase onto the fixed #14). TESTING.md's Android Auto check now covers a pick with the phone app open; CLAUDE.md names the car beside the App Intents.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The iOS app gets Siri, Shortcuts, Control Center, the Action button and Spotlight. Each works with the app closed.
.audio.playAudio) so Apple Music doesn't take itPOST /request, reads back the DJ's answer (perminder-klair/subwave#417).smallLive Activity layoutEvery intent is thin Swift that hands its action to JS. JS does the work with the same station store, credential vault and player the screens use, so station URLs, logins and passwords never reach Swift:
sequenceDiagram participant Siri as Siri / Shortcuts / Control participant Intent as Swift intent (targets/live-activity/_shared) participant Module as modules/app-intents participant JS as src/intents (registered in index.ts) Siri->>Intent: perform() Intent->>Module: post request (re-posts until acked: JS may still be booting) Module->>JS: onIntent(action, args) JS->>JS: tune / request / like / now playing JS-->>Module: reply(ok, message) Module-->>Intent: reply → Siri dialog or errorThings the work turned up, each fixed here:
expo-build-propertiesios.enableSceneSupport. iOS still connects a scene for a background intent launch, so cold intents keep working.macos-tahoe-26.6-xcode-27.1.LiveActivityIntents, and the JS reply waits for the card, so a Siri tune-in still gets one.usePlayeradopts audio it didn't start. That covers a cold start (mount-time check), an intent's tune-out (no reconnect), and a station switch from Siri (streamBelongsTo).Evidence
Before: a Release build from Xcode 27 crashed at launch on the iOS 27 simulator (
_UIApplicationEvaluateRuntimeIssueForNoSceneLifecycleAdoption), and there were no App Intents beyond the Live Activity heart.After, iPad on iOS 27.2 (Release, development-signed), app closed:
"Hey Siri, play ChillWave Radio on SUB/WAVE" with SUB/WAVE active: the store shows ChillWave made active at the intent's timestamp.
Simulator, iOS 27 and 18.5, Release, app closed each time:
/now-playingchanged, named the song still in the listener's ears.Tests:
npm run lintis clean andnpm testpasses 571 tests (576 with 5 skipped), 52 of them new:intent-tune,intent-request,intent-on-air,intent-stations,announcerandapi.Merge Danger
Door: two-way
Every piece reverts cleanly. Nothing here is destructive: the new App Group keys and Spotlight entries are rebuilt on every station change and go with the app.
Blast Radius: app-launch
usePlayer,StationContextanduseStationFeedare shared, and the native calls are no-ops there. The feed refactor (heard-track.ts) keeps the same rule. The newusePlayerpaths only act when audio started outside the hook, which Android has no route to yet.