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): extract delete group dialog

David Nashashdb2c6b9f791a
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.kt
index 7c9f6c5c..b6fcd981 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
@@ -1,7 +1,6 @@
package com.streamvault.app.ui.screens.home
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
@@ -15,8 +14,6 @@ import com.streamvault.feature.live.home.HomeViewModel
import com.streamvault.app.navigation.Routes
import com.streamvault.app.ui.components.dialogs.AddToGroupDialog
import com.streamvault.core.ui.components.dialogs.PinDialog
-import com.streamvault.core.ui.components.dialogs.PremiumDialog
-import com.streamvault.core.ui.components.dialogs.PremiumDialogFooterButton
import com.streamvault.app.ui.components.dialogs.RenameGroupDialog
import com.streamvault.app.ui.components.dialogs.M3uCategoryOrganizerDialog
import com.streamvault.app.ui.components.dialogs.M3uCategorySeriesAssignmentDialog
@@ -27,6 +24,8 @@ import com.streamvault.feature.live.home.LiveCategoryOptionsDialog
import com.streamvault.feature.live.home.LiveCategoryOptionsDialogLabels
import com.streamvault.feature.live.home.LiveAddQuickFilterDialog
import com.streamvault.feature.live.home.LiveAddQuickFilterDialogLabels
+import com.streamvault.feature.live.home.LiveDeleteGroupDialog
+import com.streamvault.feature.live.home.LiveDeleteGroupDialogLabels
import com.streamvault.domain.model.ActiveLiveSource
import com.streamvault.domain.model.Category
import com.streamvault.domain.model.Channel
@@ -38,7 +37,6 @@ import com.streamvault.domain.model.ProviderType
import com.streamvault.domain.repository.M3uCategoryItem
import com.streamvault.domain.repository.M3uClassificationTarget
import kotlinx.coroutines.CoroutineScope
-import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
@Composable
@@ -367,33 +365,15 @@ internal fun HomeDialogsHost(
val groupToDelete = uiState.groupToDelete
if (uiState.showDeleteGroupDialog && groupToDelete != null) {
val group = groupToDelete
- var canInteract by remember { mutableStateOf(false) }
- LaunchedEffect(Unit) {
- delay(500)
- canInteract = true
- }
-
- val safeDismiss = {
- if (canInteract) viewModel.cancelDeleteGroup()
- }
-
- PremiumDialog(
- title = stringResource(R.string.home_delete_group_title),
- subtitle = stringResource(R.string.home_delete_group_body, group.name),
- onDismissRequest = safeDismiss,
- widthFraction = 0.36f,
- content = {},
- footer = {
- PremiumDialogFooterButton(
- label = stringResource(R.string.home_delete_group_cancel),
- onClick = safeDismiss
- )
- PremiumDialogFooterButton(
- label = stringResource(R.string.home_delete_group_confirm),
- onClick = { if (canInteract) viewModel.confirmDeleteGroup() },
- destructive = true
- )
- }
+ LiveDeleteGroupDialog(
+ labels = LiveDeleteGroupDialogLabels(
+ title = stringResource(R.string.home_delete_group_title),
+ body = stringResource(R.string.home_delete_group_body, group.name),
+ cancel = stringResource(R.string.home_delete_group_cancel),
+ confirm = stringResource(R.string.home_delete_group_confirm)
+ ),
+ onDismiss = viewModel::cancelDeleteGroup,
+ onConfirm = viewModel::confirmDeleteGroup
)
}
}
diff --git a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
index 7a72945e..3688cc72 100644
--- a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
+++ b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
@@ -133,8 +133,8 @@ quick-filter panel/chip row, the reusable EPG guide shortcut chip, the shared
EPG guide-now ticker/provider, EPG search field/row, Home reorder top bar, and
Home channel row surface, Home channel-results header, Home category sidebar
header, channel-content state host, channel-list host, and category-list host
-and hidden category/channel dialogs, the category options dialog, and the
-quick-filter add dialog are now feature-owned
+and hidden category/channel dialogs, the category options dialog, the
+quick-filter add dialog, and the delete-group dialog are now feature-owned
while the Home and EPG
screen/dialog composition remains in `:app` for the remaining app-specific
dialogs.
@@ -142,7 +142,7 @@ The source switcher receives localized labels from the app at the current
composition boundary. Live-owned
presentation primitives, `HomeUiState`, `HomePreviewUiState`, Guide
mode/density/reminder presentation models, hidden collection dialogs, the
-category options dialog, and the quick-filter add dialog are independent of
-app code;
+category options dialog, the quick-filter add dialog, and the delete-group
+dialog are independent of app code;
screen/resource moves, golden/runtime/performance gates, and legacy app cleanup
remain 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.md
index 68a86989..f0541126 100644
--- a/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
+++ b/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
@@ -23,8 +23,8 @@ quick-filter panel/chip row, the reusable EPG guide shortcut chip, the shared
EPG guide-now ticker/provider, EPG search field/row, Home reorder top bar,
Home channel row surface, Home channel-results header, Home category sidebar
header, channel-content state host, channel-list host, and category-list host
-and hidden category/channel dialogs, the category options dialog, and the
-quick-filter add dialog are now feature-owned
+and hidden category/channel dialogs, the category options dialog, the
+quick-filter add dialog, and the delete-group dialog are now feature-owned
and their feature checks are green. Home screen/dialog composition, the
remaining live cards/rows, complete locale resource migration, and acceptance
gates remain open.
@@ -682,6 +682,8 @@ dialog follows the same contract: feature-owned UI receives a label bundle and
the app retains policy/callback wiring. The
quick-filter add dialog also owns its draft text and duplicate check while the
app supplies the saved-filter snapshot and mutation callback. The
+delete-group dialog owns its interaction guard and presentation while the app
+supplies the already formatted group-specific copy and ViewModel callbacks.
quick-filter key/selection rules are covered by `LiveQuickFiltersTest`. The
remaining app-owned live cards and shell/dialog composition still require
compatibility seams before the full Home move.
diff --git a/feature/live/src/main/java/com/streamvault/feature/live/home/LiveDeleteGroupDialog.kt b/feature/live/src/main/java/com/streamvault/feature/live/home/LiveDeleteGroupDialog.kt
new file mode 100644
index 00000000..25c17f00
--- /dev/null
+++ b/feature/live/src/main/java/com/streamvault/feature/live/home/LiveDeleteGroupDialog.kt
@@ -0,0 +1,54 @@
+package com.streamvault.feature.live.home
+
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.LaunchedEffect
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.remember
+import androidx.compose.runtime.setValue
+import com.streamvault.core.ui.components.dialogs.PremiumDialog
+import com.streamvault.core.ui.components.dialogs.PremiumDialogFooterButton
+import kotlinx.coroutines.delay
+
+data class LiveDeleteGroupDialogLabels(
+ val title: String,
+ val body: String,
+ val cancel: String,
+ val confirm: String
+)
+
+@Composable
+fun LiveDeleteGroupDialog(
+ labels: LiveDeleteGroupDialogLabels,
+ onDismiss: () -> Unit,
+ onConfirm: () -> Unit
+) {
+ var canInteract by remember { mutableStateOf(false) }
+ LaunchedEffect(Unit) {
+ delay(500)
+ canInteract = true
+ }
+
+ val safeDismiss = {
+ if (canInteract) onDismiss()
+ }
+
+ PremiumDialog(
+ title = labels.title,
+ subtitle = labels.body,
+ onDismissRequest = safeDismiss,
+ widthFraction = 0.36f,
+ content = {},
+ footer = {
+ PremiumDialogFooterButton(
+ label = labels.cancel,
+ onClick = safeDismiss
+ )
+ PremiumDialogFooterButton(
+ label = labels.confirm,
+ onClick = { if (canInteract) onConfirm() },
+ destructive = true
+ )
+ }
+ )
+}