#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:
@@ -29,8 +29,8 @@ final class Playback: NSObject {
|
||||
var onError: ((String) -> Void)?
|
||||
/// The sleep timer ran out and playback paused.
|
||||
var onSlept: (() -> Void)?
|
||||
/// Something the page did not choose is playing now: the car's pick (#420).
|
||||
var onReplaced: (() -> Void)?
|
||||
/// Something the page did not choose is loaded now: the car's pick (#420).
|
||||
var onChosen: (() -> Void)?
|
||||
|
||||
private let session: URLSession = {
|
||||
let cfg = URLSessionConfiguration.default
|
||||
@@ -55,6 +55,8 @@ final class Playback: NSObject {
|
||||
private(set) var sleepAt: Date?
|
||||
|
||||
var isPlaying: Bool { player?.timeControlStatus == .playing }
|
||||
/// Playing, or about to once it has buffered: what a player bar's button should say.
|
||||
var wantsToPlay: Bool { player.map { $0.timeControlStatus != .paused } ?? false }
|
||||
/// What is loaded, for the car's lists to mark.
|
||||
var current: Item? { item }
|
||||
var currentTime: Double { player?.currentTime().seconds ?? 0 }
|
||||
@@ -168,15 +170,15 @@ final class Playback: NSObject {
|
||||
}
|
||||
|
||||
/// An episode chosen away from the page, in the car (#420): played from where it got to, and
|
||||
/// the page told, whose player bar would otherwise go on as the old one, saving its place and
|
||||
/// marking it read by this one's clock.
|
||||
/// the page told before it plays, so its player bar shows this one, not the old one or none
|
||||
/// (#442), and the state that follows reaches it.
|
||||
func playChosen(_ item: Item, startAt: Double?) {
|
||||
if item == self.item {
|
||||
play()
|
||||
return
|
||||
}
|
||||
onReplaced?()
|
||||
load(item, startAt: startAt)
|
||||
onChosen?()
|
||||
play()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user