iOS CarPlay: the phone's bar takes up the car's episode; only playable shows (#442, #443, #444)

#442: a car's pick told the page `replaced`, and the page closed its player bar, so leaving the
car with the episode playing left nothing on the phone to pause it. And when the car launched the
app, the page loaded later and was never told anything played. Now the app sends `nowPlaying`
(the item, its place, playing or not) on a car pick, at the page's `ready`, and on coming
forward, and the page's bar takes it up and drives the phone's player. `replaced` is still
handled for builds before this one.

#443: Shows listed every feed with items, blogs included. Now only feeds with a downloaded file,
and an episode only with a downloaded audio file: /media/{id} answers 404 before the download.

#444: tests/native-bridge.ts read its failure count before the CarPlay checks, so those could
fail and still exit 0. The count is read last now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RqkrVARreS9wxzH5o2rF7N
This commit is contained in:
2026-11-11 23:08:14 +00:00
parent a55f08d4ff
commit 6d6bfe6e1d
8 changed files with 94 additions and 16 deletions

View File

@@ -192,7 +192,6 @@ ok(fetched.some(f => f.startsWith('POST /api/push/devices') && f.includes('"sand
await vm.runInContext('forgetPush()', ctx);
ok(fetched.some(f => f.startsWith(`DELETE /api/push/devices/${'ab'.repeat(32)}`)), 'signing out left ipx counting for this phone');
if (failed) { console.error(`\n${failed} failed`); process.exit(1); }
// CarPlay (#420): the car picks another episode, and the page's bar lets go of the old one.
vm.runInContext('player.guid="g1";player.feed="f";player.enc=42;player.entry=E', Object.assign(ctx, { E: entry }));
body.classList.toggle('has-video', false);
@@ -206,5 +205,21 @@ audio.removeAttribute('src');
ok(!last('stop'), "closing the page's player stopped what the car chose");
ok(!posted.some(m => m.t === 'position'), 'the old episode saved its place by the new one\'s clock');
// The car's pick, or one already playing as the page loads (#442): the bar takes it up, and its
// buttons drive the phone's player, where it used to close and leave nothing to pause.
since();
ctx.window.ipxNative.on({ t: 'nowPlaying', feedId: 'f', guid: 'g2', enc: 7, title: 'From the Car', feedTitle: 'A Feed',
playing: true, cur: 120, dur: 1800 });
ok(vm.runInContext('player.guid', ctx) === 'g2', 'the bar did not take up what the phone plays');
ok(audio.paused === false && audio.currentTime === 120 && audio.duration === 1800, 'the bar is not at the phone\'s place');
ok(!last('load') && !last('play'), 'taking it up started it again');
audio.pause();
ok(last('pause'), "the bar's pause did not reach the phone's player");
ctx.window.ipxNative.on({ t: 'state', playing: false });
ctx.window.ipxNative.on({ t: 'nowPlaying', feedId: 'f', guid: 'g2', enc: 7, title: 'From the Car', feedTitle: 'A Feed',
playing: false, cur: 130 });
ok(audio.paused === true && audio.currentTime === 130, 'told again on coming forward, the bar did not follow');
if (failed) { console.error(`\n${failed} failed`); process.exit(1); }
console.log('OK: native-bridge: the host takes playback, keeping, the sleep timer and haptics, and the page follows it');
process.exit(0);