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 content host

David Nashashb715d0265105
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 59078bb7..0cd93dd6 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
@@ -21,12 +21,11 @@ import com.streamvault.feature.live.presentation.epg.LiveGuideModeLabels
import com.streamvault.feature.live.presentation.epg.LiveGuideTimeControlLabels
import com.streamvault.feature.live.presentation.epg.LiveGuideViewOptionsLabels
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 com.streamvault.feature.live.presentation.epg.LiveGuideGrid
import com.streamvault.feature.live.presentation.epg.LiveGuideGridLabels
+import com.streamvault.feature.live.presentation.epg.LiveGuideContent
+import com.streamvault.feature.live.presentation.epg.LiveGuideContentLabels
+import com.streamvault.feature.live.presentation.epg.LiveGuideContentMessage
import com.streamvault.feature.live.presentation.epg.LiveGuideEpgOverrideDialog
import com.streamvault.feature.live.presentation.epg.LiveGuideEpgOverrideLabels
import com.streamvault.feature.live.presentation.epg.LiveGuideOptionsLabels
@@ -69,7 +68,6 @@ import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Search
-import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
@@ -129,7 +127,6 @@ import com.streamvault.core.ui.components.dialogs.PinDialog
import com.streamvault.app.ui.components.shell.AppNavigationChrome
import com.streamvault.app.ui.components.shell.AppScreenScaffold
import com.streamvault.core.ui.theme.FocusBorder
-import com.streamvault.core.ui.theme.OnBackground
import com.streamvault.core.ui.theme.OnSurface
import com.streamvault.core.ui.theme.OnSurfaceDim
import com.streamvault.core.ui.theme.Primary
@@ -364,6 +361,60 @@ fun FullEpgScreen(
}
}
+ val contentMessage = when {
+ uiState.error != null -> LiveGuideContentMessage(
+ title = when (uiState.error) {
+ EpgViewModel.NO_ACTIVE_PROVIDER -> stringResource(R.string.epg_no_provider)
+ else -> stringResource(R.string.epg_error)
+ },
+ subtitle = when (uiState.error) {
+ EpgViewModel.NO_ACTIVE_PROVIDER -> null
+ else -> stringResource(R.string.epg_retry_hint)
+ },
+ actionLabel = if (uiState.error == EpgViewModel.NO_ACTIVE_PROVIDER) {
+ null
+ } else {
+ stringResource(R.string.epg_retry)
+ },
+ onAction = if (uiState.error == EpgViewModel.NO_ACTIVE_PROVIDER) null else viewModel::refresh
+ )
+
+ uiState.channels.isEmpty() -> LiveGuideContentMessage(
+ title = when {
+ uiState.programSearchQuery.isNotBlank() ->
+ stringResource(R.string.epg_no_search_results)
+ uiState.totalChannelCount == 0 && uiState.selectedCategoryId != ChannelRepository.ALL_CHANNELS_ID ->
+ stringResource(R.string.epg_no_channels_in_category)
+ uiState.totalChannelCount == 0 ->
+ stringResource(R.string.epg_no_data)
+ else ->
+ stringResource(R.string.epg_no_scheduled_channels)
+ },
+ subtitle = when {
+ uiState.programSearchQuery.isNotBlank() ->
+ stringResource(R.string.epg_search_empty_hint)
+ uiState.totalChannelCount == 0 ->
+ stringResource(R.string.epg_filter_hint)
+ uiState.showScheduledOnly ->
+ stringResource(R.string.epg_scheduled_only_hint)
+ else ->
+ stringResource(R.string.epg_stale_warning)
+ },
+ actionLabel = if (uiState.programSearchQuery.isNotBlank()) {
+ stringResource(R.string.epg_clear_search)
+ } else {
+ stringResource(R.string.epg_retry)
+ },
+ onAction = if (uiState.programSearchQuery.isNotBlank()) {
+ viewModel::clearProgramSearch
+ } else {
+ viewModel::refresh
+ }
+ )
+
+ else -> null
+ }
+
AppScreenScaffold(
currentRoute = currentRoute,
onNavigate = onNavigate,
@@ -374,210 +425,104 @@ fun FullEpgScreen(
compactHeader = true,
showScreenHeader = false
) {
- Column(
- modifier = Modifier
- .fillMaxSize()
- .background(MaterialTheme.colorScheme.background)
- ) {
- when {
- uiState.isInitialLoading && uiState.channels.isEmpty() -> {
- Box(
- modifier = Modifier
- .fillMaxWidth()
- .weight(1f),
- contentAlignment = Alignment.Center
- ) {
- Text(stringResource(R.string.epg_loading), color = OnBackground)
- }
- }
-
- uiState.error != null -> {
- LiveGuideMessageState(
- modifier = Modifier.weight(1f),
- title = when (uiState.error) {
- EpgViewModel.NO_ACTIVE_PROVIDER -> stringResource(R.string.epg_no_provider)
- else -> stringResource(R.string.epg_error)
- },
- subtitle = when (uiState.error) {
- EpgViewModel.NO_ACTIVE_PROVIDER -> null
- else -> stringResource(R.string.epg_retry_hint)
- },
- actionLabel = if (uiState.error == EpgViewModel.NO_ACTIVE_PROVIDER) null else stringResource(R.string.epg_retry),
- onAction = if (uiState.error == EpgViewModel.NO_ACTIVE_PROVIDER) null else viewModel::refresh
- )
- }
-
- uiState.channels.isEmpty() -> {
- LiveGuideMessageState(
- modifier = Modifier.weight(1f),
- title = when {
- uiState.programSearchQuery.isNotBlank() ->
- stringResource(R.string.epg_no_search_results)
- uiState.totalChannelCount == 0 && uiState.selectedCategoryId != ChannelRepository.ALL_CHANNELS_ID ->
- stringResource(R.string.epg_no_channels_in_category)
- uiState.totalChannelCount == 0 ->
- stringResource(R.string.epg_no_data)
- else ->
- stringResource(R.string.epg_no_scheduled_channels)
- },
- subtitle = when {
- uiState.programSearchQuery.isNotBlank() ->
- stringResource(R.string.epg_search_empty_hint)
- uiState.totalChannelCount == 0 ->
- stringResource(R.string.epg_filter_hint)
- uiState.showScheduledOnly ->
- stringResource(R.string.epg_scheduled_only_hint)
- else ->
- stringResource(R.string.epg_stale_warning)
- },
- actionLabel = if (uiState.programSearchQuery.isNotBlank()) {
- stringResource(R.string.epg_clear_search)
- } else {
- stringResource(R.string.epg_retry)
- },
- onAction = if (uiState.programSearchQuery.isNotBlank()) {
- viewModel::clearProgramSearch
- } else {
- viewModel::refresh
- }
+ LiveGuideContent(
+ modifier = Modifier.fillMaxSize(),
+ isInitialLoading = uiState.isInitialLoading,
+ contentMessage = contentMessage,
+ channels = uiState.channels,
+ favoriteChannelIds = uiState.favoriteChannelIds,
+ programsByChannel = uiState.programsByChannel,
+ guideWindowStart = uiState.guideWindowStart,
+ guideWindowEnd = uiState.guideWindowEnd,
+ density = uiState.selectedDensity,
+ selectedCategoryName = uiState.categories
+ .firstOrNull { it.id == uiState.selectedCategoryId }
+ ?.name
+ ?: stringResource(R.string.epg_filter_short),
+ isRefreshing = uiState.isRefreshing,
+ previewPlayerEngine = uiState.previewPlayerEngine,
+ isPreviewLoading = uiState.isPreviewLoading,
+ focusedChannel = focusedChannel,
+ focusedProgram = focusedProgram,
+ labels = LiveGuideContentLabels(
+ loading = stringResource(R.string.epg_loading),
+ preview = LiveGuidePreviewLabels(
+ title = stringResource(R.string.epg_title),
+ placeholderTitle = stringResource(R.string.live_preview_placeholder_title),
+ noSchedule = stringResource(R.string.epg_no_schedule)
+ ),
+ toolbar = LiveGuideToolbarLabels(
+ jumpNow = stringResource(R.string.epg_jump_now),
+ search = stringResource(R.string.epg_search_label),
+ options = stringResource(R.string.epg_options_short)
+ ),
+ grid = LiveGuideGridLabels(
+ noSchedule = stringResource(R.string.epg_no_schedule_short),
+ archiveBadge = stringResource(R.string.player_archive_badge),
+ favoriteBadge = stringResource(R.string.epg_favorite_badge)
+ )
+ ),
+ onOpenCategoryPicker = { showCategoryPicker = true },
+ onJumpToNow = viewModel::jumpToNow,
+ onOpenSearch = { showSearchOverlay = true },
+ onOpenOptions = { showGuideOptions = true },
+ onGuideInteract = { topNavVisible = true },
+ onChannelClick = { channel ->
+ if (isGuideChannelLocked(channel, categoriesById, uiState.parentalControlLevel)) {
+ requestLockedGuideAction(LockedGuideAction.PlayChannel(channel, returnRoute))
+ } else if (uiState.previewChannelId == channel.id) {
+ viewModel.handoffOrClearForFullscreen(channel)
+ onPlayChannel(
+ channel,
+ playerCategoryId,
+ playerIsVirtualCategory,
+ uiState.combinedProfileId,
+ returnRoute
)
+ } else {
+ viewModel.previewChannel(channel)
}
-
- else -> {
- LiveGuideNowProvider {
- LiveGuidePreviewPane(
- previewPlayerEngine = uiState.previewPlayerEngine,
- isPreviewLoading = uiState.isPreviewLoading,
- focusedChannel = focusedChannel,
- focusedProgram = focusedProgram,
- labels = LiveGuidePreviewLabels(
- title = stringResource(R.string.epg_title),
- placeholderTitle = stringResource(R.string.live_preview_placeholder_title),
- noSchedule = stringResource(R.string.epg_no_schedule)
- ),
- modifier = Modifier
- .fillMaxWidth()
- .padding(horizontal = 14.dp, vertical = 4.dp)
- )
- }
- LiveGuideToolbarRow(
- selectedCategoryName = uiState.categories
- .firstOrNull { it.id == uiState.selectedCategoryId }
- ?.name
- ?: stringResource(R.string.epg_filter_short),
- labels = LiveGuideToolbarLabels(
- jumpNow = stringResource(R.string.epg_jump_now),
- search = stringResource(R.string.epg_search_label),
- options = stringResource(R.string.epg_options_short)
- ),
- onOpenCategoryPicker = {
- showCategoryPicker = true
- },
- onJumpToNow = {
- viewModel.jumpToNow()
- },
- onOpenSearch = {
- showSearchOverlay = true
- },
- onOpenOptions = {
- showGuideOptions = true
- },
- onGuideInteract = { topNavVisible = true },
- modifier = Modifier
- .fillMaxWidth()
- .padding(horizontal = 14.dp)
- )
- if (uiState.isRefreshing) {
- LinearProgressIndicator(
- modifier = Modifier
- .fillMaxWidth()
- .padding(horizontal = 14.dp, vertical = 4.dp)
- .height(3.dp),
- color = Primary,
- trackColor = SurfaceHighlight
+ },
+ onChannelLongClick = { channel, currentProgram ->
+ topNavVisible = false
+ if (isGuideChannelLocked(channel, categoriesById, uiState.parentalControlLevel)) {
+ requestLockedGuideAction(LockedGuideAction.PlayChannel(channel, returnRoute))
+ } else {
+ val program = currentProgram ?: run {
+ val now = System.currentTimeMillis()
+ Program(
+ channelId = channel.id.toString(),
+ title = channel.name,
+ startTime = now,
+ endTime = now + 60L * 60L * 1000L
)
}
- LiveGuideNowProvider {
- LiveGuideGrid(
- modifier = Modifier
- .fillMaxWidth()
- .weight(1f),
- channels = uiState.channels,
- favoriteChannelIds = uiState.favoriteChannelIds,
- programsByChannel = uiState.programsByChannel,
- guideWindowStart = uiState.guideWindowStart,
- guideWindowEnd = uiState.guideWindowEnd,
- density = uiState.selectedDensity,
- labels = LiveGuideGridLabels(
- noSchedule = stringResource(R.string.epg_no_schedule_short),
- archiveBadge = stringResource(R.string.player_archive_badge),
- favoriteBadge = stringResource(R.string.epg_favorite_badge)
- ),
- onChannelClick = { channel ->
- if (isGuideChannelLocked(channel, categoriesById, uiState.parentalControlLevel)) {
- requestLockedGuideAction(LockedGuideAction.PlayChannel(channel, returnRoute))
- } else if (uiState.previewChannelId == channel.id) {
- viewModel.handoffOrClearForFullscreen(channel)
- onPlayChannel(
- channel,
- playerCategoryId,
- playerIsVirtualCategory,
- uiState.combinedProfileId,
- returnRoute
- )
- } else {
- viewModel.previewChannel(channel)
- }
- },
- onChannelLongClick = { channel, currentProgram ->
- topNavVisible = false
- if (isGuideChannelLocked(channel, categoriesById, uiState.parentalControlLevel)) {
- requestLockedGuideAction(LockedGuideAction.PlayChannel(channel, returnRoute))
- } else {
- val program = currentProgram ?: run {
- // No EPG match ג€” synthesize a 1-hour "now" program so
- // the dialog still shows Record / Record Daily / Weekly.
- val now = System.currentTimeMillis()
- Program(
- channelId = channel.id.toString(),
- title = channel.name,
- startTime = now,
- endTime = now + 60L * 60L * 1000L
- )
- }
- // Delay so the long-press key-release lands on the
- // channel cell, not on an auto-focused button inside
- // the dialog (which would auto-fire "Watch Live").
- scope.launch {
- kotlinx.coroutines.delay(350)
- selectedProgram = channel to program
- }
- }
- },
- onProgramClick = { channel, program ->
- topNavVisible = false
- if (isGuideChannelLocked(channel, categoriesById, uiState.parentalControlLevel)) {
- requestLockedGuideAction(LockedGuideAction.OpenProgram(channel, program))
- } else {
- selectedProgram = channel to program
- }
- },
- onChannelFocused = { channel, currentProgram, isFirstRow ->
- topNavVisible = isFirstRow
- focusedChannel = channel
- focusedProgram = currentProgram
- },
- onProgramFocused = { channel, program, isFirstRow ->
- topNavVisible = isFirstRow
- focusedChannel = channel
- focusedProgram = program
- },
- onRequestMoreChannels = viewModel::requestMoreChannels
- )
+ scope.launch {
+ kotlinx.coroutines.delay(350)
+ selectedProgram = channel to program
}
}
- }
- }
+ },
+ onProgramClick = { channel, program ->
+ topNavVisible = false
+ if (isGuideChannelLocked(channel, categoriesById, uiState.parentalControlLevel)) {
+ requestLockedGuideAction(LockedGuideAction.OpenProgram(channel, program))
+ } else {
+ selectedProgram = channel to program
+ }
+ },
+ onChannelFocused = { channel, currentProgram, isFirstRow ->
+ topNavVisible = isFirstRow
+ focusedChannel = channel
+ focusedProgram = currentProgram
+ },
+ onProgramFocused = { channel, program, isFirstRow ->
+ topNavVisible = isFirstRow
+ focusedChannel = channel
+ focusedProgram = program
+ },
+ onRequestMoreChannels = viewModel::requestMoreChannels
+ )
}
if (showCategoryPicker) {
diff --git a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
index 81a2ed01..5d6dee20 100644
--- a/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
+++ b/docs/COMPOSE_REDUCTION_PHASE5_TRANSITIONAL_DEPENDENCIES.md
@@ -138,8 +138,8 @@ 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, guide toolbar, guide message state, hero badge, timeline header, grid
-rows/cells, grid host, options overlay, and EPG-match dialog are now
-feature-owned
+rows/cells, grid host, and the EPG content host are now feature-owned, with
+the options overlay and EPG-match dialog also feature-owned
while the Home and EPG
screen/dialog composition remains in `:app` for the remaining app-specific
dialogs.
@@ -152,7 +152,7 @@ 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, guide
toolbar, guide message state, hero badge, stable EPG channel-key helper,
-timeline header, grid rows/cells, grid host, options overlay, and EPG-match
-dialog are independent of app code;
+timeline header, grid rows/cells, grid host, EPG content host, options overlay,
+and EPG-match 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 fa3b9106..d270466f 100644
--- a/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
+++ b/docs/superpowers/plans/2026-08-28-live-feature-extraction.md
@@ -28,8 +28,8 @@ 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, guide toolbar, guide message state, hero badge, timeline header, grid
-rows/cells, grid host, options overlay, and EPG-match dialog are now
-feature-owned
+rows/cells, grid host, and the EPG content host are now feature-owned, with
+the options overlay and EPG-match dialog also 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.
@@ -718,9 +718,11 @@ identity/timeline tests. The timeline header owns marker rendering and
live-time presentation while the app supplies sizing and scroll state. Grid
rows/cells and the grid host own guide row composition, sizing, scrolling, and
focus behavior while the app supplies localized labels, guide data, and
-state/action callbacks. The options overlay and EPG-match dialog likewise own
-their presentation and focus behavior while the app supplies localized labels
-and state/action callbacks.
+state/action callbacks. The EPG content host now owns loading, message, preview,
+toolbar, refresh, and grid composition while the app supplies the localized
+label bundles, content message, state, and action callbacks. The options
+overlay and EPG-match dialog likewise own their presentation and focus behavior
+while the app supplies localized labels and state/action 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/presentation/epg/LiveGuideContent.kt b/feature/live/src/main/java/com/streamvault/feature/live/presentation/epg/LiveGuideContent.kt
new file mode 100644
index 00000000..2ae3c63f
--- /dev/null
+++ b/feature/live/src/main/java/com/streamvault/feature/live/presentation/epg/LiveGuideContent.kt
@@ -0,0 +1,170 @@
+package com.streamvault.feature.live.presentation.epg
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.fillMaxSize
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.padding
+import androidx.compose.material3.LinearProgressIndicator
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.unit.dp
+import androidx.tv.material3.MaterialTheme
+import androidx.tv.material3.Text
+import com.streamvault.core.ui.theme.OnBackground
+import com.streamvault.core.ui.theme.Primary
+import com.streamvault.core.ui.theme.SurfaceHighlight
+import com.streamvault.domain.model.Channel
+import com.streamvault.domain.model.Program
+import com.streamvault.player.PlayerEngine
+
+enum class LiveGuideContentMode {
+ INITIAL_LOADING,
+ MESSAGE,
+ GRID
+}
+
+fun liveGuideContentMode(
+ isInitialLoading: Boolean,
+ hasChannels: Boolean,
+ hasMessage: Boolean
+): LiveGuideContentMode = when {
+ isInitialLoading && !hasChannels -> LiveGuideContentMode.INITIAL_LOADING
+ hasMessage -> LiveGuideContentMode.MESSAGE
+ else -> LiveGuideContentMode.GRID
+}
+
+data class LiveGuideContentMessage(
+ val title: String,
+ val subtitle: String?,
+ val actionLabel: String?,
+ val onAction: (() -> Unit)?
+)
+
+data class LiveGuideContentLabels(
+ val loading: String,
+ val preview: LiveGuidePreviewLabels,
+ val toolbar: LiveGuideToolbarLabels,
+ val grid: LiveGuideGridLabels
+)
+
+@Composable
+fun LiveGuideContent(
+ modifier: Modifier = Modifier,
+ isInitialLoading: Boolean,
+ contentMessage: LiveGuideContentMessage?,
+ channels: List<Channel>,
+ favoriteChannelIds: Set<Long>,
+ programsByChannel: Map<String, List<Program>>,
+ guideWindowStart: Long,
+ guideWindowEnd: Long,
+ density: GuideDensity,
+ selectedCategoryName: String,
+ isRefreshing: Boolean,
+ previewPlayerEngine: PlayerEngine?,
+ isPreviewLoading: Boolean,
+ focusedChannel: Channel?,
+ focusedProgram: Program?,
+ labels: LiveGuideContentLabels,
+ onOpenCategoryPicker: () -> Unit,
+ onJumpToNow: () -> Unit,
+ onOpenSearch: () -> Unit,
+ onOpenOptions: () -> Unit,
+ onGuideInteract: () -> Unit,
+ onChannelClick: (Channel) -> Unit,
+ onChannelLongClick: ((Channel, Program?) -> Unit)? = null,
+ onProgramClick: (Channel, Program) -> Unit,
+ onChannelFocused: (Channel, Program?, Boolean) -> Unit,
+ onProgramFocused: (Channel, Program, Boolean) -> Unit,
+ onRequestMoreChannels: () -> Unit = {}
+) {
+ Column(
+ modifier = modifier
+ .fillMaxSize()
+ .background(MaterialTheme.colorScheme.background)
+ ) {
+ when (liveGuideContentMode(isInitialLoading, channels.isNotEmpty(), contentMessage != null)) {
+ LiveGuideContentMode.INITIAL_LOADING -> {
+ Box(
+ modifier = Modifier
+ .fillMaxWidth()
+ .weight(1f),
+ contentAlignment = Alignment.Center
+ ) {
+ Text(labels.loading, color = OnBackground)
+ }
+ }
+
+ LiveGuideContentMode.MESSAGE -> {
+ val message = requireNotNull(contentMessage)
+ LiveGuideMessageState(
+ modifier = Modifier.weight(1f),
+ title = message.title,
+ subtitle = message.subtitle,
+ actionLabel = message.actionLabel,
+ onAction = message.onAction
+ )
+ }
+
+ LiveGuideContentMode.GRID -> {
+ LiveGuideNowProvider {
+ LiveGuidePreviewPane(
+ previewPlayerEngine = previewPlayerEngine,
+ isPreviewLoading = isPreviewLoading,
+ focusedChannel = focusedChannel,
+ focusedProgram = focusedProgram,
+ labels = labels.preview,
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(horizontal = 14.dp, vertical = 4.dp)
+ )
+ }
+ LiveGuideToolbarRow(
+ selectedCategoryName = selectedCategoryName,
+ labels = labels.toolbar,
+ onOpenCategoryPicker = onOpenCategoryPicker,
+ onJumpToNow = onJumpToNow,
+ onOpenSearch = onOpenSearch,
+ onOpenOptions = onOpenOptions,
+ onGuideInteract = onGuideInteract,
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(horizontal = 14.dp)
+ )
+ if (isRefreshing) {
+ LinearProgressIndicator(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(horizontal = 14.dp, vertical = 4.dp)
+ .height(3.dp),
+ color = Primary,
+ trackColor = SurfaceHighlight
+ )
+ }
+ LiveGuideNowProvider {
+ LiveGuideGrid(
+ modifier = Modifier
+ .fillMaxWidth()
+ .weight(1f),
+ channels = channels,
+ favoriteChannelIds = favoriteChannelIds,
+ programsByChannel = programsByChannel,
+ guideWindowStart = guideWindowStart,
+ guideWindowEnd = guideWindowEnd,
+ density = density,
+ labels = labels.grid,
+ onChannelClick = onChannelClick,
+ onChannelLongClick = onChannelLongClick,
+ onProgramClick = onProgramClick,
+ onChannelFocused = onChannelFocused,
+ onProgramFocused = onProgramFocused,
+ onRequestMoreChannels = onRequestMoreChannels
+ )
+ }
+ }
+ }
+ }
+}
diff --git a/feature/live/src/test/java/com/streamvault/feature/live/presentation/epg/LiveGuideContentTest.kt b/feature/live/src/test/java/com/streamvault/feature/live/presentation/epg/LiveGuideContentTest.kt
new file mode 100644
index 00000000..19418acc
--- /dev/null
+++ b/feature/live/src/test/java/com/streamvault/feature/live/presentation/epg/LiveGuideContentTest.kt
@@ -0,0 +1,39 @@
+package com.streamvault.feature.live.presentation.epg
+
+import com.google.common.truth.Truth.assertThat
+import org.junit.Test
+
+class LiveGuideContentTest {
+ @Test
+ fun `initial loading takes precedence when no channels are available`() {
+ assertThat(
+ liveGuideContentMode(
+ isInitialLoading = true,
+ hasChannels = false,
+ hasMessage = false
+ )
+ ).isEqualTo(LiveGuideContentMode.INITIAL_LOADING)
+ }
+
+ @Test
+ fun `message takes precedence over the grid`() {
+ assertThat(
+ liveGuideContentMode(
+ isInitialLoading = false,
+ hasChannels = false,
+ hasMessage = true
+ )
+ ).isEqualTo(LiveGuideContentMode.MESSAGE)
+ }
+
+ @Test
+ fun `available channels render the grid`() {
+ assertThat(
+ liveGuideContentMode(
+ isInitialLoading = false,
+ hasChannels = true,
+ hasMessage = false
+ )
+ ).isEqualTo(LiveGuideContentMode.GRID)
+ }
+}