Skip to content

StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.

feat(ui): implement phase 3 cinematic UI overhaul

Davidonafc0b31f5cc25
diff --git a/app/src/main/java/com/streamvault/app/ui/components/Cards.kt b/app/src/main/java/com/streamvault/app/ui/components/Cards.kt
index bdf07175..69d6599f 100644
--- a/app/src/main/java/com/streamvault/app/ui/components/Cards.kt
+++ b/app/src/main/java/com/streamvault/app/ui/components/Cards.kt
@@ -1,27 +1,32 @@
package com.streamvault.app.ui.components
+import androidx.compose.animation.animateColorAsState
+import androidx.compose.animation.core.FastOutSlowInEasing
+import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.BorderStroke
+import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
-import androidx.compose.ui.draw.scale
+import androidx.compose.ui.draw.clip
import androidx.compose.ui.focus.onFocusChanged
+import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
-import androidx.compose.foundation.clickable
-import androidx.compose.foundation.combinedClickable
-import androidx.compose.ui.draw.clip
-import androidx.compose.foundation.border
-import androidx.compose.foundation.background
+import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.material3.LinearProgressIndicator
-import androidx.tv.material3.*
+import androidx.tv.material3.Border
+import androidx.tv.material3.ClickableSurfaceDefaults
+import androidx.tv.material3.MaterialTheme
+import androidx.tv.material3.Surface
+import androidx.tv.material3.Text
import coil3.compose.AsyncImage
import com.streamvault.app.ui.theme.*
import com.streamvault.domain.model.Channel
@@ -42,12 +47,15 @@ fun FocusableCard(
var isFocused by remember { mutableStateOf(false) }
val scale by animateFloatAsState(
- targetValue = if (isFocused) 1.06f else 1f,
- animationSpec = tween(durationMillis = 180),
+ targetValue = if (isFocused) 1.08f else 1f,
+ animationSpec = tween(durationMillis = 200, easing = FastOutSlowInEasing),
label = "cardScale"
)
-
- val borderColor = if (isFocused) FocusBorder else Color.Transparent
+ val shadowElevation by animateFloatAsState(
+ targetValue = if (isFocused) 24f else 0f,
+ animationSpec = tween(200, easing = FastOutSlowInEasing),
+ label = "cardShadow"
+ )
Surface(
onClick = onClick,
@@ -55,21 +63,25 @@ fun FocusableCard(
modifier = modifier
.width(width)
.height(height)
- .scale(scale)
+ .graphicsLayer {
+ scaleX = scale
+ scaleY = scale
+ this.shadowElevation = shadowElevation
+ }
.onFocusChanged { isFocused = it.isFocused },
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),
+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(10.dp)),
colors = ClickableSurfaceDefaults.colors(
containerColor = CardBackground,
- focusedContainerColor = CardBackground
+ focusedContainerColor = SurfaceHighlight
),
border = ClickableSurfaceDefaults.border(
border = Border(
- border = BorderStroke(2.dp, borderColor),
- shape = RoundedCornerShape(8.dp)
+ border = BorderStroke(0.dp, Color.Transparent),
+ shape = RoundedCornerShape(10.dp)
),
focusedBorder = Border(
- border = BorderStroke(2.dp, FocusBorder),
- shape = RoundedCornerShape(8.dp)
+ border = BorderStroke(2.dp, Primary),
+ shape = RoundedCornerShape(10.dp)
)
)
) {
@@ -79,7 +91,7 @@ fun FocusableCard(
}
}
-// ── Channel Card ───────────────────────────────────────────────────
+// ── Channel Card (16:9 landscape tile) ────────────────────────────
@Composable
fun ChannelCard(
@@ -93,129 +105,109 @@ fun ChannelCard(
onClick = onClick,
onLongClick = onLongClick,
modifier = modifier,
- width = 200.dp,
- height = 140.dp
+ width = 280.dp,
+ height = 157.dp
) { isFocused ->
- Column(
+ // Background: logo or solid surface
+ if (!channel.logoUrl.isNullOrBlank() && !isLocked) {
+ AsyncImage(
+ model = channel.logoUrl,
+ contentDescription = null,
+ modifier = Modifier
+ .fillMaxSize()
+ .clip(RoundedCornerShape(10.dp)),
+ contentScale = ContentScale.Fit
+ )
+ }
+
+ // Bottom gradient overlay
+ Box(
modifier = Modifier
- .fillMaxSize()
- .padding(LocalSpacing.current.sm)
- ) {
- // Top section: Logo and Name
- Row(
- verticalAlignment = Alignment.CenterVertically,
- modifier = Modifier.weight(1f)
- ) {
- if (!channel.logoUrl.isNullOrBlank() && !isLocked) {
- AsyncImage(
- model = channel.logoUrl,
- contentDescription = channel.name,
- modifier = Modifier
- .size(48.dp)
- .padding(end = 8.dp),
- contentScale = ContentScale.Fit
+ .align(Alignment.BottomCenter)
+ .fillMaxWidth()
+ .fillMaxHeight(0.55f)
+ .background(
+ Brush.verticalGradient(
+ colors = listOf(Color.Transparent, GradientOverlayBottom)
)
- }
-
- Text(
- text = if (isLocked) "Locked Channel" else channel.name,
- style = MaterialTheme.typography.bodySmall,
- color = if (isFocused) OnBackground else OnSurface,
- maxLines = 2,
- overflow = TextOverflow.Ellipsis
)
- }
+ )
+
+ // Bottom content: channel name + EPG + progress
+ Column(
+ modifier = Modifier
+ .align(Alignment.BottomStart)
+ .fillMaxWidth()
+ .padding(horizontal = 10.dp, vertical = 8.dp),
+ verticalArrangement = Arrangement.spacedBy(2.dp)
+ ) {
+ Text(
+ text = if (isLocked) "Locked Channel" else channel.name,
+ style = MaterialTheme.typography.titleSmall,
+ color = if (isFocused) TextPrimary else TextSecondary,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis
+ )
- // Bottom section: Current Program (Hide if locked)
if (!isLocked) {
channel.currentProgram?.let { program ->
- Spacer(modifier = Modifier.height(4.dp))
-
Text(
text = program.title,
- style = MaterialTheme.typography.labelSmall,
- color = if (isFocused) OnBackground.copy(alpha = 0.8f) else OnSurfaceDim,
+ style = MaterialTheme.typography.labelMedium,
+ color = TextTertiary,
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
-
- // Progress Bar
val now = System.currentTimeMillis()
val totalDuration = program.endTime - program.startTime
val elapsed = now - program.startTime
val progress = if (totalDuration > 0) elapsed.toFloat() / totalDuration else 0f
-
- Spacer(modifier = Modifier.height(4.dp))
LinearProgressIndicator(
progress = { progress.coerceIn(0f, 1f) },
- modifier = Modifier
- .fillMaxWidth()
- .height(2.dp),
- color = if (isFocused) Primary else OnSurfaceDim,
+ modifier = Modifier.fillMaxWidth().height(2.dp).clip(RoundedCornerShape(1.dp)),
+ color = AccentCyan,
trackColor = SurfaceHighlight
)
}
}
}
-
- // Lock Overlay
- if (isLocked) {
- Box(
- modifier = Modifier.fillMaxSize(),
- contentAlignment = Alignment.Center
- ) {
- Text(
- text = "🔒",
- style = MaterialTheme.typography.displayMedium
- )
- }
- }
- // Live indicator (Hide if locked)
+ // Top-right badges
if (!isLocked) {
- Box(
- modifier = Modifier
- .align(Alignment.TopEnd)
- .padding(4.dp)
+ Row(
+ modifier = Modifier.align(Alignment.TopEnd).padding(6.dp),
+ horizontalArrangement = Arrangement.spacedBy(4.dp),
+ verticalAlignment = Alignment.CenterVertically
) {
- Row(verticalAlignment = Alignment.CenterVertically) {
- if (channel.isFavorite) {
- Box(
- modifier = Modifier
- .size(24.dp)
- .padding(end = 4.dp)
- .background(Color.Yellow, androidx.compose.foundation.shape.CircleShape),
- contentAlignment = Alignment.Center
- ) {
- Text(
- text = "★",
- style = MaterialTheme.typography.labelSmall,
- fontWeight = androidx.compose.ui.text.font.FontWeight.Bold,
- color = Color.Black
- )
- }
- }
-
+ if (channel.isFavorite) {
Box(
modifier = Modifier
- .size(width = 32.dp, height = 14.dp)
- .background(LiveIndicator, RoundedCornerShape(4.dp)),
- contentAlignment = Alignment.Center
+ .background(AccentAmber, RoundedCornerShape(4.dp))
+ .padding(horizontal = 5.dp, vertical = 2.dp)
) {
- Text(
- text = "LIVE",
- style = MaterialTheme.typography.labelSmall,
- color = Color.White
- )
- }
+ Text("★", style = MaterialTheme.typography.labelSmall, color = Color.Black)
}
}
+ Box(
+ modifier = Modifier
+ .background(AccentRed, RoundedCornerShape(4.dp))
+ .padding(horizontal = 6.dp, vertical = 2.dp)
+ ) {
+ Text("LIVE", style = MaterialTheme.typography.labelSmall, color = Color.White)
+ }
}
}
- }
+ // Lock overlay
+ if (isLocked) {
+ Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
+ Text("🔒", style = MaterialTheme.typography.displayMedium)
+ }
+ }
+ }
+}
-// ── Movie Card ─────────────────────────────────────────────────────
+// ── Movie Card (2:3 poster) ────────────────────────────────────────
@Composable
fun MovieCard(
@@ -223,82 +215,113 @@ fun MovieCard(
onClick: () -> Unit,
modifier: Modifier = Modifier,
onLongClick: (() -> Unit)? = null,
- isLocked: Boolean = false
+ isLocked: Boolean = false,
+ watchProgress: Float = 0f // 0..1 from playback history
) {
FocusableCard(
onClick = onClick,
onLongClick = onLongClick,
modifier = modifier,
- width = 160.dp,
- height = 240.dp
+ width = 150.dp,
+ height = 225.dp
) { isFocused ->
+ // Poster image
if (!movie.posterUrl.isNullOrBlank() && !isLocked) {
AsyncImage(
model = movie.posterUrl,
contentDescription = movie.name,
- modifier = Modifier.fillMaxSize(),
+ modifier = Modifier.fillMaxSize().clip(RoundedCornerShape(10.dp)),
contentScale = ContentScale.Crop
)
+ } else {
+ Box(
+ modifier = Modifier.fillMaxSize().background(SurfaceElevated),
+ contentAlignment = Alignment.Center
+ ) {
+ Text(
+ text = if (isLocked) "🔒" else "🎬",
+ style = MaterialTheme.typography.headlineLarge
+ )
+ }
}
- // Title overlay at bottom
+ // Bottom gradient overlay
Box(
modifier = Modifier
.align(Alignment.BottomCenter)
.fillMaxWidth()
- .padding(LocalSpacing.current.sm)
+ .fillMaxHeight(0.5f)
+ .background(
+ Brush.verticalGradient(
+ colors = listOf(Color.Transparent, GradientOverlayBottom),
+ )
+ )
+ )
+
+ // Title + metadata at bottom
+ Column(
+ modifier = Modifier
+ .align(Alignment.BottomStart)
+ .fillMaxWidth()
+ .padding(horizontal = 8.dp, vertical = 6.dp),
+ verticalArrangement = Arrangement.spacedBy(2.dp)
) {
Text(
- text = if (isLocked) "Locked Movie" else movie.name,
- style = MaterialTheme.typography.bodySmall,
- color = if (isFocused) OnBackground else OnSurface,
+ text = if (isLocked) "Locked" else movie.name,
+ style = MaterialTheme.typography.titleSmall,
+ color = TextPrimary,
maxLines = 2,
overflow = TextOverflow.Ellipsis
)
+ if (!isLocked && movie.year != null) {
+ val year = movie.year
+ val genre = movie.genre
+ Text(
+ text = buildString {
+ append(year)
+ if (!genre.isNullOrBlank()) append(" · ${genre.take(20)}")
+ },
+ style = MaterialTheme.typography.labelMedium,
+ color = TextTertiary,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis
+ )
+ }
+ }
+
+ // Watch progress bar at very bottom edge
+ if (watchProgress > 0f && !isLocked) {
+ LinearProgressIndicator(
+ progress = { watchProgress.coerceIn(0f, 1f) },
+ modifier = Modifier
+ .align(Alignment.BottomCenter)
+ .fillMaxWidth()
+ .height(3.dp),
+ color = AccentCyan,
+ trackColor = Color.Transparent
+ )
}
- // Rating badge
+ // Rating badge top-right
if (movie.rating > 0f && !isLocked) {
Box(
modifier = Modifier
.align(Alignment.TopEnd)
- .padding(4.dp)
- ) {
- Surface(
- onClick = {},
- shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(4.dp)),
- colors = ClickableSurfaceDefaults.colors(
- containerColor = Primary.copy(alpha = 0.85f),
- focusedContainerColor = Primary.copy(alpha = 0.85f)
- ),
- modifier = Modifier.padding(2.dp)
- ) {
- Text(
- text = String.format("%.1f", movie.rating),
- style = MaterialTheme.typography.labelSmall,
- color = Color.White,
- modifier = Modifier.padding(horizontal = 6.dp, vertical = 2.dp)
- )
- }
- }
- }
-
- // Lock Overlay
- if (isLocked) {
- Box(
- modifier = Modifier.fillMaxSize(),
- contentAlignment = Alignment.Center
+ .padding(6.dp)
+ .background(PrimaryGlow, RoundedCornerShape(4.dp))
+ .padding(horizontal = 6.dp, vertical = 2.dp)
) {
Text(
- text = "🔒",
- style = MaterialTheme.typography.displayMedium
+ text = String.format("%.1f", movie.rating),
+ style = MaterialTheme.typography.labelMedium,
+ color = Color.White
)
}
}
}
}
-// ── Series Card ────────────────────────────────────────────────────
+// ── Series Card (2:3 poster) ───────────────────────────────────────
@Composable
fun SeriesCard(
@@ -306,50 +329,90 @@ fun SeriesCard(
onClick: () -> Unit,
modifier: Modifier = Modifier,
onLongClick: (() -> Unit)? = null,
- isLocked: Boolean = false
+ isLocked: Boolean = false,
+ watchProgress: Float = 0f,
+ subtitle: String? = null // e.g. "12 episodes" — caller provides to avoid type collision
) {
+ val posterUrl = series.posterUrl
+ val seriesName = series.name
+
FocusableCard(
onClick = onClick,
onLongClick = onLongClick,
modifier = modifier,
- width = 160.dp,
- height = 240.dp
+ width = 150.dp,
+ height = 225.dp
) { isFocused ->
- if (!series.posterUrl.isNullOrBlank() && !isLocked) {
+ // Poster image
+ if (!posterUrl.isNullOrBlank() && !isLocked) {
AsyncImage(
- model = series.posterUrl,
- contentDescription = series.name,
- modifier = Modifier.fillMaxSize(),
+ model = posterUrl,
+ contentDescription = seriesName,
+ modifier = Modifier.fillMaxSize().clip(RoundedCornerShape(10.dp)),
contentScale = ContentScale.Crop
)
+ } else {
+ Box(
+ modifier = Modifier.fillMaxSize().background(SurfaceElevated),
+ contentAlignment = Alignment.Center
+ ) {
+ Text(
+ text = if (isLocked) "🔒" else "📺",
+ style = MaterialTheme.typography.headlineLarge
+ )
+ }
}
+ // Bottom gradient overlay
Box(
modifier = Modifier
.align(Alignment.BottomCenter)
.fillMaxWidth()
- .padding(LocalSpacing.current.sm)
+ .fillMaxHeight(0.5f)
+ .background(
+ Brush.verticalGradient(
+ colors = listOf(Color.Transparent, GradientOverlayBottom)
+ )
+ )
+ )
+
+ // Title at bottom
+ Column(
+ modifier = Modifier
+ .align(Alignment.BottomStart)
+ .fillMaxWidth()
+ .padding(horizontal = 8.dp, vertical = 6.dp),
+ verticalArrangement = Arrangement.spacedBy(2.dp)
) {
Text(
- text = if (isLocked) "Locked Series" else series.name,
- style = MaterialTheme.typography.bodySmall,
- color = if (isFocused) OnBackground else OnSurface,
+ text = if (isLocked) "Locked" else seriesName,
+ style = MaterialTheme.typography.titleSmall,
+ color = TextPrimary,
maxLines = 2,
overflow = TextOverflow.Ellipsis
)
- }
-
- // Lock Overlay
- if (isLocked) {
- Box(
- modifier = Modifier.fillMaxSize(),
- contentAlignment = Alignment.Center
- ) {
+ if (!isLocked && !subtitle.isNullOrBlank()) {
Text(
- text = "🔒",
- style = MaterialTheme.typography.displayMedium
+ text = subtitle,
+ style = MaterialTheme.typography.labelMedium,
+ color = TextTertiary,
+ maxLines = 1
)
}
}
+
+ // Watch progress bar at very bottom edge
+ if (watchProgress > 0f && !isLocked) {
+ LinearProgressIndicator(
+ progress = { watchProgress.coerceIn(0f, 1f) },
+ modifier = Modifier
+ .align(Alignment.BottomCenter)
+ .fillMaxWidth()
+ .height(3.dp),
+ color = AccentCyan,
+ trackColor = Color.Transparent
+ )
+ }
}
}
+
diff --git a/app/src/main/java/com/streamvault/app/ui/components/CategoryRow.kt b/app/src/main/java/com/streamvault/app/ui/components/CategoryRow.kt
index a400af2e..52d57b1b 100644
--- a/app/src/main/java/com/streamvault/app/ui/components/CategoryRow.kt
+++ b/app/src/main/java/com/streamvault/app/ui/components/CategoryRow.kt
@@ -4,37 +4,51 @@ import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
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.app.ui.theme.LocalSpacing
-import com.streamvault.app.ui.theme.OnBackground
+import com.streamvault.app.ui.theme.TextPrimary
+import com.streamvault.app.ui.theme.TextTertiary
+
+// ── Netflix-style horizontal category row ─────────────────────────
@Composable
fun <T> CategoryRow(
title: String,
items: List<T>,
modifier: Modifier = Modifier,
+ onSeeAll: (() -> Unit)? = null,
itemContent: @Composable (T) -> Unit
) {
- val spacing = LocalSpacing.current
-
Column(modifier = modifier.fillMaxWidth()) {
- Text(
- text = title,
- style = MaterialTheme.typography.titleMedium,
- color = OnBackground,
- modifier = Modifier.padding(
- start = spacing.xl,
- top = spacing.lg,
- bottom = spacing.sm
+ // Row header
+ Row(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(start = 48.dp, end = 48.dp, top = 24.dp, bottom = 8.dp),
+ horizontalArrangement = Arrangement.SpaceBetween,
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ Text(
+ text = title,
+ style = MaterialTheme.typography.titleMedium,
+ color = TextPrimary
)
- )
+ if (onSeeAll != null) {
+ Text(
+ text = "See All →",
+ style = MaterialTheme.typography.labelLarge,
+ color = TextTertiary
+ )
+ }
+ }
LazyRow(
- contentPadding = PaddingValues(horizontal = spacing.xl),
- horizontalArrangement = Arrangement.spacedBy(spacing.md)
+ contentPadding = PaddingValues(horizontal = 48.dp),
+ horizontalArrangement = Arrangement.spacedBy(12.dp)
) {
items(
items = items,
diff --git a/app/src/main/java/com/streamvault/app/ui/components/ContinueWatchingRow.kt b/app/src/main/java/com/streamvault/app/ui/components/ContinueWatchingRow.kt
new file mode 100644
index 00000000..a560b11c
--- /dev/null
+++ b/app/src/main/java/com/streamvault/app/ui/components/ContinueWatchingRow.kt
@@ -0,0 +1,159 @@
+package com.streamvault.app.ui.components
+
+import androidx.compose.foundation.background
+import androidx.compose.foundation.layout.*
+import androidx.compose.foundation.lazy.LazyRow
+import androidx.compose.foundation.lazy.items
+import androidx.compose.foundation.shape.RoundedCornerShape
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.draw.clip
+import androidx.compose.ui.graphics.Brush
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.layout.ContentScale
+import androidx.compose.ui.text.style.TextOverflow
+import androidx.compose.ui.unit.dp
+import androidx.compose.material3.LinearProgressIndicator
+import androidx.tv.material3.MaterialTheme
+import androidx.tv.material3.Text
+import coil3.compose.AsyncImage
+import com.streamvault.app.ui.theme.*
+import com.streamvault.domain.model.ContentType
+import com.streamvault.domain.model.PlaybackHistory
+
+/**
+ * Netflix-style "Continue Watching" row backed by PlaybackHistoryRepository.
+ *
+ * Shows landscape tiles (280×157dp) with:
+ * - Poster/backdrop image
+ * - Bottom gradient overlay with title + episode info
+ * - AccentCyan resume progress bar at bottom edge
+ *
+ * Hidden automatically when [items] is empty.
+ */
+@Composable
+fun ContinueWatchingRow(
+ items: List<PlaybackHistory>,
+ onItemClick: (PlaybackHistory) -> Unit,
+ modifier: Modifier = Modifier
+) {
+ if (items.isEmpty()) return
+
+ Column(modifier = modifier.fillMaxWidth()) {
+ // Header
+ Row(
+ modifier = Modifier
+ .fillMaxWidth()
+ .padding(start = 48.dp, end = 48.dp, top = 24.dp, bottom = 8.dp),
+ horizontalArrangement = Arrangement.SpaceBetween,
+ verticalAlignment = Alignment.CenterVertically
+ ) {
+ Text(
+ text = "Continue Watching",
+ style = MaterialTheme.typography.titleMedium,
+ color = TextPrimary
+ )
+ }
+
+ LazyRow(
+ contentPadding = PaddingValues(horizontal = 48.dp),
+ horizontalArrangement = Arrangement.spacedBy(12.dp)
+ ) {
+ items(items = items, key = { it.id }) { history ->
+ ContinueWatchingTile(history = history, onClick = { onItemClick(history) })
+ }
+ }
+ }
+}
+
+@Composable
+private fun ContinueWatchingTile(
+ history: PlaybackHistory,
+ onClick: () -> Unit
+) {
+ val progress = if (history.totalDurationMs > 0) {
+ (history.resumePositionMs.toFloat() / history.totalDurationMs).coerceIn(0f, 1f)
+ } else 0f
+
+ FocusableCard(
+ onClick = onClick,
+ width = 280.dp,
+ height = 157.dp
+ ) { isFocused ->
+ // Artwork
+ if (!history.posterUrl.isNullOrBlank()) {
+ AsyncImage(
+ model = history.posterUrl,
+ contentDescription = history.title,
+ modifier = Modifier
+ .fillMaxSize()
+ .clip(RoundedCornerShape(10.dp)),
+ contentScale = ContentScale.Crop
+ )
+ } else {
+ Box(
+ modifier = Modifier.fillMaxSize().background(SurfaceElevated),
+ contentAlignment = Alignment.Center
+ ) {
+ Text(
+ text = when (history.contentType) {
+ ContentType.LIVE -> "📡"
+ ContentType.MOVIE -> "🎬"
+ ContentType.SERIES, ContentType.SERIES_EPISODE -> "📺"
+ },
+ style = MaterialTheme.typography.headlineLarge
+ )
+ }
+ }
+
+ // Bottom gradient
+ Box(
+ modifier = Modifier
+ .align(Alignment.BottomCenter)
+ .fillMaxWidth()
+ .fillMaxHeight(0.55f)
+ .background(Brush.verticalGradient(listOf(Color.Transparent, GradientOverlayBottom)))
+ )
+
+ // Title + subtitle
+ Column(
+ modifier = Modifier
+ .align(Alignment.BottomStart)
+ .fillMaxWidth()
+ .padding(horizontal = 10.dp, vertical = if (progress > 0f) 10.dp else 6.dp),
+ verticalArrangement = Arrangement.spacedBy(2.dp)
+ ) {
+ Text(
+ text = history.title,
+ style = MaterialTheme.typography.titleSmall,
+ color = TextPrimary,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis
+ )
+ if (history.contentType == ContentType.SERIES_EPISODE &&
+ history.seasonNumber != null && history.episodeNumber != null
+ ) {
+ Text(
+ text = "S${history.seasonNumber} E${history.episodeNumber}",
+ style = MaterialTheme.typography.labelMedium,
+ color = TextTertiary,
+ maxLines = 1
+ )
+ }
+ }
+
+ // Resume progress bar at very bottom
+ if (progress > 0f) {
+ LinearProgressIndicator(
+ progress = { progress },
+ modifier = Modifier
+ .align(Alignment.BottomCenter)
+ .fillMaxWidth()
+ .height(3.dp),
+ color = AccentCyan,
+ trackColor = Color.Transparent
+ )
+ }
+ }
+}
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/favorites/FavoritesViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/favorites/FavoritesViewModel.kt
index 5e44dbd4..f608e530 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/favorites/FavoritesViewModel.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/favorites/FavoritesViewModel.kt
@@ -71,6 +71,7 @@ class FavoritesViewModel @Inject constructor(
)
} else null
}
+ else -> null // SERIES_EPISODE and future types not favoriteable
}
} catch (e: Exception) {
null
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/movies/MoviesScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/movies/MoviesScreen.kt
index 02494ffd..2eef8bc0 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/movies/MoviesScreen.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/movies/MoviesScreen.kt
@@ -10,6 +10,7 @@ import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.tv.material3.*
import com.streamvault.app.ui.components.CategoryRow
+import com.streamvault.app.ui.components.ContinueWatchingRow
import com.streamvault.app.ui.components.MovieCard
import com.streamvault.app.ui.components.TopNavBar
import com.streamvault.app.ui.theme.*
@@ -72,6 +73,21 @@ fun MoviesScreen(
modifier = Modifier.fillMaxSize(),
contentPadding = PaddingValues(bottom = 32.dp)
) {
+ // Continue Watching row (shown first, only if non-empty)
+ item(key = "continue_watching") {
+ ContinueWatchingRow(
+ items = uiState.continueWatching,
+ onItemClick = { history -> onMovieClick(
+ com.streamvault.domain.model.Movie(
+ id = history.contentId,
+ name = history.title,
+ posterUrl = history.posterUrl,
+ streamUrl = history.streamUrl,
+ providerId = history.providerId
+ )
+ )}
+ )
+ }
items(
items = uiState.moviesByCategory.entries.toList(),
key = { it.key }
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/movies/MoviesViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/movies/MoviesViewModel.kt
index e494d2a8..7607dd48 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/movies/MoviesViewModel.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/movies/MoviesViewModel.kt
@@ -4,7 +4,9 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.streamvault.data.preferences.PreferencesRepository
import com.streamvault.domain.model.Movie
+import com.streamvault.domain.model.PlaybackHistory
import com.streamvault.domain.repository.MovieRepository
+import com.streamvault.domain.repository.PlaybackHistoryRepository
import com.streamvault.domain.repository.ProviderRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.*
@@ -15,7 +17,8 @@ import javax.inject.Inject
class MoviesViewModel @Inject constructor(
private val providerRepository: ProviderRepository,
private val movieRepository: MovieRepository,
- private val preferencesRepository: PreferencesRepository
+ private val preferencesRepository: PreferencesRepository,
+ private val playbackHistoryRepository: PlaybackHistoryRepository
) : ViewModel() {
private val _uiState = MutableStateFlow(MoviesUiState())
@@ -26,12 +29,20 @@ class MoviesViewModel @Inject constructor(
providerRepository.getActiveProvider()
.filterNotNull()
.collectLatest { provider ->
- movieRepository.getMovies(provider.id).collect { movies ->
- val grouped = movies.groupBy { it.categoryName ?: "Uncategorized" }
- _uiState.update {
- it.copy(moviesByCategory = grouped, isLoading = false)
+ // Movies by category
+ launch {
+ movieRepository.getMovies(provider.id).collect { movies ->
+ val grouped = movies.groupBy { it.categoryName ?: "Uncategorized" }
+ _uiState.update { it.copy(moviesByCategory = grouped, isLoading = false) }
}
}
+ // Continue Watching — last 20 movie/series items for this provider
+ launch {
+ playbackHistoryRepository.getRecentlyWatchedByProvider(provider.id, limit = 20)
+ .collect { history ->
+ _uiState.update { it.copy(continueWatching = history) }
+ }
+ }
}
}
@@ -49,6 +60,7 @@ class MoviesViewModel @Inject constructor(
data class MoviesUiState(
val moviesByCategory: Map<String, List<Movie>> = emptyMap(),
+ val continueWatching: List<PlaybackHistory> = emptyList(),
val isLoading: Boolean = true,
val parentalControlLevel: Int = 0
)
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/series/SeriesScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/series/SeriesScreen.kt
index 0b358f6c..8ca82d3e 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/series/SeriesScreen.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/series/SeriesScreen.kt
@@ -10,6 +10,7 @@ import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.tv.material3.*
import com.streamvault.app.ui.components.CategoryRow
+import com.streamvault.app.ui.components.ContinueWatchingRow
import com.streamvault.app.ui.components.SeriesCard
import com.streamvault.app.ui.components.TopNavBar
import com.streamvault.app.ui.theme.*
@@ -71,6 +72,13 @@ fun SeriesScreen(
modifier = Modifier.fillMaxSize(),
contentPadding = PaddingValues(bottom = 32.dp)
) {
+ // Continue Watching row (shown first, only if non-empty)
+ item(key = "continue_watching") {
+ ContinueWatchingRow(
+ items = uiState.continueWatching,
+ onItemClick = { history -> onSeriesClick(history.seriesId ?: history.contentId) }
+ )
+ }
items(
items = uiState.seriesByCategory.entries.toList(),
key = { it.key }
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/series/SeriesViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/series/SeriesViewModel.kt
index 8e128f26..62e63afd 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/series/SeriesViewModel.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/series/SeriesViewModel.kt
@@ -3,7 +3,9 @@ package com.streamvault.app.ui.screens.series
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.streamvault.data.preferences.PreferencesRepository
+import com.streamvault.domain.model.PlaybackHistory
import com.streamvault.domain.model.Series
+import com.streamvault.domain.repository.PlaybackHistoryRepository
import com.streamvault.domain.repository.ProviderRepository
import com.streamvault.domain.repository.SeriesRepository
import dagger.hilt.android.lifecycle.HiltViewModel
@@ -15,7 +17,8 @@ import javax.inject.Inject
class SeriesViewModel @Inject constructor(
private val providerRepository: ProviderRepository,
private val seriesRepository: SeriesRepository,
- private val preferencesRepository: PreferencesRepository
+ private val preferencesRepository: PreferencesRepository,
+ private val playbackHistoryRepository: PlaybackHistoryRepository
) : ViewModel() {
private val _uiState = MutableStateFlow(SeriesUiState())
@@ -26,12 +29,20 @@ class SeriesViewModel @Inject constructor(
providerRepository.getActiveProvider()
.filterNotNull()
.collectLatest { provider ->
- seriesRepository.getSeries(provider.id).collect { seriesList ->
- val grouped = seriesList.groupBy { it.categoryName ?: "Uncategorized" }
- _uiState.update {
- it.copy(seriesByCategory = grouped, isLoading = false)
+ // Series by category
+ launch {
+ seriesRepository.getSeries(provider.id).collect { seriesList ->
+ val grouped = seriesList.groupBy { it.categoryName ?: "Uncategorized" }
+ _uiState.update { it.copy(seriesByCategory = grouped, isLoading = false) }
}
}
+ // Continue Watching — last 20 items for this provider
+ launch {
+ playbackHistoryRepository.getRecentlyWatchedByProvider(provider.id, limit = 20)
+ .collect { history ->
+ _uiState.update { it.copy(continueWatching = history) }
+ }
+ }
}
}
@@ -49,6 +60,7 @@ class SeriesViewModel @Inject constructor(
data class SeriesUiState(
val seriesByCategory: Map<String, List<Series>> = emptyMap(),
+ val continueWatching: List<PlaybackHistory> = emptyList(),
val isLoading: Boolean = true,
val parentalControlLevel: Int = 0
)
diff --git a/app/src/main/java/com/streamvault/app/ui/theme/Color.kt b/app/src/main/java/com/streamvault/app/ui/theme/Color.kt
index dd33a33b..5c8a2f88 100644
--- a/app/src/main/java/com/streamvault/app/ui/theme/Color.kt
+++ b/app/src/main/java/com/streamvault/app/ui/theme/Color.kt
@@ -2,34 +2,53 @@ package com.streamvault.app.ui.theme
import androidx.compose.ui.graphics.Color
-// ── Primary Palette ────────────────────────────────────────────────
-val Primary = Color(0xFF6C63FF)
-val PrimaryVariant = Color(0xFF8B83FF)
-val PrimaryDark = Color(0xFF4A42DB)
-val Secondary = Color(0xFF03DAC6)
-val OnPrimary = Color(0xFFFFFFFF)
-
-// ── Background & Surface ──────────────────────────────────────────
-val Background = Color(0xFF0D0D0D)
-val Surface = Color(0xFF1A1A1A)
-val SurfaceElevated = Color(0xFF242424)
-val SurfaceHighlight = Color(0xFF2D2D2D)
-val SurfaceVariant = SurfaceElevated
-
-// ── Text Colors ───────────────────────────────────────────────────
-val OnBackground = Color(0xFFE8E8E8)
-val OnSurface = Color(0xFFB0B0B0)
-val OnSurfaceVariant = Color(0xFF888888)
-val OnSurfaceDim = Color(0xFF666666)
-
-// ── Status Colors ─────────────────────────────────────────────────
-val ErrorColor = Color(0xFFFF6B6B)
-val SuccessColor = Color(0xFF4ECB71)
-val LiveIndicator = Color(0xFFFF4444)
-val WarningColor = Color(0xFFFFB74D)
+// ── Brand Primary — Deep Indigo-Violet ────────────────────────────
+val Primary = Color(0xFF6C63FF)
+val PrimaryLight = Color(0xFF9D97FF) // hover/pressed states
+val PrimaryVariant = PrimaryLight // legacy alias
+val PrimaryDark = Color(0xFF4A42DB)
+val PrimaryGlow = Color(0x336C63FF) // 20% opacity glow ring
+
+// ── Backgrounds — Layered depth system ────────────────────────────
+val BackgroundDeep = Color(0xFF050508) // Deepest — behind everything
+val Background = Color(0xFF0D0D12) // Slight blue tint
+val Surface = Color(0xFF16161F) // Card surfaces
+val SurfaceElevated = Color(0xFF1E1E2A) // Modals, overlays, sidebar
+val SurfaceHighlight = Color(0xFF282838) // Selected/hovered
+val SurfaceVariant = SurfaceElevated
+
+// ── Text — 4-tier hierarchy ───────────────────────────────────────
+val TextPrimary = Color(0xFFF0F0F5) // Titles, high emphasis
+val TextSecondary = Color(0xFFB8B8C8) // Descriptions, metadata
+val TextTertiary = Color(0xFF7A7A8E) // Timestamps, counts
+val TextDisabled = Color(0xFF4A4A58) // Disabled states
+
+// Legacy aliases kept for compatibility
+val OnBackground = TextPrimary
+val OnSurface = TextSecondary
+val OnSurfaceVariant = TextSecondary
+val OnSurfaceDim = TextTertiary
+
+// ── Accents ────────────────────────────────────────────────────────
+val AccentRed = Color(0xFFFF4B6A) // Live indicator, errors
+val AccentGreen = Color(0xFF2DD881) // Success, online
+val AccentAmber = Color(0xFFFFA742) // Warnings, badges
+val AccentCyan = Color(0xFF00D4FF) // EPG progress, info
+
+// Legacy aliases
+val OnPrimary = Color(0xFFFFFFFF)
+val Secondary = Color(0xFF03DAC6)
+val ErrorColor = AccentRed
+val SuccessColor = AccentGreen
+val LiveIndicator = AccentRed
+val WarningColor = AccentAmber
+
+// ── Gradient Overlays ─────────────────────────────────────────────
+val GradientOverlayTop = Color(0xCC000005) // 80% opacity
+val GradientOverlayBottom = Color(0xE6000005) // 90% opacity
// ── Card & Focus ──────────────────────────────────────────────────
-val FocusBorder = Primary
-val CardBackground = Surface
-val ProgressBar = Primary
-val ProgressBarBackground = Color(0xFF333333)
+val FocusBorder = Primary
+val CardBackground = Surface
+val ProgressBar = Primary
+val ProgressBarBackground = Color(0xFF333344)
diff --git a/app/src/main/java/com/streamvault/app/ui/theme/Theme.kt b/app/src/main/java/com/streamvault/app/ui/theme/Theme.kt
index a39302b6..6d9842a1 100644
--- a/app/src/main/java/com/streamvault/app/ui/theme/Theme.kt
+++ b/app/src/main/java/com/streamvault/app/ui/theme/Theme.kt
@@ -7,13 +7,13 @@ import androidx.tv.material3.darkColorScheme
private val DarkColorScheme = darkColorScheme(
primary = Primary,
- onPrimary = OnBackground,
+ onPrimary = OnPrimary,
surface = Surface,
- onSurface = OnSurface,
+ onSurface = TextSecondary,
background = Background,
- onBackground = OnBackground,
+ onBackground = TextPrimary,
error = ErrorColor,
- onError = OnBackground
+ onError = OnPrimary
)
@Composable
@@ -23,6 +23,7 @@ fun StreamVaultTheme(content: @Composable () -> Unit) {
) {
MaterialTheme(
colorScheme = DarkColorScheme,
+ typography = StreamVaultTypography,
content = content
)
}
diff --git a/app/src/main/java/com/streamvault/app/ui/theme/Type.kt b/app/src/main/java/com/streamvault/app/ui/theme/Type.kt
new file mode 100644
index 00000000..965f6e17
--- /dev/null
+++ b/app/src/main/java/com/streamvault/app/ui/theme/Type.kt
@@ -0,0 +1,31 @@
+package com.streamvault.app.ui.theme
+
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.font.Font
+import androidx.compose.ui.text.font.FontFamily
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.unit.sp
+import androidx.tv.material3.Typography
+import com.streamvault.app.R
+
+val Inter = FontFamily(
+ Font(R.font.inter_regular, FontWeight.Normal),
+ Font(R.font.inter_medium, FontWeight.Medium),
+ Font(R.font.inter_semibold, FontWeight.SemiBold),
+ Font(R.font.inter_bold, FontWeight.Bold)
+)
+
+val StreamVaultTypography = Typography(
+ displayLarge = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Bold, fontSize = 48.sp, lineHeight = 56.sp),
+ headlineLarge = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Bold, fontSize = 32.sp, lineHeight = 40.sp),
+ headlineMedium= TextStyle(fontFamily = Inter, fontWeight = FontWeight.SemiBold, fontSize = 24.sp, lineHeight = 32.sp),
+ titleLarge = TextStyle(fontFamily = Inter, fontWeight = FontWeight.SemiBold, fontSize = 20.sp, lineHeight = 28.sp),
+ titleMedium = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Medium, fontSize = 16.sp, lineHeight = 24.sp),
+ titleSmall = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Medium, fontSize = 14.sp, lineHeight = 20.sp),
+ bodyLarge = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Normal, fontSize = 16.sp, lineHeight = 24.sp),
+ bodyMedium = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Normal, fontSize = 14.sp, lineHeight = 20.sp),
+ bodySmall = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Normal, fontSize = 12.sp, lineHeight = 16.sp),
+ labelLarge = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Medium, fontSize = 14.sp, lineHeight = 20.sp),
+ labelMedium = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Medium, fontSize = 12.sp, lineHeight = 16.sp),
+ labelSmall = TextStyle(fontFamily = Inter, fontWeight = FontWeight.Medium, fontSize = 10.sp, lineHeight = 14.sp),
+)
diff --git a/app/src/main/res/font/inter_bold.ttf b/app/src/main/res/font/inter_bold.ttf
new file mode 100644
index 00000000..15e908f2
Binary files /dev/null and b/app/src/main/res/font/inter_bold.ttf differ
diff --git a/app/src/main/res/font/inter_medium.ttf b/app/src/main/res/font/inter_medium.ttf
new file mode 100644
index 00000000..93427308
Binary files /dev/null and b/app/src/main/res/font/inter_medium.ttf differ
diff --git a/app/src/main/res/font/inter_regular.ttf b/app/src/main/res/font/inter_regular.ttf
new file mode 100644
index 00000000..c544be47
Binary files /dev/null and b/app/src/main/res/font/inter_regular.ttf differ
diff --git a/app/src/main/res/font/inter_semibold.ttf b/app/src/main/res/font/inter_semibold.ttf
new file mode 100644
index 00000000..a32e2b8d
Binary files /dev/null and b/app/src/main/res/font/inter_semibold.ttf differ
diff --git a/domain/bin/main/com/streamvault/domain/manager/ParentalControlManager.kt b/domain/bin/main/com/streamvault/domain/manager/ParentalControlManager.kt
deleted file mode 100644
index 2f82762d..00000000
--- a/domain/bin/main/com/streamvault/domain/manager/ParentalControlManager.kt
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.streamvault.domain.manager
-
-import kotlinx.coroutines.flow.MutableStateFlow
-import kotlinx.coroutines.flow.StateFlow
-import kotlinx.coroutines.flow.asStateFlow
-import javax.inject.Inject
-import javax.inject.Singleton
-
-@Singleton
-class ParentalControlManager @Inject constructor() {
- private val _unlockedCategories = MutableStateFlow<Set<Long>>(emptySet())
- val unlockedCategories: StateFlow<Set<Long>> = _unlockedCategories.asStateFlow()
-
- fun unlockCategory(categoryId: Long) {
- val current = _unlockedCategories.value.toMutableSet()
- current.add(categoryId)
- _unlockedCategories.value = current
- }
-
- fun isCategoryUnlocked(categoryId: Long): Boolean {
- return _unlockedCategories.value.contains(categoryId)
- }
-
- fun clearUnlockedCategories() {
- _unlockedCategories.value = emptySet()
- }
-}
diff --git a/domain/bin/main/com/streamvault/domain/model/Category.kt b/domain/bin/main/com/streamvault/domain/model/Category.kt
deleted file mode 100644
index a26bfd47..00000000
--- a/domain/bin/main/com/streamvault/domain/model/Category.kt
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.streamvault.domain.model
-
-data class Category(
- val id: Long,
- val name: String,
- val parentId: Long? = null,
- val type: ContentType = ContentType.LIVE,
- val isVirtual: Boolean = false,
- val count: Int = 0,
- val isAdult: Boolean = false,
- val isUserProtected: Boolean = false
-)
diff --git a/domain/bin/main/com/streamvault/domain/model/Channel.kt b/domain/bin/main/com/streamvault/domain/model/Channel.kt
deleted file mode 100644
index 02e859f8..00000000
--- a/domain/bin/main/com/streamvault/domain/model/Channel.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.streamvault.domain.model
-
-data class Channel(
- val id: Long,
- val name: String,
- val logoUrl: String? = null,
- val groupTitle: String? = null,
- val categoryId: Long? = null,
- val categoryName: String? = null,
- val streamUrl: String = "",
- val epgChannelId: String? = null,
- val number: Int = 0,
- val isFavorite: Boolean = false,
- val catchUpSupported: Boolean = false,
- val catchUpDays: Int = 0,
- val providerId: Long = 0,
- val currentProgram: Program? = null,
- val nextProgram: Program? = null,
- val isAdult: Boolean = false,
- val isUserProtected: Boolean = false
-)
diff --git a/domain/bin/main/com/streamvault/domain/model/ContentType.kt b/domain/bin/main/com/streamvault/domain/model/ContentType.kt
deleted file mode 100644
index 2d636e21..00000000
--- a/domain/bin/main/com/streamvault/domain/model/ContentType.kt
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.streamvault.domain.model
-
-enum class ContentType {
- LIVE,
- MOVIE,
- SERIES
-}
diff --git a/domain/bin/main/com/streamvault/domain/model/Favorite.kt b/domain/bin/main/com/streamvault/domain/model/Favorite.kt
deleted file mode 100644
index f78307bf..00000000
--- a/domain/bin/main/com/streamvault/domain/model/Favorite.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.streamvault.domain.model
-
-data class Favorite(
- val id: Long = 0,
- val contentId: Long,
- val contentType: ContentType,
- val position: Int = 0,
- val groupId: Long? = null,
- val addedAt: Long = System.currentTimeMillis()
-)
-
-data class VirtualGroup(
- val id: Long = 0,
- val name: String,
- val iconEmoji: String? = null,
- val position: Int = 0,
- val createdAt: Long = System.currentTimeMillis()
-)
diff --git a/domain/bin/main/com/streamvault/domain/model/Movie.kt b/domain/bin/main/com/streamvault/domain/model/Movie.kt
deleted file mode 100644
index 365804fe..00000000
--- a/domain/bin/main/com/streamvault/domain/model/Movie.kt
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.streamvault.domain.model
-
-data class Movie(
- val id: Long,
- val name: String,
- val posterUrl: String? = null,
- val backdropUrl: String? = null,
- val categoryId: Long? = null,
- val categoryName: String? = null,
- val streamUrl: String = "",
- val containerExtension: String? = null,
- val plot: String? = null,
- val cast: String? = null,
- val director: String? = null,
- val genre: String? = null,
- val releaseDate: String? = null,
- val duration: String? = null,
- val durationSeconds: Int = 0,
- val rating: Float = 0f,
- val year: String? = null,
- val tmdbId: Long? = null,
- val youtubeTrailer: String? = null,
- val isFavorite: Boolean = false,
- val providerId: Long = 0,
- val watchProgress: Long = 0L,
- val lastWatchedAt: Long = 0L,
- val isAdult: Boolean = false,
- val isUserProtected: Boolean = false
-)
diff --git a/domain/bin/main/com/streamvault/domain/model/PlaybackHistory.kt b/domain/bin/main/com/streamvault/domain/model/PlaybackHistory.kt
deleted file mode 100644
index 9c502588..00000000
--- a/domain/bin/main/com/streamvault/domain/model/PlaybackHistory.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.streamvault.domain.model
-
-data class PlaybackHistory(
- val id: Long = 0,
- val contentId: Long,
- val contentType: ContentType,
- val providerId: Long,
- val title: String,
- val posterUrl: String? = null,
- val streamUrl: String,
- val resumePositionMs: Long = 0,
- val totalDurationMs: Long = 0,
- val lastWatchedAt: Long = 0,
- val watchCount: Int = 1,
- val seriesId: Long? = null,
- val seasonNumber: Int? = null,
- val episodeNumber: Int? = null
-)
diff --git a/domain/bin/main/com/streamvault/domain/model/Program.kt b/domain/bin/main/com/streamvault/domain/model/Program.kt
deleted file mode 100644
index 6264b748..00000000
--- a/domain/bin/main/com/streamvault/domain/model/Program.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.streamvault.domain.model
-
-data class Program(
- val id: Long = 0,
- val channelId: String,
- val title: String,
- val description: String = "",
- val startTime: Long = 0L,
- val endTime: Long = 0L,
- val lang: String = "",
- val hasArchive: Boolean = false,
- val isNowPlaying: Boolean = false
-) {
- val durationMinutes: Int
- get() = ((endTime - startTime) / 60000).toInt()
-
- val progressPercent: Float
- get() {
- if (!isNowPlaying) return 0f
- val now = System.currentTimeMillis()
- if (now < startTime || endTime <= startTime) return 0f
- return ((now - startTime).toFloat() / (endTime - startTime).toFloat()).coerceIn(0f, 1f)
- }
-}
diff --git a/domain/bin/main/com/streamvault/domain/model/Provider.kt b/domain/bin/main/com/streamvault/domain/model/Provider.kt
deleted file mode 100644
index 6b5a6d06..00000000
--- a/domain/bin/main/com/streamvault/domain/model/Provider.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.streamvault.domain.model
-
-data class Provider(
- val id: Long = 0,
- val name: String,
- val type: ProviderType,
- val serverUrl: String,
- val username: String = "",
- val password: String = "",
- val m3uUrl: String = "",
- val epgUrl: String = "",
- val isActive: Boolean = true,
- val maxConnections: Int = 1,
- val expirationDate: Long? = null,
- val status: ProviderStatus = ProviderStatus.UNKNOWN,
- val lastSyncedAt: Long = 0L,
- val createdAt: Long = System.currentTimeMillis()
-)
-
-enum class ProviderType {
- XTREAM_CODES,
- M3U
-}
-
-enum class ProviderStatus {
- ACTIVE,
- EXPIRED,
- DISABLED,
- ERROR,
- UNKNOWN
-}
diff --git a/domain/bin/main/com/streamvault/domain/model/Result.kt b/domain/bin/main/com/streamvault/domain/model/Result.kt
deleted file mode 100644
index b9240014..00000000
--- a/domain/bin/main/com/streamvault/domain/model/Result.kt
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.streamvault.domain.model
-
-/**
- * Generic result wrapper for handling success/failure across layers.
- */
-sealed class Result<out T> {
- data class Success<T>(val data: T) : Result<T>()
- data class Error(val message: String, val exception: Throwable? = null) : Result<Nothing>()
- data object Loading : Result<Nothing>()
-
- val isSuccess: Boolean get() = this is Success
- val isError: Boolean get() = this is Error
-
- fun getOrNull(): T? = (this as? Success)?.data
- fun errorMessageOrNull(): String? = (this as? Error)?.message
-
- fun <R> map(transform: (T) -> R): Result<R> = when (this) {
- is Success -> Success(transform(data))
- is Error -> Error(message, exception)
- is Loading -> Loading
- }
-
- companion object {
- fun <T> success(data: T) = Success(data)
- fun error(message: String, exception: Throwable? = null) = Error(message, exception)
- }
-}
diff --git a/domain/bin/main/com/streamvault/domain/model/Series.kt b/domain/bin/main/com/streamvault/domain/model/Series.kt
deleted file mode 100644
index 61c5efd6..00000000
--- a/domain/bin/main/com/streamvault/domain/model/Series.kt
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.streamvault.domain.model
-
-data class Series(
- val id: Long,
- val name: String,
- val posterUrl: String? = null,
- val backdropUrl: String? = null,
- val categoryId: Long? = null,
- val categoryName: String? = null,
- val plot: String? = null,
- val cast: String? = null,
- val director: String? = null,
- val genre: String? = null,
- val releaseDate: String? = null,
- val rating: Float = 0f,
- val tmdbId: Long? = null,
- val youtubeTrailer: String? = null,
- val isFavorite: Boolean = false,
- val providerId: Long = 0,
- val seasons: List<Season> = emptyList(),
- val episodeRunTime: String? = null,
- val lastModified: Long = 0L,
- val isAdult: Boolean = false,
- val isUserProtected: Boolean = false
-)
-
-data class Season(
- val seasonNumber: Int,
- val name: String = "Season $seasonNumber",
- val coverUrl: String? = null,
- val episodes: List<Episode> = emptyList(),
- val airDate: String? = null,
- val episodeCount: Int = 0
-)
-
-data class Episode(
- val id: Long,
- val title: String,
- val episodeNumber: Int,
- val seasonNumber: Int,
- val streamUrl: String = "",
- val containerExtension: String? = null,
- val coverUrl: String? = null,
- val plot: String? = null,
- val duration: String? = null,
- val durationSeconds: Int = 0,
- val rating: Float = 0f,
- val releaseDate: String? = null,
- val seriesId: Long = 0,
- val providerId: Long = 0,
- val watchProgress: Long = 0L,
- val lastWatchedAt: Long = 0L,
- val isAdult: Boolean = false,
- val isUserProtected: Boolean = false
-)
diff --git a/domain/bin/main/com/streamvault/domain/model/StreamInfo.kt b/domain/bin/main/com/streamvault/domain/model/StreamInfo.kt
deleted file mode 100644
index c9019467..00000000
--- a/domain/bin/main/com/streamvault/domain/model/StreamInfo.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.streamvault.domain.model
-
-data class StreamInfo(
- val url: String,
- val headers: Map<String, String> = emptyMap(),
- val userAgent: String? = null,
- val streamType: StreamType = StreamType.UNKNOWN,
- val containerExtension: String? = null,
- val catchUpUrl: String? = null
-)
-
-enum class StreamType {
- HLS,
- DASH,
- MPEG_TS,
- PROGRESSIVE,
- UNKNOWN
-}
-
-enum class DecoderMode {
- AUTO,
- HARDWARE,
- SOFTWARE
-}
diff --git a/domain/bin/main/com/streamvault/domain/model/SyncMetadata.kt b/domain/bin/main/com/streamvault/domain/model/SyncMetadata.kt
deleted file mode 100644
index 1189253e..00000000
--- a/domain/bin/main/com/streamvault/domain/model/SyncMetadata.kt
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.streamvault.domain.model
-
-data class SyncMetadata(
- val providerId: Long,
- val lastLiveSync: Long = 0,
- val lastMovieSync: Long = 0,
- val lastSeriesSync: Long = 0,
- val lastEpgSync: Long = 0,
- val liveCount: Int = 0,
- val movieCount: Int = 0,
- val seriesCount: Int = 0,
- val epgCount: Int = 0,
- val lastSyncStatus: String = "NONE"
-)
diff --git a/domain/bin/main/com/streamvault/domain/model/SyncState.kt b/domain/bin/main/com/streamvault/domain/model/SyncState.kt
deleted file mode 100644
index 7be31580..00000000
--- a/domain/bin/main/com/streamvault/domain/model/SyncState.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.streamvault.domain.model
-
-/**
- * Represents every stage of a provider sync operation.
- *
- * Designed as a sealed hierarchy so `when` branches are exhaustive and
- * the compiler enforces handling of every state.
- */
-sealed class SyncState {
-
- /** No sync is in progress and no result is available yet. */
- object Idle : SyncState()
-
- /** A sync is actively running. [phase] describes the current work (e.g. "Downloading Live TV…"). */
- data class Syncing(val phase: String = "") : SyncState()
-
- /** The most recent sync completed successfully at [timestamp] (epoch millis). */
- data class Success(val timestamp: Long = System.currentTimeMillis()) : SyncState()
-
- /**
- * The most recent sync failed.
- *
- * @param message Human-readable description of the failure.
- * @param cause Optional underlying exception for diagnostics.
- */
- data class Error(val message: String, val cause: Throwable? = null) : SyncState()
-
- // ── Convenience helpers ─────────────────────────────────────────
-
- val isSyncing: Boolean get() = this is Syncing
- val isError: Boolean get() = this is Error
- val isSuccess: Boolean get() = this is Success
-}
diff --git a/domain/bin/main/com/streamvault/domain/model/VideoFormat.kt b/domain/bin/main/com/streamvault/domain/model/VideoFormat.kt
deleted file mode 100644
index 6dfe7bbe..00000000
--- a/domain/bin/main/com/streamvault/domain/model/VideoFormat.kt
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.streamvault.domain.model
-
-data class VideoFormat(
- val width: Int,
- val height: Int,
- val frameRate: Float = 0f,
- val bitrate: Int = 0,
- val codecV: String? = null,
- val codecA: String? = null
-) {
- val resolutionLabel: String
- get() = when {
- height >= 2160 -> "4K"
- height >= 1440 -> "1440p"
- height >= 1080 -> "1080p"
- height >= 720 -> "720p"
- height > 0 -> "${height}p"
- else -> "Unknown"
- }
-
- val isEmpty: Boolean get() = width == 0 && height == 0
-}
diff --git a/domain/bin/main/com/streamvault/domain/provider/IptvProvider.kt b/domain/bin/main/com/streamvault/domain/provider/IptvProvider.kt
deleted file mode 100644
index b9e92e2b..00000000
--- a/domain/bin/main/com/streamvault/domain/provider/IptvProvider.kt
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.streamvault.domain.provider
-
-import com.streamvault.domain.model.*
-
-/**
- * Shared interface for all IPTV providers (Xtream Codes, M3U, etc.).
- * Each provider type implements this to normalize data into domain models.
- */
-interface IptvProvider {
- val providerId: Long
-
- suspend fun authenticate(): Result<Provider>
-
- suspend fun getLiveCategories(): Result<List<Category>>
- suspend fun getLiveStreams(categoryId: Long? = null): Result<List<Channel>>
-
- suspend fun getVodCategories(): Result<List<Category>>
- suspend fun getVodStreams(categoryId: Long? = null): Result<List<Movie>>
- suspend fun getVodInfo(vodId: Long): Result<Movie>
-
- suspend fun getSeriesCategories(): Result<List<Category>>
- suspend fun getSeriesList(categoryId: Long? = null): Result<List<Series>>
- suspend fun getSeriesInfo(seriesId: Long): Result<Series>
-
- suspend fun getEpg(channelId: String): Result<List<Program>>
- suspend fun getShortEpg(channelId: String, limit: Int = 4): Result<List<Program>>
-
- suspend fun buildStreamUrl(streamId: Long, containerExtension: String? = null): String
- suspend fun buildCatchUpUrl(streamId: Long, start: Long, end: Long): String?
-}
diff --git a/domain/bin/main/com/streamvault/domain/repository/CategoryRepository.kt b/domain/bin/main/com/streamvault/domain/repository/CategoryRepository.kt
deleted file mode 100644
index a5fb174b..00000000
--- a/domain/bin/main/com/streamvault/domain/repository/CategoryRepository.kt
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.streamvault.domain.repository
-
-import com.streamvault.domain.model.Category
-import kotlinx.coroutines.flow.Flow
-
-interface CategoryRepository {
- fun getCategories(providerId: Long): Flow<List<Category>>
- suspend fun setCategoryProtection(categoryId: Long, isProtected: Boolean)
-}
diff --git a/domain/bin/main/com/streamvault/domain/repository/ChannelRepository.kt b/domain/bin/main/com/streamvault/domain/repository/ChannelRepository.kt
deleted file mode 100644
index 9515373a..00000000
--- a/domain/bin/main/com/streamvault/domain/repository/ChannelRepository.kt
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.streamvault.domain.repository
-
-import com.streamvault.domain.model.Category
-import com.streamvault.domain.model.Channel
-import com.streamvault.domain.model.Result
-import kotlinx.coroutines.flow.Flow
-
-interface ChannelRepository {
- fun getChannels(providerId: Long): Flow<List<Channel>>
- fun getChannelsByCategory(providerId: Long, categoryId: Long): Flow<List<Channel>>
- fun getCategories(providerId: Long): Flow<List<Category>>
- fun searchChannels(providerId: Long, query: String): Flow<List<Channel>>
- suspend fun getChannel(channelId: Long): Channel?
- suspend fun getStreamUrl(channel: Channel): Result<String>
- suspend fun refreshChannels(providerId: Long): Result<Unit>
- fun getChannelsByIds(ids: List<Long>): Flow<List<Channel>>
-
- companion object {
- const val ALL_CHANNELS_ID = -1_000_000L
- }
-}
diff --git a/domain/bin/main/com/streamvault/domain/repository/EpgRepository.kt b/domain/bin/main/com/streamvault/domain/repository/EpgRepository.kt
deleted file mode 100644
index c09aa489..00000000
--- a/domain/bin/main/com/streamvault/domain/repository/EpgRepository.kt
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.streamvault.domain.repository
-
-import com.streamvault.domain.model.Program
-import com.streamvault.domain.model.Result
-import kotlinx.coroutines.flow.Flow
-
-interface EpgRepository {
- fun getProgramsForChannel(channelId: String, startTime: Long, endTime: Long): Flow<List<Program>>
- fun getNowPlaying(channelId: String): Flow<Program?>
- fun getNowPlayingForChannels(channelIds: List<String>): Flow<List<Program>>
- fun getNowAndNext(channelId: String): Flow<Pair<Program?, Program?>>
- suspend fun refreshEpg(providerId: Long, epgUrl: String): Result<Unit>
- suspend fun clearOldPrograms(beforeTime: Long)
-}
diff --git a/domain/bin/main/com/streamvault/domain/repository/FavoriteRepository.kt b/domain/bin/main/com/streamvault/domain/repository/FavoriteRepository.kt
deleted file mode 100644
index 7e9aac48..00000000
--- a/domain/bin/main/com/streamvault/domain/repository/FavoriteRepository.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.streamvault.domain.repository
-
-import com.streamvault.domain.model.ContentType
-import com.streamvault.domain.model.Favorite
-import com.streamvault.domain.model.Result
-import com.streamvault.domain.model.VirtualGroup
-import kotlinx.coroutines.flow.Flow
-
-interface FavoriteRepository {
- fun getFavorites(contentType: ContentType? = null): Flow<List<Favorite>>
- fun getFavoritesByGroup(groupId: Long): Flow<List<Favorite>>
- fun getGroups(): Flow<List<VirtualGroup>>
-
- fun getGlobalLiveFavoriteCount(): Flow<Int>
- fun getGroupLiveFavoriteCounts(): Flow<Map<Long, Int>>
-
- suspend fun addFavorite(contentId: Long, contentType: ContentType, groupId: Long? = null): Result<Unit>
- suspend fun removeFavorite(contentId: Long, contentType: ContentType, groupId: Long? = null): Result<Unit>
-
- suspend fun reorderFavorites(favorites: List<Favorite>): Result<Unit>
- suspend fun isFavorite(contentId: Long, contentType: ContentType): Boolean
-
- suspend fun getGroupMemberships(contentId: Long, contentType: ContentType): List<Long>
-
- suspend fun createGroup(name: String, iconEmoji: String? = null): Result<VirtualGroup>
- suspend fun deleteGroup(groupId: Long): Result<Unit>
- suspend fun renameGroup(groupId: Long, newName: String): Result<Unit>
-}
diff --git a/domain/bin/main/com/streamvault/domain/repository/MovieRepository.kt b/domain/bin/main/com/streamvault/domain/repository/MovieRepository.kt
deleted file mode 100644
index 3f9bef68..00000000
--- a/domain/bin/main/com/streamvault/domain/repository/MovieRepository.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.streamvault.domain.repository
-
-import com.streamvault.domain.model.Category
-import com.streamvault.domain.model.Movie
-import com.streamvault.domain.model.Result
-import kotlinx.coroutines.flow.Flow
-
-interface MovieRepository {
- fun getMovies(providerId: Long): Flow<List<Movie>>
- fun getMoviesByCategory(providerId: Long, categoryId: Long): Flow<List<Movie>>
- fun getCategories(providerId: Long): Flow<List<Category>>
- fun searchMovies(providerId: Long, query: String): Flow<List<Movie>>
- suspend fun getMovie(movieId: Long): Movie?
- suspend fun getMovieDetails(providerId: Long, movieId: Long): Result<Movie>
- suspend fun getStreamUrl(movie: Movie): Result<String>
- suspend fun refreshMovies(providerId: Long): Result<Unit>
- suspend fun updateWatchProgress(movieId: Long, progress: Long)
-}
diff --git a/domain/bin/main/com/streamvault/domain/repository/PlaybackHistoryRepository.kt b/domain/bin/main/com/streamvault/domain/repository/PlaybackHistoryRepository.kt
deleted file mode 100644
index e69a467d..00000000
--- a/domain/bin/main/com/streamvault/domain/repository/PlaybackHistoryRepository.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.streamvault.domain.repository
-
-import com.streamvault.domain.model.ContentType
-import com.streamvault.domain.model.PlaybackHistory
-import kotlinx.coroutines.flow.Flow
-
-interface PlaybackHistoryRepository {
- fun getRecentlyWatched(limit: Int = 100): Flow<List<PlaybackHistory>>
- fun getRecentlyWatchedByProvider(providerId: Long, limit: Int = 100): Flow<List<PlaybackHistory>>
- suspend fun getPlaybackHistory(contentId: Long, contentType: ContentType, providerId: Long): PlaybackHistory?
-
- suspend fun updateResumePosition(history: PlaybackHistory)
- suspend fun removeFromHistory(contentId: Long, contentType: ContentType, providerId: Long)
- suspend fun clearAllHistory()
- suspend fun clearHistoryForProvider(providerId: Long)
-}
diff --git a/domain/bin/main/com/streamvault/domain/repository/ProviderRepository.kt b/domain/bin/main/com/streamvault/domain/repository/ProviderRepository.kt
deleted file mode 100644
index 54a2b3ce..00000000
--- a/domain/bin/main/com/streamvault/domain/repository/ProviderRepository.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.streamvault.domain.repository
-
-import com.streamvault.domain.model.Provider
-import com.streamvault.domain.model.Result
-import kotlinx.coroutines.flow.Flow
-
-interface ProviderRepository {
- fun getProviders(): Flow<List<Provider>>
- fun getActiveProvider(): Flow<Provider?>
- suspend fun getProvider(id: Long): Provider?
- suspend fun addProvider(provider: Provider): Result<Long>
- suspend fun updateProvider(provider: Provider): Result<Unit>
- suspend fun deleteProvider(id: Long): Result<Unit>
- suspend fun setActiveProvider(id: Long): Result<Unit>
- suspend fun loginXtream(serverUrl: String, username: String, password: String, name: String, onProgress: ((String) -> Unit)? = null, id: Long? = null): Result<Provider>
- suspend fun validateM3u(url: String, name: String, onProgress: ((String) -> Unit)? = null, id: Long? = null): Result<Provider>
- suspend fun refreshProviderData(providerId: Long, onProgress: ((String) -> Unit)? = null): Result<Unit>
-}
diff --git a/domain/bin/main/com/streamvault/domain/repository/SeriesRepository.kt b/domain/bin/main/com/streamvault/domain/repository/SeriesRepository.kt
deleted file mode 100644
index 6c394dc2..00000000
--- a/domain/bin/main/com/streamvault/domain/repository/SeriesRepository.kt
+++ /dev/null
@@ -1,19 +0,0 @@
-package com.streamvault.domain.repository
-
-import com.streamvault.domain.model.Category
-import com.streamvault.domain.model.Episode
-import com.streamvault.domain.model.Result
-import com.streamvault.domain.model.Series
-import kotlinx.coroutines.flow.Flow
-
-interface SeriesRepository {
- fun getSeries(providerId: Long): Flow<List<Series>>
- fun getSeriesByCategory(providerId: Long, categoryId: Long): Flow<List<Series>>
- fun getCategories(providerId: Long): Flow<List<Category>>
- fun searchSeries(providerId: Long, query: String): Flow<List<Series>>
- suspend fun getSeriesById(seriesId: Long): Series?
- suspend fun getSeriesDetails(providerId: Long, seriesId: Long): Result<Series>
- suspend fun getEpisodeStreamUrl(episode: Episode): Result<String>
- suspend fun refreshSeries(providerId: Long): Result<Unit>
- suspend fun updateEpisodeWatchProgress(episodeId: Long, progress: Long)
-}
diff --git a/domain/bin/main/com/streamvault/domain/repository/SyncMetadataRepository.kt b/domain/bin/main/com/streamvault/domain/repository/SyncMetadataRepository.kt
deleted file mode 100644
index 48faefe6..00000000
--- a/domain/bin/main/com/streamvault/domain/repository/SyncMetadataRepository.kt
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.streamvault.domain.repository
-
-import com.streamvault.domain.model.SyncMetadata
-import kotlinx.coroutines.flow.Flow
-
-interface SyncMetadataRepository {
- fun observeMetadata(providerId: Long): Flow<SyncMetadata?>
- suspend fun getMetadata(providerId: Long): SyncMetadata?
- suspend fun updateMetadata(metadata: SyncMetadata)
- suspend fun clearMetadata(providerId: Long)
-}
diff --git a/domain/bin/main/com/streamvault/domain/usecase/GetCustomCategories.kt b/domain/bin/main/com/streamvault/domain/usecase/GetCustomCategories.kt
deleted file mode 100644
index 8587e6c8..00000000
--- a/domain/bin/main/com/streamvault/domain/usecase/GetCustomCategories.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.streamvault.domain.usecase
-
-import com.streamvault.domain.model.Category
-import com.streamvault.domain.model.ContentType
-import com.streamvault.domain.repository.FavoriteRepository
-import kotlinx.coroutines.flow.Flow
-import kotlinx.coroutines.flow.map
-import javax.inject.Inject
-
-class GetCustomCategories @Inject constructor(
- private val favoriteRepository: FavoriteRepository
-) {
- operator fun invoke(): Flow<List<Category>> {
- return kotlinx.coroutines.flow.combine(
- favoriteRepository.getGroups(),
- favoriteRepository.getGlobalLiveFavoriteCount(),
- favoriteRepository.getGroupLiveFavoriteCounts()
- ) { groups, globalCount, groupCounts ->
- try {
- println("GetCustomCategories: Processing ${groups.size} groups. Global: $globalCount, Counts: ${groupCounts.size}")
-
- val categories = groups.map { group ->
- Category(
- id = -group.id, // Use negative ID for virtual groups
- name = group.name,
- type = ContentType.LIVE,
- isVirtual = true,
- count = groupCounts.getOrDefault(group.id, 0)
- )
- }.toMutableList()
-
- // prepend "Favorites" as a special virtual category
- categories.add(0, Category(
- id = -999L, // Special ID for "All Favorites"
- name = "★ Favorites",
- type = ContentType.LIVE,
- isVirtual = true,
- count = globalCount
- ))
-
- categories
- } catch (e: Exception) {
- println("GetCustomCategories: Error processing categories: ${e.message}")
- e.printStackTrace()
- emptyList<Category>()
- }
- }
- }
-}
diff --git a/domain/src/main/java/com/streamvault/domain/model/ContentType.kt b/domain/src/main/java/com/streamvault/domain/model/ContentType.kt
index 2d636e21..283a509d 100644
--- a/domain/src/main/java/com/streamvault/domain/model/ContentType.kt
+++ b/domain/src/main/java/com/streamvault/domain/model/ContentType.kt
@@ -3,5 +3,6 @@ package com.streamvault.domain.model
enum class ContentType {
LIVE,
MOVIE,
- SERIES
+ SERIES,
+ SERIES_EPISODE
}