Modern Apps git

← Modern-Apps.git

cast/tv: route receiver screens as typed destinations (#nav)

Commit
bc40eab07104c0d514e7bd2dc5abf512b0e5e28a
Author
Vayun Mathur <[email protected]>
When
2026-11-16 20:37 UTC (19 days ago)
Parents
ead746c
MainActivity claimed there is one screen, but ReceiverContent ran a
when(phase) over the sealed ReceiverPhase that swapped six full
screens (Starting, Ready, Pairing, Connected, the mirroring
held-breath, Failed) — a screen state machine held in the
controller's StateFlow, invisible to any back stack.

Add Route (Starting / Ready / Pairing(senderName, code,
attemptsLeft, codeChanged) / Connected(senderName) / Failed(reason))
and a one-deep MainNavigation host in Navigation.kt. The controller
phase is projected with receiverRouteFor and the stack is reset to
that single destination whenever it changes: receiver states replace
each other, so there is deliberately no back behaviour, but the
destinations are typed (arguments travel with the destination and
cannot drift from the phase that produced them) and the retained
stack restores the phase's screen on recreation instead of always
restarting at a hard-coded first screen.

ReceiverController and every phase writer (advertiser, pairing,
media loops, content session) are unchanged — the engine stays where
it was; only its projection onto the screen moved. Mirroring stays
an Activity: receiverRouteFor maps it to Connected(sourceName)
underneath MirrorActivity, which is also the held-breath screen seen
between the stream starting and that Activity coming up.
localNetworkBlocked still pre-empts any destination inside
ReceiverContent, which now renders a single Route instead of
dispatching on the phase.

Tests: new RouteTest pins the phase-to-destination projection for
every phase (including mirroring naming the casting app), the
pairing codeChanged default, and JSON round-trips for all five
destinations; the compose tests in TvUiComposeTest and UiDeep2Test
now render explicit routes instead of phases.

Verified: ./gradlew :cast:tv:compileDevKotlin
:cast:tv:testDevUnitTest green (141 tests).

Diff

cast/tv/AGENTS.md
diff --git a/cast/tv/AGENTS.md b/cast/tv/AGENTS.mdindex 42bb33a490..7efea608c0 100644--- a/cast/tv/AGENTS.md+++ b/cast/tv/AGENTS.md@@ -6,7 +6,7 @@ _Install: ./install cast/tv (dev by default)._ <!-- last-reviewed: 2026-10-16 --> - Gradle: :cast:tv / dir: cast/tv/ - Package roots present: ui, platform, service-- Entry files: MainActivity.kt (receiver shell — NOT a phone app; no Route/Navigation, TV panel modes instead)+- Entry files: MainActivity.kt, Route.kt, Navigation.kt (receiver shell — NOT a phone app; one-deep Route host, TV panel modes instead) - Deps: :cast:protocol, :library:e2ee-p2p - Metadata: metadata_data/cast-tv.md (present) - Rust: no / screenshotTest: no@@ -25,8 +25,10 @@ _Install: ./install cast/tv (dev by default)._ - Pairing store persists trust; clearing it force-drops all senders  ## Key files-### Root — receiver shell (no Route/Navigation)+### Root — receiver shell + navigation - com/vayunmathur/cast/tv/MainActivity.kt+- com/vayunmathur/cast/tv/Route.kt — Starting/Ready/Pairing/Connected/Failed destinations+- com/vayunmathur/cast/tv/Navigation.kt — one-deep MainNavigation host (phase → Route) ### platform/ — receiver pipeline - com/vayunmathur/cast/tv/platform/ReceiverController.kt - com/vayunmathur/cast/tv/platform/ReceiverUiContract.kt
cast/tv/src/main/java/com/vayunmathur/cast/tv/MainActivity.kt
diff --git a/cast/tv/src/main/java/com/vayunmathur/cast/tv/MainActivity.kt b/cast/tv/src/main/java/com/vayunmathur/cast/tv/MainActivity.ktindex e4deb10563..f1b967f4a6 100644--- a/cast/tv/src/main/java/com/vayunmathur/cast/tv/MainActivity.kt+++ b/cast/tv/src/main/java/com/vayunmathur/cast/tv/MainActivity.kt@@ -10,7 +10,6 @@ import com.vayunmathur.cast.tv.platform.ReceiverController import com.vayunmathur.cast.tv.platform.ReceiverPhase import com.vayunmathur.cast.tv.service.ReceiverService import com.vayunmathur.cast.tv.ui.CastTvTheme-import com.vayunmathur.cast.tv.ui.ReceiverContent import com.vayunmathur.library.ui.MaActivity import kotlinx.coroutines.flow.distinctUntilChangedBy import kotlinx.coroutines.launch@@ -22,8 +21,10 @@ import kotlinx.coroutines.launch  * mDNS registration alive whether or not this Activity is in front, which is why nothing here owns any  * session state.  *- * No `Route.kt` or `Navigation.kt`: there is one screen, and a nav graph over a single destination- * would be scaffolding around nothing.+ * The screens are [Route] destinations on a one-deep host (Navigation.kt):+ * the controller's phase is the session engine, the route is only its+ * projection onto the screen. There is no back behaviour between receiver+ * states; the graph buys typed destinations and restore.  */ class MainActivity : MaActivity() {     override val edgeToEdge: Boolean = false@@ -51,6 +52,6 @@ class MainActivity : MaActivity() {     @Composable     override fun Content() {         val state by ReceiverController.state.collectAsState()-        ReceiverContent(state)+        ReceiverNavigation(state)     } }
cast/tv/src/main/java/com/vayunmathur/cast/tv/Navigation.kt
diff --git a/cast/tv/src/main/java/com/vayunmathur/cast/tv/Navigation.kt b/cast/tv/src/main/java/com/vayunmathur/cast/tv/Navigation.ktnew file mode 100644index 0000000000..3ab2e43d6b--- /dev/null+++ b/cast/tv/src/main/java/com/vayunmathur/cast/tv/Navigation.kt@@ -0,0 +1,53 @@+package com.vayunmathur.cast.tv++import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.Color+import com.vayunmathur.cast.tv.platform.ReceiverUiState+import com.vayunmathur.cast.tv.ui.ReceiverContent+import com.vayunmathur.library.util.MainNavigation+import com.vayunmathur.library.util.rememberNavBackStack++/**+ * The receiver's one-deep navigation host.+ *+ * The controller's phase is projected to a [Route] and the stack is reset+ * to that single destination whenever it changes: receiver states replace+ * each other rather than stacking, so there is deliberately no back+ * behaviour here. What the graph buys over the old `when (phase)` is typed+ * destination arguments carried with the destination itself, and restore —+ * a recreated Activity re-enters the destination the phase names, not a+ * hard-coded starting screen.+ *+ * `Mirroring` never reaches this host as a destination: the picture is+ * `MirrorActivity`, and [receiverRouteFor] keeps [Route.Connected]+ * underneath it.+ */+@Composable+fun ReceiverNavigation(state: ReceiverUiState, modifier: Modifier = Modifier) {+    val target = receiverRouteFor(state.phase)+    val backStack = rememberNavBackStack<Route>(target)+    // The phase drives the destination. A mismatch also covers recreation,+    // where the retained stack may hold yesterday's phase.+    LaunchedEffect(target) {+        if (backStack.backStack.lastOrNull() != target) backStack.reset(target)+    }+    MainNavigation(backStack, containerColor = Color.Transparent) {+        entry<Route.Starting> { route ->+            ReceiverContent(route, state, modifier)+        }+        entry<Route.Ready> { route ->+            ReceiverContent(route, state, modifier)+        }+        entry<Route.Pairing> { route ->+            ReceiverContent(route, state, modifier)+        }+        entry<Route.Connected> { route ->+            ReceiverContent(route, state, modifier)+        }+        entry<Route.Failed> { route ->+            ReceiverContent(route, state, modifier)+        }+    }+}
cast/tv/src/main/java/com/vayunmathur/cast/tv/Route.kt
diff --git a/cast/tv/src/main/java/com/vayunmathur/cast/tv/Route.kt b/cast/tv/src/main/java/com/vayunmathur/cast/tv/Route.ktnew file mode 100644index 0000000000..5d98ccba27--- /dev/null+++ b/cast/tv/src/main/java/com/vayunmathur/cast/tv/Route.kt@@ -0,0 +1,69 @@+package com.vayunmathur.cast.tv++import com.vayunmathur.cast.tv.platform.ReceiverFailure+import com.vayunmathur.cast.tv.platform.ReceiverPhase+import com.vayunmathur.library.util.NavKey+import kotlinx.serialization.Serializable++/**+ * The receiver's screens as typed destinations.+ *+ * [ReceiverPhase] stays the session engine's state: `ReceiverController`+ * and its media loops write phases as sockets and decoders move, and this+ * graph is only their projection onto the screen. The stack is always one+ * deep (see Navigation.kt) — there is no back behaviour between receiver+ * states, nobody navigates a TV back from Paired to Pairing — but typed+ * destinations buy arguments that cannot drift from the phase that produced+ * them, and a stack that restores the right screen on recreation instead+ * of restarting from [Starting].+ */+@Serializable+sealed interface Route : NavKey {+    /** Loading the device identity and binding sockets. */+    @Serializable+    data object Starting : Route++    /** Announced on the LAN, waiting for a phone. */+    @Serializable+    data object Ready : Route++    /** A phone we do not know is connecting; [code] is what the user types. */+    @Serializable+    data class Pairing(+        val senderName: String,+        val code: String,+        val attemptsLeft: Int,+        val codeChanged: Boolean = false,+    ) : Route++    /** Paired; the stream is being set up. */+    @Serializable+    data class Connected(val senderName: String) : Route++    /** Something the user has to know about. */+    @Serializable+    data class Failed(val reason: ReceiverFailure) : Route+}++/**+ * The phase-to-destination projection.+ *+ * [ReceiverPhase.Mirroring] has no destination of its own: the picture+ * lives in `MirrorActivity`, launched by `MainActivity` the moment frames+ * arrive. Underneath it the stack holds [Route.Connected] naming the+ * source, which is also the held-breath screen seen in the moment between+ * the stream starting and that Activity coming up.+ */+fun receiverRouteFor(phase: ReceiverPhase): Route = when (phase) {+    ReceiverPhase.Starting -> Route.Starting+    ReceiverPhase.Advertising -> Route.Ready+    is ReceiverPhase.Pairing -> Route.Pairing(+        senderName = phase.senderName,+        code = phase.code,+        attemptsLeft = phase.attemptsLeft,+        codeChanged = phase.codeChanged,+    )+    is ReceiverPhase.Connected -> Route.Connected(phase.senderName)+    is ReceiverPhase.Mirroring -> Route.Connected(phase.sourceName)+    is ReceiverPhase.Failed -> Route.Failed(phase.reason)+}
cast/tv/src/main/java/com/vayunmathur/cast/tv/ui/ReceiverContent.kt
diff --git a/cast/tv/src/main/java/com/vayunmathur/cast/tv/ui/ReceiverContent.kt b/cast/tv/src/main/java/com/vayunmathur/cast/tv/ui/ReceiverContent.ktindex 2bee3f8a6c..22940f3f73 100644--- a/cast/tv/src/main/java/com/vayunmathur/cast/tv/ui/ReceiverContent.kt+++ b/cast/tv/src/main/java/com/vayunmathur/cast/tv/ui/ReceiverContent.kt@@ -13,8 +13,8 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import com.vayunmathur.cast.tv.R+import com.vayunmathur.cast.tv.Route import com.vayunmathur.cast.tv.platform.ReceiverFailure-import com.vayunmathur.cast.tv.platform.ReceiverPhase import com.vayunmathur.cast.tv.platform.ReceiverUiState import com.vayunmathur.library.tv.TvButton import com.vayunmathur.library.tv.TvEmptyState@@ -27,44 +27,43 @@ import com.vayunmathur.library.ui.IconWarning /**  * Every full-screen state of the receiver that is not the picture itself.  *- * A dispatcher, not a layout: each arm is its own screen in its own file, sharing only the- * theme. The picture gets `MirrorActivity`; the now-playing artwork screen lives there too,- * beside the surface it accompanies. Nothing here paints a base background - the overlay case- * above a decoder surface needs transparency, so screens that want colour say so themselves.+ * Renders one [Route] destination: the navigation host (Navigation.kt)+ * chooses the destination from the controller's phase, and this renders+ * only what that destination names — destination arguments first, and the+ * beside-the-phase state (device/network labels) from [state]. The picture+ * gets `MirrorActivity`; the now-playing artwork screen lives there too,+ * beside the surface it accompanies. Nothing here paints a base background+ * - the overlay case above a decoder surface needs transparency, so+ * screens that want colour say so themselves.  */ @Composable-fun ReceiverContent(state: ReceiverUiState, modifier: Modifier = Modifier) {+fun ReceiverContent(route: Route, state: ReceiverUiState, modifier: Modifier = Modifier) {     if (state.localNetworkBlocked) {         NetworkBlockedScreen(modifier)         return     }-    when (val phase = state.phase) {-        ReceiverPhase.Starting -> StartingScreen(modifier)+    when (route) {+        Route.Starting -> StartingScreen(modifier) -        ReceiverPhase.Advertising -> ReadyScreen(+        Route.Ready -> ReadyScreen(             deviceName = state.deviceName.ifBlank { stringResource(R.string.tv_name_unknown) },             networkLabel = state.networkLabel,             modifier = modifier,         ) -        is ReceiverPhase.Pairing -> PairingScreen(-            senderName = phase.senderName,-            code = phase.code,-            attemptsLeft = phase.attemptsLeft,-            codeChanged = phase.codeChanged,+        is Route.Pairing -> PairingScreen(+            senderName = route.senderName,+            code = route.code,+            attemptsLeft = route.attemptsLeft,+            codeChanged = route.codeChanged,             modifier = modifier,         )          // Paired; the stream is being set up. `MainActivity` moves on to `MirrorActivity` the-        // moment frames arrive, so this is a held breath rather than a destination.-        is ReceiverPhase.Connected -> ConnectedScreen(senderName = phase.senderName, modifier = modifier)+        // moment frames arrive, so this is a held breath rather than a place anyone stays.+        is Route.Connected -> ConnectedScreen(senderName = route.senderName, modifier = modifier) -        // The mirror has its own full-screen Activity, so this is only ever seen for the-        // moment between the stream starting and that Activity coming up.-        is ReceiverPhase.Mirroring ->-            ConnectedScreen(senderName = phase.sourceName, mirroring = true, modifier = modifier)--        is ReceiverPhase.Failed -> FailedScreen(reason = phase.reason, modifier = modifier)+        is Route.Failed -> FailedScreen(reason = route.reason, modifier = modifier)     } } 
cast/tv/src/test/java/com/vayunmathur/cast/tv/RouteTest.kt
diff --git a/cast/tv/src/test/java/com/vayunmathur/cast/tv/RouteTest.kt b/cast/tv/src/test/java/com/vayunmathur/cast/tv/RouteTest.ktnew file mode 100644index 0000000000..3436eff3d4--- /dev/null+++ b/cast/tv/src/test/java/com/vayunmathur/cast/tv/RouteTest.kt@@ -0,0 +1,73 @@+package com.vayunmathur.cast.tv++import com.vayunmathur.cast.tv.platform.ReceiverFailure+import com.vayunmathur.cast.tv.platform.ReceiverPhase+import com.vayunmathur.library.util.NavKey+import kotlin.test.Test+import kotlin.test.assertEquals+import kotlin.test.assertIs++/**+ * The receiver's destinations and their projection from the engine's+ * phases. [ReceiverPhase] stays the session state; [receiverRouteFor] is+ * the only place that turns it into a screen.+ */+class RouteTest {++    @Test+    fun `every phase projects to its destination`() {+        assertEquals(Route.Starting, receiverRouteFor(ReceiverPhase.Starting))+        assertEquals(Route.Ready, receiverRouteFor(ReceiverPhase.Advertising))+        assertEquals(+            Route.Pairing("Pixel 9", "123456", attemptsLeft = 2, codeChanged = true),+            receiverRouteFor(ReceiverPhase.Pairing("Pixel 9", "123456", 2, codeChanged = true)),+        )+        assertEquals(Route.Connected("Pixel 9"), receiverRouteFor(ReceiverPhase.Connected("Pixel 9")))+        assertEquals(+            Route.Failed(ReceiverFailure.NoDecoder),+            receiverRouteFor(ReceiverPhase.Failed(ReceiverFailure.NoDecoder)),+        )+    }++    @Test+    fun `mirroring keeps the connected destination naming the source`() {+        // The picture itself is MirrorActivity; underneath it the stack+        // holds Connected, naming the app when one is casting.+        assertEquals(+            Route.Connected("YouPipe"),+            receiverRouteFor(ReceiverPhase.Mirroring("Pixel 9", 1920, 1080, appLabel = "YouPipe")),+        )+        assertEquals(+            Route.Connected("Pixel 9"),+            receiverRouteFor(ReceiverPhase.Mirroring("Pixel 9", 1920, 1080)),+        )+    }++    @Test+    fun `pairing route defaults to an unchanged code`() {+        assertEquals(+            ReceiverPhase.Pairing("Pixel 9", "123456", 3).codeChanged,+            Route.Pairing("Pixel 9", "123456", 3).codeChanged,+        )+    }++    @Test+    fun `every route is a serializable nav key`() {+        val routes: List<Route> = listOf(+            Route.Starting,+            Route.Ready,+            Route.Pairing("Pixel 9", "123456", 3),+            Route.Connected("Pixel 9"),+            Route.Failed(ReceiverFailure.Handshake),+        )+        routes.forEach { assertIs<NavKey>(it) }+        // The stack persists destinations by kotlinx serialization, so+        // every destination must round-trip (this module's test classpath+        // has no kotlin-reflect for a sealed-subclass walk).+        val json = kotlinx.serialization.json.Json+        for (route in routes) {+            val text = json.encodeToString(Route.serializer(), route)+            assertEquals(route, json.decodeFromString(Route.serializer(), text))+        }+    }+}
cast/tv/src/test/java/com/vayunmathur/cast/tv/ui/TvUiComposeTest.kt
diff --git a/cast/tv/src/test/java/com/vayunmathur/cast/tv/ui/TvUiComposeTest.kt b/cast/tv/src/test/java/com/vayunmathur/cast/tv/ui/TvUiComposeTest.ktindex c917c00bd1..7f1bf396e3 100644--- a/cast/tv/src/test/java/com/vayunmathur/cast/tv/ui/TvUiComposeTest.kt+++ b/cast/tv/src/test/java/com/vayunmathur/cast/tv/ui/TvUiComposeTest.kt@@ -7,6 +7,7 @@ import androidx.compose.ui.test.performClick import com.vayunmathur.cast.protocol.LyricLine import com.vayunmathur.cast.protocol.NowPlaying import com.vayunmathur.cast.protocol.PlaybackState+import com.vayunmathur.cast.tv.Route import com.vayunmathur.cast.tv.platform.PlaybackSnapshot import com.vayunmathur.cast.tv.platform.ReceiverFailure import com.vayunmathur.cast.tv.platform.ReceiverPhase@@ -26,20 +27,20 @@ class TvUiComposeTest {         PlaybackSnapshot(PlaybackState(pos, duration, playing, buffering, speed = speed, hasNext = true, hasPrevious = true), 1000)      @Test fun receiverContentStarting() {-        rule.setContent { CastTvTheme { ReceiverContent(ReceiverUiState(phase = ReceiverPhase.Starting)) } }+        rule.setContent { CastTvTheme { ReceiverContent(Route.Starting, ReceiverUiState(phase = ReceiverPhase.Starting)) } }         rule.waitForIdle()     }     @Test fun receiverContentAdvertisingShowsDeviceAndNetwork() {-        rule.setContent { CastTvTheme { ReceiverContent(ReceiverUiState(phase = ReceiverPhase.Advertising, deviceName = "Living Room TV", networkLabel = "HomeWiFi · 192.168.1.4")) } }+        rule.setContent { CastTvTheme { ReceiverContent(Route.Ready, ReceiverUiState(phase = ReceiverPhase.Advertising, deviceName = "Living Room TV", networkLabel = "HomeWiFi · 192.168.1.4")) } }         rule.onNodeWithText("Living Room TV").assertIsDisplayed()         rule.onNodeWithText("HomeWiFi · 192.168.1.4", substring = true).assertIsDisplayed()     }     @Test fun receiverContentPairing() {-        rule.setContent { CastTvTheme { ReceiverContent(ReceiverUiState(phase = ReceiverPhase.Pairing("Pixel 9", "123456", 2))) } }+        rule.setContent { CastTvTheme { ReceiverContent(Route.Pairing("Pixel 9", "123456", 2), ReceiverUiState(phase = ReceiverPhase.Pairing("Pixel 9", "123456", 2))) } }         rule.onNodeWithText("123  456").assertIsDisplayed()     }     @Test fun receiverContentConnectedAndMirroring() {-        rule.setContent { CastTvTheme { ReceiverContent(ReceiverUiState(phase = ReceiverPhase.Connected("Pixel 9"))) } }+        rule.setContent { CastTvTheme { ReceiverContent(Route.Connected("Pixel 9"), ReceiverUiState(phase = ReceiverPhase.Connected("Pixel 9"))) } }         rule.waitForIdle()     }     @Test fun pairingScreenChangedCode() {@@ -47,20 +48,20 @@ class TvUiComposeTest {         rule.onNodeWithText("654  321").assertIsDisplayed()     }     @Test fun receiverContentMirroring() {-        rule.setContent { CastTvTheme { ReceiverContent(ReceiverUiState(phase = ReceiverPhase.Mirroring("Pixel 9", 1920, 1080, appLabel = "YouPipe"))) } }+        rule.setContent { CastTvTheme { ReceiverContent(Route.Connected("YouPipe"), ReceiverUiState(phase = ReceiverPhase.Mirroring("Pixel 9", 1920, 1080, appLabel = "YouPipe"))) } }         rule.waitForIdle()     }     @Test fun receiverContentAllFailures() {-        rule.setContent { CastTvTheme { ReceiverContent(ReceiverUiState(phase = ReceiverPhase.Failed(ReceiverFailure.NoDecoder))) } }+        rule.setContent { CastTvTheme { ReceiverContent(Route.Failed(ReceiverFailure.NoDecoder), ReceiverUiState(phase = ReceiverPhase.Failed(ReceiverFailure.NoDecoder))) } }         rule.waitForIdle()     }     @Test fun receiverContentFailureVariants() {         // remaining failures share the FailedScreen shape; rendered in platform-level state tests plus this smoke of each message branch via separate compositions is done in individual tests below-        rule.setContent { CastTvTheme { ReceiverContent(ReceiverUiState(phase = ReceiverPhase.Failed(ReceiverFailure.StreamEnded))) } }+        rule.setContent { CastTvTheme { ReceiverContent(Route.Failed(ReceiverFailure.StreamEnded), ReceiverUiState(phase = ReceiverPhase.Failed(ReceiverFailure.StreamEnded))) } }         rule.waitForIdle()     }     @Test fun receiverContentNetworkBlocked() {-        rule.setContent { CastTvTheme { ReceiverContent(ReceiverUiState(localNetworkBlocked = true)) } }+        rule.setContent { CastTvTheme { ReceiverContent(Route.Starting, ReceiverUiState(localNetworkBlocked = true)) } }         rule.waitForIdle()         // The settings button fires an app-details intent; Robolectric shadows the start.         runCatching { rule.onNodeWithText("Open Settings", substring = true).performClick() }
cast/tv/src/test/java/com/vayunmathur/cast/tv/ui/UiDeep2Test.kt
diff --git a/cast/tv/src/test/java/com/vayunmathur/cast/tv/ui/UiDeep2Test.kt b/cast/tv/src/test/java/com/vayunmathur/cast/tv/ui/UiDeep2Test.ktindex a299cd37da..1d9dbac451 100644--- a/cast/tv/src/test/java/com/vayunmathur/cast/tv/ui/UiDeep2Test.kt+++ b/cast/tv/src/test/java/com/vayunmathur/cast/tv/ui/UiDeep2Test.kt@@ -11,6 +11,7 @@ import com.vayunmathur.cast.protocol.ContentSession import com.vayunmathur.cast.protocol.LyricLine import com.vayunmathur.cast.protocol.NowPlaying import com.vayunmathur.cast.protocol.PlaybackState+import com.vayunmathur.cast.tv.Route import com.vayunmathur.cast.tv.platform.ArtworkFetcher import com.vayunmathur.cast.tv.platform.PlaybackSnapshot import com.vayunmathur.cast.tv.platform.ReceiverFailure@@ -40,7 +41,7 @@ class UiDeep2Test {     @Test fun everyFailureRendersItsScreen() {         val failureState = androidx.compose.runtime.mutableStateOf(ReceiverFailure.entries.first())         rule.setContent {-            CastTvTheme { ReceiverContent(ReceiverUiState(phase = ReceiverPhase.Failed(failureState.value))) }+            CastTvTheme { ReceiverContent(Route.Failed(failureState.value), ReceiverUiState(phase = ReceiverPhase.Failed(failureState.value))) }         }         for (next in ReceiverFailure.entries) {             failureState.value = next@@ -50,7 +51,7 @@ class UiDeep2Test {      @Test fun networkBlockedButtonFiresSettingsIntent() {         rule.setContent {-            CastTvTheme { ReceiverContent(ReceiverUiState(localNetworkBlocked = true)) }+            CastTvTheme { ReceiverContent(Route.Starting, ReceiverUiState(localNetworkBlocked = true)) }         }         rule.waitForIdle()         rule.onNodeWithText("Open Settings", substring = true).performClick()