Skip to content

StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.

refactor(live): isolate multiview planner composition

David Nashash354d28422ca2
diff --git a/app/src/main/java/com/streamvault/app/live/AppLiveMultiViewPlanner.kt b/app/src/main/java/com/streamvault/app/live/AppLiveMultiViewPlanner.kt
new file mode 100644
index 00000000..1f2bf75f
--- /dev/null
+++ b/app/src/main/java/com/streamvault/app/live/AppLiveMultiViewPlanner.kt
@@ -0,0 +1,31 @@
+package com.streamvault.app.live
+
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.remember
+import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
+import com.streamvault.feature.live.api.LiveMultiViewPlannerContent
+import com.streamvault.feature.playback.multiview.MultiViewPlannerDialog
+import com.streamvault.feature.playback.multiview.MultiViewViewModel
+
+/** App composition adapter for the Playback-owned MultiView planner. */
+internal data class AppLiveMultiViewPlannerAdapter(
+ val content: LiveMultiViewPlannerContent,
+ val isChannelQueued: (Long) -> Boolean,
+)
+
+@Composable
+internal fun rememberAppLiveMultiViewPlannerContent(
+ viewModel: MultiViewViewModel = hiltViewModel(),
+): AppLiveMultiViewPlannerAdapter = remember(viewModel) {
+ AppLiveMultiViewPlannerAdapter(
+ content = { selectedChannel, onDismiss, onConfirmed ->
+ MultiViewPlannerDialog(
+ pendingChannel = selectedChannel,
+ onDismiss = onDismiss,
+ onLaunch = onConfirmed,
+ viewModel = viewModel,
+ )
+ },
+ isChannelQueued = viewModel::isQueued,
+ )
+}
diff --git a/app/src/main/java/com/streamvault/app/navigation/graph/LiveGraph.kt b/app/src/main/java/com/streamvault/app/navigation/graph/LiveGraph.kt
index 733c5b96..f2673eae 100644
--- a/app/src/main/java/com/streamvault/app/navigation/graph/LiveGraph.kt
+++ b/app/src/main/java/com/streamvault/app/navigation/graph/LiveGraph.kt
@@ -1,16 +1,14 @@
package com.streamvault.app.navigation.graph
import androidx.navigation.NavGraphBuilder
-import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
import com.streamvault.app.navigation.AppRouteCodec
import com.streamvault.app.navigation.AppRoutePatterns
import com.streamvault.app.live.toAppArchivePlayerNavigationRequest
+import com.streamvault.app.live.rememberAppLiveMultiViewPlannerContent
import com.streamvault.app.live.toAppPlayerNavigationRequest
import com.streamvault.app.ui.components.shell.AppNavigationChrome
import com.streamvault.app.ui.components.shell.AppScreenScaffold
import com.streamvault.app.ui.components.dialogs.AddToGroupDialog
-import com.streamvault.feature.playback.multiview.MultiViewPlannerDialog
-import com.streamvault.feature.playback.multiview.MultiViewViewModel
import com.streamvault.core.navigation.AppDestination
import com.streamvault.core.navigation.NavigationActions
import com.streamvault.domain.playback.isArchivePlayable
@@ -27,7 +25,7 @@ internal fun NavGraphBuilder.registerLiveGraph(
) {
registerFeatureLiveGraph(
liveTvContent = { initialCategoryId, onPlaybackRequested, onNavigate ->
- val multiViewViewModel: MultiViewViewModel = hiltViewModel()
+ val multiViewPlanner = rememberAppLiveMultiViewPlannerContent()
LiveHomeScreen(
onChannelClick = { channel, category, provider, combinedProfileId, combinedSourceFilterProviderId ->
onPlaybackRequested(
@@ -56,14 +54,7 @@ internal fun NavGraphBuilder.registerLiveGraph(
content = content,
)
},
- multiViewPlanner = { selectedChannel, onDismiss, onConfirmed ->
- MultiViewPlannerDialog(
- pendingChannel = selectedChannel,
- onDismiss = onDismiss,
- onLaunch = onConfirmed,
- viewModel = multiViewViewModel,
- )
- },
+ multiViewPlanner = multiViewPlanner.content,
addToGroupContent = { request: LiveAddToGroupDialogRequest ->
AddToGroupDialog(
contentTitle = request.contentTitle,
@@ -84,7 +75,7 @@ internal fun NavGraphBuilder.registerLiveGraph(
onMoveToSeries = request.onMoveToSeries,
)
},
- isChannelQueuedForMultiView = multiViewViewModel::isQueued,
+ isChannelQueuedForMultiView = multiViewPlanner.isChannelQueued,
currentRoute = AppRoutePatterns.LIVE_TV,
initialCategoryId = initialCategoryId,
)
diff --git a/docs/superpowers/plans/2026-08-28-live-feature-extraction.md b/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
index b9051e34..df28f0e0 100644
--- a/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
+++ b/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
@@ -987,7 +987,7 @@ Delegate to the existing `playerNavigationRequest`/`toLivePlayerRequest`
helpers so payload behavior stays app-owned. Do not duplicate codec or payload
storage.
-- [ ] **Step 5: Compose the existing MultiView planner in app**
+- [x] **Step 5: Compose the existing MultiView planner in app**
Implement `rememberAppLiveMultiViewPlannerContent()` as a composable provider
that obtains the existing `MultiViewViewModel` in the destination composition
@@ -995,6 +995,10 @@ and renders `MultiViewPlannerDialog(pendingChannel, onDismiss, onLaunch,
viewModel)`. The feature supplies the state-clearing callbacks; the app content
only renders Playback presentation.
+`AppLiveMultiViewPlanner.kt` now owns this adapter. It remembers the existing
+Playback ViewModel, exposes the planner content and queue predicate, and leaves
+all planner state/lifecycle behavior in Playback.
+
- [x] **Step 6: Wire `AppNavHost` and verify RED-to-GREEN integration**
Replace the app graph call with `com.streamvault.feature.live.navigation.registerLiveGraph`, pass `rememberAppDestinationItems(...)`, app player mapping callbacks, `onTopLevelDestinationRequested`, and planner content.
@@ -1012,13 +1016,16 @@ Expected: PASS with one production owner for each live destination.
The route/mapping/navigation bundle passed on 2026-08-29, including the Live
boundary verifier and app Kotlin compilation.
-- [ ] **Step 8: Commit graph ownership**
+- [x] **Step 8: Commit graph ownership**
```powershell
git add feature/live/src/main/java/com/streamvault/feature/live/navigation feature/live/src/test/java/com/streamvault/feature/live/navigation app/src/main/java/com/streamvault/app/live app/src/test/java/com/streamvault/app/live app/src/main/java/com/streamvault/app/navigation
git commit -m "feat(live): register feature-owned navigation graph"
```
+The graph contract, app player mapper, and MultiView composition adapter were
+committed together in `8a3e8cd1`.
+
---
### Task 9: Remove legacy ownership and run structural/resource gates