StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
refactor(live): extract m3u series dialogs
David Nashash2a686572d0bc
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreenDialogs.kt b/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreenDialogs.ktindex 01e917b6..5c9bb2e6 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreenDialogs.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreenDialogs.kt@@ -14,8 +14,6 @@ import com.streamvault.feature.live.home.HomeViewModelimport com.streamvault.app.navigation.Routesimport com.streamvault.app.ui.components.dialogs.AddToGroupDialogimport com.streamvault.core.ui.components.dialogs.PinDialog-import com.streamvault.app.ui.components.dialogs.M3uCategorySeriesAssignmentDialog-import com.streamvault.app.ui.components.dialogs.M3uSeriesAssignmentDialogimport com.streamvault.feature.playback.multiview.MultiViewPlannerDialogimport com.streamvault.feature.playback.multiview.MultiViewViewModelimport com.streamvault.feature.live.home.LiveCategoryOptionsDialog@@ -28,6 +26,10 @@ import com.streamvault.feature.live.home.LiveRenameGroupDialogimport com.streamvault.feature.live.home.LiveRenameGroupDialogLabelsimport com.streamvault.feature.live.home.LiveM3uCategoryOrganizerDialogimport com.streamvault.feature.live.home.LiveM3uCategoryOrganizerLabels+import com.streamvault.feature.live.home.LiveM3uSeriesAssignmentDialog+import com.streamvault.feature.live.home.LiveM3uSeriesAssignmentLabels+import com.streamvault.feature.live.home.LiveM3uCategorySeriesAssignmentDialog+import com.streamvault.feature.live.home.LiveM3uCategorySeriesAssignmentLabelsimport com.streamvault.domain.model.ActiveLiveSourceimport com.streamvault.domain.model.Categoryimport com.streamvault.domain.model.Channel@@ -291,8 +293,16 @@ internal fun HomeDialogsHost(}pendingM3uSeriesChannel?.let { channel ->- M3uSeriesAssignmentDialog(+ LiveM3uSeriesAssignmentDialog(initialTitle = channel.name,+ labels = LiveM3uSeriesAssignmentLabels(+ title = stringResource(R.string.m3u_move_to_series),+ seriesName = stringResource(R.string.m3u_series_name),+ seasonNumber = stringResource(R.string.m3u_season_number),+ episodeNumber = stringResource(R.string.m3u_episode_number),+ classify = stringResource(R.string.m3u_classify),+ cancel = stringResource(R.string.category_options_cancel)+ ),onDismiss = { pendingM3uSeriesChannel = null },onConfirm = { assignment ->pendingM3uSeriesChannel = null@@ -329,9 +339,18 @@ internal fun HomeDialogsHost(if (pendingM3uSeriesCategory != null && pendingM3uSeriesItems != null) {val category = pendingM3uSeriesCategory!!- M3uCategorySeriesAssignmentDialog(- categoryName = category.name,+ LiveM3uCategorySeriesAssignmentDialog(items = pendingM3uSeriesItems!!,+ labels = LiveM3uCategorySeriesAssignmentLabels(+ title = stringResource(R.string.m3u_series_review_title, category.name),+ subtitle = stringResource(R.string.m3u_series_review_subtitle),+ seriesName = stringResource(R.string.m3u_series_name),+ seasonNumber = stringResource(R.string.m3u_season_number),+ episodeNumber = stringResource(R.string.m3u_episode_number),+ episodeUnresolved = stringResource(R.string.m3u_episode_unresolved),+ classify = stringResource(R.string.m3u_classify),+ cancel = stringResource(R.string.category_options_cancel)+ ),onDismiss = {pendingM3uSeriesCategory = nullpendingM3uSeriesItems = nulldiff --git a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.mdindex 81cb280f..2fcd1810 100644--- a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md+++ b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md@@ -134,8 +134,8 @@ EPG guide-now ticker/provider, EPG search field/row, Home reorder top bar, andHome channel row surface, Home channel-results header, Home category sidebarheader, channel-content state host, channel-list host, and category-list hostand hidden category/channel dialogs, the category options dialog, the-quick-filter add dialog, delete-group dialog, rename-group dialog, and the M3U-category organizer dialog are now feature-owned+quick-filter add dialog, delete-group dialog, rename-group dialog, M3U category+organizer dialog, and M3U series-assignment dialogs are now feature-ownedwhile the Home and EPGscreen/dialog composition remains in `:app` for the remaining app-specificdialogs.@@ -144,7 +144,7 @@ composition boundary. Live-ownedpresentation primitives, `HomeUiState`, `HomePreviewUiState`, Guidemode/density/reminder presentation models, hidden collection dialogs, thecategory options dialog, the quick-filter add dialog, the delete-group dialog,-and the rename-group dialog and M3U category organizer dialog are independent-of app code;+and the rename-group dialog, M3U category organizer dialog, and M3U+series-assignment dialogs are independent of app code;screen/resource moves, golden/runtime/performance gates, and legacy app cleanupremain open, so no live slice acceptance gate is claimed yet.diff --git a/docs/superpowers/plans/2026-08-28-live-feature-extraction.md b/docs/superpowers/plans/2026-08-28-live-feature-extraction.mdindex f35750fb..5323a697 100644--- a/docs/superpowers/plans/2026-08-28-live-feature-extraction.md+++ b/docs/superpowers/plans/2026-08-28-live-feature-extraction.md@@ -24,8 +24,8 @@ EPG guide-now ticker/provider, EPG search field/row, Home reorder top bar,Home channel row surface, Home channel-results header, Home category sidebarheader, channel-content state host, channel-list host, and category-list hostand hidden category/channel dialogs, the category options dialog, the-quick-filter add dialog, delete-group dialog, rename-group dialog, and the M3U-category organizer dialog are now feature-owned+quick-filter add dialog, delete-group dialog, rename-group dialog, M3U category+organizer dialog, and M3U series-assignment dialogs are now feature-ownedand their feature checks are green. Home screen/dialog composition, theremaining live cards/rows, complete locale resource migration, and acceptancegates remain open.@@ -689,6 +689,8 @@ The rename-group dialog owns draft text, focus, and device sizing while the appsupplies validation text and rename/cancel callbacks.The M3U category organizer likewise receives explicit labels and reports onlythe selected classification target to the app.+The single-item and category-review series dialogs own draft normalization and+assignment construction while the app retains repository mutations.quick-filter key/selection rules are covered by `LiveQuickFiltersTest`. Theremaining app-owned live cards and shell/dialog composition still requirecompatibility seams before the full Home move.diff --git a/feature/live/src/main/java/com/streamvault/feature/live/home/LiveM3uSeriesAssignmentDialogs.kt b/feature/live/src/main/java/com/streamvault/feature/live/home/LiveM3uSeriesAssignmentDialogs.ktnew file mode 100644index 00000000..a4758858--- /dev/null+++ b/feature/live/src/main/java/com/streamvault/feature/live/home/LiveM3uSeriesAssignmentDialogs.kt@@ -0,0 +1,284 @@+package com.streamvault.feature.live.home++import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.fillMaxHeight+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.items+import androidx.compose.material3.OutlinedTextField+import androidx.compose.material3.OutlinedTextFieldDefaults+import androidx.compose.runtime.Composable+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.unit.dp+import androidx.compose.ui.window.Dialog+import androidx.compose.ui.window.DialogProperties+import androidx.tv.material3.Button+import androidx.tv.material3.ButtonDefaults+import androidx.tv.material3.MaterialTheme+import androidx.tv.material3.Surface+import androidx.tv.material3.SurfaceDefaults+import androidx.tv.material3.Text+import com.streamvault.core.ui.theme.OnSurface+import com.streamvault.core.ui.theme.SurfaceElevated+import com.streamvault.domain.repository.M3uCategoryItem+import com.streamvault.domain.repository.M3uSeriesAssignment++data class LiveM3uSeriesAssignmentLabels(+ val title: String,+ val seriesName: String,+ val seasonNumber: String,+ val episodeNumber: String,+ val classify: String,+ val cancel: String+)++data class LiveM3uCategorySeriesAssignmentLabels(+ val title: String,+ val subtitle: String,+ val seriesName: String,+ val seasonNumber: String,+ val episodeNumber: String,+ val episodeUnresolved: String,+ val classify: String,+ val cancel: String+)++@Composable+fun LiveM3uSeriesAssignmentDialog(+ initialTitle: String,+ labels: LiveM3uSeriesAssignmentLabels,+ onDismiss: () -> Unit,+ onConfirm: (M3uSeriesAssignment) -> Unit+) {+ var seriesName by remember { mutableStateOf(initialTitle.trim()) }+ var season by remember { mutableStateOf("1") }+ var episode by remember { mutableStateOf("1") }++ Dialog(+ onDismissRequest = onDismiss,+ properties = DialogProperties(usePlatformDefaultWidth = false)+ ) {+ Surface(+ modifier = Modifier.fillMaxWidth(0.55f),+ colors = SurfaceDefaults.colors(containerColor = SurfaceElevated)+ ) {+ Column(+ modifier = Modifier.padding(28.dp),+ verticalArrangement = Arrangement.spacedBy(14.dp)+ ) {+ Text(+ text = labels.title,+ style = MaterialTheme.typography.headlineSmall,+ color = OnSurface+ )+ Text(text = labels.seriesName, color = OnSurface)+ LiveM3uTextField(seriesName, { seriesName = it }, labels.seriesName)+ LiveM3uTextField(season, { season = it.filter(Char::isDigit) }, labels.seasonNumber)+ LiveM3uTextField(episode, { episode = it.filter(Char::isDigit) }, labels.episodeNumber)+ Button(+ onClick = {+ if (seriesName.isNotBlank()) {+ onConfirm(+ M3uSeriesAssignment(+ seriesName = seriesName.trim(),+ seasonNumber = season.toIntOrNull()?.coerceAtLeast(1) ?: 1,+ episodeNumber = episode.toIntOrNull()?.coerceAtLeast(1) ?: 1+ )+ )+ }+ },+ enabled = seriesName.isNotBlank(),+ modifier = Modifier.fillMaxWidth(),+ colors = ButtonDefaults.colors(+ containerColor = MaterialTheme.colorScheme.primary,+ contentColor = Color.Black+ )+ ) {+ Text(labels.classify)+ }+ Button(+ onClick = onDismiss,+ modifier = Modifier.fillMaxWidth(),+ colors = ButtonDefaults.colors(+ containerColor = Color.White.copy(alpha = 0.08f),+ contentColor = OnSurface+ )+ ) {+ Text(labels.cancel)+ }+ }+ }+ }+}++@Composable+fun LiveM3uCategorySeriesAssignmentDialog(+ items: List<M3uCategoryItem>,+ labels: LiveM3uCategorySeriesAssignmentLabels,+ onDismiss: () -> Unit,+ onConfirm: (Map<Long, M3uSeriesAssignment>) -> Unit+) {+ var drafts by remember(items) {+ mutableStateOf(+ items.associate { item ->+ item.channelId to LiveM3uAssignmentDraft(+ seriesName = item.suggestedAssignment.seriesName,+ seasonNumber = item.suggestedAssignment.seasonNumber.toString(),+ episodeNumber = (item.suggestedAssignment.episodeNumber ?: 0).toString()+ )+ }+ )+ }++ Dialog(+ onDismissRequest = onDismiss,+ properties = DialogProperties(usePlatformDefaultWidth = false)+ ) {+ Surface(+ modifier = Modifier+ .fillMaxWidth(0.84f)+ .fillMaxHeight(0.86f),+ colors = SurfaceDefaults.colors(containerColor = SurfaceElevated)+ ) {+ Column(+ modifier = Modifier.padding(28.dp),+ verticalArrangement = Arrangement.spacedBy(12.dp)+ ) {+ Text(+ text = labels.title,+ style = MaterialTheme.typography.headlineSmall,+ color = OnSurface+ )+ Text(text = labels.subtitle, color = OnSurface.copy(alpha = 0.75f))+ LazyColumn(+ modifier = Modifier.weight(1f),+ verticalArrangement = Arrangement.spacedBy(14.dp)+ ) {+ items(+ items = items,+ key = { it.channelId },+ contentType = { "series_assignment" }+ ) { item ->+ val draft = drafts[item.channelId] ?: return@items+ Column(verticalArrangement = Arrangement.spacedBy(6.dp)) {+ Text(item.title, color = OnSurface)+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.spacedBy(8.dp)+ ) {+ LiveM3uAssignmentField(+ value = draft.seriesName,+ label = labels.seriesName,+ onValueChange = { value ->+ drafts = drafts + (item.channelId to draft.copy(seriesName = value))+ },+ modifier = Modifier.weight(1.8f)+ )+ LiveM3uAssignmentField(+ value = draft.seasonNumber,+ label = labels.seasonNumber,+ onValueChange = { value ->+ drafts = drafts + (item.channelId to draft.copy(seasonNumber = value.filter(Char::isDigit)))+ },+ modifier = Modifier.weight(0.7f)+ )+ LiveM3uAssignmentField(+ value = draft.episodeNumber,+ label = labels.episodeNumber,+ onValueChange = { value ->+ drafts = drafts + (item.channelId to draft.copy(episodeNumber = value.filter(Char::isDigit)))+ },+ modifier = Modifier.weight(0.7f)+ )+ }+ if (draft.episodeNumber.toIntOrNull() == 0) {+ Text(text = labels.episodeUnresolved, color = MaterialTheme.colorScheme.error)+ }+ }+ }+ }+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.spacedBy(12.dp)+ ) {+ Button(+ onClick = {+ onConfirm(+ items.associate { item ->+ val draft = drafts.getValue(item.channelId)+ item.channelId to M3uSeriesAssignment(+ seriesName = draft.seriesName.trim(),+ seasonNumber = draft.seasonNumber.toIntOrNull()?.coerceAtLeast(1) ?: 1,+ episodeNumber = draft.episodeNumber.toIntOrNull()?.coerceAtLeast(0) ?: 0,+ episodeTitle = item.title+ )+ }+ )+ },+ enabled = items.isNotEmpty() && drafts.values.all { it.seriesName.isNotBlank() },+ modifier = Modifier.weight(1f),+ colors = ButtonDefaults.colors(+ containerColor = MaterialTheme.colorScheme.primary,+ contentColor = Color.Black+ )+ ) { Text(labels.classify) }+ Button(+ onClick = onDismiss,+ modifier = Modifier.weight(1f),+ colors = ButtonDefaults.colors(+ containerColor = Color.White.copy(alpha = 0.08f),+ contentColor = OnSurface+ )+ ) { Text(labels.cancel) }+ }+ }+ }+ }+}++private data class LiveM3uAssignmentDraft(+ val seriesName: String,+ val seasonNumber: String,+ val episodeNumber: String+)++@Composable+private fun LiveM3uTextField(+ value: String,+ onValueChange: (String) -> Unit,+ label: String+) {+ LiveM3uAssignmentField(value, label, onValueChange, Modifier.fillMaxWidth())+}++@Composable+private fun LiveM3uAssignmentField(+ value: String,+ label: String,+ onValueChange: (String) -> Unit,+ modifier: Modifier+) {+ OutlinedTextField(+ value = value,+ onValueChange = onValueChange,+ label = { Text(label) },+ singleLine = true,+ modifier = modifier,+ colors = OutlinedTextFieldDefaults.colors(+ focusedTextColor = OnSurface,+ unfocusedTextColor = OnSurface,+ focusedBorderColor = MaterialTheme.colorScheme.primary,+ unfocusedBorderColor = OnSurface.copy(alpha = 0.4f),+ focusedLabelColor = MaterialTheme.colorScheme.primary,+ unfocusedLabelColor = OnSurface.copy(alpha = 0.7f)+ )+ )+}