StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
Fix build: resolve Dao conflicts, syntax errors, and category count crash
Davidona162d86d6f415
diff --git a/README.md b/README.mdnew file mode 100644index 00000000..a61b73ad--- /dev/null+++ b/README.md@@ -0,0 +1,95 @@+# ๐บ StreamVault โ Android TV IPTV Player++## ๐ Overview+**StreamVault** is a fast, modern, and production-grade **Android TV IPTV Player** built with **Jetpack Compose for TV**. It is designed to replace aging, clunky IPTV apps with a fluid, "console-like" user experience.++The app supports **Xtream Codes** API and standard **M3U** playlists. It features Live TV, Movies (VOD), Series, comprehensive EPG (Electronic Program Guide), and a robust Favorites system.++### ๐ฏ Core Philosophy+- **Performance First**: Zero frame drops on standard Android TV hardware (Fire TV Stick 4K, Chromecast with Google TV).+- **TV-Native**: Designed strictly for D-Pad navigation. No "touch emulation". Focus management is explicit and deterministic.+- **Clean Architecture**: Strict separation of concerns (Domain, Data, Player, UI) to ensure scalability and maintainability.++---++## ๐ Architecture & Modules++The project follows **Clean Architecture** principles with a multi-module Gradle setup:++### 1. `:app` (UI & Presentation)+- **Tech**: Jetpack Compose for TV, ViewModel, Hilt.+- **Responsibility**: Renders the UI, manages focus state, and handles user input.+- **Key Pattern**: "Screens" observe `UiState` flows from ViewModels. No business logic in Composables.++### 2. `:domain` (Business Logic)+- **Tech**: Pure Kotlin.+- **Responsibility**: Defines core models (`Channel`, `Program`, `Provider`), Repository interfaces, and Use Cases (`GetChannelsUseCase`, `SyncEpgUseCase`).+- **Dependency**: Zero Android dependencies.++### 3. `:data` (Data Layer)+- **Tech**: Room, Retrofit, OkHttp.+- **Responsibility**: Implements Repositories. Handles data synchronization, offline caching (Room), and API communication (Xtream Codes / M3U parsing).+- **Key Feature**: "Offline-First" capability using Room as the single source of truth.++### 4. `:player` (Media Engine)+- **Tech**: Media3 (ExoPlayer).+- **Responsibility**: Encapsulates all playback logic. Handles adaptive streaming (HLS/DASH), track selection, and Zapping (channel switching).++---++## ๐ Technology Stack++| Layer | Technology | Notes |+|-------|------------|-------|+| **Language** | Kotlin 2.0+ | Modern syntax, Coroutines, Flow. |+| **UI** | Jetpack Compose for TV | Specially designed for 10-foot interfaces. |+| **Media** | Media3 (ExoPlayer) | Robust playback for HLS, DASH, TS. |+| **DI** | Hilt | Standard dependency injection. |+| **Database** | Room | Local persistence for Channels, EPG, Favorites. |+| **Network** | Retrofit + OkHttp | Xtream Codes API client. |+| **Async** | Coroutines + Flow | All data streams are reactive. |+| **Image** | Coil | Optimized image loading with caching. |++---++## โก Key Implementation Details (For Future Agents)++### ๐ฎ Focus & Input Handling (Crucial)+Android TV requires **explicit focus management**. Compose for TV handles much of this, but we use specific patterns for stability:+- **Search Bar**: Uses a custom `Box` + `BasicTextField` pattern. Standard `OutlinedTextField` causes keyboard focus issues on TV. The outer Box handles the D-Pad focus and click, then requests focus for the inner text field.+- **Long Press**: We use a **Top-Level Boolean Lock** (`ignoreNextClick`) in `HomeScreen` to handle the "Release after Long Press" event. This prevents the dialog from closing immediately when the user releases the select button.++### ๐บ Playback & Zapping+- **Zapping**: Channel switching (Up/Down in player) is handled by passing `internalChannelId` to the player. The player uses this ID to query the database for the *next/previous* channel in the *current category context*.++### ๐ Favorites & Groups+- **Favorites**: Stored locally in Room. Toggling a favorite is optimistic and instant in the UI.+- **Custom Groups**: Users can create custom "Virtual Categories" to organize channels.++---++## ๐ Getting Started++### Prerequisites+- Android Studio Koala or later.+- JDK 17+.+- Android TV Emulator (API 34) or physical device (Enabled Developer Options).++### Build Instructions+1. **Clone the repo**.+2. **Sync Gradle**.+3. **Run**: Select `app` configuration and run on an Android TV device.++### Project Structure+```text+streamvault/+โโโ app/ # UI, Navigation, DI+โโโ data/ # Database, API, Repository Impls+โโโ domain/ # Models, Use Cases, Interfaces+โโโ player/ # Media3/ExoPlayer Wrapper+โโโ gradle/ # Version Catalog (libs.versions.toml)+```++---++*Documentation maintained by Antigravity Agents.*diff --git a/UI_DESIGN.md b/UI_DESIGN.mdindex 9ff70ce7..e3bc892c 100644--- a/UI_DESIGN.md+++ b/UI_DESIGN.md@@ -270,3 +270,44 @@ XXL: 48dp (major section breaks)## ๐ฏ Design SummaryThe visual identity is **dark, clean, and fast**. Every design decision serves the goal of instant-feeling D-pad navigation. The palette is muted with a single accent color. Cards are simple rectangles with posters. Focus is communicated through a consistent scale + border pattern. The entire UI could run on a $30 Android TV stick without frame drops.++---++## ๐ง Interaction Patterns & Lessons Learned++### 1. The "TV Focus" Rule+Standard Compose Material 3 components often fail on Android TV because they assume touch interaction or handle focus internally in ways that conflict with D-Pad navigation.+- **Rule**: If a component has complex internal state (like `TextField`), wrap it in a `Box` that handles the D-Pad focus and click events.+- **Why**: `OutlinedTextField` often captures focus and refuses to surrender it, or fails to show the keyboard when focused via D-Pad.++### 2. Search Bar Pattern+**Do Not Use**: `OutlinedTextField` directly exposed to D-Pad.+**Use This**:+```kotlin+Box(+ modifier = Modifier+ .focusable()+ .clickable {+ // 1. Request focus for inner TextField+ // 2. Show keyboard manually+ }+) {+ BasicTextField(+ readOnly = true // Only editable when virtual keyboard is active+ )+}+```++### 3. Long Press & Ghost Clicks+**The Problem**: On many TV remotes, releasing the Select button after a Long Press triggers a subsequent `onClick` event ("Ghost Click").+**The Fix**: Implement a **Top-Level Click Lock**.+- When `onLongClick` fires: Set `lock = true`.+- When `onClick` fires: Check `lock`. If true, consume event and set `lock = false`.+- Safety: Auto-reset `lock` after 1s to prevent stuck states.+- **Do Not Use**: Debounce by timestamp alone (unreliable if user holds button long).++### 4. Zapping Architecture+Channel zapping (P+/P-) in the player requires global context.+- **Do Not**: Pass just the stream URL to the player.+- **Do**: Pass the `channelId` and the `playlistContext` (Category ID). The player logic must query the DB for "Next Channel in Category X after Channel Y".+diff --git a/app/src/main/java/com/streamvault/app/navigation/AppNavigation.kt b/app/src/main/java/com/streamvault/app/navigation/AppNavigation.ktindex 9afcfc0d..40539e51 100644--- a/app/src/main/java/com/streamvault/app/navigation/AppNavigation.kt+++ b/app/src/main/java/com/streamvault/app/navigation/AppNavigation.kt@@ -21,12 +21,12 @@ object Routes {const val SERIES = "series"const val FAVORITES = "favorites"const val SETTINGS = "settings"- const val PLAYER = "player/{streamUrl}?title={title}&channelId={channelId}&categoryId={categoryId}&providerId={providerId}&isVirtual={isVirtual}"+ const val PLAYER = "player/{streamUrl}?title={title}&channelId={channelId}&internalId={internalId}&categoryId={categoryId}&providerId={providerId}&isVirtual={isVirtual}"const val SEARCH = "search"const val SERIES_DETAIL = "series_detail/{seriesId}"- fun player(streamUrl: String, title: String = "", channelId: String? = null, categoryId: Long? = null, providerId: Long? = null, isVirtual: Boolean = false) =- "player/${java.net.URLEncoder.encode(streamUrl, "UTF-8")}?title=${java.net.URLEncoder.encode(title, "UTF-8")}&channelId=${channelId ?: ""}&categoryId=${categoryId ?: -1}&providerId=${providerId ?: -1}&isVirtual=$isVirtual"+ fun player(streamUrl: String, title: String = "", channelId: String? = null, internalId: Long = -1L, categoryId: Long? = null, providerId: Long? = null, isVirtual: Boolean = false) =+ "player/${java.net.URLEncoder.encode(streamUrl, "UTF-8")}?title=${java.net.URLEncoder.encode(title, "UTF-8")}&channelId=${channelId ?: ""}&internalId=$internalId&categoryId=${categoryId ?: -1}&providerId=${providerId ?: -1}&isVirtual=$isVirtual"fun seriesDetail(seriesId: Long) = "series_detail/$seriesId"}@@ -57,6 +57,7 @@ fun AppNavigation() {streamUrl = channel.streamUrl,title = channel.name,channelId = channel.epgChannelId,+ internalId = channel.id,categoryId = category?.id,providerId = provider?.id,isVirtual = category?.isVirtual == true@@ -166,6 +167,7 @@ fun AppNavigation() {navArgument("streamUrl") { type = NavType.StringType },navArgument("title") { type = NavType.StringType; defaultValue = "" },navArgument("channelId") { type = NavType.StringType; defaultValue = "" },+ navArgument("internalId") { type = NavType.LongType; defaultValue = -1L },navArgument("categoryId") { type = NavType.LongType; defaultValue = -1L },navArgument("providerId") { type = NavType.LongType; defaultValue = -1L },navArgument("isVirtual") { type = NavType.BoolType; defaultValue = false }@@ -180,6 +182,7 @@ fun AppNavigation() {"UTF-8")val channelId = backStackEntry.arguments?.getString("channelId")?.takeIf { it.isNotBlank() }+ val internalId = backStackEntry.arguments?.getLong("internalId") ?: -1Lval categoryId = backStackEntry.arguments?.getLong("categoryId")?.takeIf { it != -1L }val providerId = backStackEntry.arguments?.getLong("providerId")?.takeIf { it != -1L }val isVirtual = backStackEntry.arguments?.getBoolean("isVirtual") ?: false@@ -188,6 +191,7 @@ fun AppNavigation() {streamUrl = streamUrl,title = title,epgChannelId = channelId,+ internalChannelId = internalId,categoryId = categoryId,providerId = providerId,isVirtual = isVirtual,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.ktindex d3da3111..62d7e249 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@@ -11,6 +11,10 @@ import androidx.compose.ui.Modifierimport androidx.compose.ui.draw.scaleimport androidx.compose.ui.focus.onFocusChangedimport 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.borderimport androidx.compose.foundation.backgroundimport androidx.compose.ui.layout.ContentScaleimport androidx.compose.ui.text.style.TextOverflowdiff --git a/app/src/main/java/com/streamvault/app/ui/components/dialogs/AddToGroupDialog.kt b/app/src/main/java/com/streamvault/app/ui/components/dialogs/AddToGroupDialog.ktindex 5fd05c71..9636448a 100644--- a/app/src/main/java/com/streamvault/app/ui/components/dialogs/AddToGroupDialog.kt+++ b/app/src/main/java/com/streamvault/app/ui/components/dialogs/AddToGroupDialog.kt@@ -1,12 +1,14 @@package com.streamvault.app.ui.components.dialogsimport androidx.compose.foundation.layout.*+import androidx.compose.foundation.borderimport androidx.compose.foundation.lazy.LazyColumnimport androidx.compose.foundation.lazy.itemsimport androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.material.icons.Iconsimport androidx.compose.material.icons.filled.Addimport androidx.compose.material.icons.filled.Check+import androidx.compose.material.icons.filled.Closeimport androidx.compose.material.icons.filled.Starimport androidx.compose.material3.*import androidx.compose.runtime.*@@ -20,11 +22,17 @@ import androidx.compose.ui.window.Dialogimport com.streamvault.domain.model.Channelimport com.streamvault.domain.model.Category+import androidx.compose.ui.input.key.*+import androidx.compose.ui.focus.onFocusChanged+import androidx.compose.foundation.shape.CircleShape+import kotlinx.coroutines.delay+@Composablefun AddToGroupDialog(channel: Channel,groups: List<Category>, // Only custom groupsisFavorite: Boolean,+ memberOfGroups: List<Long>,onDismiss: () -> Unit,onToggleFavorite: () -> Unit,onAddToGroup: (Category) -> Unit,@@ -35,19 +43,47 @@ fun AddToGroupDialog() {var showCreateGroup by remember { mutableStateOf(false) }var newGroupName by remember { mutableStateOf("") }+ val focusRequester = remember { FocusRequester() }++ // Fix for ghost clicks: Debounce interaction for 500ms to ignore long-press release+ var canInteract by remember { mutableStateOf(false) }- Dialog(onDismissRequest = onDismiss) {+ LaunchedEffect(Unit) {+ focusRequester.requestFocus()+ delay(500)+ canInteract = true+ }++ val safeDismiss = {+ if (canInteract) onDismiss()+ }++ Dialog(onDismissRequest = safeDismiss) {Surface(shape = RoundedCornerShape(16.dp),color = MaterialTheme.colorScheme.surface,- modifier = Modifier.width(400.dp).padding(16.dp)+ modifier = Modifier+ .width(400.dp)+ .padding(16.dp)) {Column(modifier = Modifier.padding(24.dp)) {- Text(- text = "Manage: ${channel.name}",- style = MaterialTheme.typography.titleLarge,- modifier = Modifier.padding(bottom = 16.dp)- )+ Row(+ modifier = Modifier.fillMaxWidth().padding(bottom = 16.dp),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Text(+ text = "Manage: ${channel.name}",+ style = MaterialTheme.typography.titleLarge,+ modifier = Modifier.weight(1f)+ )+ IconButton(+ onClick = safeDismiss,+ modifier = Modifier.focusRequester(focusRequester)+ ) {+ Icon(Icons.Default.Close, contentDescription = "Close")+ }+ }if (showCreateGroup) {OutlinedTextField(@@ -74,106 +110,121 @@ fun AddToGroupDialog(}}} else {- // Favorites Toggle- Row(- modifier = Modifier- .fillMaxWidth()- .padding(bottom = 8.dp),- verticalAlignment = Alignment.CenterVertically+ // Content in a scrollable container to prevent cut-off+ LazyColumn(+ modifier = Modifier.weight(1f, fill = false),+ verticalArrangement = Arrangement.spacedBy(8.dp)) {- Button(- onClick = onToggleFavorite,- modifier = Modifier.fillMaxWidth(),- colors = ButtonDefaults.buttonColors(- containerColor = if (isFavorite) Color.Yellow else MaterialTheme.colorScheme.primary- )- ) {- Icon(- imageVector = Icons.Default.Star,- contentDescription = null,- tint = if (isFavorite) Color.Black else Color.White- )- Spacer(modifier = Modifier.width(8.dp))- Text(- text = if (isFavorite) "Remove from Favorites" else "Add to Favorites",- color = if (isFavorite) Color.Black else Color.White- )- }- }-- // Reordering Controls (only if enabled)- if (onMoveUp != null && onMoveDown != null) {- Spacer(modifier = Modifier.height(8.dp))- Text(- text = "Reorder",- style = MaterialTheme.typography.titleMedium,- modifier = Modifier.padding(bottom = 8.dp)- )- Row(- modifier = Modifier.fillMaxWidth(),- horizontalArrangement = Arrangement.SpaceEvenly- ) {- OutlinedButton(onClick = onMoveUp, modifier = Modifier.weight(1f)) {- Text("Move Up")- }- Spacer(modifier = Modifier.width(8.dp))- OutlinedButton(onClick = onMoveDown, modifier = Modifier.weight(1f)) {- Text("Move Down")+ item {+ // Favorites Toggle+ var isFocused by remember { mutableStateOf(false) }+ Button(+ onClick = onToggleFavorite,+ modifier = Modifier+ .fillMaxWidth()+ .onFocusChanged { isFocused = it.isFocused }+ .border(+ if (isFocused) 2.dp else 0.dp,+ if (isFocused) MaterialTheme.colorScheme.onSurface else Color.Transparent,+ CircleShape+ ),+ colors = ButtonDefaults.buttonColors(+ containerColor = if (isFavorite) Color.Yellow else MaterialTheme.colorScheme.primary+ )+ ) {+ Icon(+ imageVector = Icons.Default.Star,+ contentDescription = null,+ tint = if (isFavorite) Color.Black else Color.White+ )+ Spacer(modifier = Modifier.width(8.dp))+ Text(+ text = if (isFavorite) "Remove from Favorites" else "Add to Favorites",+ color = if (isFavorite) Color.Black else Color.White+ )}}- HorizontalDivider(modifier = Modifier.padding(vertical = 8.dp))- }- HorizontalDivider(modifier = Modifier.padding(vertical = 8.dp))+ // Reordering Controls (only if enabled)+ if (onMoveUp != null && onMoveDown != null) {+ item {+ Text(+ text = "Reorder",+ style = MaterialTheme.typography.titleMedium,+ modifier = Modifier.padding(top = 8.dp, bottom = 4.dp)+ )+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceEvenly+ ) {+ OutlinedButton(onClick = onMoveUp, modifier = Modifier.weight(1f)) {+ Text("Move Up")+ }+ Spacer(modifier = Modifier.width(8.dp))+ OutlinedButton(onClick = onMoveDown, modifier = Modifier.weight(1f)) {+ Text("Move Down")+ }+ }+ HorizontalDivider(modifier = Modifier.padding(vertical = 8.dp))+ }+ }- Text(- text = "Custom Groups",- style = MaterialTheme.typography.titleMedium,- modifier = Modifier.padding(bottom = 8.dp)- )+ item {+ HorizontalDivider(modifier = Modifier.padding(vertical = 8.dp))+ Text(+ text = "Custom Groups",+ style = MaterialTheme.typography.titleMedium,+ modifier = Modifier.padding(bottom = 8.dp)+ )+ }- LazyColumn(- modifier = Modifier.weight(1f, fill = false).heightIn(max = 200.dp)- ) {items(groups) { group ->- // We need to know if channel is already in this group.- // Since we don't have that info passed easily, we perform the check in UI state upstream?- // Or we treat it as toggle logic in repository.- // For now, let's assume we can add/remove blindly or we need state.- // Ideally check if channel is in group.- // Let's assume clicking specific action adds/removes.+ val groupId = -group.id+ val isMember = memberOfGroups.contains(groupId)+ var isFocused by remember { mutableStateOf(false) }Row(modifier = Modifier.fillMaxWidth().padding(vertical = 4.dp),horizontalArrangement = Arrangement.SpaceBetween,verticalAlignment = Alignment.CenterVertically) {- Text(group.name, style = MaterialTheme.typography.bodyMedium)-- // Simplified: "Add" button always visible?- // Or we need to know membership.- // Let's use simple buttons for now "Add" / "Remove" logic is clearer- // if we don't have membership state here.- // BUT user experience is better with checkboxes.- // I will assume we can make the parent pass membership info.- // For now, simple Button "Add to Group" is safer.-- Button(onClick = { onAddToGroup(group) }) {- Text("Add")+ Text(+ text = group.name,+ style = MaterialTheme.typography.bodyMedium,+ modifier = Modifier.weight(1f)+ )+ Button(+ onClick = {+ if (isMember) onRemoveFromGroup(group) else onAddToGroup(group)+ },+ modifier = Modifier+ .onFocusChanged { isFocused = it.isFocused }+ .border(+ if (isFocused) 2.dp else 0.dp,+ if (isFocused) MaterialTheme.colorScheme.onSurface else Color.Transparent,+ CircleShape+ ),+ colors = ButtonDefaults.buttonColors(+ containerColor = if (isMember) MaterialTheme.colorScheme.errorContainer else MaterialTheme.colorScheme.primaryContainer,+ contentColor = if (isMember) MaterialTheme.colorScheme.onErrorContainer else MaterialTheme.colorScheme.onPrimaryContainer+ )+ ) {+ Text(if (isMember) "Remove" else "Add")}}}- }-- Spacer(modifier = Modifier.height(8.dp))-- OutlinedButton(- onClick = { showCreateGroup = true },- modifier = Modifier.fillMaxWidth()- ) {- Icon(Icons.Default.Add, contentDescription = null)- Spacer(modifier = Modifier.width(8.dp))- Text("Create New Group")++ item {+ Spacer(modifier = Modifier.height(8.dp))+ OutlinedButton(+ onClick = { showCreateGroup = true },+ modifier = Modifier.fillMaxWidth()+ ) {+ Icon(Icons.Default.Add, contentDescription = null)+ Spacer(modifier = Modifier.width(8.dp))+ Text("Create New Group")+ }+ }}}}diff --git a/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreen.ktindex 4bd1ee95..dc081d75 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreen.kt@@ -11,17 +11,24 @@ import androidx.compose.foundation.lazy.grid.GridCellsimport androidx.compose.foundation.lazy.grid.itemsimport androidx.compose.foundation.borderimport androidx.compose.foundation.background+import androidx.compose.foundation.clickableimport androidx.compose.foundation.shape.RoundedCornerShapeimport androidx.compose.runtime.*import androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifierimport androidx.compose.ui.focus.onFocusChanged+import androidx.compose.ui.focus.focusRequester+import androidx.compose.ui.focus.FocusRequester+import androidx.compose.ui.input.key.onPreviewKeyEventimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.unit.dpimport androidx.hilt.navigation.compose.hiltViewModelimport androidx.lifecycle.ViewModelimport androidx.lifecycle.viewModelScopeimport androidx.tv.material3.*+import androidx.compose.material3.SnackbarHost+import androidx.compose.material3.SnackbarHostState+import androidx.compose.material3.TextButtonimport com.streamvault.app.ui.components.CategoryRowimport com.streamvault.app.ui.components.ChannelCardimport com.streamvault.app.ui.components.TopNavBar@@ -55,9 +62,13 @@ class HomeViewModel @Inject constructor(val uiState: StateFlow<HomeUiState> = _uiState.asStateFlow()// Cache channels locally for filtering- private var localChannels: List<Channel> = emptyList()+ // Reactive state for channels and favorites+ private val _localChannels = MutableStateFlow<List<Channel>>(emptyList())private var epgJob: Job? = null++ private var loadChannelsJob: Job? = null+init {loadAllProviders()viewModelScope.launch {@@ -66,10 +77,40 @@ class HomeViewModel @Inject constructor(.collectLatest { provider ->_uiState.update { it.copy(provider = provider) }loadCategoriesAndChannels(provider.id)- // Save as last activepreferencesRepository.setLastActiveProviderId(provider.id)}}++ // Observe channels, search query, and favorites to update UI+ viewModelScope.launch {+ combine(+ _localChannels,+ _uiState.map { it.channelSearchQuery }.distinctUntilChanged(),+ favoriteRepository.getFavorites(com.streamvault.domain.model.ContentType.LIVE)+ ) { channels, query, favorites ->+ Triple(channels, query, favorites)+ }.collectLatest { (channels, query, favorites) ->+ val favoriteIds = favorites.map { it.contentId }.toSet()++ // 1. Filter+ val filtered = if (query.isBlank()) {+ channels+ } else {+ channels.filter { it.name.contains(query, ignoreCase = true) }+ }++ // 2. Mark Favorites+ val markedChannels = filtered.map { channel ->+ if (favoriteIds.contains(channel.id)) channel.copy(isFavorite = true)+ else channel.copy(isFavorite = false)+ }++ _uiState.update { it.copy(filteredChannels = markedChannels, isLoading = false) }++ // 3. Fetch EPG for visible channels+ fetchEpgForChannels(markedChannels)+ }+ }}private fun loadAllProviders() {@@ -97,30 +138,54 @@ class HomeViewModel @Inject constructor(}.collect { categories ->_uiState.update { it.copy(categories = categories) }- // Select "Favorites" by default if nothing selected- if (_uiState.value.selectedCategory == null && categories.isNotEmpty()) {- // Try to find Favorites (ID -999)+ val currentSelected = _uiState.value.selectedCategory++ if (currentSelected == null && categories.isNotEmpty()) {+ // Initial selectionval favoritesCat = categories.find { it.id == -999L }if (favoritesCat != null) {selectCategory(favoritesCat)} else {selectCategory(categories.first())}- } else if (_uiState.value.selectedCategory != null) {- // Re-select current category to refresh channels (e.g. if favorites changed)- selectCategory(_uiState.value.selectedCategory!!)+ } else if (currentSelected != null) {+ // Try to find the currently selected category in the new list to preserve selection+ val reselectedCat = categories.find { it.id == currentSelected.id }++ if (reselectedCat != null) {+ // Category still exists, update state with new object just in case (name change etc)+ if (reselectedCat != currentSelected) {+ _uiState.update { it.copy(selectedCategory = reselectedCat) }+ }+ // Refresh content. Do NOT set isLoading=true here to avoid flickering.+ loadChannelsForCategory(reselectedCat)+ } else {+ // Category disappeared (deleted group?), fallback to default+ val favoritesCat = categories.find { it.id == -999L }+ if (favoritesCat != null) {+ selectCategory(favoritesCat)+ } else if (categories.isNotEmpty()) {+ selectCategory(categories.first())+ }+ }}}}}fun selectCategory(category: Category) {+ // Fix for Bug 1: Prevent double-click from reloading/clearing if already selected+ if (_uiState.value.selectedCategory?.id == category.id) return+_uiState.update { it.copy(selectedCategory = category, isLoading = true) }loadChannelsForCategory(category)}private fun loadChannelsForCategory(category: Category) {- viewModelScope.launch {+ // Fix for Bug 1: Cancel previous job to prevent race conditions+ loadChannelsJob?.cancel()++ loadChannelsJob = viewModelScope.launch {val providerId = _uiState.value.provider?.id ?: return@launchval channelsFlow = if (category.isVirtual) {@@ -154,9 +219,8 @@ class HomeViewModel @Inject constructor(}channelsFlow.collect { channels ->- localChannels = channels_uiState.update { it.copy(hasChannels = channels.isNotEmpty()) }- updateFilteredChannels()+ _localChannels.value = channels}}}@@ -170,31 +234,16 @@ class HomeViewModel @Inject constructor(fun updateChannelSearchQuery(query: String) {_uiState.update { it.copy(channelSearchQuery = query) }- updateFilteredChannels()+ // updateFilteredChannels handled by flow}- private fun updateFilteredChannels() {+ private fun fetchEpgForChannels(channels: List<Channel>) {epgJob?.cancel()+ val epgIds = channels.mapNotNull { it.epgChannelId }.distinct()- val query = _uiState.value.channelSearchQuery.lowercase()- val filtered = if (query.isBlank()) {- localChannels- } else {- localChannels.filter { it.name.lowercase().contains(query) }- }-- // Update UI with initial list- _uiState.update { it.copy(filteredChannels = filtered, isLoading = false) }-- // Fetch EPG for these channels- val epgIds = filtered.mapNotNull { it.epgChannelId }.distinct()-- viewModelScope.launch {- // Get Favorites to mark channels- val favorites = favoriteRepository.getFavorites(com.streamvault.domain.model.ContentType.LIVE)- .firstOrNull() ?: emptyList()- val favoriteIds = favorites.map { it.contentId }.toSet()-+ epgJob = viewModelScope.launch {+ // Get Favorites to mark channels (No need here, already marked)+// Fetch EPGval programs = if (epgIds.isNotEmpty()) {epgRepository.getNowPlayingForChannels(epgIds).firstOrNull() ?: emptyList()@@ -203,17 +252,9 @@ class HomeViewModel @Inject constructor(}val programMap = programs.associateBy { it.channelId }- val enrichedChannels = filtered.map { channel ->- var enriched = channel- if (favoriteIds.contains(channel.id)) {- enriched = enriched.copy(isFavorite = true)- }-+ val enrichedChannels = channels.map { channel ->val program = channel.epgChannelId?.let { programMap[it] }- if (program != null) {- enriched = enriched.copy(currentProgram = program)- }- enriched+ if (program != null) channel.copy(currentProgram = program) else channel}_uiState.update { it.copy(filteredChannels = enrichedChannels) }@@ -224,9 +265,11 @@ class HomeViewModel @Inject constructor(viewModelScope.launch {favoriteRepository.addFavorite(contentId = channel.id,- contentType = com.streamvault.domain.model.ContentType.LIVE+ contentType = com.streamvault.domain.model.ContentType.LIVE,+ groupId = null // Global Favorites)- // If currently in Favorites, this might trigger a refresh via flows+ onDismissDialog()+ _uiState.update { it.copy(userMessage = "Added ${channel.name} to Favorites") }}}@@ -234,33 +277,77 @@ class HomeViewModel @Inject constructor(viewModelScope.launch {favoriteRepository.removeFavorite(contentId = channel.id,- contentType = com.streamvault.domain.model.ContentType.LIVE+ contentType = com.streamvault.domain.model.ContentType.LIVE,+ groupId = null // Global Favorites)+ onDismissDialog()+ _uiState.update { it.copy(userMessage = "Removed ${channel.name} from Favorites") }}}fun createCustomGroup(name: String) {+ val trimmed = name.trim()+ if (trimmed.equals("Favorites", ignoreCase = true)) {+ _uiState.update { it.copy(userMessage = "Cannot create group named 'Favorites'") }+ return+ }+ if (_uiState.value.categories.any { it.name.equals(trimmed, ignoreCase = true) }) {+ _uiState.update { it.copy(userMessage = "Group '$trimmed' already exists") }+ return+ }+viewModelScope.launch {- favoriteRepository.createGroup(name)+ favoriteRepository.createGroup(trimmed)+ _uiState.update { it.copy(userMessage = "Group '$trimmed' created") }}}- fun deleteCustomGroup(category: Category) {+ fun requestDeleteGroup(category: Category) {if (!category.isVirtual || category.id == -999L) return+ _uiState.update { it.copy(showDeleteGroupDialog = true, groupToDelete = category) }+ }++ fun cancelDeleteGroup() {+ _uiState.update { it.copy(showDeleteGroupDialog = false, groupToDelete = null) }+ }++ fun confirmDeleteGroup() {+ val category = _uiState.value.groupToDelete ?: returnviewModelScope.launch {favoriteRepository.deleteGroup(-category.id)+ _uiState.update { it.copy(+ showDeleteGroupDialog = false,+ groupToDelete = null,+ userMessage = "Group '${category.name}' deleted"+ ) }}}fun addToGroup(channel: Channel, category: Category) {if (!category.isVirtual || category.id == -999L) returnviewModelScope.launch {- // This will replace existing favorite entry, effectively moving it to the group+ val groupId = -category.idfavoriteRepository.addFavorite(contentId = channel.id,contentType = com.streamvault.domain.model.ContentType.LIVE,- groupId = -category.id+ groupId = groupId)+ onDismissDialog()+ _uiState.update { it.copy(userMessage = "Added ${channel.name} to ${category.name}") }+ }+ }++ fun removeFromGroup(channel: Channel, category: Category) {+ if (!category.isVirtual || category.id == -999L) return+ viewModelScope.launch {+ val groupId = -category.id+ favoriteRepository.removeFavorite(+ contentId = channel.id,+ contentType = com.streamvault.domain.model.ContentType.LIVE,+ groupId = groupId+ )+ onDismissDialog()+ _uiState.update { it.copy(userMessage = "Removed ${channel.name} from ${category.name}") }}}@@ -269,7 +356,7 @@ class HomeViewModel @Inject constructor(val currentCategory = _uiState.value.selectedCategory ?: returnif (!currentCategory.isVirtual) return // Only for Favorites/Custom Groups- val currentList = localChannels.toMutableList()+ val currentList = _localChannels.value.toMutableList()val index = currentList.indexOfFirst { it.id == channel.id }if (index == -1) return@@ -278,8 +365,7 @@ class HomeViewModel @Inject constructor(// Optimistic UI updatejava.util.Collections.swap(currentList, index, newIndex)- localChannels = currentList- updateFilteredChannels()+ _localChannels.value = currentList// Persist changeviewModelScope.launch {@@ -306,6 +392,10 @@ class HomeViewModel @Inject constructor(}}+ fun userMessageShown() {+ _uiState.update { it.copy(userMessage = null) }+ }+fun refreshData() {val provider = _uiState.value.provider ?: returnviewModelScope.launch {@@ -316,6 +406,10 @@ class HomeViewModel @Inject constructor(}fun onShowDialog(channel: Channel) {_uiState.update { it.copy(showDialog = true, selectedChannelForDialog = channel) }+ viewModelScope.launch {+ val memberships = favoriteRepository.getGroupMemberships(channel.id, com.streamvault.domain.model.ContentType.LIVE)+ _uiState.update { it.copy(dialogGroupMemberships = memberships) }+ }}fun onDismissDialog() {@@ -334,7 +428,11 @@ data class HomeUiState(val categorySearchQuery: String = "",val channelSearchQuery: String = "",val showDialog: Boolean = false,- val selectedChannelForDialog: Channel? = null+ val selectedChannelForDialog: Channel? = null,+ val dialogGroupMemberships: List<Long> = emptyList(),+ val userMessage: String? = null,+ val showDeleteGroupDialog: Boolean = false,+ val groupToDelete: Category? = null)// โโ Screen โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ@@ -347,180 +445,216 @@ fun HomeScreen(viewModel: HomeViewModel = hiltViewModel()) {val uiState by viewModel.uiState.collectAsState()+ val snackbarHostState = remember { SnackbarHostState() }- Column(modifier = Modifier.fillMaxSize()) {- Row(- modifier = Modifier.fillMaxWidth(),- horizontalArrangement = Arrangement.SpaceBetween,- verticalAlignment = Alignment.CenterVertically- ) {- TopNavBar(- currentRoute = currentRoute,- onNavigate = onNavigate,- modifier = Modifier.weight(1f)- )-- // Playlist Switcher- if (uiState.allProviders.size > 1) {- com.streamvault.app.ui.components.PlaylistSwitcher(- currentProvider = uiState.provider,- allProviders = uiState.allProviders,- onProviderSelected = { provider ->- viewModel.switchProvider(provider.id)- },- modifier = Modifier.padding(end = 32.dp)- )- }+ LaunchedEffect(uiState.userMessage) {+ uiState.userMessage?.let { message ->+ snackbarHostState.showSnackbar(message)+ viewModel.userMessageShown()}+ }- if (uiState.isLoading && uiState.categories.isEmpty()) {- Box(- modifier = Modifier.fillMaxSize(),- contentAlignment = Alignment.Center+ Box(modifier = Modifier.fillMaxSize()) {+ Column(modifier = Modifier.fillMaxSize()) {+ Row(+ modifier = Modifier.fillMaxWidth(),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically) {- Text(- text = "Loading channels...",- style = MaterialTheme.typography.bodyLarge,- color = OnSurface+ TopNavBar(+ currentRoute = currentRoute,+ onNavigate = onNavigate,+ modifier = Modifier.weight(1f))++ // Playlist Switcher+ if (uiState.allProviders.size > 1) {+ com.streamvault.app.ui.components.PlaylistSwitcher(+ currentProvider = uiState.provider,+ allProviders = uiState.allProviders,+ onProviderSelected = { provider ->+ viewModel.switchProvider(provider.id)+ },+ modifier = Modifier.padding(end = 32.dp)+ )+ }}- } else {- val context = androidx.compose.ui.platform.LocalContext.current-- Row(modifier = Modifier.fillMaxSize()) {- // Sidebar - Categories- LazyColumn(- modifier = Modifier- .width(280.dp)- .fillMaxHeight()- .background(SurfaceElevated)- .padding(vertical = 16.dp),- contentPadding = PaddingValues(horizontal = 16.dp)++ if (uiState.isLoading && uiState.categories.isEmpty()) {+ Box(+ modifier = Modifier.fillMaxSize(),+ contentAlignment = Alignment.Center) {- item {- Column {- Text(- text = "Categories",- style = MaterialTheme.typography.titleMedium,- color = OnSurface,- modifier = Modifier.padding(bottom = 8.dp, start = 8.dp)- )- SearchInput(- value = uiState.categorySearchQuery,- onValueChange = { viewModel.updateCategorySearchQuery(it) },- placeholder = "Search categories...",- modifier = Modifier.padding(bottom = 16.dp)- )- }- }-- items(- items = uiState.categories.filter {- uiState.categorySearchQuery.isEmpty() ||- it.name.contains(uiState.categorySearchQuery, ignoreCase = true)- },- key = { it.id }- ) { category ->- CategoryItem(- category = category,- isSelected = category.id == uiState.selectedCategory?.id,- onClick = { viewModel.selectCategory(category) }- )- }+ Text(+ text = "Loading channels...",+ style = MaterialTheme.typography.bodyLarge,+ color = OnSurface+ )}+ } else {+ val context = androidx.compose.ui.platform.LocalContext.current- // Content - Channel Grid- Column(- modifier = Modifier- .weight(1f)- .fillMaxHeight()- ) {- // Category Title Header and Search- Row(+ Row(modifier = Modifier.fillMaxSize()) {+ // Sidebar - Categories+ LazyColumn(modifier = Modifier- .fillMaxWidth()- .padding(start = 24.dp, top = 24.dp, bottom = 16.dp, end = 24.dp),- horizontalArrangement = Arrangement.SpaceBetween,- verticalAlignment = Alignment.CenterVertically+ .width(280.dp)+ .fillMaxHeight()+ .background(SurfaceElevated)+ .padding(vertical = 16.dp),+ contentPadding = PaddingValues(horizontal = 16.dp)) {- Text(- text = uiState.selectedCategory?.name ?: "All Channels",- style = MaterialTheme.typography.headlineSmall,- color = OnBackground- )+ item {+ Column {+ Text(+ text = "Categories",+ style = MaterialTheme.typography.titleMedium,+ color = OnSurface,+ modifier = Modifier.padding(bottom = 8.dp, start = 8.dp)+ )+ SearchInput(+ value = uiState.categorySearchQuery,+ onValueChange = { viewModel.updateCategorySearchQuery(it) },+ placeholder = "Search categories...",+ modifier = Modifier.padding(bottom = 16.dp)+ )+ }+ }- SearchInput(- value = uiState.channelSearchQuery,- onValueChange = { viewModel.updateChannelSearchQuery(it) },- placeholder = "Search channels...",- modifier = Modifier.width(300.dp)- )+ items(+ items = uiState.categories.filter {+ uiState.categorySearchQuery.isEmpty() ||+ it.name.contains(uiState.categorySearchQuery, ignoreCase = true)+ },+ key = { it.id }+ ) { category ->+ CategoryItem(+ category = category,+ isSelected = category.id == uiState.selectedCategory?.id,+ onClick = { viewModel.selectCategory(category) },+ onLongClick = { viewModel.requestDeleteGroup(category) }+ )+ }}- if (uiState.isLoading) {- Box(- modifier = Modifier.fillMaxSize(),- contentAlignment = Alignment.Center+ // Content - Channel Grid+ Column(+ modifier = Modifier+ .weight(1f)+ .fillMaxHeight()+ ) {+ // Category Title Header and Search+ Row(+ modifier = Modifier+ .fillMaxWidth()+ .padding(start = 24.dp, top = 24.dp, bottom = 16.dp, end = 24.dp),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically) {Text(- text = "Loading...",- style = MaterialTheme.typography.bodyLarge,- color = OnSurface+ text = uiState.selectedCategory?.name ?: "All Channels",+ style = MaterialTheme.typography.headlineSmall,+ color = OnBackground+ )++ SearchInput(+ value = uiState.channelSearchQuery,+ onValueChange = { viewModel.updateChannelSearchQuery(it) },+ placeholder = "Search channels...",+ modifier = Modifier.width(300.dp))}- } else if (!uiState.hasChannels) {- Box(- modifier = Modifier.fillMaxSize(),- contentAlignment = Alignment.Center- ) {- Column(horizontalAlignment = Alignment.CenterHorizontally) {- Text(- text = "๐บ",- style = MaterialTheme.typography.displayLarge- )- Spacer(modifier = Modifier.height(8.dp))++ if (uiState.isLoading) {+ Box(+ modifier = Modifier.fillMaxSize(),+ contentAlignment = Alignment.Center+ ) {Text(- text = "No channels found in this category",+ text = "Loading...",style = MaterialTheme.typography.bodyLarge,color = OnSurface)- val selectedCategory = uiState.selectedCategory- if (selectedCategory?.isVirtual == true && selectedCategory.id == -999L) {+ }+ } else if (!uiState.hasChannels) {+ Box(+ modifier = Modifier.fillMaxSize(),+ contentAlignment = Alignment.Center+ ) {+ Column(horizontalAlignment = Alignment.CenterHorizontally) {+ Text(+ text = "๐บ",+ style = MaterialTheme.typography.displayLarge+ )+ Spacer(modifier = Modifier.height(8.dp))Text(- text = "Add channels to favorites to see them here",- style = MaterialTheme.typography.bodySmall,- color = OnSurfaceDim,- modifier = Modifier.padding(top = 4.dp)+ text = "No channels found in this category",+ style = MaterialTheme.typography.bodyLarge,+ color = OnSurface)+ val selectedCategory = uiState.selectedCategory+ if (selectedCategory?.isVirtual == true && selectedCategory.id == -999L) {+ Text(+ text = "Add channels to favorites to see them here",+ style = MaterialTheme.typography.bodySmall,+ color = OnSurfaceDim,+ modifier = Modifier.padding(top = 4.dp)+ )+ }}}- }- } else {- LazyVerticalGrid(- columns = GridCells.Adaptive(minSize = 180.dp),- modifier = Modifier.fillMaxSize(),- contentPadding = PaddingValues(start = 24.dp, end = 24.dp, bottom = 32.dp),- verticalArrangement = Arrangement.spacedBy(16.dp),- horizontalArrangement = Arrangement.spacedBy(16.dp)- ) {- items(- items = uiState.filteredChannels,- key = { it.id }- ) { channel ->- ChannelCard(- channel = channel,- onClick = { onChannelClick(channel, uiState.selectedCategory, uiState.provider) },- onLongClick = {- viewModel.onShowDialog(channel)- },- modifier = Modifier.aspectRatio(16f/9f)- )+ } else {+ // Shared lock state for all items+ var ignoreNextClick by remember { mutableStateOf(false) }++ // Auto-reset lock if click never comes (e.g. user drags away)+ LaunchedEffect(ignoreNextClick) {+ if (ignoreNextClick) {+ kotlinx.coroutines.delay(1000)+ ignoreNextClick = false+ }+ }++ LazyVerticalGrid(+ columns = GridCells.Adaptive(minSize = 180.dp),+ modifier = Modifier.fillMaxSize(),+ contentPadding = PaddingValues(start = 24.dp, end = 24.dp, bottom = 32.dp),+ verticalArrangement = Arrangement.spacedBy(16.dp),+ horizontalArrangement = Arrangement.spacedBy(16.dp)+ ) {+ items(+ items = uiState.filteredChannels,+ key = { it.id }+ ) { channel ->+ ChannelCard(+ channel = channel,+ onClick = {+ if (ignoreNextClick) {+ ignoreNextClick = false+ } else if (!uiState.showDialog) {+ onChannelClick(channel, uiState.selectedCategory, uiState.provider)+ }+ },+ onLongClick = {+ ignoreNextClick = true+ viewModel.onShowDialog(channel)+ },+ modifier = Modifier.aspectRatio(16f/9f)+ )+ }}}}}}}++ SnackbarHost(+ hostState = snackbarHostState,+ modifier = Modifier+ .align(Alignment.BottomCenter)+ .padding(bottom = 16.dp)+ )}if (uiState.showDialog && uiState.selectedChannelForDialog != null) {@@ -529,35 +663,70 @@ fun HomeScreen(com.streamvault.app.ui.components.dialogs.AddToGroupDialog(channel = channel,groups = uiState.categories.filter { it.isVirtual && it.id != -999L },- isFavorite = channel.isFavorite,+ isFavorite = channel.isFavorite, // This is now Global Favorite status+ memberOfGroups = uiState.dialogGroupMemberships,onDismiss = { viewModel.onDismissDialog() },onToggleFavorite = {if (channel.isFavorite) viewModel.removeFavorite(channel) else viewModel.addFavorite(channel)- viewModel.onDismissDialog()+ // Dialog dismissed by ViewModel via side-effect or manually here?+ // VM dismisses it now.},onAddToGroup = { group ->viewModel.addToGroup(channel, group)- viewModel.onDismissDialog()- android.widget.Toast.makeText(context, "Added to ${group.name}", android.widget.Toast.LENGTH_SHORT).show()},- onRemoveFromGroup = { /* Not implemented yet directly, toggle favorite removes it */ },+ onRemoveFromGroup = { group ->+ viewModel.removeFromGroup(channel, group)+ },onCreateGroup = { name -> viewModel.createCustomGroup(name) },onMoveUp = if (uiState.selectedCategory?.isVirtual == true) { { viewModel.moveChannel(channel, -1) } } else null,onMoveDown = if (uiState.selectedCategory?.isVirtual == true) { { viewModel.moveChannel(channel, 1) } } else null)}++ if (uiState.showDeleteGroupDialog && uiState.groupToDelete != null) {+ val group = uiState.groupToDelete!!++ // Fix for ghost clicks: Debounce interaction for 500ms to ignore long-press release+ var canInteract by remember { mutableStateOf(false) }+ LaunchedEffect(Unit) {+ kotlinx.coroutines.delay(500)+ canInteract = true+ }++ val safeDismiss = {+ if (canInteract) viewModel.cancelDeleteGroup()+ }++ androidx.compose.material3.AlertDialog(+ onDismissRequest = safeDismiss,+ title = { Text("Delete Group?") },+ text = { Text("Are you sure you want to delete '${group.name}'? This will remove all channels from this group.") },+ confirmButton = {+ TextButton(onClick = { if (canInteract) viewModel.confirmDeleteGroup() }) {+ Text("Delete", color = MaterialTheme.colorScheme.error)+ }+ },+ dismissButton = {+ TextButton(onClick = safeDismiss) {+ Text("Cancel")+ }+ }+ )+ }}@Composableprivate fun CategoryItem(category: Category,isSelected: Boolean,- onClick: () -> Unit+ onClick: () -> Unit,+ onLongClick: (() -> Unit)? = null) {var isFocused by remember { mutableStateOf(false) }Surface(onClick = onClick,+ onLongClick = onLongClick,modifier = Modifier.fillMaxWidth().padding(vertical = 4.dp)@@ -576,7 +745,7 @@ private fun CategoryItem()) {Text(- text = category.name,+ text = "${category.name} (${category.count})",style = if (isSelected) MaterialTheme.typography.titleSmall else MaterialTheme.typography.bodyMedium,modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp),maxLines = 1,@@ -585,7 +754,6 @@ private fun CategoryItem(}}-@OptIn(ExperimentalMaterial3Api::class)@Composablefun SearchInput(value: String,@@ -594,34 +762,53 @@ fun SearchInput(modifier: Modifier = Modifier) {var isFocused by remember { mutableStateOf(false) }-- androidx.compose.material3.OutlinedTextField(- value = value,- onValueChange = onValueChange,- placeholder = {- Text(- text = placeholder,- style = MaterialTheme.typography.bodyMedium,- color = OnSurfaceDim- )- },+ val focusRequester = remember { androidx.compose.ui.focus.FocusRequester() }+ val keyboardController = androidx.compose.ui.platform.LocalSoftwareKeyboardController.current++ val borderColor = if (isFocused) FocusBorder else OnSurfaceDim.copy(alpha = 0.5f)+ val bgColor = if (isFocused) SurfaceHighlight else SurfaceElevated+ val borderWidth = if (isFocused) 2.dp else 1.dp++ // Pattern copied from ProviderSetupScreen's TvTextField+ Box(modifier = modifier.fillMaxWidth()- .onFocusChanged { isFocused = it.isFocused },- shape = RoundedCornerShape(8.dp),- colors = androidx.compose.material3.OutlinedTextFieldDefaults.colors(- focusedBorderColor = if (isFocused) FocusBorder else OnSurfaceDim,- unfocusedBorderColor = OnSurfaceDim.copy(alpha = 0.5f),- cursorColor = Primary,- focusedContainerColor = if (isFocused) SurfaceHighlight else SurfaceElevated,- unfocusedContainerColor = if (isFocused) SurfaceHighlight else SurfaceElevated,- focusedTextColor = OnSurface,- unfocusedTextColor = OnSurface- ),- singleLine = true,- leadingIcon = {- Text("๐", modifier = Modifier.padding(start = 8.dp))- },- textStyle = MaterialTheme.typography.bodyMedium- )+ .height(56.dp)+ .background(bgColor, RoundedCornerShape(8.dp))+ .border(borderWidth, borderColor, RoundedCornerShape(8.dp))+ .clickable {+ focusRequester.requestFocus()+ keyboardController?.show()+ }+ .padding(horizontal = 12.dp),+ contentAlignment = Alignment.CenterStart+ ) {+ Row(verticalAlignment = Alignment.CenterVertically) {+ Text("๐", modifier = Modifier.padding(end = 8.dp))++ Box(modifier = Modifier.weight(1f)) {+ if (value.isEmpty() && !isFocused) {+ Text(+ text = placeholder,+ style = MaterialTheme.typography.bodyMedium,+ color = OnSurfaceDim+ )+ }++ androidx.compose.foundation.text.BasicTextField(+ value = value,+ onValueChange = onValueChange,+ modifier = Modifier+ .fillMaxWidth()+ .focusRequester(focusRequester)+ .onFocusChanged { isFocused = it.isFocused },+ textStyle = MaterialTheme.typography.bodyMedium.copy(+ color = OnSurface+ ),+ singleLine = true,+ cursorBrush = androidx.compose.ui.graphics.SolidColor(Primary)+ )+ }+ }+ }}diff --git a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.ktindex 58613bbb..15d06059 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/player/PlayerScreen.kt@@ -64,7 +64,7 @@ class PlayerViewModel @Inject constructor(val videoFormat: StateFlow<VideoFormat> = playerEngine.videoFormat- fun prepare(streamUrl: String, epgChannelId: String?, categoryId: Long = -1, providerId: Long = -1, isVirtual: Boolean = false) {+ fun prepare(streamUrl: String, epgChannelId: String?, internalChannelId: Long, categoryId: Long = -1, providerId: Long = -1, isVirtual: Boolean = false) {val streamInfo = StreamInfo(url = streamUrl,streamType = com.streamvault.domain.model.StreamType.UNKNOWN@@ -76,11 +76,15 @@ class PlayerViewModel @Inject constructor(currentCategoryId = categoryIdcurrentProviderId = providerIdisVirtualCategory = isVirtual- loadPlaylist(categoryId, providerId, isVirtual)+ loadPlaylist(categoryId, providerId, isVirtual, internalChannelId)} else {// If playlist already loaded, just update index- if (channelList.isNotEmpty()) {- currentChannelIndex = channelList.indexOfFirst { it.streamUrl == streamUrl }+ if (channelList.isNotEmpty() && internalChannelId != -1L) {+ currentChannelIndex = channelList.indexOfFirst { it.id == internalChannelId }+ // Fallback to URL if ID fail+ if (currentChannelIndex == -1) {+ currentChannelIndex = channelList.indexOfFirst { it.streamUrl == streamUrl }+ }}}currentStreamUrl = streamUrl@@ -102,7 +106,7 @@ class PlayerViewModel @Inject constructor(}}- private fun loadPlaylist(categoryId: Long, providerId: Long, isVirtual: Boolean) {+ private fun loadPlaylist(categoryId: Long, providerId: Long, isVirtual: Boolean, initialChannelId: Long) {playlistJob?.cancel()playlistJob = viewModelScope.launch {val flows = if (isVirtual) {@@ -139,14 +143,13 @@ class PlayerViewModel @Inject constructor(flows.collect { channels ->channelList = channels- // Recalculate index based on currently playing URL (from prepare call)- // We'll rely on prepare checking streamUrl.- // But prepare is called ONCE.- // We should update index here if we can match the URL.- // Since we don't have URL here, we will just use playNext/playPrevious carefully.- // Ideally we should track currentUrl efficiently.- // For now, next PlayNext call will find current index if -1.- // But PlayNext cannot find it if we don't store it.+ // Recalculate index based on initial ID or URL+ if (initialChannelId != -1L) {+ currentChannelIndex = channelList.indexOfFirst { it.id == initialChannelId }+ }+ if (currentChannelIndex == -1) {+ currentChannelIndex = channelList.indexOfFirst { it.streamUrl == currentStreamUrl }+ }}}}@@ -212,7 +215,8 @@ class PlayerViewModel @Inject constructor(}fun retryStream(streamUrl: String, epgChannelId: String?) {- prepare(streamUrl, epgChannelId, currentCategoryId, currentProviderId, isVirtualCategory)+ val currentId = if (currentChannelIndex != -1 && channelList.isNotEmpty()) channelList[currentChannelIndex].id else -1L+ prepare(streamUrl, epgChannelId, currentId, currentCategoryId, currentProviderId, isVirtualCategory)}override fun onCleared() {@@ -228,6 +232,7 @@ fun PlayerScreen(streamUrl: String,title: String,epgChannelId: String? = null,+ internalChannelId: Long = -1L,categoryId: Long? = null,providerId: Long? = null,isVirtual: Boolean = false,@@ -253,7 +258,7 @@ fun PlayerScreen(}LaunchedEffect(streamUrl, epgChannelId) {- viewModel.prepare(streamUrl, epgChannelId, categoryId ?: -1, providerId ?: -1, isVirtual)+ viewModel.prepare(streamUrl, epgChannelId, internalChannelId, categoryId ?: -1, providerId ?: -1, isVirtual)}LaunchedEffect(showControls) {diff --git a/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupScreen.kt b/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupScreen.ktindex 4b37834a..801cf215 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupScreen.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/provider/ProviderSetupScreen.kt@@ -8,6 +8,7 @@ import androidx.compose.foundation.borderimport androidx.compose.foundation.clickableimport androidx.compose.foundation.layout.*import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.material3.CircularProgressIndicatorimport androidx.compose.runtime.*import androidx.compose.ui.Alignmentimport androidx.compose.ui.Modifier@@ -15,7 +16,9 @@ import androidx.compose.ui.draw.scaleimport androidx.compose.ui.focus.FocusRequesterimport androidx.compose.ui.focus.focusRequesterimport androidx.compose.ui.focus.onFocusChanged+import androidx.compose.ui.text.style.TextAlignimport androidx.compose.ui.unit.dp+import androidx.compose.ui.window.Dialogimport androidx.hilt.navigation.compose.hiltViewModelimport androidx.lifecycle.ViewModelimport androidx.lifecycle.viewModelScope@@ -64,11 +67,13 @@ class ProviderSetupViewModel @Inject constructor(}viewModelScope.launch {- _uiState.update { it.copy(isLoading = true, validationError = null) }- when (val result = providerRepository.loginXtream(serverUrl, username, password, name)) {+ _uiState.update { it.copy(isLoading = true, validationError = null, syncProgress = "Connecting...") }+ when (val result = providerRepository.loginXtream(serverUrl, username, password, name, onProgress = { msg ->+ _uiState.update { it.copy(syncProgress = msg) }+ })) {is Result.Success -> {_uiState.update {- it.copy(isLoading = false, loginSuccess = true, error = null)+ it.copy(isLoading = false, loginSuccess = true, error = null, syncProgress = null)}}is Result.Error -> {@@ -83,7 +88,7 @@ class ProviderSetupViewModel @Inject constructor(else -> result.message}_uiState.update {- it.copy(isLoading = false, error = userMessage)+ it.copy(isLoading = false, error = userMessage, syncProgress = null)}}is Result.Loading -> { /* no-op */ }@@ -102,16 +107,18 @@ class ProviderSetupViewModel @Inject constructor(}viewModelScope.launch {- _uiState.update { it.copy(isLoading = true, validationError = null) }- when (val result = providerRepository.validateM3u(url, name)) {+ _uiState.update { it.copy(isLoading = true, validationError = null, syncProgress = "Validating...") }+ when (val result = providerRepository.validateM3u(url, name, onProgress = { msg ->+ _uiState.update { it.copy(syncProgress = msg) }+ })) {is Result.Success -> {_uiState.update {- it.copy(isLoading = false, loginSuccess = true, error = null)+ it.copy(isLoading = false, loginSuccess = true, error = null, syncProgress = null)}}is Result.Error -> {_uiState.update {- it.copy(isLoading = false, error = "Could not validate playlist URL โ please check the URL: ${result.message}")+ it.copy(isLoading = false, error = "Could not validate playlist URL โ please check the URL: ${result.message}", syncProgress = null)}}is Result.Loading -> { /* no-op */ }@@ -125,7 +132,8 @@ data class ProviderSetupState(val loginSuccess: Boolean = false,val hasExistingProvider: Boolean = false,val error: String? = null,- val validationError: String? = null+ val validationError: String? = null,+ val syncProgress: String? = null)// โโ Screen โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ@@ -238,6 +246,34 @@ fun ProviderSetupScreen(}}}++ if (uiState.syncProgress != null) {+ SyncProgressDialog(message = uiState.syncProgress!!)+ }+}++@Composable+fun SyncProgressDialog(message: String) {+ Dialog(onDismissRequest = {}) {+ androidx.compose.material3.Surface(+ shape = RoundedCornerShape(16.dp),+ color = MaterialTheme.colorScheme.surface,+ modifier = Modifier.width(300.dp).padding(16.dp)+ ) {+ Column(+ modifier = Modifier.padding(24.dp),+ horizontalAlignment = Alignment.CenterHorizontally,+ verticalArrangement = Arrangement.spacedBy(16.dp)+ ) {+ CircularProgressIndicator(color = MaterialTheme.colorScheme.primary)+ Text(+ text = message,+ style = MaterialTheme.typography.bodyLarge,+ textAlign = TextAlign.Center+ )+ }+ }+ }}@Composablediff --git a/build.log b/build.lognew file mode 100644index 00000000..b71becd4--- /dev/null+++ b/build.log@@ -0,0 +1,108 @@+> Task :app:preBuild UP-TO-DATE+> Task :app:preDebugBuild UP-TO-DATE+> Task :app:mergeDebugNativeDebugMetadata NO-SOURCE+> Task :domain:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :domain:compileKotlin UP-TO-DATE+> Task :domain:compileJava NO-SOURCE+> Task :domain:processResources NO-SOURCE+> Task :domain:classes UP-TO-DATE+> Task :domain:jar UP-TO-DATE+> Task :app:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :data:preBuild UP-TO-DATE+> Task :data:preDebugBuild UP-TO-DATE+> Task :data:writeDebugAarMetadata UP-TO-DATE+> Task :player:preBuild UP-TO-DATE+> Task :player:preDebugBuild UP-TO-DATE+> Task :player:writeDebugAarMetadata UP-TO-DATE+> Task :app:checkDebugAarMetadata UP-TO-DATE+> Task :app:generateDebugResValues UP-TO-DATE+> Task :data:generateDebugResValues UP-TO-DATE+> Task :data:generateDebugResources UP-TO-DATE+> Task :data:packageDebugResources UP-TO-DATE+> Task :player:generateDebugResValues UP-TO-DATE+> Task :player:generateDebugResources UP-TO-DATE+> Task :player:packageDebugResources UP-TO-DATE+> Task :app:mapDebugSourceSetPaths UP-TO-DATE+> Task :app:generateDebugResources UP-TO-DATE+> Task :app:mergeDebugResources UP-TO-DATE+> Task :app:packageDebugResources UP-TO-DATE+> Task :app:parseDebugLocalResources UP-TO-DATE+> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE+> Task :app:extractDeepLinksDebug UP-TO-DATE+> Task :data:extractDeepLinksDebug UP-TO-DATE+> Task :data:processDebugManifest UP-TO-DATE+> Task :player:extractDeepLinksDebug UP-TO-DATE+> Task :player:processDebugManifest UP-TO-DATE+> Task :app:processDebugMainManifest UP-TO-DATE+> Task :app:processDebugManifest UP-TO-DATE+> Task :app:processDebugManifestForPackage UP-TO-DATE+> Task :data:compileDebugLibraryResources UP-TO-DATE+> Task :data:parseDebugLocalResources UP-TO-DATE+> Task :data:generateDebugRFile UP-TO-DATE+> Task :player:compileDebugLibraryResources UP-TO-DATE+> Task :player:parseDebugLocalResources UP-TO-DATE+> Task :player:generateDebugRFile UP-TO-DATE+> Task :app:processDebugResources UP-TO-DATE+> Task :data:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :data:javaPreCompileDebug UP-TO-DATE+> Task :player:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :player:kspDebugKotlin UP-TO-DATE+> Task :player:compileDebugKotlin UP-TO-DATE+> Task :player:javaPreCompileDebug UP-TO-DATE+> Task :player:compileDebugJavaWithJavac UP-TO-DATE+> Task :player:transformDebugClassesWithAsm UP-TO-DATE+> Task :player:bundleLibCompileToJarDebug UP-TO-DATE+> Task :app:javaPreCompileDebug UP-TO-DATE+> Task :app:mergeDebugShaders UP-TO-DATE+> Task :app:compileDebugShaders NO-SOURCE+> Task :app:generateDebugAssets UP-TO-DATE+> Task :data:mergeDebugShaders UP-TO-DATE+> Task :data:compileDebugShaders NO-SOURCE+> Task :data:generateDebugAssets UP-TO-DATE+> Task :data:packageDebugAssets UP-TO-DATE+> Task :player:mergeDebugShaders UP-TO-DATE+> Task :player:compileDebugShaders NO-SOURCE+> Task :player:generateDebugAssets UP-TO-DATE+> Task :player:packageDebugAssets UP-TO-DATE+> Task :app:mergeDebugAssets UP-TO-DATE+> Task :app:compressDebugAssets UP-TO-DATE+> Task :player:bundleLibRuntimeToJarDebug UP-TO-DATE+> Task :app:desugarDebugFileDependencies UP-TO-DATE+> Task :player:processDebugJavaRes UP-TO-DATE+> Task :app:checkDebugDuplicateClasses UP-TO-DATE+> Task :app:mergeExtDexDebug UP-TO-DATE+> Task :player:bundleLibRuntimeToDirDebug UP-TO-DATE+> Task :app:mergeDebugJniLibFolders UP-TO-DATE+> Task :data:mergeDebugJniLibFolders UP-TO-DATE+> Task :data:mergeDebugNativeLibs NO-SOURCE+> Task :data:copyDebugJniLibsProjectOnly UP-TO-DATE+> Task :player:mergeDebugJniLibFolders UP-TO-DATE+> Task :player:mergeDebugNativeLibs NO-SOURCE+> Task :player:copyDebugJniLibsProjectOnly UP-TO-DATE+> Task :app:mergeDebugNativeLibs UP-TO-DATE+> Task :app:stripDebugDebugSymbols UP-TO-DATE+> Task :app:validateSigningDebug UP-TO-DATE+> Task :app:writeDebugAppMetadata UP-TO-DATE+> Task :app:writeDebugSigningConfigVersions UP-TO-DATE+> Task :data:stripDebugDebugSymbols NO-SOURCE+> Task :data:copyDebugJniLibsProjectAndLocalJars UP-TO-DATE+> Task :data:extractDeepLinksForAarDebug UP-TO-DATE+> Task :data:prepareDebugArtProfile UP-TO-DATE+> Task :data:prepareLintJarForPublish UP-TO-DATE+> Task :player:stripDebugDebugSymbols NO-SOURCE+> Task :player:copyDebugJniLibsProjectAndLocalJars UP-TO-DATE+> Task :player:extractDebugAnnotations UP-TO-DATE+> Task :player:extractDeepLinksForAarDebug UP-TO-DATE+> Task :player:mergeDebugGeneratedProguardFiles UP-TO-DATE+> Task :player:mergeDebugConsumerProguardFiles UP-TO-DATE+> Task :player:prepareDebugArtProfile UP-TO-DATE+> Task :player:prepareLintJarForPublish UP-TO-DATE+> Task :player:mergeDebugJavaResource UP-TO-DATE+> Task :player:syncDebugLibJars UP-TO-DATE+> Task :player:bundleDebugAar UP-TO-DATE+> Task :player:assembleDebug UP-TO-DATE++> Task :data:kspDebugKotlin FAILED++> Task :data:copyRoomSchemas NO-SOURCE+79 actionable tasks: 1 executed, 78 up-to-datediff --git a/build_clean.log b/build_clean.lognew file mode 100644index 00000000..91181e92--- /dev/null+++ b/build_clean.log@@ -0,0 +1,148 @@+> Task :app:clean+> Task :data:clean+> Task :domain:clean+> Task :player:clean+> Task :app:preBuild UP-TO-DATE+> Task :app:preDebugBuild UP-TO-DATE+> Task :app:mergeDebugNativeDebugMetadata NO-SOURCE+> Task :domain:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :domain:processResources NO-SOURCE+> Task :app:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :data:preBuild UP-TO-DATE+> Task :data:preDebugBuild UP-TO-DATE+> Task :player:preBuild UP-TO-DATE+> Task :player:preDebugBuild UP-TO-DATE+> Task :app:generateDebugResValues+> Task :data:generateDebugResValues+> Task :data:writeDebugAarMetadata+> Task :player:writeDebugAarMetadata+> Task :data:generateDebugResources+> Task :app:checkDebugAarMetadata+> Task :data:packageDebugResources+> Task :player:generateDebugResValues+> Task :player:generateDebugResources+> Task :player:packageDebugResources+> Task :app:mapDebugSourceSetPaths+> Task :app:generateDebugResources+> Task :domain:compileKotlin+> Task :domain:compileJava NO-SOURCE+> Task :domain:classes UP-TO-DATE+> Task :domain:jar+> Task :app:packageDebugResources+> Task :app:createDebugCompatibleScreenManifests+> Task :app:extractDeepLinksDebug+> Task :data:extractDeepLinksDebug+> Task :player:extractDeepLinksDebug+> Task :data:parseDebugLocalResources+> Task :app:parseDebugLocalResources+> Task :player:compileDebugLibraryResources+> Task :data:compileDebugLibraryResources+> Task :data:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :player:parseDebugLocalResources+> Task :player:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :data:javaPreCompileDebug+> Task :app:javaPreCompileDebug+> Task :player:javaPreCompileDebug+> Task :data:generateDebugRFile+> Task :player:generateDebugRFile+> Task :data:processDebugManifest+> Task :player:processDebugManifest+> Task :app:mergeDebugResources+> Task :app:mergeDebugShaders+> Task :app:processDebugMainManifest+> Task :app:processDebugManifest+> Task :app:compileDebugShaders NO-SOURCE+> Task :app:generateDebugAssets UP-TO-DATE+> Task :data:mergeDebugShaders+> Task :data:compileDebugShaders NO-SOURCE+> Task :data:generateDebugAssets UP-TO-DATE+> Task :data:packageDebugAssets+> Task :player:mergeDebugShaders+> Task :player:compileDebugShaders NO-SOURCE+> Task :player:generateDebugAssets UP-TO-DATE+> Task :player:packageDebugAssets+> Task :app:mergeDebugAssets+> Task :app:compressDebugAssets+> Task :app:desugarDebugFileDependencies+> Task :app:mergeDebugJniLibFolders+> Task :data:mergeDebugJniLibFolders+> Task :data:mergeDebugNativeLibs NO-SOURCE+> Task :data:copyDebugJniLibsProjectOnly+> Task :player:mergeDebugJniLibFolders+> Task :player:mergeDebugNativeLibs NO-SOURCE+> Task :player:copyDebugJniLibsProjectOnly+> Task :app:validateSigningDebug+> Task :app:checkDebugDuplicateClasses+> Task :app:mergeDebugNativeLibs+> Task :app:processDebugManifestForPackage+> Task :app:writeDebugAppMetadata+> Task :app:writeDebugSigningConfigVersions+> Task :data:stripDebugDebugSymbols NO-SOURCE+> Task :data:extractDeepLinksForAarDebug UP-TO-DATE+> Task :data:prepareDebugArtProfile UP-TO-DATE+> Task :data:prepareLintJarForPublish UP-TO-DATE+> Task :player:stripDebugDebugSymbols NO-SOURCE+> Task :data:copyDebugJniLibsProjectAndLocalJars+> Task :player:copyDebugJniLibsProjectAndLocalJars++> Task :app:stripDebugDebugSymbols+Unable to strip the following libraries, packaging them as they are: libandroidx.graphics.path.so, libdatastore_shared_counter.so.++> Task :player:extractDeepLinksForAarDebug UP-TO-DATE+> Task :player:prepareDebugArtProfile UP-TO-DATE+> Task :player:prepareLintJarForPublish UP-TO-DATE+> Task :player:kspDebugKotlin+> Task :app:processDebugResources+> Task :player:compileDebugKotlin+> Task :player:compileDebugJavaWithJavac+> Task :player:processDebugJavaRes+> Task :player:extractDebugAnnotations+> Task :player:mergeDebugJavaResource+> Task :player:transformDebugClassesWithAsm+> Task :player:bundleLibRuntimeToJarDebug+> Task :player:mergeDebugGeneratedProguardFiles UP-TO-DATE+> Task :player:mergeDebugConsumerProguardFiles UP-TO-DATE+> Task :player:bundleLibCompileToJarDebug+> Task :player:bundleLibRuntimeToDirDebug+> Task :player:syncDebugLibJars+> Task :player:bundleDebugAar+> Task :player:assembleDebug+> Task :data:kspDebugKotlin+> Task :app:mergeExtDexDebug++> Task :data:compileDebugKotlin FAILED+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:35:9 None of the following candidates is applicable:+fun <T1, T2, R> combine(flow: Flow<T1>, flow2: Flow<T2>, transform: suspend (@ParameterName(...) T1, @ParameterName(...) T2) -> R): Flow<R>+fun <reified T, R> combine(vararg flows: Flow<T>, crossinline transform: suspend (Array<T>) -> R): Flow<R>+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:38:13 Cannot infer type for this parameter. Please specify it explicitly.+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:38:25 Cannot infer type for this parameter. Please specify it explicitly.+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:38:33 Cannot infer type for this parameter. Please specify it explicitly.+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:39:47 Unresolved reference 'it'.+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:39:61 Cannot infer type for this parameter. Please specify it explicitly.+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:39:64 Unresolved reference 'it'.+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:48:47 Cannot infer type for this parameter. Please specify it explicitly.+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:48:47 Not enough information to infer type argument for 'T'.+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:48:47 Not enough information to infer type argument for 'R'.+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:48:53 Cannot infer type for this parameter. Please specify it explicitly.+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:49:35 Unresolved reference 'copy'.+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:49:64 Unresolved reference 'categoryId'.+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:52:41 Cannot infer type for this parameter. Please specify it explicitly.+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:52:41 Not enough information to infer type argument for 'T'.++> Task :data:copyRoomSchemas NO-SOURCE++FAILURE: Build failed with an exception.++* What went wrong:+Execution failed for task ':data:compileDebugKotlin'.+> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction+ > Compilation error. See log for more details++* Try:+> Run with --stacktrace option to get the stack trace.+> Run with --info or --debug option to get more log output.+> Run with --scan to get full insights.+> Get more help at https://help.gradle.org.++BUILD FAILED in 20s+84 actionable tasks: 76 executed, 8 up-to-datediff --git a/build_err.log b/build_err.lognew file mode 100644index 00000000..27cf7fbb--- /dev/null+++ b/build_err.log@@ -0,0 +1,27 @@+e: [ksp] [MissingType]: Element 'com.streamvault.data.local.StreamVaultDatabase' references a type that is not present+e: Error occurred in KSP, check log for detail+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:39:13 Expecting ')'+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:39:26 Expecting an element+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:39:34 Expecting an element+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:52:13 Expecting member declaration+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:52:19 Expecting member declaration+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:52:20 Expecting member declaration+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:52:39 Expecting member declaration+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:52:41 Expecting member declaration+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:52:43 Expecting member declaration+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:75:1 Expecting a top level declaration++FAILURE: Build failed with an exception.++* What went wrong:+Execution failed for task ':data:kspDebugKotlin'.+> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction+ > Compilation error. See log for more details++* Try:+> Run with --stacktrace option to get the stack trace.+> Run with --info or --debug option to get more log output.+> Run with --scan to get full insights.+> Get more help at https://help.gradle.org.++BUILD FAILED in 4sdiff --git a/build_error_log.txt b/build_error_log.txtnew file mode 100644index 00000000..070bfb97Binary files /dev/null and b/build_error_log.txt differdiff --git a/build_log.txt b/build_log.txtindex 5dc71b04..6c733625 100644Binary files a/build_log.txt and b/build_log.txt differdiff --git a/build_log_2.txt b/build_log_2.txtnew file mode 100644index 00000000..9e7629d1Binary files /dev/null and b/build_log_2.txt differdiff --git a/build_log_2_utf8.txt b/build_log_2_utf8.txtnew file mode 100644index 00000000..6c973275--- /dev/null+++ b/build_log_2_utf8.txt@@ -0,0 +1,182 @@+๏ปฟ> Task :app:preBuild UP-TO-DATE+> Task :app:preDebugBuild UP-TO-DATE+> Task :app:mergeDebugNativeDebugMetadata NO-SOURCE+> Task :domain:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :domain:compileKotlin UP-TO-DATE+> Task :domain:compileJava NO-SOURCE+> Task :domain:processResources NO-SOURCE+> Task :domain:classes UP-TO-DATE+> Task :domain:jar UP-TO-DATE+> Task :app:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :data:preBuild UP-TO-DATE+> Task :data:preDebugBuild UP-TO-DATE+> Task :data:writeDebugAarMetadata UP-TO-DATE+> Task :player:preBuild UP-TO-DATE+> Task :player:preDebugBuild UP-TO-DATE+> Task :player:writeDebugAarMetadata UP-TO-DATE+> Task :app:checkDebugAarMetadata UP-TO-DATE+> Task :app:generateDebugResValues UP-TO-DATE+> Task :data:generateDebugResValues UP-TO-DATE+> Task :data:generateDebugResources UP-TO-DATE+> Task :data:packageDebugResources UP-TO-DATE+> Task :player:generateDebugResValues UP-TO-DATE+> Task :player:generateDebugResources UP-TO-DATE+> Task :player:packageDebugResources UP-TO-DATE+> Task :app:mapDebugSourceSetPaths UP-TO-DATE+> Task :app:generateDebugResources UP-TO-DATE+> Task :app:mergeDebugResources UP-TO-DATE+> Task :app:packageDebugResources UP-TO-DATE+> Task :app:parseDebugLocalResources UP-TO-DATE+> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE+> Task :app:extractDeepLinksDebug UP-TO-DATE+> Task :data:extractDeepLinksDebug UP-TO-DATE+> Task :data:processDebugManifest UP-TO-DATE+> Task :player:extractDeepLinksDebug UP-TO-DATE+> Task :player:processDebugManifest UP-TO-DATE+> Task :app:processDebugMainManifest UP-TO-DATE+> Task :app:processDebugManifest UP-TO-DATE+> Task :app:processDebugManifestForPackage UP-TO-DATE+> Task :data:compileDebugLibraryResources UP-TO-DATE+> Task :data:parseDebugLocalResources UP-TO-DATE+> Task :data:generateDebugRFile UP-TO-DATE+> Task :player:compileDebugLibraryResources UP-TO-DATE+> Task :player:parseDebugLocalResources UP-TO-DATE+> Task :player:generateDebugRFile UP-TO-DATE+> Task :app:processDebugResources UP-TO-DATE+> Task :data:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :data:kspDebugKotlin UP-TO-DATE+> Task :data:compileDebugKotlin UP-TO-DATE+> Task :data:javaPreCompileDebug UP-TO-DATE+> Task :data:compileDebugJavaWithJavac UP-TO-DATE+> Task :data:copyRoomSchemas NO-SOURCE+> Task :data:transformDebugClassesWithAsm UP-TO-DATE+> Task :data:bundleLibCompileToJarDebug UP-TO-DATE+> Task :player:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :player:kspDebugKotlin UP-TO-DATE+> Task :player:compileDebugKotlin UP-TO-DATE+> Task :player:javaPreCompileDebug UP-TO-DATE+> Task :player:compileDebugJavaWithJavac UP-TO-DATE+> Task :player:transformDebugClassesWithAsm UP-TO-DATE+> Task :player:bundleLibCompileToJarDebug UP-TO-DATE+> Task :app:kspDebugKotlin UP-TO-DATE+> Task :app:javaPreCompileDebug UP-TO-DATE+> Task :app:mergeDebugShaders UP-TO-DATE+> Task :app:compileDebugShaders NO-SOURCE+> Task :app:generateDebugAssets UP-TO-DATE+> Task :data:mergeDebugShaders UP-TO-DATE+> Task :data:compileDebugShaders NO-SOURCE+> Task :data:generateDebugAssets UP-TO-DATE+> Task :data:packageDebugAssets UP-TO-DATE+> Task :player:mergeDebugShaders UP-TO-DATE+> Task :player:compileDebugShaders NO-SOURCE+> Task :player:generateDebugAssets UP-TO-DATE+> Task :player:packageDebugAssets UP-TO-DATE+> Task :app:mergeDebugAssets UP-TO-DATE+> Task :app:compressDebugAssets UP-TO-DATE+> Task :data:bundleLibRuntimeToJarDebug UP-TO-DATE+> Task :player:bundleLibRuntimeToJarDebug UP-TO-DATE+> Task :app:desugarDebugFileDependencies UP-TO-DATE+> Task :data:processDebugJavaRes UP-TO-DATE+> Task :player:processDebugJavaRes UP-TO-DATE+> Task :app:checkDebugDuplicateClasses UP-TO-DATE+> Task :app:mergeExtDexDebug UP-TO-DATE+> Task :data:bundleLibRuntimeToDirDebug UP-TO-DATE+> Task :player:bundleLibRuntimeToDirDebug UP-TO-DATE+> Task :app:mergeDebugJniLibFolders UP-TO-DATE+> Task :app:mergeLibDexDebug UP-TO-DATE+> Task :data:mergeDebugJniLibFolders UP-TO-DATE+> Task :data:mergeDebugNativeLibs NO-SOURCE+> Task :data:copyDebugJniLibsProjectOnly UP-TO-DATE+> Task :player:mergeDebugJniLibFolders UP-TO-DATE+> Task :player:mergeDebugNativeLibs NO-SOURCE+> Task :player:copyDebugJniLibsProjectOnly UP-TO-DATE+> Task :app:mergeDebugNativeLibs UP-TO-DATE+> Task :app:stripDebugDebugSymbols UP-TO-DATE+> Task :app:validateSigningDebug UP-TO-DATE+> Task :app:writeDebugAppMetadata UP-TO-DATE+> Task :app:writeDebugSigningConfigVersions UP-TO-DATE+> Task :data:stripDebugDebugSymbols NO-SOURCE+> Task :data:copyDebugJniLibsProjectAndLocalJars UP-TO-DATE+> Task :data:extractDebugAnnotations UP-TO-DATE+> Task :data:extractDeepLinksForAarDebug UP-TO-DATE+> Task :data:mergeDebugGeneratedProguardFiles UP-TO-DATE+> Task :data:mergeDebugConsumerProguardFiles UP-TO-DATE+> Task :data:prepareDebugArtProfile UP-TO-DATE+> Task :data:prepareLintJarForPublish UP-TO-DATE+> Task :data:mergeDebugJavaResource UP-TO-DATE+> Task :data:syncDebugLibJars UP-TO-DATE+> Task :data:bundleDebugAar UP-TO-DATE+> Task :data:assembleDebug UP-TO-DATE+> Task :player:stripDebugDebugSymbols NO-SOURCE+> Task :player:copyDebugJniLibsProjectAndLocalJars UP-TO-DATE+> Task :player:extractDebugAnnotations UP-TO-DATE+> Task :player:extractDeepLinksForAarDebug UP-TO-DATE+> Task :player:mergeDebugGeneratedProguardFiles UP-TO-DATE+> Task :player:mergeDebugConsumerProguardFiles UP-TO-DATE+> Task :player:prepareDebugArtProfile UP-TO-DATE+> Task :player:prepareLintJarForPublish UP-TO-DATE+> Task :player:mergeDebugJavaResource UP-TO-DATE+> Task :player:syncDebugLibJars UP-TO-DATE+> Task :player:bundleDebugAar UP-TO-DATE+> Task :player:assembleDebug UP-TO-DATE++> Task :app:compileDebugKotlin FAILED+.\gradlew : e: file:///C:/Users/david/.gemini/antigravity+/scratch/iptv-player/app/src/main/java/com/streamvault/ap+p/ui/screens/provider/ProviderSetupScreen.kt:258:9 None+of the following candidates is applicable:+At line:1 char:1++ .\gradlew assembleDebug > build_log_2.txt 2>&1++ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ + CategoryInfo : NotSpecified: (e: file:///+ C:/U... is applicable::String) [], RemoteException+ + FullyQualifiedErrorId : NativeCommandError++fun Surface(onClick: () -> Unit, modifier: Modifier =+..., onLongClick: (() -> Unit)? = ..., enabled: Boolean+= ..., tonalElevation: Dp = ..., shape:+ClickableSurfaceShape = ..., colors:+ClickableSurfaceColors = ..., scale:+ClickableSurfaceScale = ..., border:+ClickableSurfaceBorder = ..., glow: ClickableSurfaceGlow+= ..., interactionSource: MutableInteractionSource? =+..., content: @Composable()+ComposableFunction1<BoxScope, Unit>): Unit+fun Surface(modifier: Modifier = ..., tonalElevation: Dp+= ..., shape: Shape = ..., colors: SurfaceColors = ...,+border: Border = ..., glow: Glow = ..., content:+@Composable() ComposableFunction1<BoxScope, Unit>): Unit+fun Surface(selected: Boolean, onClick: () -> Unit,+modifier: Modifier = ..., enabled: Boolean = ...,+onLongClick: (() -> Unit)? = ..., tonalElevation: Dp =+..., shape: SelectableSurfaceShape = ..., colors:+SelectableSurfaceColors = ..., scale:+SelectableSurfaceScale = ..., border:+SelectableSurfaceBorder = ..., glow:+SelectableSurfaceGlow = ..., interactionSource:+MutableInteractionSource? = ..., content: @Composable()+ComposableFunction1<BoxScope, Unit>): Unit+e: file:///C:/Users/david/.gemini/antigravity/scratch/ipt+v-player/app/src/main/java/com/streamvault/app/ui/screens+/provider/ProviderSetupScreen.kt:263:13 @Composable+invocations can only happen from the context of a+@Composable function++FAILURE: Build failed with an exception.++* What went wrong:+Execution failed for task ':app:compileDebugKotlin'.+> A failure occurred while executing org.jetbrains.kotlin+.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKot+linCompilerWorkAction+ > Compilation error. See log for more details++* Try:+> Run with --stacktrace option to get the stack trace.+> Run with --info or --debug option to get more log+output.+> Run with --scan to get full insights.+> Get more help at https://help.gradle.org.++BUILD FAILED in 3s+95 actionable tasks: 1 executed, 94 up-to-datediff --git a/build_log_crashFunc.txt b/build_log_crashFunc.txtnew file mode 100644index 00000000..35f51bcdBinary files /dev/null and b/build_log_crashFunc.txt differdiff --git a/build_log_final_2.txt b/build_log_final_2.txtnew file mode 100644index 00000000..07a56323--- /dev/null+++ b/build_log_final_2.txt@@ -0,0 +1,125 @@+> Task :app:preBuild UP-TO-DATE+> Task :app:preDebugBuild UP-TO-DATE+> Task :app:mergeDebugNativeDebugMetadata NO-SOURCE+> Task :domain:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :domain:compileKotlin UP-TO-DATE+> Task :domain:compileJava NO-SOURCE+> Task :domain:processResources NO-SOURCE+> Task :domain:classes UP-TO-DATE+> Task :domain:jar UP-TO-DATE+> Task :app:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :data:preBuild UP-TO-DATE+> Task :data:preDebugBuild UP-TO-DATE+> Task :data:writeDebugAarMetadata UP-TO-DATE+> Task :player:preBuild UP-TO-DATE+> Task :player:preDebugBuild UP-TO-DATE+> Task :player:writeDebugAarMetadata UP-TO-DATE+> Task :app:checkDebugAarMetadata UP-TO-DATE+> Task :app:generateDebugResValues UP-TO-DATE+> Task :data:generateDebugResValues UP-TO-DATE+> Task :data:generateDebugResources UP-TO-DATE+> Task :data:packageDebugResources UP-TO-DATE+> Task :player:generateDebugResValues UP-TO-DATE+> Task :player:generateDebugResources UP-TO-DATE+> Task :player:packageDebugResources UP-TO-DATE+> Task :app:mapDebugSourceSetPaths UP-TO-DATE+> Task :app:generateDebugResources UP-TO-DATE+> Task :app:mergeDebugResources UP-TO-DATE+> Task :app:packageDebugResources UP-TO-DATE+> Task :app:parseDebugLocalResources UP-TO-DATE+> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE+> Task :app:extractDeepLinksDebug UP-TO-DATE+> Task :data:extractDeepLinksDebug UP-TO-DATE+> Task :data:processDebugManifest UP-TO-DATE+> Task :player:extractDeepLinksDebug UP-TO-DATE+> Task :player:processDebugManifest UP-TO-DATE+> Task :app:processDebugMainManifest UP-TO-DATE+> Task :app:processDebugManifest UP-TO-DATE+> Task :app:processDebugManifestForPackage UP-TO-DATE+> Task :data:compileDebugLibraryResources UP-TO-DATE+> Task :data:parseDebugLocalResources UP-TO-DATE+> Task :data:generateDebugRFile UP-TO-DATE+> Task :player:compileDebugLibraryResources UP-TO-DATE+> Task :player:parseDebugLocalResources UP-TO-DATE+> Task :player:generateDebugRFile UP-TO-DATE+> Task :app:processDebugResources UP-TO-DATE+> Task :data:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :data:javaPreCompileDebug UP-TO-DATE+> Task :player:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :player:kspDebugKotlin UP-TO-DATE+> Task :player:compileDebugKotlin UP-TO-DATE+> Task :player:javaPreCompileDebug UP-TO-DATE+> Task :player:compileDebugJavaWithJavac UP-TO-DATE+> Task :player:transformDebugClassesWithAsm UP-TO-DATE+> Task :player:bundleLibCompileToJarDebug UP-TO-DATE+> Task :app:javaPreCompileDebug UP-TO-DATE+> Task :app:mergeDebugShaders UP-TO-DATE+> Task :app:compileDebugShaders NO-SOURCE+> Task :app:generateDebugAssets UP-TO-DATE+> Task :data:mergeDebugShaders UP-TO-DATE+> Task :data:compileDebugShaders NO-SOURCE+> Task :data:generateDebugAssets UP-TO-DATE+> Task :data:packageDebugAssets UP-TO-DATE+> Task :player:mergeDebugShaders UP-TO-DATE+> Task :player:compileDebugShaders NO-SOURCE+> Task :player:generateDebugAssets UP-TO-DATE+> Task :player:packageDebugAssets UP-TO-DATE+> Task :app:mergeDebugAssets UP-TO-DATE+> Task :app:compressDebugAssets UP-TO-DATE+> Task :player:bundleLibRuntimeToJarDebug UP-TO-DATE+> Task :app:desugarDebugFileDependencies UP-TO-DATE+> Task :player:processDebugJavaRes UP-TO-DATE+> Task :app:checkDebugDuplicateClasses UP-TO-DATE+> Task :app:mergeExtDexDebug UP-TO-DATE+> Task :player:bundleLibRuntimeToDirDebug UP-TO-DATE+> Task :app:mergeDebugJniLibFolders UP-TO-DATE+> Task :data:mergeDebugJniLibFolders UP-TO-DATE+> Task :data:mergeDebugNativeLibs NO-SOURCE+> Task :data:copyDebugJniLibsProjectOnly UP-TO-DATE+> Task :player:mergeDebugJniLibFolders UP-TO-DATE+> Task :player:mergeDebugNativeLibs NO-SOURCE+> Task :player:copyDebugJniLibsProjectOnly UP-TO-DATE+> Task :app:mergeDebugNativeLibs UP-TO-DATE+> Task :app:stripDebugDebugSymbols UP-TO-DATE+> Task :app:validateSigningDebug UP-TO-DATE+> Task :app:writeDebugAppMetadata UP-TO-DATE+> Task :app:writeDebugSigningConfigVersions UP-TO-DATE+> Task :data:stripDebugDebugSymbols NO-SOURCE+> Task :data:copyDebugJniLibsProjectAndLocalJars UP-TO-DATE+> Task :data:extractDeepLinksForAarDebug UP-TO-DATE+> Task :data:prepareDebugArtProfile UP-TO-DATE+> Task :data:prepareLintJarForPublish UP-TO-DATE+> Task :player:stripDebugDebugSymbols NO-SOURCE+> Task :player:copyDebugJniLibsProjectAndLocalJars UP-TO-DATE+> Task :player:extractDebugAnnotations UP-TO-DATE+> Task :player:extractDeepLinksForAarDebug UP-TO-DATE+> Task :player:mergeDebugGeneratedProguardFiles UP-TO-DATE+> Task :player:mergeDebugConsumerProguardFiles UP-TO-DATE+> Task :player:prepareDebugArtProfile UP-TO-DATE+> Task :player:prepareLintJarForPublish UP-TO-DATE+> Task :player:mergeDebugJavaResource UP-TO-DATE+> Task :player:syncDebugLibJars UP-TO-DATE+> Task :player:bundleDebugAar UP-TO-DATE+> Task :player:assembleDebug UP-TO-DATE++> Task :data:kspDebugKotlin FAILED+e: [ksp] [MissingType]: Element 'com.streamvault.data.local.StreamVaultDatabase' references a type that is not present+e: Error occurred in KSP, check log for detail++> Task :data:copyRoomSchemas NO-SOURCE++FAILURE: Build failed with an exception.++* What went wrong:+Execution failed for task ':data:kspDebugKotlin'.+> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction+ > Compilation error. See log for more details++* Try:+> Run with --stacktrace option to get the stack trace.+> Run with --info or --debug option to get more log output.+> Run with --scan to get full insights.+> Get more help at https://help.gradle.org.++BUILD FAILED in 3s+79 actionable tasks: 1 executed, 78 up-to-datediff --git a/build_log_fixedDao.txt b/build_log_fixedDao.txtnew file mode 100644index 00000000..4e117af6--- /dev/null+++ b/build_log_fixedDao.txt@@ -0,0 +1,135 @@+> Task :app:preBuild UP-TO-DATE+> Task :app:preDebugBuild UP-TO-DATE+> Task :app:mergeDebugNativeDebugMetadata NO-SOURCE+> Task :domain:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :domain:compileKotlin UP-TO-DATE+> Task :domain:compileJava NO-SOURCE+> Task :domain:processResources NO-SOURCE+> Task :domain:classes UP-TO-DATE+> Task :domain:jar UP-TO-DATE+> Task :app:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :data:preBuild UP-TO-DATE+> Task :data:preDebugBuild UP-TO-DATE+> Task :data:writeDebugAarMetadata UP-TO-DATE+> Task :player:preBuild UP-TO-DATE+> Task :player:preDebugBuild UP-TO-DATE+> Task :player:writeDebugAarMetadata UP-TO-DATE+> Task :app:checkDebugAarMetadata UP-TO-DATE+> Task :app:generateDebugResValues UP-TO-DATE+> Task :data:generateDebugResValues UP-TO-DATE+> Task :data:generateDebugResources UP-TO-DATE+> Task :data:packageDebugResources UP-TO-DATE+> Task :player:generateDebugResValues UP-TO-DATE+> Task :player:generateDebugResources UP-TO-DATE+> Task :player:packageDebugResources UP-TO-DATE+> Task :app:mapDebugSourceSetPaths UP-TO-DATE+> Task :app:generateDebugResources UP-TO-DATE+> Task :app:mergeDebugResources UP-TO-DATE+> Task :app:packageDebugResources UP-TO-DATE+> Task :app:parseDebugLocalResources UP-TO-DATE+> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE+> Task :app:extractDeepLinksDebug UP-TO-DATE+> Task :data:extractDeepLinksDebug UP-TO-DATE+> Task :data:processDebugManifest UP-TO-DATE+> Task :player:extractDeepLinksDebug UP-TO-DATE+> Task :player:processDebugManifest UP-TO-DATE+> Task :app:processDebugMainManifest UP-TO-DATE+> Task :app:processDebugManifest UP-TO-DATE+> Task :app:processDebugManifestForPackage UP-TO-DATE+> Task :data:compileDebugLibraryResources UP-TO-DATE+> Task :data:parseDebugLocalResources UP-TO-DATE+> Task :data:generateDebugRFile UP-TO-DATE+> Task :player:compileDebugLibraryResources UP-TO-DATE+> Task :player:parseDebugLocalResources UP-TO-DATE+> Task :player:generateDebugRFile UP-TO-DATE+> Task :app:processDebugResources UP-TO-DATE+> Task :data:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :data:javaPreCompileDebug UP-TO-DATE+> Task :player:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :player:kspDebugKotlin UP-TO-DATE+> Task :player:compileDebugKotlin UP-TO-DATE+> Task :player:javaPreCompileDebug UP-TO-DATE+> Task :player:compileDebugJavaWithJavac UP-TO-DATE+> Task :player:transformDebugClassesWithAsm UP-TO-DATE+> Task :player:bundleLibCompileToJarDebug UP-TO-DATE+> Task :app:javaPreCompileDebug UP-TO-DATE+> Task :app:mergeDebugShaders UP-TO-DATE+> Task :app:compileDebugShaders NO-SOURCE+> Task :app:generateDebugAssets UP-TO-DATE+> Task :data:mergeDebugShaders UP-TO-DATE+> Task :data:compileDebugShaders NO-SOURCE+> Task :data:generateDebugAssets UP-TO-DATE+> Task :data:packageDebugAssets UP-TO-DATE+> Task :player:mergeDebugShaders UP-TO-DATE+> Task :player:compileDebugShaders NO-SOURCE+> Task :player:generateDebugAssets UP-TO-DATE+> Task :player:packageDebugAssets UP-TO-DATE+> Task :app:mergeDebugAssets UP-TO-DATE+> Task :app:compressDebugAssets UP-TO-DATE+> Task :player:bundleLibRuntimeToJarDebug UP-TO-DATE+> Task :app:desugarDebugFileDependencies UP-TO-DATE+> Task :player:processDebugJavaRes UP-TO-DATE+> Task :app:checkDebugDuplicateClasses UP-TO-DATE+> Task :app:mergeExtDexDebug UP-TO-DATE+> Task :player:bundleLibRuntimeToDirDebug UP-TO-DATE+> Task :app:mergeDebugJniLibFolders UP-TO-DATE+> Task :data:mergeDebugJniLibFolders UP-TO-DATE+> Task :data:mergeDebugNativeLibs NO-SOURCE+> Task :data:copyDebugJniLibsProjectOnly UP-TO-DATE+> Task :player:mergeDebugJniLibFolders UP-TO-DATE+> Task :player:mergeDebugNativeLibs NO-SOURCE+> Task :player:copyDebugJniLibsProjectOnly UP-TO-DATE+> Task :app:mergeDebugNativeLibs UP-TO-DATE+> Task :app:stripDebugDebugSymbols UP-TO-DATE+> Task :app:validateSigningDebug UP-TO-DATE+> Task :app:writeDebugAppMetadata UP-TO-DATE+> Task :app:writeDebugSigningConfigVersions UP-TO-DATE+> Task :data:stripDebugDebugSymbols NO-SOURCE+> Task :data:copyDebugJniLibsProjectAndLocalJars UP-TO-DATE+> Task :data:extractDeepLinksForAarDebug UP-TO-DATE+> Task :data:prepareDebugArtProfile UP-TO-DATE+> Task :data:prepareLintJarForPublish UP-TO-DATE+> Task :player:stripDebugDebugSymbols NO-SOURCE+> Task :player:copyDebugJniLibsProjectAndLocalJars UP-TO-DATE+> Task :player:extractDebugAnnotations UP-TO-DATE+> Task :player:extractDeepLinksForAarDebug UP-TO-DATE+> Task :player:mergeDebugGeneratedProguardFiles UP-TO-DATE+> Task :player:mergeDebugConsumerProguardFiles UP-TO-DATE+> Task :player:prepareDebugArtProfile UP-TO-DATE+> Task :player:prepareLintJarForPublish UP-TO-DATE+> Task :player:mergeDebugJavaResource UP-TO-DATE+> Task :player:syncDebugLibJars UP-TO-DATE+> Task :player:bundleDebugAar UP-TO-DATE+> Task :player:assembleDebug UP-TO-DATE++> Task :data:kspDebugKotlin FAILED+e: [ksp] [MissingType]: Element 'com.streamvault.data.local.StreamVaultDatabase' references a type that is not present+e: Error occurred in KSP, check log for detail+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:39:13 Expecting ')'+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:39:26 Expecting an element+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:39:34 Expecting an element+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:52:13 Expecting member declaration+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:52:19 Expecting member declaration+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:52:20 Expecting member declaration+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:52:39 Expecting member declaration+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:52:41 Expecting member declaration+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:52:43 Expecting member declaration+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:75:1 Expecting a top level declaration++> Task :data:copyRoomSchemas NO-SOURCE++FAILURE: Build failed with an exception.++* What went wrong:+Execution failed for task ':data:kspDebugKotlin'.+> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction+ > Compilation error. See log for more details++* Try:+> Run with --stacktrace option to get the stack trace.+> Run with --info or --debug option to get more log output.+> Run with --scan to get full insights.+> Get more help at https://help.gradle.org.++BUILD FAILED in 4s+79 actionable tasks: 1 executed, 78 up-to-datediff --git a/build_log_utf8.txt b/build_log_utf8.txtnew file mode 100644index 00000000..f16da897--- /dev/null+++ b/build_log_utf8.txt@@ -0,0 +1,135 @@+๏ปฟ> Task :app:preBuild UP-TO-DATE+> Task :app:preDebugBuild UP-TO-DATE+> Task :app:mergeDebugNativeDebugMetadata NO-SOURCE+> Task :domain:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :domain:compileKotlin UP-TO-DATE+> Task :domain:compileJava NO-SOURCE+> Task :domain:processResources NO-SOURCE+> Task :domain:classes UP-TO-DATE+> Task :domain:jar UP-TO-DATE+> Task :app:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :data:preBuild UP-TO-DATE+> Task :data:preDebugBuild UP-TO-DATE+> Task :data:writeDebugAarMetadata UP-TO-DATE+> Task :player:preBuild UP-TO-DATE+> Task :player:preDebugBuild UP-TO-DATE+> Task :player:writeDebugAarMetadata UP-TO-DATE+> Task :app:checkDebugAarMetadata UP-TO-DATE+> Task :app:generateDebugResValues UP-TO-DATE+> Task :data:generateDebugResValues UP-TO-DATE+> Task :data:generateDebugResources UP-TO-DATE+> Task :data:packageDebugResources UP-TO-DATE+> Task :player:generateDebugResValues UP-TO-DATE+> Task :player:generateDebugResources UP-TO-DATE+> Task :player:packageDebugResources UP-TO-DATE+> Task :app:mapDebugSourceSetPaths UP-TO-DATE+> Task :app:generateDebugResources UP-TO-DATE+> Task :app:mergeDebugResources UP-TO-DATE+> Task :app:packageDebugResources UP-TO-DATE+> Task :app:parseDebugLocalResources UP-TO-DATE+> Task :app:createDebugCompatibleScreenManifests UP-TO-DATE+> Task :app:extractDeepLinksDebug UP-TO-DATE+> Task :data:extractDeepLinksDebug UP-TO-DATE+> Task :data:processDebugManifest UP-TO-DATE+> Task :player:extractDeepLinksDebug UP-TO-DATE+> Task :player:processDebugManifest UP-TO-DATE+> Task :app:processDebugMainManifest UP-TO-DATE+> Task :app:processDebugManifest UP-TO-DATE+> Task :app:processDebugManifestForPackage UP-TO-DATE+> Task :data:compileDebugLibraryResources UP-TO-DATE+> Task :data:parseDebugLocalResources UP-TO-DATE+> Task :data:generateDebugRFile UP-TO-DATE+> Task :player:compileDebugLibraryResources UP-TO-DATE+> Task :player:parseDebugLocalResources UP-TO-DATE+> Task :player:generateDebugRFile UP-TO-DATE+> Task :app:processDebugResources UP-TO-DATE+> Task :data:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :data:javaPreCompileDebug UP-TO-DATE+> Task :player:checkKotlinGradlePluginConfigurationErrors SKIPPED+> Task :player:kspDebugKotlin UP-TO-DATE+> Task :player:compileDebugKotlin UP-TO-DATE+> Task :player:javaPreCompileDebug UP-TO-DATE+> Task :player:compileDebugJavaWithJavac UP-TO-DATE+> Task :player:transformDebugClassesWithAsm UP-TO-DATE+> Task :player:bundleLibCompileToJarDebug UP-TO-DATE+> Task :app:javaPreCompileDebug UP-TO-DATE+> Task :app:mergeDebugShaders UP-TO-DATE+> Task :app:compileDebugShaders NO-SOURCE+> Task :app:generateDebugAssets UP-TO-DATE+> Task :data:mergeDebugShaders UP-TO-DATE+> Task :data:compileDebugShaders NO-SOURCE+> Task :data:generateDebugAssets UP-TO-DATE+> Task :data:packageDebugAssets UP-TO-DATE+> Task :player:mergeDebugShaders UP-TO-DATE+> Task :player:compileDebugShaders NO-SOURCE+> Task :player:generateDebugAssets UP-TO-DATE+> Task :player:packageDebugAssets UP-TO-DATE+> Task :app:mergeDebugAssets UP-TO-DATE+> Task :app:compressDebugAssets UP-TO-DATE+> Task :player:bundleLibRuntimeToJarDebug UP-TO-DATE+> Task :app:desugarDebugFileDependencies UP-TO-DATE+> Task :player:processDebugJavaRes UP-TO-DATE+> Task :app:checkDebugDuplicateClasses UP-TO-DATE+> Task :app:mergeExtDexDebug UP-TO-DATE+> Task :player:bundleLibRuntimeToDirDebug UP-TO-DATE+> Task :app:mergeDebugJniLibFolders UP-TO-DATE+> Task :data:mergeDebugJniLibFolders UP-TO-DATE+> Task :data:mergeDebugNativeLibs NO-SOURCE+> Task :data:copyDebugJniLibsProjectOnly UP-TO-DATE+> Task :player:mergeDebugJniLibFolders UP-TO-DATE+> Task :player:mergeDebugNativeLibs NO-SOURCE+> Task :player:copyDebugJniLibsProjectOnly UP-TO-DATE+> Task :app:mergeDebugNativeLibs UP-TO-DATE+> Task :app:stripDebugDebugSymbols UP-TO-DATE+> Task :app:validateSigningDebug UP-TO-DATE+> Task :app:writeDebugAppMetadata UP-TO-DATE+> Task :app:writeDebugSigningConfigVersions UP-TO-DATE+> Task :data:stripDebugDebugSymbols NO-SOURCE+> Task :data:copyDebugJniLibsProjectAndLocalJars UP-TO-DATE+> Task :data:extractDeepLinksForAarDebug UP-TO-DATE+> Task :data:prepareDebugArtProfile UP-TO-DATE+> Task :data:prepareLintJarForPublish UP-TO-DATE+> Task :player:stripDebugDebugSymbols NO-SOURCE+> Task :player:copyDebugJniLibsProjectAndLocalJars UP-TO-DATE+> Task :player:extractDebugAnnotations UP-TO-DATE+> Task :player:extractDeepLinksForAarDebug UP-TO-DATE+> Task :player:mergeDebugGeneratedProguardFiles UP-TO-DATE+> Task :player:mergeDebugConsumerProguardFiles UP-TO-DATE+> Task :player:prepareDebugArtProfile UP-TO-DATE+> Task :player:prepareLintJarForPublish UP-TO-DATE+> Task :player:mergeDebugJavaResource UP-TO-DATE+> Task :player:syncDebugLibJars UP-TO-DATE+> Task :player:bundleDebugAar UP-TO-DATE+> Task :player:assembleDebug UP-TO-DATE++> Task :data:kspDebugKotlin FAILED+e: [ksp] [MissingType]: Element 'com.streamvault.data.local.StreamVaultDatabase' references a type that is not present+e: Error occurred in KSP, check log for detail+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:39:13 Expecting ')'+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:39:26 Expecting an element+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:39:34 Expecting an element+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:52:13 Expecting member declaration+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:52:19 Expecting member declaration+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:52:20 Expecting member declaration+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:52:39 Expecting member declaration+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:52:41 Expecting member declaration+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:52:43 Expecting member declaration+e: file:///C:/Users/david/.gemini/antigravity/scratch/iptv-player/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt:75:1 Expecting a top level declaration++> Task :data:copyRoomSchemas NO-SOURCE++FAILURE: Build failed with an exception.++* What went wrong:+Execution failed for task ':data:kspDebugKotlin'.+> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction+ > Compilation error. See log for more details++* Try:+> Run with --stacktrace option to get the stack trace.+> Run with --info or --debug option to get more log output.+> Run with --scan to get full insights.+> Get more help at https://help.gradle.org.++BUILD FAILED in 3s+79 actionable tasks: 1 executed, 78 up-to-datediff --git a/build_output.txt b/build_output.txtindex 304c7174..df21c7a8 100644Binary files a/build_output.txt and b/build_output.txt differdiff --git a/data/schemas/com.streamvault.data.local.StreamVaultDatabase/1.json b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/1.jsonindex 96d18a91..adcbf111 100644--- a/data/schemas/com.streamvault.data.local.StreamVaultDatabase/1.json+++ b/data/schemas/com.streamvault.data.local.StreamVaultDatabase/1.json@@ -2,7 +2,7 @@"formatVersion": 1,"database": {"version": 1,- "identityHash": "15b565221157cd14c584e8fb02ef82d1",+ "identityHash": "2607ef936d82d6579c34e49871f8ee3d","entities": [{"tableName": "providers",@@ -922,14 +922,15 @@},"indices": [{- "name": "index_favorites_content_id_content_type",+ "name": "index_favorites_content_id_content_type_group_id","unique": true,"columnNames": ["content_id",- "content_type"+ "content_type",+ "group_id"],"orders": [],- "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_favorites_content_id_content_type` ON `${TABLE_NAME}` (`content_id`, `content_type`)"+ "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_favorites_content_id_content_type_group_id` ON `${TABLE_NAME}` (`content_id`, `content_type`, `group_id`)"},{"name": "index_favorites_group_id",@@ -1010,7 +1011,7 @@"views": [],"setupQueries": ["CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",- "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '15b565221157cd14c584e8fb02ef82d1')"+ "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '2607ef936d82d6579c34e49871f8ee3d')"]}}\ No newline at end of filediff --git a/data/src/main/java/com/streamvault/data/local/dao/Daos.kt b/data/src/main/java/com/streamvault/data/local/dao/Daos.ktindex 4cf0079e..17db4852 100644--- a/data/src/main/java/com/streamvault/data/local/dao/Daos.kt+++ b/data/src/main/java/com/streamvault/data/local/dao/Daos.kt@@ -12,6 +12,9 @@ interface ProviderDao {@Query("SELECT * FROM providers WHERE is_active = 1 LIMIT 1")fun getActive(): Flow<ProviderEntity?>+ @Query("SELECT * FROM providers WHERE server_url = :serverUrl AND username = :username")+ suspend fun getByUrlAndUser(serverUrl: String, username: String): ProviderEntity?+@Query("SELECT * FROM providers WHERE id = :id")suspend fun getById(id: Long): ProviderEntity?@@ -62,6 +65,12 @@ interface ChannelDao {@Query("SELECT * FROM channels WHERE id IN (:ids)")fun getByIds(ids: List<Long>): Flow<List<ChannelEntity>>++ @Query("SELECT category_id, COUNT(*) as item_count FROM channels WHERE provider_id = :providerId GROUP BY category_id")+ fun getCategoryCounts(providerId: Long): Flow<List<CategoryCount>>++ @Query("SELECT COUNT(*) FROM channels WHERE provider_id = :providerId")+ fun getCount(providerId: Long): Flow<Int>}@Dao@@ -98,6 +107,12 @@ interface MovieDao {deleteByProvider(providerId)insertAll(movies)}++ @Query("SELECT category_id, COUNT(*) as item_count FROM movies WHERE provider_id = :providerId GROUP BY category_id")+ fun getCategoryCounts(providerId: Long): Flow<List<CategoryCount>>++ @Query("SELECT COUNT(*) FROM movies WHERE provider_id = :providerId")+ fun getCount(providerId: Long): Flow<Int>}@Dao@@ -125,8 +140,15 @@ interface SeriesDao {deleteByProvider(providerId)insertAll(series)}++ @Query("SELECT category_id, COUNT(*) as item_count FROM series WHERE provider_id = :providerId GROUP BY category_id")+ fun getCategoryCounts(providerId: Long): Flow<List<CategoryCount>>++ @Query("SELECT COUNT(*) FROM series WHERE provider_id = :providerId")+ fun getCount(providerId: Long): Flow<Int>}+@Daointerface EpisodeDao {@Query("SELECT * FROM episodes WHERE series_id = :seriesId ORDER BY season_number ASC, episode_number ASC")@@ -186,20 +208,29 @@ interface ProgramDao {@Daointerface FavoriteDao {- @Query("SELECT * FROM favorites ORDER BY position ASC")- fun getAll(): Flow<List<FavoriteEntity>>+ @Query("SELECT * FROM favorites WHERE group_id IS NULL ORDER BY position ASC")+ fun getAllGlobal(): Flow<List<FavoriteEntity>>- @Query("SELECT * FROM favorites WHERE content_type = :contentType ORDER BY position ASC")- fun getByType(contentType: String): Flow<List<FavoriteEntity>>+ @Query("SELECT * FROM favorites WHERE content_type = :contentType AND group_id IS NULL ORDER BY position ASC")+ fun getGlobalByType(contentType: String): Flow<List<FavoriteEntity>>@Query("SELECT * FROM favorites WHERE group_id = :groupId ORDER BY position ASC")fun getByGroup(groupId: Long): Flow<List<FavoriteEntity>>- @Query("SELECT * FROM favorites WHERE content_id = :contentId AND content_type = :contentType LIMIT 1")- suspend fun get(contentId: Long, contentType: String): FavoriteEntity?+ @Query("SELECT * FROM favorites WHERE content_id = :contentId AND content_type = :contentType AND (:groupId IS NULL AND group_id IS NULL OR group_id = :groupId) LIMIT 1")+ suspend fun get(contentId: Long, contentType: String, groupId: Long?): FavoriteEntity?++ @Query("SELECT COUNT(*) FROM favorites WHERE group_id IS NULL AND content_type = 'LIVE'")+ fun getGlobalLiveCount(): Flow<Int>++ @Query("SELECT group_id as category_id, COUNT(*) as item_count FROM favorites WHERE group_id IS NOT NULL AND content_type = 'LIVE' GROUP BY group_id")+ fun getGroupLiveCounts(): Flow<List<CategoryCount>>++ @Query("SELECT group_id FROM favorites WHERE content_id = :contentId AND content_type = :contentType AND group_id IS NOT NULL")+ suspend fun getGroupMemberships(contentId: Long, contentType: String): List<Long>- @Query("SELECT MAX(position) FROM favorites")- suspend fun getMaxPosition(): Int?+ @Query("SELECT MAX(position) FROM favorites WHERE (:groupId IS NULL AND group_id IS NULL OR group_id = :groupId)")+ suspend fun getMaxPosition(groupId: Long?): Int?@Insert(onConflict = OnConflictStrategy.REPLACE)suspend fun insert(favorite: FavoriteEntity)@@ -207,8 +238,8 @@ interface FavoriteDao {@Updatesuspend fun updateAll(favorites: List<FavoriteEntity>)- @Query("DELETE FROM favorites WHERE content_id = :contentId AND content_type = :contentType")- suspend fun delete(contentId: Long, contentType: String)+ @Query("DELETE FROM favorites WHERE content_id = :contentId AND content_type = :contentType AND (:groupId IS NULL AND group_id IS NULL OR group_id = :groupId)")+ suspend fun delete(contentId: Long, contentType: String, groupId: Long?)@Query("UPDATE favorites SET group_id = :groupId WHERE id = :favoriteId")suspend fun updateGroup(favoriteId: Long, groupId: Long?)diff --git a/data/src/main/java/com/streamvault/data/local/entity/Entities.kt b/data/src/main/java/com/streamvault/data/local/entity/Entities.ktindex 1a3611a5..e7f82445 100644--- a/data/src/main/java/com/streamvault/data/local/entity/Entities.kt+++ b/data/src/main/java/com/streamvault/data/local/entity/Entities.kt@@ -186,7 +186,7 @@ data class ProgramEntity(@Entity(tableName = "favorites",indices = [- Index(value = ["content_id", "content_type"], unique = true),+ Index(value = ["content_id", "content_type", "group_id"], unique = true),Index(value = ["group_id"]),Index(value = ["position"])]@@ -213,3 +213,10 @@ data class VirtualGroupEntity(val position: Int = 0,@ColumnInfo(name = "created_at") val createdAt: Long = System.currentTimeMillis())++data class CategoryCount(+ @ColumnInfo(name = "category_id") val categoryId: Long,+ @ColumnInfo(name = "item_count") val item_count: Int+)++diff --git a/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt b/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.ktindex a674be95..84f9e368 100644--- a/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt+++ b/data/src/main/java/com/streamvault/data/repository/ChannelRepositoryImpl.kt@@ -2,6 +2,7 @@ package com.streamvault.data.repositoryimport com.streamvault.data.local.dao.CategoryDaoimport com.streamvault.data.local.dao.ChannelDao+import com.streamvault.data.local.entity.CategoryCountimport com.streamvault.data.mapper.toDomainimport com.streamvault.domain.model.Categoryimport com.streamvault.domain.model.Channel@@ -10,6 +11,7 @@ import com.streamvault.domain.model.Resultimport com.streamvault.domain.repository.ChannelRepositoryimport kotlinx.coroutines.flow.Flowimport kotlinx.coroutines.flow.map+import kotlinx.coroutines.flow.combineimport javax.inject.Injectimport javax.inject.Singleton@@ -23,11 +25,33 @@ class ChannelRepositoryImpl @Inject constructor(channelDao.getByProvider(providerId).map { entities -> entities.map { it.toDomain() } }override fun getChannelsByCategory(providerId: Long, categoryId: Long): Flow<List<Channel>> =- channelDao.getByCategory(providerId, categoryId).map { entities -> entities.map { it.toDomain() } }+ if (categoryId == ChannelRepository.ALL_CHANNELS_ID) {+ channelDao.getByProvider(providerId).map { entities -> entities.map { it.toDomain() } }+ } else {+ channelDao.getByCategory(providerId, categoryId).map { entities -> entities.map { it.toDomain() } }+ }override fun getCategories(providerId: Long): Flow<List<Category>> =- categoryDao.getByProviderAndType(providerId, ContentType.LIVE.name)- .map { entities -> entities.map { it.toDomain() } }+ combine(+ categoryDao.getByProviderAndType(providerId, ContentType.LIVE.name),+ channelDao.getCategoryCounts(providerId),+ channelDao.getCount(providerId)+ ) { categories, counts, totalCount ->+ val countMap = counts.associate { it.categoryId to it.item_count }++ val allChannelsCategory = Category(+ id = ChannelRepository.ALL_CHANNELS_ID,+ name = "All Channels",+ type = ContentType.LIVE,+ count = totalCount+ )++ val mappedCategories = categories.map { entity ->+ entity.toDomain().copy(count = countMap[entity.categoryId] ?: 0)+ }++ listOf(allChannelsCategory) + mappedCategories+ }override fun searchChannels(providerId: Long, query: String): Flow<List<Channel>> =channelDao.search(providerId, query).map { entities -> entities.map { it.toDomain() } }diff --git a/data/src/main/java/com/streamvault/data/repository/FavoriteRepositoryImpl.kt b/data/src/main/java/com/streamvault/data/repository/FavoriteRepositoryImpl.ktindex 6e0e207f..76c436ec 100644--- a/data/src/main/java/com/streamvault/data/repository/FavoriteRepositoryImpl.kt+++ b/data/src/main/java/com/streamvault/data/repository/FavoriteRepositoryImpl.kt@@ -2,6 +2,7 @@ package com.streamvault.data.repositoryimport com.streamvault.data.local.dao.FavoriteDaoimport com.streamvault.data.local.dao.VirtualGroupDao+import com.streamvault.data.local.entity.CategoryCountimport com.streamvault.data.mapper.toDomainimport com.streamvault.data.mapper.toEntityimport com.streamvault.domain.model.*@@ -19,9 +20,9 @@ class FavoriteRepositoryImpl @Inject constructor(override fun getFavorites(contentType: ContentType?): Flow<List<Favorite>> {val flow = if (contentType != null) {- favoriteDao.getByType(contentType.name)+ favoriteDao.getGlobalByType(contentType.name)} else {- favoriteDao.getAll()+ favoriteDao.getAllGlobal()}return flow.map { entities -> entities.map { it.toDomain() } }}@@ -32,12 +33,19 @@ class FavoriteRepositoryImpl @Inject constructor(override fun getGroups(): Flow<List<VirtualGroup>> =virtualGroupDao.getAll().map { entities -> entities.map { it.toDomain() } }+ override fun getGlobalLiveFavoriteCount(): Flow<Int> =+ favoriteDao.getGlobalLiveCount()++ override fun getGroupLiveFavoriteCounts(): Flow<Map<Long, Int>> =+ favoriteDao.getGroupLiveCounts()+ .map { list -> list.associate { it.categoryId to it.item_count } }+override suspend fun addFavorite(contentId: Long,contentType: ContentType,groupId: Long?): Result<Unit> = try {- val maxPos = favoriteDao.getMaxPosition() ?: -1+ val maxPos = favoriteDao.getMaxPosition(groupId) ?: -1val favorite = Favorite(contentId = contentId,contentType = contentType,@@ -50,8 +58,8 @@ class FavoriteRepositoryImpl @Inject constructor(Result.error("Failed to add favorite: ${e.message}", e)}- override suspend fun removeFavorite(contentId: Long, contentType: ContentType): Result<Unit> = try {- favoriteDao.delete(contentId, contentType.name)+ override suspend fun removeFavorite(contentId: Long, contentType: ContentType, groupId: Long?): Result<Unit> = try {+ favoriteDao.delete(contentId, contentType.name, groupId)Result.success(Unit)} catch (e: Exception) {Result.error("Failed to remove favorite: ${e.message}", e)@@ -67,8 +75,12 @@ class FavoriteRepositoryImpl @Inject constructor(Result.error("Failed to reorder favorites: ${e.message}", e)}+ // Checks if content is in Global Favorites (groupId = null)override suspend fun isFavorite(contentId: Long, contentType: ContentType): Boolean =- favoriteDao.get(contentId, contentType.name) != null+ favoriteDao.get(contentId, contentType.name, null) != null++ override suspend fun getGroupMemberships(contentId: Long, contentType: ContentType): List<Long> =+ favoriteDao.getGroupMemberships(contentId, contentType.name)override suspend fun createGroup(name: String, iconEmoji: String?): Result<VirtualGroup> = try {val id = virtualGroupDao.insert(@@ -95,11 +107,4 @@ class FavoriteRepositoryImpl @Inject constructor(} catch (e: Exception) {Result.error("Failed to rename group: ${e.message}", e)}-- override suspend fun moveToGroup(favoriteId: Long, groupId: Long?): Result<Unit> = try {- favoriteDao.updateGroup(favoriteId, groupId)- Result.success(Unit)- } catch (e: Exception) {- Result.error("Failed to move favorite: ${e.message}", e)- }}diff --git a/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt b/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.ktindex 9e72de5f..f6a528d6 100644--- a/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt+++ b/data/src/main/java/com/streamvault/data/repository/ProviderRepositoryImpl.kt@@ -2,6 +2,7 @@ package com.streamvault.data.repositoryimport com.streamvault.data.local.dao.*import com.streamvault.data.local.entity.CategoryEntity+import com.streamvault.data.local.entity.ProviderEntityimport com.streamvault.data.mapper.*import com.streamvault.data.parser.M3uParserimport com.streamvault.data.remote.xtream.XtreamApiService@@ -80,70 +81,117 @@ class ProviderRepositoryImpl @Inject constructor(serverUrl: String,username: String,password: String,- name: String+ name: String,+ onProgress: ((String) -> Unit)?): Result<Provider> {+ onProgress?.invoke("Authenticating...")val provider = createXtreamProvider(0, serverUrl, username, password)return when (val authResult = provider.authenticate()) {is Result.Success -> {- // Use the provided name, or fallback to server's name if empty- val providerData = authResult.data.copy(- name = name.ifBlank { authResult.data.name }- )- val id = providerDao.insert(providerData.toEntity())- providerDao.deactivateAll()- providerDao.activate(id)- val savedProvider = providerData.copy(id = id)- // Auto-refresh: fetch all channels, movies, series immediately+ // Check if provider already exists+ val existingProvider = providerDao.getByUrlAndUser(serverUrl, username)++ val providerData = if (existingProvider != null) {+ onProgress?.invoke("Updating existing provider...")+ // Update existing provider details+ val updated = existingProvider.copy(+ name = name.ifBlank { existingProvider.name },+ password = password, // Update password if changed+ isActive = true,+ lastSyncedAt = 0 // Reset sync time to force update? Or keep?+ )+ providerDao.update(updated)+ updated.toDomain()+ } else {+ // Use the provided name, or fallback to server's name if empty+ val newData = authResult.data.copy(+ name = name.ifBlank { authResult.data.name }+ )+ val id = providerDao.insert(newData.toEntity())+ newData.copy(id = id)+ }++ val id = providerData.id+try {- refreshXtreamData(savedProvider)+ providerDao.deactivateAll()+ providerDao.activate(id)++ // Auto-refresh: fetch all channels, movies, series immediately+ refreshXtreamData(providerData, onProgress)providerDao.updateSyncTime(id, System.currentTimeMillis())- } catch (_: Exception) {- // Provider is added even if initial refresh fails++ Result.success(providerData)+ } catch (e: Exception) {+ // If it was a NEW provider and failed, delete it.+ // If it was EXISTING, maybe don't delete?+ if (existingProvider == null) {+ providerDao.delete(id)+ }+ Result.error("Sync failed: ${e.message}", e)}- Result.success(savedProvider)}is Result.Error -> Result.error(authResult.message, authResult.exception)is Result.Loading -> Result.error("Unexpected loading state")}}- override suspend fun validateM3u(url: String, name: String): Result<Provider> = try {- // For M3U, we create a provider entry and validate the URL is reachable+ override suspend fun validateM3u(url: String, name: String, onProgress: ((String) -> Unit)?): Result<Provider> = try {+ onProgress?.invoke("Validating playlist URL...")val providerName = name.ifBlank {url.substringAfterLast("/").substringBefore("?").ifBlank { "M3U Playlist" }}- val provider = Provider(- name = providerName,- type = ProviderType.M3U,- serverUrl = url,- m3uUrl = url,- status = ProviderStatus.ACTIVE- )- val id = providerDao.insert(provider.toEntity())- providerDao.deactivateAll()- providerDao.activate(id)- val savedProvider = provider.copy(id = id)- // Auto-refresh: download and parse M3U immediately+ // Check for existing+ val existingProvider = providerDao.getByUrlAndUser(url, "")++ val providerData = if (existingProvider != null) {+ val updated = existingProvider.copy(+ name = if (name.isNotBlank()) name else existingProvider.name,+ isActive = true+ )+ providerDao.update(updated)+ updated.toDomain()+ } else {+ val provider = Provider(+ name = providerName,+ type = ProviderType.M3U,+ serverUrl = url,+ m3uUrl = url,+ status = ProviderStatus.ACTIVE+ )+ val id = providerDao.insert(provider.toEntity())+ provider.copy(id = id)+ }++ val id = providerData.id+try {- refreshM3uData(savedProvider)+ providerDao.deactivateAll()+ providerDao.activate(id)++ refreshM3uData(providerData, onProgress)providerDao.updateSyncTime(id, System.currentTimeMillis())- } catch (_: Exception) {- // Provider is added even if initial parsing fails++ Result.success(providerData)+ } catch (e: Exception) {+ if (existingProvider == null) {+ providerDao.delete(id)+ }+ throw e}- Result.success(savedProvider)} catch (e: Exception) {Result.error("Failed to add M3U provider: ${e.message}", e)}- override suspend fun refreshProviderData(providerId: Long): Result<Unit> = try {+ override suspend fun refreshProviderData(providerId: Long, onProgress: ((String) -> Unit)?): Result<Unit> = try {val providerEntity = providerDao.getById(providerId)?: return Result.error("Provider not found")val provider = providerEntity.toDomain()when (provider.type) {- ProviderType.XTREAM_CODES -> refreshXtreamData(provider)- ProviderType.M3U -> refreshM3uData(provider)+ ProviderType.XTREAM_CODES -> refreshXtreamData(provider, onProgress)+ ProviderType.M3U -> refreshM3uData(provider, onProgress)}providerDao.updateSyncTime(providerId, System.currentTimeMillis())@@ -152,34 +200,51 @@ class ProviderRepositoryImpl @Inject constructor(Result.error("Failed to refresh provider data: ${e.message}", e)}- private suspend fun refreshXtreamData(provider: Provider) {+ private suspend fun refreshXtreamData(provider: Provider, onProgress: ((String) -> Unit)? = null) {+ onProgress?.invoke("Connecting to server...")val xtreamProvider = createXtreamProvider(provider.id, provider.serverUrl, provider.username, provider.password)// Refresh live categories & channels- xtreamProvider.getLiveCategories().getOrNull()?.let { categories ->+ onProgress?.invoke("Downloading Live TV...")+ val liveCatsResult = xtreamProvider.getLiveCategories()+ if (liveCatsResult is Result.Error) throw Exception("Failed to fetch Live Categories: ${liveCatsResult.message}")++ liveCatsResult.getOrNull()?.let { categories ->categoryDao.replaceAll(provider.id, "LIVE",categories.map { it.toEntity(provider.id) })}- xtreamProvider.getLiveStreams().getOrNull()?.let { channels ->++ val liveStreamsResult = xtreamProvider.getLiveStreams()+ if (liveStreamsResult is Result.Error) throw Exception("Failed to fetch Live Streams: ${liveStreamsResult.message}")++ liveStreamsResult.getOrNull()?.let { channels ->channelDao.replaceAll(provider.id, channels.map { it.toEntity() })}// Refresh VOD categories & movies- xtreamProvider.getVodCategories().getOrNull()?.let { categories ->+ onProgress?.invoke("Downloading Movies...")+ val vodCatsResult = xtreamProvider.getVodCategories()+ // Don't fail entire sync if VOD fails, but maybe log it? For now, let's keep it strict or lenient?+ // User complaint was "nothing loads". If connection works for auth, it should work for data.+ // Let's be semi-strict: If Live works, we're good. If VOD fails, just log.++ vodCatsResult.getOrNull()?.let { categories ->categoryDao.replaceAll(provider.id, "MOVIE",categories.map { it.toEntity(provider.id) })}+xtreamProvider.getVodStreams().getOrNull()?.let { movies ->movieDao.replaceAll(provider.id, movies.map { it.toEntity() })}// Refresh series categories & series+ onProgress?.invoke("Downloading Series...")xtreamProvider.getSeriesCategories().getOrNull()?.let { categories ->categoryDao.replaceAll(provider.id, "SERIES",@@ -191,18 +256,18 @@ class ProviderRepositoryImpl @Inject constructor(}// Refresh EPG (XMLTV)- // Construct XMLTV URL: http://server:port/xmltv.php?username=...&password=...try {+ onProgress?.invoke("Downloading EPG...")val serverUrl = provider.serverUrl.trimEnd('/')val xmltvUrl = "$serverUrl/xmltv.php?username=${provider.username}&password=${provider.password}"epgRepository.refreshEpg(provider.id, xmltvUrl)} catch (e: Exception) {- // Log error but don't fail the whole refresh if EPG failse.printStackTrace()}}- private suspend fun refreshM3uData(provider: Provider) = withContext(Dispatchers.IO) {+ private suspend fun refreshM3uData(provider: Provider, onProgress: ((String) -> Unit)? = null) = withContext(Dispatchers.IO) {+ onProgress?.invoke("Downloading Playlist...")val m3uUrl = provider.m3uUrl.ifBlank { provider.serverUrl }val request = Request.Builder().url(m3uUrl).build()val response = okHttpClient.newCall(request).execute()@@ -213,6 +278,7 @@ class ProviderRepositoryImpl @Inject constructor(val body = response.body ?: throw Exception("Empty M3U response")+ onProgress?.invoke("Parsing Playlist...")val entries = body.byteStream().use { inputStream ->m3uParser.parse(inputStream)}@@ -226,6 +292,7 @@ class ProviderRepositoryImpl @Inject constructor(val vodGroups = vodEntries.map { it.groupTitle }.distinct()// Insert live categories+ onProgress?.invoke("Saving Channels...")val liveCategories = liveGroups.mapIndexed { index, name ->CategoryEntity(categoryId = (index + 1).toLong(),@@ -238,6 +305,7 @@ class ProviderRepositoryImpl @Inject constructor(categoryDao.replaceAll(provider.id, "LIVE", liveCategories)// Insert VOD categories+ onProgress?.invoke("Saving Movies...")val vodCategories = vodGroups.mapIndexed { index, name ->CategoryEntity(categoryId = (index + 10000).toLong(),diff --git a/domain/src/main/java/com/streamvault/domain/model/Category.kt b/domain/src/main/java/com/streamvault/domain/model/Category.ktindex 2739ec0d..46462db7 100644--- a/domain/src/main/java/com/streamvault/domain/model/Category.kt+++ b/domain/src/main/java/com/streamvault/domain/model/Category.kt@@ -5,5 +5,6 @@ data class Category(val name: String,val parentId: Long? = null,val type: ContentType = ContentType.LIVE,- val isVirtual: Boolean = false+ val isVirtual: Boolean = false,+ val count: Int = 0)diff --git a/domain/src/main/java/com/streamvault/domain/repository/ChannelRepository.kt b/domain/src/main/java/com/streamvault/domain/repository/ChannelRepository.ktindex 239e5f1f..264bf6a5 100644--- a/domain/src/main/java/com/streamvault/domain/repository/ChannelRepository.kt+++ b/domain/src/main/java/com/streamvault/domain/repository/ChannelRepository.kt@@ -14,4 +14,8 @@ interface ChannelRepository {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 = -1L+ }}diff --git a/domain/src/main/java/com/streamvault/domain/repository/FavoriteRepository.kt b/domain/src/main/java/com/streamvault/domain/repository/FavoriteRepository.ktindex 56654a56..7e9aac48 100644--- a/domain/src/main/java/com/streamvault/domain/repository/FavoriteRepository.kt+++ b/domain/src/main/java/com/streamvault/domain/repository/FavoriteRepository.kt@@ -10,12 +10,19 @@ 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): 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>- suspend fun moveToGroup(favoriteId: Long, groupId: Long?): Result<Unit>}diff --git a/domain/src/main/java/com/streamvault/domain/repository/ProviderRepository.kt b/domain/src/main/java/com/streamvault/domain/repository/ProviderRepository.ktindex 95f28f66..9e2628ec 100644--- a/domain/src/main/java/com/streamvault/domain/repository/ProviderRepository.kt+++ b/domain/src/main/java/com/streamvault/domain/repository/ProviderRepository.kt@@ -12,7 +12,7 @@ interface ProviderRepository {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): Result<Provider>- suspend fun validateM3u(url: String, name: String): Result<Provider>- suspend fun refreshProviderData(providerId: Long): Result<Unit>+ suspend fun loginXtream(serverUrl: String, username: String, password: String, name: String, onProgress: ((String) -> Unit)? = null): Result<Provider>+ suspend fun validateM3u(url: String, name: String, onProgress: ((String) -> Unit)? = null): Result<Provider>+ suspend fun refreshProviderData(providerId: Long, onProgress: ((String) -> Unit)? = null): Result<Unit>}diff --git a/domain/src/main/java/com/streamvault/domain/usecase/GetCustomCategories.kt b/domain/src/main/java/com/streamvault/domain/usecase/GetCustomCategories.ktindex 57b17412..6cf1c7b4 100644--- a/domain/src/main/java/com/streamvault/domain/usecase/GetCustomCategories.kt+++ b/domain/src/main/java/com/streamvault/domain/usecase/GetCustomCategories.kt@@ -11,13 +11,19 @@ class GetCustomCategories @Inject constructor(private val favoriteRepository: FavoriteRepository) {operator fun invoke(): Flow<List<Category>> {- return favoriteRepository.getGroups().map { groups ->+ return kotlinx.coroutines.flow.combine(+ favoriteRepository.getGroups(),+ favoriteRepository.getGlobalLiveFavoriteCount(),+ favoriteRepository.getGroupLiveFavoriteCounts()+ ) { groups, globalCount, groupCounts ->+val categories = groups.map { group ->Category(- id = -group.id, // Use negative ID for virtual groups to avoid collision with provider IDs+ id = -group.id, // Use negative ID for virtual groupsname = group.name,type = ContentType.LIVE,- isVirtual = true+ isVirtual = true,+ count = groupCounts[group.id] ?: 0)}.toMutableList()@@ -26,7 +32,8 @@ class GetCustomCategories @Inject constructor(id = -999L, // Special ID for "All Favorites"name = "โ Favorites",type = ContentType.LIVE,- isVirtual = true+ isVirtual = true,+ count = globalCount))categories