Orbit Companion phase 3: Create in five steps, Director approvals, who's watching; logos fit

Create a channel in the Companion (Name, Shows, Style, Hours, Review), saved as
before; the phone can now make channels from any screen, not only while Settings
is open. The Director's Chair on the phone: Drive-In event ideas to approve,
defer or dismiss, and titles to place or drop, saved as Settings saves them.
Who's watching from the phone: Kids straight in, Adult with the PIN when one's
set; while Kids watches, making channels and the Director are refused. The
playback bug for Signature, Unscripted and Christmas fits the whole name.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-07 00:08:29 +00:00
co-authored by Claude Opus 5.5
parent 862b4b5448
commit 21884c1478
11 changed files with 319 additions and 73 deletions
@@ -226,4 +226,31 @@ class PhoneLinkTest {
repeat(5) { assertNotNull(OrbitCompanion.enqueue(screen, 101, null, now)) }
assertNull(OrbitCompanion.enqueue(screen, 101, null, now)); OrbitCompanion.queue = emptyList()
}
@Test fun phaseThreeKeepsKidsToWhatKidsMayDoAndTheDirectorDecidesAsSettingsDoes() {
PhoneLink.clock = { now }
val placed = mutableListOf<Pair<String, Int>>(); val dropped = mutableListOf<String>()
val report = DeskReport(0, 0, 0, 0, emptyList(), 0, listOf(DeskPick("Dune", "Sci-Fi", "", "New", "d1", "Movie", 2021, listOf(DeskOption(132, "Sci-Fi", "Fits")))),
emptyList(), 0, true, 0, now, 1)
PhoneLink.screen = CompanionScreen({ companionChannels }, { selected }, { true }, { 0 }, { _, _ -> }, director = { report },
place = { c, n -> placed += c.id to n }, drop = { dropped += it.id })
val before = Profiles.current
try {
val cookie = joinedCookie()
val profiles = JSONObject(call("/api/profiles", cookie = cookie).body).getJSONArray("profiles")
val kidsId = (0 until profiles.length()).map { profiles.getJSONObject(it) }.first { it.getString("kind") == "Kids" }.getString("id")
val adultId = (0 until profiles.length()).map { profiles.getJSONObject(it) }.first { it.getString("kind") == "Grown" }.getString("id")
assertEquals(1, JSONObject(call("/api/director", cookie = cookie).body).getJSONArray("choices").length())
assertEquals(400, call("/api/director/place", "POST", """{"id":"d1","channel":999}""", cookie = cookie).status) // only its own channels
assertEquals(200, call("/api/director/place", "POST", """{"id":"d1","channel":132}""", cookie = cookie).status); assertEquals(listOf("d1" to 132), placed)
assertEquals(404, call("/api/director/drop", "POST", """{"id":"nope"}""", cookie = cookie).status)
// Kids: no Director and no making channels from the phone.
assertEquals(200, call("/api/profile", "POST", """{"id":"$kidsId"}""", cookie = cookie).status); assertTrue(Profiles.kids)
assertEquals(403, call("/api/director", cookie = cookie).status)
assertEquals(403, call("/api/channels", "POST", """{"name":"X","shows":[]}""", cookie = cookie).status)
// Back to Adult (no PIN set here, so it goes straight in, as on the TV).
assertEquals(200, call("/api/profile", "POST", """{"id":"$adultId"}""", cookie = cookie).status); assertFalse(Profiles.kids)
assertEquals(403, call("/api/profile", "POST", """{"id":"nobody"}""", cookie = cookie).status)
} finally { PhoneLink.screen = null; Profiles.current = before }
}
}