Rename the Grown-ups profile and PIN to Adult (0.108.48)

A profile saved under the old name takes the new one when it loads.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-06 09:47:54 +00:00
co-authored by Claude Opus 5.5
parent 97ddf1979f
commit a43e808f7a
8 changed files with 26 additions and 20 deletions
@@ -200,7 +200,7 @@ private fun PhoneCard(modifier: Modifier) {
}
Text(PhoneLink.active?.let { "Connected: $it" } ?: "Same Wi-Fi as this TV. The code works once, for two minutes.", color = if (PhoneLink.active != null) Mint else Muted, fontSize = 11.sp)
// The phone asks for the After Dark PIN next, which is also four digits: say so here, so it isn't mistaken for this code.
if (PhoneLink.active == null && AfterDarkLock.pinSet) Text("Then your phone asks for your Grown-ups PIN, the one for After Dark.", color = Muted, fontSize = 11.sp)
if (PhoneLink.active == null && AfterDarkLock.pinSet) Text("Then your phone asks for your Adult PIN, the one for After Dark.", color = Muted, fontSize = 11.sp)
}
}
@@ -134,7 +134,7 @@ private fun OrbitApp() {
kotlinx.coroutines.withContext(kotlinx.coroutines.Dispatchers.IO) { RememberedConnectionStore.get(context).load() } == null) Onboarding.start(tour = false)
}
val onboarding = Onboarding.step != null
// With no Kids profile there's no one to ask: Grown-ups goes straight in.
// With no Kids profile there's no one to ask: Adult goes straight in.
LaunchedEffect(realChannelAvailable, profile, Profiles.kidsOn, onboarding) {
if (realChannelAvailable && profile == null && !Profiles.kidsOn && !onboarding) Profiles.current = Profiles.all.first { it.kind == ProfileKind.Grown }
}
@@ -174,7 +174,7 @@ private fun OrbitApp() {
}
// The sections sit centred on the screen, over the centred page below; the logo keeps the left, the clock the right.
if (picking) WhosWatching(onClose = { activity?.finish() })
// At the end of the flow the one who set Orbit up starts watching as Grown-ups; the tour goes back to Settings.
// At the end of the flow the one who set Orbit up starts watching as Adult; the tour goes back to Settings.
if (onboarding) OnboardingScreen(signedIn = realChannelAvailable) { tour ->
if (!tour) { section = if (realChannelAvailable) "Home" else "Connect Emby"; Profiles.current = Profiles.all.first { it.kind == ProfileKind.Grown } }
}
@@ -36,7 +36,7 @@ import kotlin.math.sin
/**
* First launch for a new user (Paul, 5 November 2026, from the approved design; Emby first, the other servers later). Welcome
* with Ollie, choose the server, sign in (Orbit's own sign-in), pick the channels while Drift sets them up and shows what went
* where, who watches (the Grown-ups PIN and Kids), and You're on air. It runs once, for a box that has never been signed in.
* where, who watches (the Adult PIN and Kids), and You're on air. It runs once, for a box that has never been signed in.
* Settings › Emby account can show it again as a tour, which changes nothing. Ollie rolls in and blinks; Drift bobs and blinks;
* at the end the cast floats right through the stars. All still with Reduce motion on.
*/
@@ -303,7 +303,7 @@ private fun WhoWatchesStep(onNext: () -> Unit) {
LaunchedEffect(pinStep) { if (pinStep == 0) runCatching { go.requestFocus() } }
Column(Modifier.fillMaxSize(), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(12.dp)) {
Text("Who watches?", color = Ink, fontFamily = Anton, fontSize = 32.sp)
Text("Set a PIN for Grown-ups, and keep a Kids profile if there are little ones about.", color = Muted, fontSize = 15.sp)
Text("Set a PIN for the Adult profile, and keep a Kids profile if there are little ones about.", color = Muted, fontSize = 15.sp)
if (pinStep > 0) {
if (pinStep == 1) key(1) { PinEntry("Choose a four-digit PIN", null, onDone = { first = it; pinStep = 2 }, onCancel = { pinStep = 0 }) }
else key(2) { PinEntry("Enter it again", null, onDone = { pin ->
@@ -315,7 +315,7 @@ private fun WhoWatchesStep(onNext: () -> Unit) {
Row(horizontalArrangement = Arrangement.spacedBy(28.dp), modifier = Modifier.padding(top = 10.dp)) {
Column(Modifier.width(280.dp).background(Panel, RoundedCornerShape(14.dp)).padding(18.dp), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(8.dp)) {
ProfileAvatar("sil-blue", 90.dp)
Text("Grown-ups", color = Ink, fontSize = 20.sp, fontWeight = FontWeight.SemiBold)
Text("Adult", color = Ink, fontSize = 20.sp, fontWeight = FontWeight.SemiBold)
Text("Everything, including After Dark", color = Muted, fontSize = 13.sp)
OrbitButton(if (AfterDarkLock.pinSet) "PIN set: change it" else "Set a PIN", Modifier.focusRequester(go), onClick = { note = null; pinStep = 1 })
}
@@ -328,7 +328,7 @@ private fun WhoWatchesStep(onNext: () -> Unit) {
}
note?.let { Text(it, color = Yellow, fontSize = 14.sp) }
OrbitButton("Next", Modifier.padding(top = 8.dp).width(200.dp), onClick = onNext)
Text("You can skip this: with no PIN, Grown-ups opens without one. Change both in Settings › Profiles.", color = Muted, fontSize = 12.sp)
Text("You can skip this: with no PIN, Adult opens without one. Change both in Settings › Profiles.", color = Muted, fontSize = 12.sp)
}
}
@@ -28,7 +28,7 @@ import java.util.concurrent.Executors
* on the home Wi-Fi, which a phone opens by scanning a QR code on the TV. No app, no account, and the Emby sign-in never
* leaves the TV. The rules:
* - Only addresses on the home network are answered; anything else is closed unread.
* - A phone joins with a one-time code from the TV, good for two minutes and five tries, and the Grown-ups PIN if one is set
* - A phone joins with a one-time code from the TV, good for two minutes and five tries, and the Adult PIN if one is set
* (three tries). Each phone address also has its own limit: five wrong answers in ten minutes and it's refused for ten.
* - Requests must name the TV by its address (Host is an IP), so a web page elsewhere can't reach it through a borrowed name.
* - A phone's token works only on the TV that issued it, and the phone page carries catalogue metadata only: titles, years,
@@ -11,8 +11,8 @@ background:#ffde59;color:#071632;font-size:18px;font-weight:700}.note{color:#ffd
fun join(note: String?) = """<!doctype html><html><head><title>Orbit</title>$STYLE</head><body><main><h1>Orbit</h1>
<p>Enter the code shown on the TV in Settings › Channels › Create a channel › On your phone.</p>${note?.let { "<p class='note'>${esc(it)}</p>" }.orEmpty()}
<form method="post" action="/join"><input name="code" inputmode="numeric" maxlength="4" autocomplete="one-time-code" autofocus><button>Join</button></form></main></body></html>"""
fun pin(k: String?, code: String?, wrong: Boolean) = """<!doctype html><html><head><title>Orbit</title>$STYLE</head><body><main><h1>Grown-ups PIN</h1>
<p>The code worked. Making channels is for Grown-ups, so now enter your <b>Grown-ups PIN</b>: the four digits that unlock After Dark on the TV.</p>
fun pin(k: String?, code: String?, wrong: Boolean) = """<!doctype html><html><head><title>Orbit</title>$STYLE</head><body><main><h1>Adult PIN</h1>
<p>The code worked. Making channels is for adults, so now enter your <b>Adult PIN</b>: the four digits that unlock After Dark on the TV.</p>
<p>It isn't the code on the TV screen.</p>${if (wrong) "<p class='note'>That PIN didn't match. It's the After Dark PIN, not the TV's code.</p>" else ""}
<form method="post" action="/join">${k?.let { "<input type='hidden' name='k' value='${esc(it)}'>" }.orEmpty()}${code?.let { "<input type='hidden' name='code' value='${esc(it)}'>" }.orEmpty()}
<input name="pin" type="password" inputmode="numeric" maxlength="8" autofocus><button>Continue</button></form></main></body></html>"""
@@ -35,9 +35,9 @@ import org.json.JSONArray
import org.json.JSONObject
/**
* Profiles (Paul, 5 November 2026, from the approved design). "Who's watching?" when Orbit opens: Grown-ups, behind the PIN
* Profiles (Paul, 5 November 2026, from the approved design). "Who's watching?" when Orbit opens: Adult, behind the PIN
* from the After Dark lock, sees everything; Kids sees only the channels ticked for it, never After Dark or The Late Show, has
* no Settings, and leaving it for Grown-ups needs the PIN. Each has a picture: one of the cast, a favourite thing (drawn in
* no Settings, and leaving it for Adult needs the PIN. Each has a picture: one of the cast, a favourite thing (drawn in
* VectorCraft, design/profiles/pictures) or a silhouette in a colour. Kept on this box only. Orbit asks again each time it opens.
*/
internal enum class ProfileKind { Grown, Kids }
@@ -49,7 +49,7 @@ internal data class Profile(val id: String, val name: String, val picture: Strin
/** Kids' channels to start with, from the approved design: Tots, Junior, Wonder, PixelZ, ToonZ, Heroes, Rewind, Vortex, Terra, Wild. */
internal val KidsStartChannels = setOf(TOTS_NUMBER, 611, 612, 613, 605, 602, 604, VORTEX_NUMBER, 201, 203)
internal val DefaultProfiles = listOf(Profile("grown", "Grown-ups", "sil-blue", ProfileKind.Grown), Profile("kids", "Kids", "ollie", ProfileKind.Kids, KidsStartChannels))
internal val DefaultProfiles = listOf(Profile("grown", "Adult", "sil-blue", ProfileKind.Grown), Profile("kids", "Kids", "ollie", ProfileKind.Kids, KidsStartChannels))
/** Every picture there is to choose: the cast, favourite things, and silhouettes in Orbit's colours. */
internal val ProfilePictures = listOf("ollie", "blaze", "zip", "drift", "luna", "bumble", "football", "wand", "rocket", "crown", "rainbow", "paw",
@@ -65,7 +65,7 @@ internal object Profiles {
/** Who's watching, or null before anyone's chosen. */
var current by mutableStateOf<Profile?>(null)
val kids get() = current?.kind == ProfileKind.Kids
/** A Kids profile is in use, so Orbit asks who's watching; without one, Grown-ups goes straight in. */
/** A Kids profile is in use, so Orbit asks who's watching; without one, Adult goes straight in. */
var kidsOn by mutableStateOf(true)
private set
fun setKidsOn(context: Context, on: Boolean) { kidsOn = on; prefs(context).edit().putBoolean("kids_on", on).apply() }
@@ -88,7 +88,8 @@ internal object Profiles {
val a = JSONArray(text)
return (0 until a.length()).map { i ->
val o = a.getJSONObject(i); val ch = o.optJSONArray("channels")
Profile(o.getString("id"), o.getString("name"), o.getString("picture"), ProfileKind.valueOf(o.getString("kind")),
// "Grown-ups" became "Adult" (Paul, 6 November 2026): a profile saved under the old name takes the new one.
Profile(o.getString("id"), o.getString("name").let { if (it == "Grown-ups") "Adult" else it }, o.getString("picture"), ProfileKind.valueOf(o.getString("kind")),
ch?.let { c -> (0 until c.length()).map { c.getInt(it) }.toSet() }.orEmpty(), o.optBoolean("arcade", true), o.optBoolean("driveIn", false))
}.takeIf { list -> list.any { it.kind == ProfileKind.Grown } } ?: DefaultProfiles
}
@@ -152,7 +153,7 @@ internal fun StarrySky(modifier: Modifier = Modifier) {
}
}
/** "Who's watching?" Grown-ups asks for the PIN, when one's set; Kids goes straight in. */
/** "Who's watching?" Adult asks for the PIN, when one's set; Kids goes straight in. */
@Composable
internal fun WhosWatching(onClose: () -> Unit) {
val context = LocalContext.current
@@ -188,7 +189,7 @@ internal fun WhosWatching(onClose: () -> Unit) {
}
}
}
Text("Kids sees only the channels and games chosen for it." + if (AfterDarkLock.pinSet) " Grown-ups needs the PIN." else " Set a PIN in Settings › Profiles to keep Grown-ups for grown-ups.",
Text("Kids sees only the channels and games chosen for it." + if (AfterDarkLock.pinSet) " Adult needs the PIN." else " Set a PIN in Settings › Profiles to keep Adult for grown-ups.",
color = Muted, fontSize = 15.sp)
}
asking?.let { p ->
@@ -238,7 +239,7 @@ internal fun ProfilesDetail(firstSwitch: FocusRequester, modifier: Modifier) {
Text(grown.name, color = Ink, fontSize = 18.sp, fontWeight = FontWeight.SemiBold, modifier = Modifier.weight(1f))
OrbitButton("Change picture", Modifier.focusRequester(firstSwitch), onClick = { choosingFor = grown })
}
// The PIN: what keeps Grown-ups, After Dark and The Late Show for grown-ups.
// The PIN: what keeps Adult, After Dark and The Late Show for grown-ups.
LockDetail(remember { FocusRequester() }, Modifier.fillMaxWidth())
if (kids != null) {
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier.padding(top = 6.dp)) {
@@ -90,7 +90,7 @@ class PhoneLinkTest {
PhoneLink.pinNeeded = { true }; PhoneLink.pinCheck = { it == "4321" }
val q = PhoneLink.beginPairing()
val asked = call("/join", "POST", "code=${q.code}", form = true).body
assertTrue(asked.contains("Grown-ups PIN")); assertTrue(asked.contains("isn't the code on the TV screen"))
assertTrue(asked.contains("Adult PIN")); assertTrue(asked.contains("isn't the code on the TV screen"))
assertTrue(call("/join", "POST", "code=${q.code}&pin=${q.code}", form = true).body.contains("not the TV's code"))
repeat(3) { call("/join", "POST", "code=${q.code}", form = true) } // asking again spends no tries
assertEquals(302, call("/join", "POST", "code=${q.code}&pin=4321", form = true).status)
@@ -10,7 +10,7 @@ class ProfilesTest {
@Test fun profilesSurviveBeingSavedAndRead() {
val changed = DefaultProfiles.map { if (it.kind == ProfileKind.Kids) it.copy(picture = "wand", channels = setOf(TOTS_NUMBER, 611), arcade = false, driveIn = true) else it }
assertEquals(changed, Profiles.decode(Profiles.encode(changed)))
// A saved list without Grown-ups is never used: Orbit goes back to the two it starts with.
// A saved list without Adult is never used: Orbit goes back to the two it starts with.
assertEquals(DefaultProfiles, Profiles.decode(Profiles.encode(changed.filter { it.kind == ProfileKind.Kids })))
}
@@ -31,4 +31,9 @@ class ProfilesTest {
assertEquals(18, ProfilePictures.size)
assertEquals("Fairy wand", pictureName("wand")); assertEquals("Pink", pictureName("sil-pink")); assertEquals("Ollie", pictureName("ollie"))
}
@Test fun aProfileSavedAsGrownUpsIsNowAdult() {
val saved = Profiles.encode(DefaultProfiles).replace("\"Adult\"", "\"Grown-ups\"")
assertEquals("Adult", Profiles.decode(saved).first { it.kind == ProfileKind.Grown }.name)
}
}