iOS: CarPlay (#420)
A CarPlay scene beside the phone's: In Progress, Unread and Shows as
CPListTemplates from ipx's API, read with the player's credentials, and
a pick played through the same Playback, so it resumes from the saved
place, saves as it goes and marks read at 90%. Now Playing is the
system's template over Playback's now-playing info.
When the car starts a different episode the page is sent
{t:"replaced"} and closes its player bar. Left open, the bar would have
gone on as the old episode while the host's clock belonged to the new
one, saving that time and marking the wrong item read.
The badge's fetch moves into API.get, which CarPlay shares. Build 13.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -71,17 +71,8 @@ enum Badge {
|
||||
|
||||
/// All Subscriptions' unread count from ipx, or nil when it cannot be had.
|
||||
static func fetch() async -> Int? {
|
||||
guard let url = Server.resolveForPlayer("/api/feeds") else { return nil }
|
||||
var req = URLRequest(url: url)
|
||||
req.timeoutInterval = 20
|
||||
req.setValue("application/json", forHTTPHeaderField: "Accept")
|
||||
Credentials.headers.forEach { req.setValue($1, forHTTPHeaderField: $0) }
|
||||
let cfg = URLSessionConfiguration.default
|
||||
cfg.httpCookieStorage = .shared
|
||||
guard let (data, resp) = try? await URLSession(configuration: cfg).data(for: req),
|
||||
(resp as? HTTPURLResponse)?.statusCode == 200,
|
||||
let n = unread(inAll: data) else { return nil }
|
||||
return n
|
||||
guard let data = await API.get("/api/feeds") else { return nil }
|
||||
return unread(inAll: data)
|
||||
}
|
||||
|
||||
// MARK: - while the app is closed
|
||||
|
||||
Reference in New Issue
Block a user