From e8f4b80c4232ef3f75ec610e022d09a82c8f711d Mon Sep 17 00:00:00 2001 From: Pauljd Date: Thu, 5 Nov 2026 23:08:32 +0000 Subject: [PATCH] 0.108.34: profiles, Who's watching, and the starry sky Paul, 5 November 2026, from the approved design. Orbit asks Who's watching? each time it opens: Kids (first, with Ollie) and Grown-ups. Grown-ups asks for the PIN when one is set, and entering it also unlocks After Dark and The Late Show. Kids sees only the channels ticked for it (Tots, Junior, Wonder, PixelZ, ToonZ, Heroes, Rewind, Vortex, Terra and Wild to start) across the guide, Home, What's On, Catch Up, channel up and down and the number box; never After Dark or The Late Show; no Settings; the Arcade and Drive-In as set for it (Arcade on, Drive-In off to start). A picture of who's watching sits by the clock; OK on it goes back to Who's watching?. Settings > Profiles holds the PIN, each profile's picture and Kids' channel ticks and switches. Pictures: the cast (drawn in code, to the model sheet), a football, fairy wand, rocket, crown, rainbow and paw print (drawn in VectorCraft, design/profiles/pictures), and silhouettes in six colours. The soft starry sky from the design now sits behind the whole app. Co-Authored-By: Claude Opus 5.5 (1M context) --- android/app/build.gradle.kts | 4 +- .../java/tv/orbit/classic/AfterDarkLock.kt | 3 +- .../main/java/tv/orbit/classic/EmbyClient.kt | 2 +- .../tv/orbit/classic/EmbyConnectionScreen.kt | 11 +- .../java/tv/orbit/classic/MainActivity.kt | 41 ++- .../main/java/tv/orbit/classic/Profiles.kt | 262 ++++++++++++++++++ .../tv/orbit/classic/SecureMediaDataSource.kt | 2 +- .../main/java/tv/orbit/classic/Settings.kt | 4 +- .../drawable-nodpi/orbit_picture_crown.webp | Bin 0 -> 1750 bytes .../orbit_picture_football.webp | Bin 0 -> 3546 bytes .../res/drawable-nodpi/orbit_picture_paw.webp | Bin 0 -> 2068 bytes .../drawable-nodpi/orbit_picture_rainbow.webp | Bin 0 -> 4170 bytes .../drawable-nodpi/orbit_picture_rocket.webp | Bin 0 -> 1908 bytes .../drawable-nodpi/orbit_picture_wand.webp | Bin 0 -> 2244 bytes .../java/tv/orbit/classic/ProfilesTest.kt | 34 +++ 15 files changed, 341 insertions(+), 22 deletions(-) create mode 100644 android/app/src/main/java/tv/orbit/classic/Profiles.kt create mode 100644 android/app/src/main/res/drawable-nodpi/orbit_picture_crown.webp create mode 100644 android/app/src/main/res/drawable-nodpi/orbit_picture_football.webp create mode 100644 android/app/src/main/res/drawable-nodpi/orbit_picture_paw.webp create mode 100644 android/app/src/main/res/drawable-nodpi/orbit_picture_rainbow.webp create mode 100644 android/app/src/main/res/drawable-nodpi/orbit_picture_rocket.webp create mode 100644 android/app/src/main/res/drawable-nodpi/orbit_picture_wand.webp create mode 100644 android/app/src/test/java/tv/orbit/classic/ProfilesTest.kt diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index aa0f1df6..ee8b8f5d 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -9,8 +9,8 @@ android { applicationId = "tv.orbit.classic" minSdk = 26 targetSdk = 36 - versionCode = 193 - versionName = "0.108.33-after-dark-lock" + versionCode = 194 + versionName = "0.108.34-profiles" } buildFeatures { compose = true } compileOptions { sourceCompatibility = JavaVersion.VERSION_17; targetCompatibility = JavaVersion.VERSION_17 } diff --git a/android/app/src/main/java/tv/orbit/classic/AfterDarkLock.kt b/android/app/src/main/java/tv/orbit/classic/AfterDarkLock.kt index 7a0c7cd9..aae2e2f1 100644 --- a/android/app/src/main/java/tv/orbit/classic/AfterDarkLock.kt +++ b/android/app/src/main/java/tv/orbit/classic/AfterDarkLock.kt @@ -38,7 +38,8 @@ internal object AfterDarkLock { /** Unlocked with the PIN, until Orbit closes. */ var unlocked by mutableStateOf(false) private set - val locked get() = pinSet && !unlocked + /** Hidden: a PIN is set and it hasn't been entered, or Kids is watching. */ + val locked get() = (pinSet && !unlocked) || Profiles.kids fun load(context: Context) { pinSet = prefs(context).getString("after_dark_pin", null) != null } private fun prefs(context: Context) = context.getSharedPreferences("orbit_lock", Context.MODE_PRIVATE) diff --git a/android/app/src/main/java/tv/orbit/classic/EmbyClient.kt b/android/app/src/main/java/tv/orbit/classic/EmbyClient.kt index cce4a8eb..bb70a34d 100644 --- a/android/app/src/main/java/tv/orbit/classic/EmbyClient.kt +++ b/android/app/src/main/java/tv/orbit/classic/EmbyClient.kt @@ -66,7 +66,7 @@ internal class HttpsEmbyTransport(internal val deviceId: String = UUID.randomUUI connection.connectTimeout = 10_000 connection.readTimeout = request.readTimeoutMs ?: if (request.path == "/Sessions/Logout") 5_000 else 15_000 connection.setRequestProperty("Accept", "application/json") - connection.setRequestProperty("X-Emby-Authorization", "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.33\"") + connection.setRequestProperty("X-Emby-Authorization", "Emby Client=\"Orbit TV\", Device=\"Orbit TV\", DeviceId=\"$deviceId\", Version=\"0.108.34\"") request.token?.let { connection.setRequestProperty("X-Emby-Token", it) } if (request.method == "POST") { val bytes = request.body.orEmpty().toByteArray(Charsets.UTF_8) diff --git a/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt b/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt index 6f8e238c..a6c362e8 100644 --- a/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt +++ b/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt @@ -333,6 +333,8 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea fun answered() { saveReminders(reminders.map { if (it.channel == due.channel && it.startMs == due.startMs) it.copy(stage = due.stage) else it }); programmeReminder = null } ProgrammeReminderCard(due, System.currentTimeMillis(), onDismiss = ::answered, onWatch = { answered() + // Not for a channel this profile can't see. + if (lockedOut(due.channel) || profileHides(due.channel)) return@ProgrammeReminderCard if (selectedNumber != due.channel) { lastNumber = selectedNumber; selectedNumber = due.channel } channelClockOffset = 0; watchingChannel = true if (!mainGuide && !mainHome && !mainWhatsOn && !mainCatchUp) onGuide() @@ -354,10 +356,10 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea } // The After Dark lock hides its channels from everything that lists or steps through channels, Catch Up included. val availableChannels = availableSampleChannels(channel?.let(::onAir), afterDarkChannel?.let(::onAir), toonamiChannel?.let(::onAir), *extraChannels.map(::onAir).toTypedArray()) - .filterNot { lockedOut(it.number) } + .filterNot { lockedOut(it.number) || profileHides(it.number) } // Locked while on After Dark: back to the first channel, and out of full screen. - LaunchedEffect(AfterDarkLock.locked) { - if (AfterDarkLock.locked && lockedOut(selectedNumber)) { watchingChannel = false; channelClockOffset = 0; selectedNumber = availableChannels.firstOrNull()?.number ?: 101 } + LaunchedEffect(AfterDarkLock.locked, Profiles.current) { + if (lockedOut(selectedNumber) || profileHides(selectedNumber)) { watchingChannel = false; channelClockOffset = 0; selectedNumber = availableChannels.firstOrNull()?.number ?: 101 } } val liveChannel = availableChannels.firstOrNull { it.number == selectedNumber } if (mainDriveIn && liveSession != null) { @@ -409,7 +411,8 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea when { mainHome -> HomeScreen(availableChannels, modifier, onCategory = { guideCategory = it; onGuide() }) mainCatchUp -> CatchUpScreen(availableChannels, modifier, onOpen = { catchUpOpen = it }) - mainWhatsOn -> WhatsOnScreen(liveSession, scheduledChannels.filterKeys { !lockedOut(it) }.mapValues { it.value.plan }, driveInPlan, modifier, reminders, + mainWhatsOn -> WhatsOnScreen(liveSession, scheduledChannels.filterKeys { !lockedOut(it) && !profileHides(it) }.mapValues { it.value.plan }, + driveInPlan.takeIf { Profiles.current?.let { it.kind != ProfileKind.Kids || it.driveIn } ?: true }, modifier, reminders, onWatch = { tune(it, 0) }, onDriveIn = onDriveIn, onBack = onHome, onRemind = { item -> saveReminders(liveReminders(reminders, System.currentTimeMillis()) + ProgrammeReminder(item.channel, item.startMs, item.title)) }) else -> GuideGrid(channelsIn(guideCategory, availableChannels).ifEmpty { availableChannels }, selectedNumber, modifier, guideCategory, homeCategories(availableChannels.map { it.number }), picture, diff --git a/android/app/src/main/java/tv/orbit/classic/MainActivity.kt b/android/app/src/main/java/tv/orbit/classic/MainActivity.kt index 34adad89..2903b089 100644 --- a/android/app/src/main/java/tv/orbit/classic/MainActivity.kt +++ b/android/app/src/main/java/tv/orbit/classic/MainActivity.kt @@ -60,6 +60,7 @@ class MainActivity : ComponentActivity() { } // Before anything is drawn, so a locked After Dark never shows for a moment. AfterDarkLock.load(this) + Profiles.load(this) // One typeface everywhere, matching the channel logos. setContent { MaterialTheme { CompositionLocalProvider(androidx.tv.material3.LocalTextStyle provides androidx.compose.ui.text.TextStyle(fontFamily = Barlow)) { OrbitApp() } } } } @@ -109,7 +110,8 @@ private fun OrbitApp() { // Opening the app always lands on the main menu, wherever it was left. if (event == Lifecycle.Event.ON_STOP && realChannelAvailable && section != "Connect Emby") section = "Home" // The sleep timer is for this evening's viewing only. - if (event == Lifecycle.Event.ON_STOP) { SleepTimer.clear(); AfterDarkLock.lock() } + // Orbit asks who's watching again each time it opens. + if (event == Lifecycle.Event.ON_STOP) { SleepTimer.clear(); AfterDarkLock.lock(); Profiles.current = null } } lifecycle.addObserver(observer) onDispose { lifecycle.removeObserver(observer) } @@ -118,6 +120,16 @@ private fun OrbitApp() { BackHandler(realChannelAvailable && section != "TV Guide" && section != "Home" && section != "What's On") { section = "Home" } val navFocus = remember { FocusRequester() } val driveInFocus = remember { FocusRequester() } + // Who's watching? comes first, once there's something to watch. + val profile = Profiles.current + val chosen = profile != null + val picking = realChannelAvailable && restoreChecked && !chosen + val kidsDriveIn = profile?.kind != ProfileKind.Kids || profile.driveIn + val kidsArcade = profile?.kind != ProfileKind.Kids || profile.arcade + // Kids never reaches Settings, and only the parts of Orbit chosen for it. + LaunchedEffect(profile, section) { + if (Profiles.kids && realChannelAvailable && (section == "Connect Emby" || (section == "Drive-In" && !kidsDriveIn) || (section == "Arcade" && !kidsArcade))) section = "Home" + } // The sleep timer switches Orbit off wherever you are in it; the TV then sleeps as it normally would. val activity = androidx.activity.compose.LocalActivity.current LaunchedEffect(Unit) { while (true) { delay(1000); if (SleepTimer.tick(System.currentTimeMillis())) { SleepTimer.clear(); activity?.finish() } } } @@ -127,23 +139,26 @@ private fun OrbitApp() { if (event.nativeKeyEvent.action == android.view.KeyEvent.ACTION_UP) SleepTimer.keepWatching(System.currentTimeMillis()) true }) { + // The soft stars behind everything (Paul: "that slight starry background works across the app and identity"). + StarrySky() CompositionLocalProvider(LocalNavFocus provides navFocus, LocalDriveInFocus provides driveInFocus) { // The Drive-In and a game in play take the whole screen; the bar sits over the Drive-In's sky. val fullBleed = section == "Drive-In" || playingGame Column(if (fullBleed) Modifier.fillMaxSize() else Modifier.fillMaxSize().padding(start = 36.dp, end = 36.dp, top = 56.dp, bottom = 16.dp)) { if (!restoreChecked) Text("Tuning in…", color = Muted, fontSize = 15.sp) - if (section == "Arcade" && realChannelAvailable) OrbitArcade(Modifier.weight(1f), onPlaying = { playingGame = it }) + if (section == "Arcade" && realChannelAvailable && chosen) OrbitArcade(Modifier.weight(1f), onPlaying = { playingGame = it }) EmbyConnectionScreen(if (section == "Arcade") Modifier else Modifier.weight(1f), visible = section == "Connect Emby", - mainGuide = section == "TV Guide" && realChannelAvailable, - mainHome = section == "Home" && realChannelAvailable, - mainDriveIn = section == "Drive-In" && realChannelAvailable, - mainWhatsOn = section == "What's On" && realChannelAvailable, - mainCatchUp = section == "Catch Up" && realChannelAvailable, + mainGuide = section == "TV Guide" && realChannelAvailable && chosen, + mainHome = section == "Home" && realChannelAvailable && chosen, + mainDriveIn = section == "Drive-In" && realChannelAvailable && chosen, + mainWhatsOn = section == "What's On" && realChannelAvailable && chosen, + mainCatchUp = section == "Catch Up" && realChannelAvailable && chosen, onChannelAvailable = { realChannelAvailable = it }, onRestoreChecked = { restoreChecked = true }, onGuide = { section = "TV Guide" }, onHome = { section = "Home" }, onDriveIn = { section = "Drive-In" }) } // The sections sit centred on the screen, over the centred page below; the logo keeps the left, the clock the right. - if (!playingGame) Box(Modifier.fillMaxWidth().padding(start = 36.dp, end = 36.dp, top = 12.dp)) { + if (picking) WhosWatching(onClose = { activity?.finish() }) + if (!playingGame && !picking) Box(Modifier.fillMaxWidth().padding(start = 36.dp, end = 36.dp, top = 12.dp)) { if (realChannelAvailable) Row(Modifier.align(Alignment.Center), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) { // The whole-screen Drive-In has nothing for down to find by itself, so it's told. val below = if (section == "Drive-In") driveInFocus else null @@ -151,8 +166,8 @@ private fun OrbitApp() { NavItem("What's On", section == "What's On", null, below) { section = "What's On" } NavItem("TV Guide", section == "TV Guide", null, below) { section = "TV Guide" } NavItem("Catch Up", section == "Catch Up", null, below) { section = "Catch Up" } - NavItem("Drive-In", section == "Drive-In", null, below) { section = "Drive-In" } - NavItem("Arcade", section == "Arcade", null, below) { section = "Arcade" } + if (kidsDriveIn) NavItem("Drive-In", section == "Drive-In", null, below) { section = "Drive-In" } + if (kidsArcade) NavItem("Arcade", section == "Arcade", null, below) { section = "Arcade" } } Row(Modifier.fillMaxWidth(), verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) { Image(painterResource(R.drawable.orbit_logo), "Orbit", Modifier.width(144.dp).height(36.dp)) @@ -161,7 +176,11 @@ private fun OrbitApp() { Text(SimpleDateFormat("HH:mm", Locale.UK).format(Date(now)), color = Color.White, fontFamily = BarlowCondensed, fontSize = 20.sp) Text(SimpleDateFormat("EEEE d MMMM", Locale.UK).format(Date(now)), color = Muted, fontSize = 10.sp) } - if (realChannelAvailable) HomeCard(Modifier.size(38.dp, 32.dp).focusProperties { if (section == "Drive-In") down = driveInFocus }, onClick = { section = "Connect Emby" }) { focused -> + // Who's watching, as a little picture: OK goes back to Who's watching? to switch. + if (realChannelAvailable && profile != null) HomeCard(Modifier.size(38.dp, 32.dp).focusProperties { if (section == "Drive-In") down = driveInFocus }, onClick = { section = "Home"; Profiles.current = null }) { focused -> + Box(Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { ProfileAvatar(profile.picture, 28.dp, ringed = false) } + } + if (realChannelAvailable && !Profiles.kids) HomeCard(Modifier.size(38.dp, 32.dp).focusProperties { if (section == "Drive-In") down = driveInFocus }, onClick = { section = "Connect Emby" }) { focused -> Image(painterResource(R.drawable.orbit_icon_gear), "Settings", Modifier.fillMaxSize().padding(5.dp), colorFilter = if (focused) ColorFilter.tint(Navy) else null) } } diff --git a/android/app/src/main/java/tv/orbit/classic/Profiles.kt b/android/app/src/main/java/tv/orbit/classic/Profiles.kt new file mode 100644 index 00000000..2e1db413 --- /dev/null +++ b/android/app/src/main/java/tv/orbit/classic/Profiles.kt @@ -0,0 +1,262 @@ +package tv.orbit.classic + +import android.content.Context +import androidx.activity.compose.BackHandler +import androidx.compose.foundation.Canvas +import androidx.compose.foundation.Image +import androidx.compose.foundation.background +import androidx.compose.foundation.border +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.* +import androidx.compose.foundation.lazy.grid.GridCells +import androidx.compose.foundation.lazy.grid.LazyVerticalGrid +import androidx.compose.foundation.lazy.grid.items +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.runtime.* +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.focus.FocusRequester +import androidx.compose.ui.focus.focusRequester +import androidx.compose.ui.focus.onFocusChanged +import androidx.compose.ui.geometry.Offset +import androidx.compose.ui.geometry.Size +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.graphics.drawscope.DrawScope +import androidx.compose.ui.platform.LocalContext +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.Dp +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import androidx.tv.material3.Text +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 + * 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 + * 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 } + +internal data class Profile(val id: String, val name: String, val picture: String, val kind: ProfileKind, + /** Kids only: the channels it sees. */ + val channels: Set = emptySet(), val arcade: Boolean = true, val driveIn: Boolean = false) + +/** 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)) + +/** 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", + "sil-blue", "sil-pink", "sil-green", "sil-yellow", "sil-purple", "sil-orange") +internal fun pictureName(id: String) = when (id) { + "wand" -> "Fairy wand"; "paw" -> "Paw print" + else -> id.removePrefix("sil-").replaceFirstChar { it.uppercase() } +} + +internal object Profiles { + var all by mutableStateOf(DefaultProfiles) + private set + /** Who's watching, or null before anyone's chosen. */ + var current by mutableStateOf(null) + val kids get() = current?.kind == ProfileKind.Kids + + private fun prefs(context: Context) = context.getSharedPreferences("orbit_profiles", Context.MODE_PRIVATE) + fun load(context: Context) { all = runCatching { decode(prefs(context).getString("profiles", null)!!) }.getOrDefault(DefaultProfiles) } + fun update(context: Context, changed: Profile) { + all = all.map { if (it.id == changed.id) changed else it } + if (current?.id == changed.id) current = changed + prefs(context).edit().putString("profiles", encode(all)).apply() + } + fun encode(list: List) = JSONArray(list.map { p -> + JSONObject().put("id", p.id).put("name", p.name).put("picture", p.picture).put("kind", p.kind.name) + .put("channels", JSONArray(p.channels.sorted())).put("arcade", p.arcade).put("driveIn", p.driveIn) + }).toString() + fun decode(text: String): List { + 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")), + 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 + } +} + +/** Hidden from the profile watching: for Kids, every channel not ticked for it. */ +internal fun profileHides(number: Int, profile: Profile? = Profiles.current) = profile?.kind == ProfileKind.Kids && number !in profile.channels + +private val SilColours = mapOf("sil-blue" to Color(0xFF45B8F5), "sil-pink" to Color(0xFFFF4FA3), "sil-green" to Color(0xFF6EDCAA), + "sil-yellow" to Color(0xFFFFD84A), "sil-purple" to Color(0xFFA77BFF), "sil-orange" to Color(0xFFFF8A3D)) +private val PictureBacks = mapOf("ollie" to Color(0xFF285AA0), "blaze" to Color(0xFF3C285A), "zip" to Color(0xFF322864), "drift" to Color(0xFF1E4678), + "luna" to Color(0xFF281E5A), "bumble" to Color(0xFF285A50), "football" to Color(0xFF2E8C50), "wand" to Color(0xFF783CA0), "rocket" to Color(0xFF1E326E), + "crown" to Color(0xFF782850), "rainbow" to Color(0xFF3C8CDC), "paw" to Color(0xFFC8783C)) +private val PictureImages = mapOf("football" to R.drawable.orbit_picture_football, "wand" to R.drawable.orbit_picture_wand, "rocket" to R.drawable.orbit_picture_rocket, + "crown" to R.drawable.orbit_picture_crown, "rainbow" to R.drawable.orbit_picture_rainbow, "paw" to R.drawable.orbit_picture_paw) + +private fun DrawScope.silhouette(colour: Color) { + val r = size.minDimension / 2; val c = center + drawCircle(colour, r * .34f, c + Offset(0f, -r * .22f)) + drawArc(colour, 180f, 180f, true, c + Offset(-r * .62f, r * .12f), Size(r * 1.24f, r * 1.08f)) +} + +/** A profile's picture in its circle, ringed gold when [ringed]. */ +@Composable +internal fun ProfileAvatar(picture: String, diameter: Dp, modifier: Modifier = Modifier, ringed: Boolean = false) { + val sil = SilColours[picture] + Box(modifier.size(diameter).then(if (ringed) Modifier.border(4.dp, Yellow, CircleShape) else Modifier).padding(if (ringed) 6.dp else 0.dp) + .clip(CircleShape).background(sil?.copy(alpha = .35f)?.compositeOverNavy() ?: PictureBacks[picture] ?: Panel), contentAlignment = Alignment.Center) { + val image = PictureImages[picture] + if (image != null) Image(painterResource(image), pictureName(picture), Modifier.fillMaxSize()) + else Canvas(Modifier.fillMaxSize()) { + val r = size.minDimension / 2 + when (picture) { + "ollie" -> drawOrbMascot(center, r * .5f) + "blaze" -> drawOrbChaser(center + Offset(r * .12f, 0f), r * .55f, OrbCharacter.Blaze, OrbDir.Right, false, false, false, 0f) + "zip" -> drawOrbChaser(center, r * .55f, OrbCharacter.Zip, OrbDir.Down, false, false, false, 0f) + "drift" -> drawOrbChaser(center, r * .58f, OrbCharacter.Drift, OrbDir.Down, false, false, false, 0f) + "luna" -> drawOrbChaser(center, r * .58f, OrbCharacter.Luna, OrbDir.Down, false, false, false, 0f) + "bumble" -> drawOrbBee(center + Offset(0f, r * .12f), r * .5f) + else -> silhouette(sil ?: Color(0xFF45B8F5)) + } + } + } +} + +private fun Color.compositeOverNavy() = Color(red * alpha + Navy.red * (1 - alpha), green * alpha + Navy.green * (1 - alpha), blue * alpha + Navy.blue * (1 - alpha)) + +/** A soft field of stars, still, for behind the app (Paul: "that slight starry background works across the app and identity"). */ +@Composable +internal fun StarrySky(modifier: Modifier = Modifier) { + Canvas(modifier.fillMaxSize()) { + val stars = java.util.Random(5) + repeat(140) { + drawCircle(Color(0xFF3C5078).copy(alpha = .55f + stars.nextFloat() * .45f), .8f + stars.nextFloat() * 1.6f, Offset(stars.nextFloat() * size.width, stars.nextFloat() * size.height)) + } + } +} + +/** "Who's watching?" Grown-ups asks for the PIN, when one's set; Kids goes straight in. */ +@Composable +internal fun WhosWatching(onClose: () -> Unit) { + val context = LocalContext.current + var asking by remember { mutableStateOf(null) } + var problem by remember { mutableStateOf(null) } + val first = remember { FocusRequester() } + LaunchedEffect(asking) { if (asking == null) runCatching { first.requestFocus() } } + BackHandler(asking == null, onBack = onClose) + fun choose(p: Profile) { + if (p.kind == ProfileKind.Grown && AfterDarkLock.pinSet) { asking = p; problem = null } + else { if (p.kind == ProfileKind.Kids) AfterDarkLock.lock(); Profiles.current = p } + } + Box(Modifier.fillMaxSize()) { + Column(Modifier.align(Alignment.Center), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(28.dp)) { + Image(painterResource(R.drawable.orbit_logo), "Orbit", Modifier.width(150.dp).height(38.dp)) + Text("Who's watching?", color = Color.White, fontFamily = Anton, fontSize = 40.sp) + Row(horizontalArrangement = Arrangement.spacedBy(56.dp)) { + // Kids first, so a child's OK goes straight to their own. + Profiles.all.sortedBy { if (it.kind == ProfileKind.Kids) 0 else 1 }.forEachIndexed { i, p -> + var focused by remember { mutableStateOf(false) } + Column(Modifier.then(if (i == 0) Modifier.focusRequester(first) else Modifier).onFocusChanged { focused = it.isFocused }.clickable { choose(p) }, + horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(10.dp)) { + Box { + ProfileAvatar(p.picture, 132.dp, ringed = focused) + if (p.kind == ProfileKind.Grown && AfterDarkLock.pinSet) Canvas(Modifier.align(Alignment.BottomEnd).size(28.dp)) { + val s = size.minDimension + drawRoundRect(Yellow, Offset(s * .15f, s * .45f), Size(s * .7f, s * .5f), androidx.compose.ui.geometry.CornerRadius(s * .08f)) + drawArc(Yellow, 180f, 180f, false, Offset(s * .27f, s * .12f), Size(s * .46f, s * .62f), style = androidx.compose.ui.graphics.drawscope.Stroke(s * .1f)) + } + } + Text(p.name, color = if (focused) Yellow else Color.White, fontSize = 20.sp, fontWeight = FontWeight.SemiBold) + if (p.kind == ProfileKind.Grown && AfterDarkLock.pinSet) Text("PIN", color = Muted, fontSize = 13.sp) + } + } + } + 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.", + color = Muted, fontSize = 15.sp) + } + asking?.let { p -> + Box(Modifier.fillMaxSize().background(Navy.copy(alpha = .85f)), contentAlignment = Alignment.Center) { + Column(horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy(10.dp)) { + ProfileAvatar(p.picture, 90.dp) + Text(p.name, color = Color.White, fontSize = 20.sp, fontWeight = FontWeight.SemiBold) + PinEntry("Enter the PIN", problem, onDone = { pin -> + if (AfterDarkLock.unlock(context, pin)) { asking = null; Profiles.current = p } else problem = "That's not the PIN" + }, onCancel = { asking = null }) + } + } + } + } +} + +/** Settings › Profiles: the PIN, each profile's picture, and what Kids can see and play. */ +@Composable +internal fun ProfilesDetail(firstSwitch: FocusRequester, modifier: Modifier) { + val context = LocalContext.current + var choosingFor by remember { mutableStateOf(null) } + val kids = Profiles.all.firstOrNull { it.kind == ProfileKind.Kids } + val grown = Profiles.all.first { it.kind == ProfileKind.Grown } + choosingFor?.let { p -> + Column(modifier, verticalArrangement = Arrangement.spacedBy(8.dp)) { + BackHandler { choosingFor = null } + Text("Choose a picture for ${p.name}", color = Yellow, fontFamily = Anton, fontSize = 22.sp) + Text("The cast, a few favourite things, or a silhouette in a colour of your own.", color = Muted, fontSize = 12.sp) + val first = remember { FocusRequester() } + LaunchedEffect(Unit) { first.requestFocus() } + LazyVerticalGrid(GridCells.Fixed(6), Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(8.dp), horizontalArrangement = Arrangement.spacedBy(8.dp)) { + items(ProfilePictures) { pic -> + var focused by remember { mutableStateOf(false) } + Column(Modifier.then(if (pic == p.picture) Modifier.focusRequester(first) else Modifier).onFocusChanged { focused = it.isFocused } + .clickable { Profiles.update(context, p.copy(picture = pic)); choosingFor = null }, horizontalAlignment = Alignment.CenterHorizontally) { + ProfileAvatar(pic, 64.dp, ringed = focused) + Text(pictureName(pic) + if (pic == p.picture) " (now)" else "", color = if (focused) Yellow else Color.White, fontSize = 11.sp, maxLines = 1) + } + } + } + } + return + } + Column(modifier, verticalArrangement = Arrangement.spacedBy(8.dp)) { + Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp)) { + ProfileAvatar(grown.picture, 48.dp) + Text(grown.name, color = Color.White, 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. + LockDetail(remember { FocusRequester() }, Modifier.fillMaxWidth()) + if (kids != null) { + Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier.padding(top = 6.dp)) { + ProfileAvatar(kids.picture, 48.dp) + Text(kids.name, color = Color.White, fontSize = 18.sp, fontWeight = FontWeight.SemiBold, modifier = Modifier.weight(1f)) + OrbitButton("Change picture", onClick = { choosingFor = kids }) + OrbitButton("Arcade: ${if (kids.arcade) "On" else "Off"}", selected = kids.arcade, onClick = { Profiles.update(context, kids.copy(arcade = !kids.arcade)) }) + OrbitButton("Drive-In: ${if (kids.driveIn) "On" else "Off"}", selected = kids.driveIn, onClick = { Profiles.update(context, kids.copy(driveIn = !kids.driveIn)) }) + } + Text("CHANNELS FOR KIDS", color = Muted, fontSize = 12.sp, fontWeight = FontWeight.SemiBold) + val channels = SmartChannels.sortedBy { it.number }.filter { it.number !in LockedChannels } + LazyVerticalGrid(GridCells.Fixed(4), Modifier.weight(1f), verticalArrangement = Arrangement.spacedBy(6.dp), horizontalArrangement = Arrangement.spacedBy(6.dp)) { + items(channels, key = { it.number }) { programming -> + val on = programming.number in kids.channels + var focused by remember { mutableStateOf(false) } + val corner = RoundedCornerShape(8.dp) + Row(Modifier.height(44.dp).onFocusChanged { focused = it.isFocused }.background(if (focused) Navy else Panel, corner) + .border(if (focused) 3.dp else 0.dp, if (focused) Yellow else Color.Transparent, corner) + .clickable { Profiles.update(context, kids.copy(channels = if (on) kids.channels - programming.number else kids.channels + programming.number)) } + .padding(horizontal = 8.dp), verticalAlignment = Alignment.CenterVertically) { + val brand = ChannelBrands.forNumber(programming.number) + if (brand != null) Image(painterResource(brand.logo), brand.displayName, Modifier.width(84.dp).height(26.dp)) else Text(programming.name, color = Color.White, fontSize = 13.sp) + Spacer(Modifier.weight(1f)) + Box(Modifier.size(22.dp).background(if (on) Color(0xFF6EDCAA) else Color(0xFF283C64), RoundedCornerShape(5.dp)), contentAlignment = Alignment.Center) { + if (on) Text("✓", color = Navy, fontSize = 14.sp, fontWeight = FontWeight.Bold) + } + } + } + } + Text("Kids never sees After Dark or The Late Show. What's On and Catch Up show only Kids' channels. Leaving Kids needs the PIN.", color = Muted, fontSize = 11.sp) + } + } +} diff --git a/android/app/src/main/java/tv/orbit/classic/SecureMediaDataSource.kt b/android/app/src/main/java/tv/orbit/classic/SecureMediaDataSource.kt index 339f7665..ec365f8a 100644 --- a/android/app/src/main/java/tv/orbit/classic/SecureMediaDataSource.kt +++ b/android/app/src/main/java/tv/orbit/classic/SecureMediaDataSource.kt @@ -33,7 +33,7 @@ internal class SecureMediaDataSource(private val session: EmbySampleSession) : B next.instanceFollowRedirects = false next.connectTimeout = 10_000 next.readTimeout = 20_000 - next.setRequestProperty("User-Agent", "OrbitTV/0.108.33") + next.setRequestProperty("User-Agent", "OrbitTV/0.108.34") next.setRequestProperty("Accept-Encoding", "identity") session.mediaHeaders(address).forEach { (key, value) -> next.setRequestProperty(key, value) } if (dataSpec.position != 0L || dataSpec.length != C.LENGTH_UNSET.toLong()) { diff --git a/android/app/src/main/java/tv/orbit/classic/Settings.kt b/android/app/src/main/java/tv/orbit/classic/Settings.kt index 8a12b8b8..e689391b 100644 --- a/android/app/src/main/java/tv/orbit/classic/Settings.kt +++ b/android/app/src/main/java/tv/orbit/classic/Settings.kt @@ -111,7 +111,7 @@ internal enum class SettingsSection(val label: String, val icon: Int) { Viewing("Watching", R.drawable.orbit_icon_entertainment), Arrivals("New arrivals", R.drawable.orbit_icon_movies), Director("Director's Chair", R.drawable.orbit_icon_entertainment), - Lock("After Dark lock", R.drawable.orbit_icon_profile), + Profiles("Profiles", R.drawable.orbit_icon_profile), Account("Emby account", R.drawable.orbit_icon_profile), } @@ -287,7 +287,7 @@ internal fun SettingsScreen(section: SettingsSection, onSection: (SettingsSectio SettingsSection.Viewing -> ViewingDetail(isOn(TOTS_NUMBER), windingDown, onWindDown, firstSwitch, detail) SettingsSection.Arrivals -> arrivals(detail, firstSwitch) SettingsSection.Director -> director(detail, firstSwitch) - SettingsSection.Lock -> LockDetail(firstSwitch, detail) + SettingsSection.Profiles -> ProfilesDetail(firstSwitch, detail) SettingsSection.Account -> AccountDetail(server, titles, onSignOut, firstSwitch, detail) } } diff --git a/android/app/src/main/res/drawable-nodpi/orbit_picture_crown.webp b/android/app/src/main/res/drawable-nodpi/orbit_picture_crown.webp new file mode 100644 index 0000000000000000000000000000000000000000..bd252ef8e5dd9f2a5f5786fb80cdedd8e1183791 GIT binary patch literal 1750 zcma*a`#Tc~1Hf@J5fhV{2{WbRe(NmDC6~$6;YA~|iMckp=2UJuWY(&K73KQwB!}EJ z8s>5s9=X>NGRMrALgQd4#NOV&;C-LZFW)cr5(e{DT0+9d3GLzSan7~-N1KYfQ^Der zmsvX3E36KM3U6*d7m*55k3{`#whU)(P()xxRIxp*N!zB$EFpU?1PCE>G&}8x+K)@X z%HRBmo_X6b9D4OftR#5q9X8IVsq4!!mK>Tzl3qhqtV60L~+Zm z^VB@B$ZlG}C23UV=!*x3?yQ(W@&6)@XIcjFz8Y^HI0QaSGUWksf@i4`bf*p@-o@}fl_1w#-CB4aK6YySd>j*o7A2GxDR5wLMQd<75r# zN=*5L)XF6#TglMLV%eWui*gilFQXu?4-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%&7}f7xGX?Dywy{_SU?eyqMxCN`Bfq`ROqbg*w@t1i-98xFsVZ9b@<34L6Q+BMz% WCv~Yni?hjmmLtynzlar+B>n>wT6*vR literal 0 HcmV?d00001 diff --git a/android/app/src/main/res/drawable-nodpi/orbit_picture_football.webp b/android/app/src/main/res/drawable-nodpi/orbit_picture_football.webp new file mode 100644 index 0000000000000000000000000000000000000000..7b58f2f28ca556192a3d52ba16a67002acc6eb41 GIT binary patch literal 3546 zcmV<04JGnYNk&G}4FCXFMM6+kP&iD*4FCWy|G|F{|Dd348>#%^dH}vV5Cqva_qXi? zP9|+r|8|#u1cDI#KZ^yj|7Z2jT2_BVKtTf_0HA^a0m@O(wvANthrR7y0ueC*`4uZ_ zHU)!uCsTrK?r8Tc1o;(3+jiT=4kcM-DB654y(jJ@o6C5+s>MCwXs6z$7}$d)Rgu-ov-U?w;Lu>MIJY#Ah;6%Jg2z?15pz)Mv2?k-LVzD&X8 z_f6E-r0=NJ57sp)B5Nh_=Z2|&fb6c01X)u`rOqebP9b;H^~p?4PR(Mkb~hmp*l#S; z-)(7PKKlN1Rl(1a9C8-GIVucYw)~=O5X>bJ_Hz|_@RkJ2+yvbRu)mShP4>*fUD5{j zs>I687@~1W+5k^f<>l`=Cl}6*K=*hOGrn{#j=lZW=j1M)%ObjGQYIIQ=fc?COAJnBzG+v9a^BWc&qYK z`CQ?H)r)R-o0^q!%G(*lHHxcV_=7izqq}V7u2Qa-9f8!g%(8W-{D<2^D=Q++n~^Az zbw>+*ql&KOF;psuSS{#Nq2#ePRS=S5LwA0tqA((~{odS)Rz+1oLn5G55YcHhQ&Jp< zlwYkwi$8U>UR0m3Sdpr-Vgs@IM6K!Q`O9yte?qL$>X)ODa(pQ^ppmYN$^nlo|NX|o z5gDu0>>Lm(i0{P)Mo;+@PGjIvL3C8EYv?uA5RM8Wx}%b;)ocSeDv0<1%vy2f*KLsc zh1fvo6<*-H2blk|vVp-H&|9KTLIsr*dD4x)bq@`;#@_^g2>e^)Z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woF z{t0%TiwK&zCW4rY5W3A&7`n_<7@C9Tg6JxbQS>I$8#ZQW%PFRr_ z5e9>!g`c&S_zqm;+3gy2#`u6Crl}{QNE_Xh`;XVd;(JF+0=Zrk&G& z|M%bj{fB_EeaXJd_8Ix!>h`V8z4l}Kl+^1&K+e3M7zFW7VW363a-iVJIui;q((Q`F z+MH{`K}oqTB;EP`;Su+XAgIneNAn+XjW*>=TaZLT%pp`=lQSr=3j&?O zPK!R}K+lssCiG9gnrS(lj1Qs&tKroGCFTL6lQtqD7N( zJW$w&&9`_UPnMV-G^{6xZt);8lDySN2=fHfEgoTQjx^mn%&(xj#l6%h;<{^?C%A5L z7db=Xc43~6{`l0$3iaMEal0VMsoREmKI7w$M#g*Z7Prw!k8<1~tY4q@wGFewg`g`s-QGYiCzc?v}}v&@3=Q*gtU5DVieRLmY7(paoQ-bKb}@- ztJhOz!Ts@+!duPbW&yq**Ae&A$C!w#eoQaO^B7{Tp8v!G{jWa_)D?fng1vqx+||pQ uQNVwAGm%$g-$z0Jao-Dj^*RgukA=Sf`+xd>`hWU=`hWU=`hWU=A{+pi_NDXy literal 0 HcmV?d00001 diff --git a/android/app/src/main/res/drawable-nodpi/orbit_picture_wand.webp b/android/app/src/main/res/drawable-nodpi/orbit_picture_wand.webp new file mode 100644 index 0000000000000000000000000000000000000000..4227734cbdbd37a6a4131c4b1adc793d7654f96c GIT binary patch literal 2244 zcmV;#2s`&uNk&Gz2mk1d(jx8aPe#PeTGHfxK=%`j^!2AcU|H%5|fNB8t0+B8n)& zPZUu^u~4zIRuoZWJ0XPScR@zDItGMrtPsM}30eq^iES~lwS7#BjcH7y4o6&Z6trz4 zCH!IUzatP46Tp|olcqx+*On2tVIogUu&u3$BsxsaIS)ouK(^rix8+pXr-Yhz<}*g#uRdeeq+`zs9qGy`Y(TnvGFy-?pZq2R z8Xc`v@Jx6d1?}Q~5OU4H-@Ww)No8 zkO{--0IGb7Cy0lEoKTfd^#qC6mT3!E<&(3^K!Kcal~2h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0(`c{HOR&@t^;Ovj6}UzFZRk literal 0 HcmV?d00001 diff --git a/android/app/src/test/java/tv/orbit/classic/ProfilesTest.kt b/android/app/src/test/java/tv/orbit/classic/ProfilesTest.kt new file mode 100644 index 00000000..a6b65204 --- /dev/null +++ b/android/app/src/test/java/tv/orbit/classic/ProfilesTest.kt @@ -0,0 +1,34 @@ +package tv.orbit.classic + +import org.junit.After +import org.junit.Assert.* +import org.junit.Test + +class ProfilesTest { + @After fun reset() { Profiles.current = null } + + @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. + assertEquals(DefaultProfiles, Profiles.decode(Profiles.encode(changed.filter { it.kind == ProfileKind.Kids }))) + } + + @Test fun kidsSeesOnlyItsChannelsAndNeverAfterDark() { + val kids = DefaultProfiles.first { it.kind == ProfileKind.Kids } + val grown = DefaultProfiles.first { it.kind == ProfileKind.Grown } + assertFalse(profileHides(TOTS_NUMBER, kids)); assertTrue(profileHides(304, kids)); assertTrue(profileHides(AFTER_DARK_NUMBER, kids)) + assertFalse(profileHides(304, grown)); assertFalse(profileHides(304, null)) + assertTrue(AFTER_DARK_NUMBER !in KidsStartChannels) + // Kids watching locks After Dark and The Late Show, PIN or not. + Profiles.current = kids + assertTrue(AfterDarkLock.locked) + Profiles.current = grown + assertEquals(AfterDarkLock.pinSet && !AfterDarkLock.unlocked, AfterDarkLock.locked) + } + + @Test fun everyPictureHasAName() { + assertEquals(18, ProfilePictures.size) + assertEquals("Fairy wand", pictureName("wand")); assertEquals("Pink", pictureName("sil-pink")); assertEquals("Ollie", pictureName("ollie")) + } +}