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): move guide presentation models

David Nashash967eb4c2cc38
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgControlComponents.kt b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgControlComponents.kt
index c01c9198..32db416d 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgControlComponents.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgControlComponents.kt
@@ -56,6 +56,8 @@ import androidx.tv.material3.ClickableSurfaceDefaults
import androidx.tv.material3.MaterialTheme
import androidx.tv.material3.Text
import com.streamvault.app.R
+import com.streamvault.feature.live.presentation.epg.GuideChannelMode
+import com.streamvault.feature.live.presentation.epg.GuideDensity
import com.streamvault.app.device.rememberIsTelevisionDevice
import com.streamvault.app.ui.components.SelectionChip
import com.streamvault.app.ui.components.SelectionChipRow
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 fc6a9c25..b589f960 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
@@ -50,6 +50,7 @@ import androidx.tv.material3.Surface
import androidx.tv.material3.SurfaceDefaults
import androidx.tv.material3.Text
import com.streamvault.app.R
+import com.streamvault.feature.live.presentation.epg.GuideDensity
import com.streamvault.core.ui.image.ChannelLogoBadge
import com.streamvault.core.ui.interaction.TvButton
import com.streamvault.core.ui.interaction.TvClickableSurface
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgHeroComponents.kt b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgHeroComponents.kt
index aabfc23a..f590d3b6 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgHeroComponents.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgHeroComponents.kt
@@ -42,6 +42,7 @@ import androidx.tv.material3.Surface
import androidx.tv.material3.SurfaceDefaults
import androidx.tv.material3.Text
import com.streamvault.app.R
+import com.streamvault.feature.live.presentation.epg.GuideDensity
import com.streamvault.core.ui.image.ChannelLogoBadge
import com.streamvault.player.ui.PlayerRenderView
import com.streamvault.domain.playback.isArchivePlayable
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreenDialogs.kt b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreenDialogs.kt
index 475eea47..63ba881d 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreenDialogs.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgScreenDialogs.kt
@@ -50,6 +50,8 @@ import androidx.tv.material3.Surface
import androidx.tv.material3.SurfaceDefaults
import androidx.tv.material3.Text
import com.streamvault.app.R
+import com.streamvault.feature.live.presentation.epg.GuideChannelMode
+import com.streamvault.feature.live.presentation.epg.GuideDensity
import com.streamvault.core.ui.interaction.TvClickableSurface
import com.streamvault.core.ui.interaction.TvButton
import com.streamvault.feature.live.presentation.time.LocalLiveTimeFormat
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgViewModel.kt
index 344df36f..838ba75f 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgViewModel.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/epg/EpgViewModel.kt
@@ -75,6 +75,9 @@ import com.streamvault.player.PlayerEngine
import com.streamvault.feature.live.presentation.epg.guidePrimeTimeAnchor
import com.streamvault.feature.live.presentation.epg.jumpGuideAnchorToDay
import com.streamvault.feature.live.presentation.epg.shiftGuideAnchorByDays
+import com.streamvault.feature.live.presentation.epg.GuideChannelMode
+import com.streamvault.feature.live.presentation.epg.GuideDensity
+import com.streamvault.feature.live.presentation.epg.programReminderDeliveryIssueMessage
import javax.inject.Provider as InjectProvider
data class RecordingConflictInfo(
@@ -149,29 +152,6 @@ data class ProgramReminderUiState(
this.programStartTime == programStartTime
}
-internal fun programReminderDeliveryIssueMessage(reminders: List<ProgramReminder>): String? {
- val issue = reminders.firstOrNull {
- it.deliveryState == ProgramReminderDeliveryState.BLOCKED ||
- it.deliveryState == ProgramReminderDeliveryState.FAILED
- } ?: return null
- val reason = issue.deliveryFailureReason
- ?.takeIf { it.isNotBlank() }
- ?: "The notification was not accepted."
- return "Reminder for ${issue.programTitle} was not delivered: $reason"
-}
-
-enum class GuideChannelMode {
- ALL,
- ANCHORED,
- ARCHIVE_READY
-}
-
-enum class GuideDensity {
- COMPACT,
- COMFORTABLE,
- CINEMATIC
-}
-
private data class GuideProgramsResult(
val programsByChannel: Map<String, List<Program>>,
val failedCount: Int
diff --git a/app/src/test/java/com/streamvault/app/ui/screens/epg/ProgramReminderIssueMessageTest.kt b/app/src/test/java/com/streamvault/app/ui/screens/epg/ProgramReminderIssueMessageTest.kt
index f26bf56a..8e6ddccd 100644
--- a/app/src/test/java/com/streamvault/app/ui/screens/epg/ProgramReminderIssueMessageTest.kt
+++ b/app/src/test/java/com/streamvault/app/ui/screens/epg/ProgramReminderIssueMessageTest.kt
@@ -1,5 +1,7 @@
package com.streamvault.app.ui.screens.epg
+import com.streamvault.feature.live.presentation.epg.programReminderDeliveryIssueMessage
+
import com.google.common.truth.Truth.assertThat
import com.streamvault.domain.model.ProgramReminder
import com.streamvault.domain.model.ProgramReminderDeliveryState
diff --git a/feature/live/src/main/java/com/streamvault/feature/live/presentation/epg/GuidePresentationModels.kt b/feature/live/src/main/java/com/streamvault/feature/live/presentation/epg/GuidePresentationModels.kt
new file mode 100644
index 00000000..239d91f8
--- /dev/null
+++ b/feature/live/src/main/java/com/streamvault/feature/live/presentation/epg/GuidePresentationModels.kt
@@ -0,0 +1,27 @@
+package com.streamvault.feature.live.presentation.epg
+
+import com.streamvault.domain.model.ProgramReminder
+import com.streamvault.domain.model.ProgramReminderDeliveryState
+
+enum class GuideChannelMode {
+ ALL,
+ ANCHORED,
+ ARCHIVE_READY
+}
+
+enum class GuideDensity {
+ COMPACT,
+ COMFORTABLE,
+ CINEMATIC
+}
+
+fun programReminderDeliveryIssueMessage(reminders: List<ProgramReminder>): String? {
+ val issue = reminders.firstOrNull {
+ it.deliveryState == ProgramReminderDeliveryState.BLOCKED ||
+ it.deliveryState == ProgramReminderDeliveryState.FAILED
+ } ?: return null
+ val reason = issue.deliveryFailureReason
+ ?.takeIf { it.isNotBlank() }
+ ?: "The notification was not accepted."
+ return "Reminder for ${issue.programTitle} was not delivered: $reason"
+}