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 epg message state

David Nashash2d5b5af7398c
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgGridComponents.kt b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgGridComponents.kt
index da1b7dd0..3b4bf9e4 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgGridComponents.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgGridComponents.kt
@@ -74,47 +74,6 @@ import java.time.ZoneId
import kotlinx.coroutines.delay
import kotlin.math.max
-@Composable
-internal fun GuideMessageState(
- modifier: Modifier = Modifier,
- title: String,
- subtitle: String?,
- actionLabel: String?,
- onAction: (() -> Unit)?
-) {
- Box(modifier = modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
- Column(
- horizontalAlignment = Alignment.CenterHorizontally,
- verticalArrangement = Arrangement.spacedBy(10.dp),
- modifier = Modifier.padding(horizontal = 32.dp)
- ) {
- Text(
- text = title,
- style = MaterialTheme.typography.titleLarge,
- color = OnSurface
- )
- if (!subtitle.isNullOrBlank()) {
- Text(
- text = subtitle,
- style = MaterialTheme.typography.bodyMedium,
- color = OnSurfaceDim
- )
- }
- if (actionLabel != null && onAction != null) {
- TvButton(
- onClick = onAction,
- colors = ButtonDefaults.colors(
- containerColor = Primary,
- contentColor = Color.White
- )
- ) {
- Text(actionLabel)
- }
- }
- }
- }
-}
-
@Composable
internal fun EpgGrid(
modifier: Modifier = Modifier,
@@ -230,7 +189,6 @@ internal fun EpgGrid(
}
}
}
-
@Composable
private fun GuideTimelineHeader(
windowStart: Long,
@@ -327,7 +285,6 @@ private fun GuideTimelineHeader(
}
}
}
-
@Composable
fun EpgRow(
channel: Channel,
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreen.kt
index fb10249f..147d6fbb 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreen.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreen.kt
@@ -24,6 +24,7 @@ import com.streamvault.feature.live.presentation.epg.LiveGuidePreviewLabels
import com.streamvault.feature.live.presentation.epg.LiveGuidePreviewPane
import com.streamvault.feature.live.presentation.epg.LiveGuideToolbarLabels
import com.streamvault.feature.live.presentation.epg.LiveGuideToolbarRow
+import com.streamvault.feature.live.presentation.epg.LiveGuideMessageState
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
@@ -384,7 +385,7 @@ fun FullEpgScreen(
}
uiState.error != null -> {
- GuideMessageState(
+ LiveGuideMessageState(
modifier = Modifier.weight(1f),
title = when (uiState.error) {
EpgViewModel.NO_ACTIVE_PROVIDER -> stringResource(R.string.epg_no_provider)
@@ -400,7 +401,7 @@ fun FullEpgScreen(
}
uiState.channels.isEmpty() -> {
- GuideMessageState(
+ LiveGuideMessageState(
modifier = Modifier.weight(1f),
title = when {
uiState.programSearchQuery.isNotBlank() ->
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/epg/PlayerTransparentGuideOverlay.kt b/app/src/main/java/com/streamvault/app/ui/screens/epg/PlayerTransparentGuideOverlay.kt
index 4d5d2557..8bd93864 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/epg/PlayerTransparentGuideOverlay.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/epg/PlayerTransparentGuideOverlay.kt
@@ -33,7 +33,6 @@ import com.streamvault.domain.playback.isArchivePlayable
import com.streamvault.app.ui.screens.epg.EpgGrid
import com.streamvault.app.ui.screens.epg.EpgUiState
import com.streamvault.app.ui.screens.epg.EpgViewModel
-import com.streamvault.app.ui.screens.epg.GuideMessageState
import com.streamvault.feature.live.presentation.epg.LiveGuideNowProvider
import com.streamvault.feature.live.presentation.epg.LiveGuideSearchOverlay
import com.streamvault.feature.live.presentation.epg.LiveGuideSearchOverlayLabels
@@ -42,6 +41,7 @@ import com.streamvault.feature.live.presentation.epg.LiveGuideCategoryPickerLabe
import com.streamvault.feature.live.presentation.epg.LiveCompactGuideProgramDialog
import com.streamvault.feature.live.presentation.epg.LiveCompactGuideProgramLabels
import com.streamvault.feature.live.presentation.epg.LiveGuideToolbarButton
+import com.streamvault.feature.live.presentation.epg.LiveGuideMessageState
import com.streamvault.feature.live.presentation.epg.currentLiveGuideNow
import com.streamvault.app.ui.screens.epg.isGuideCategoryLocked
import com.streamvault.core.ui.theme.OnSurfaceDim
@@ -205,7 +205,7 @@ fun PlayerTransparentGuideOverlay(
) {
when {
uiState.isInitialLoading -> {
- GuideMessageState(
+ LiveGuideMessageState(
title = stringResource(R.string.epg_loading),
subtitle = contextLabel.takeIf { it.isNotBlank() },
actionLabel = null,
@@ -213,7 +213,7 @@ fun PlayerTransparentGuideOverlay(
)
}
uiState.channels.isEmpty() -> {
- GuideMessageState(
+ LiveGuideMessageState(
title = stringResource(R.string.epg_title),
subtitle = uiState.error
?.takeUnless { it == EpgViewModel.NO_ACTIVE_PROVIDER }
diff --git a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
index 2b7f7a78..662dfd56 100644
--- a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
+++ b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
@@ -137,7 +137,7 @@ and hidden category/channel dialogs, the category options dialog, the
quick-filter add dialog, delete-group dialog, rename-group dialog, M3U category
organizer dialog, M3U series-assignment dialogs, EPG search overlay, guide
category picker, compact guide-program dialog, guide control rows, EPG preview
-pane, and guide toolbar are now feature-owned
+pane, guide toolbar, and guide message state are now feature-owned
while the Home and EPG
screen/dialog composition remains in `:app` for the remaining app-specific
dialogs.
@@ -148,7 +148,7 @@ mode/density/reminder presentation models, hidden collection dialogs, the
category options dialog, the quick-filter add dialog, the delete-group dialog,
and the rename-group dialog, M3U category organizer dialog, and M3U
series-assignment dialogs, the EPG search overlay, guide category picker, and
-compact guide-program dialog, guide control rows, EPG preview pane, and guide
-toolbar are independent of app code;
+compact guide-program dialog, guide control rows, EPG preview pane, guide
+toolbar, and guide message state 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 456cd4a6..5296e4a9 100644
--- a/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
+++ b/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
@@ -27,7 +27,7 @@ and hidden category/channel dialogs, the category options dialog, the
quick-filter add dialog, delete-group dialog, rename-group dialog, M3U category
organizer dialog, M3U series-assignment dialogs, EPG search overlay, guide
category picker, compact guide-program dialog, guide control rows, EPG preview
-pane, and guide toolbar are now feature-owned
+pane, guide toolbar, and guide message state 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.
@@ -707,6 +707,8 @@ selection, placeholder/loading states, channel/program metadata, and progress
presentation while the app supplies the player and focused data.
The guide toolbar owns button layout and focus affordances while the app
supplies category text and navigation callbacks.
+The guide message state owns centered empty/loading/error presentation and the
+optional action affordance while callers supply state-specific copy and action.
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/presentation/epg/LiveGuideMessageState.kt b/feature/live/src/main/java/com/streamvault/feature/live/presentation/epg/LiveGuideMessageState.kt
new file mode 100644
index 00000000..d6e0b221
--- /dev/null
+++ b/feature/live/src/main/java/com/streamvault/feature/live/presentation/epg/LiveGuideMessageState.kt
@@ -0,0 +1,49 @@
+package com.streamvault.feature.live.presentation.epg
+
+import androidx.compose.foundation.layout.Arrangement
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.padding
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.unit.dp
+import androidx.tv.material3.ButtonDefaults
+import androidx.tv.material3.MaterialTheme
+import androidx.tv.material3.Text
+import com.streamvault.core.ui.interaction.TvButton
+import com.streamvault.core.ui.theme.OnSurface
+import com.streamvault.core.ui.theme.OnSurfaceDim
+import com.streamvault.core.ui.theme.Primary
+
+@Composable
+fun LiveGuideMessageState(
+ modifier: Modifier = Modifier,
+ title: String,
+ subtitle: String?,
+ actionLabel: String?,
+ onAction: (() -> Unit)?
+) {
+ Box(modifier = modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
+ Column(
+ horizontalAlignment = Alignment.CenterHorizontally,
+ verticalArrangement = Arrangement.spacedBy(10.dp),
+ modifier = Modifier.padding(horizontal = 32.dp)
+ ) {
+ Text(text = title, style = MaterialTheme.typography.titleLarge, color = OnSurface)
+ if (!subtitle.isNullOrBlank()) {
+ Text(text = subtitle, style = MaterialTheme.typography.bodyMedium, color = OnSurfaceDim)
+ }
+ if (actionLabel != null && onAction != null) {
+ TvButton(
+ onClick = onAction,
+ colors = ButtonDefaults.colors(containerColor = Primary, contentColor = Color.White)
+ ) {
+ Text(actionLabel)
+ }
+ }
+ }
+ }
+}