StreamVault is a TV-first free IPTV player for Android TV built with Kotlin, Jetpack Compose, Room, Hilt, and Media3.
Kotlin iptv-player
favorites customization added
David Nashash9e7376645639
diff --git a/app/src/main/java/com/streamvault/app/MainActivity.kt b/app/src/main/java/com/streamvault/app/MainActivity.ktindex 5ae9b1c2..75c09815 100644--- a/app/src/main/java/com/streamvault/app/MainActivity.kt+++ b/app/src/main/java/com/streamvault/app/MainActivity.kt@@ -24,6 +24,10 @@ import com.streamvault.app.tv.WatchNextManagerimport com.streamvault.app.tvinput.TvInputChannelSyncManagerimport com.streamvault.app.ui.theme.StreamVaultThemeimport com.streamvault.app.ui.time.LocalAppTimeFormat+import com.streamvault.domain.repository.ChannelRepository+import com.streamvault.domain.repository.CombinedM3uRepository+import com.streamvault.domain.repository.FavoriteRepository+import com.streamvault.domain.repository.PlaybackHistoryRepositoryimport dagger.hilt.android.AndroidEntryPointimport javax.inject.Inject@@ -73,6 +77,18 @@ class MainActivity : ComponentActivity() {@Injectlateinit var preferencesRepository: PreferencesRepository+ @Inject+ lateinit var combinedM3uRepository: CombinedM3uRepository++ @Inject+ lateinit var favoriteRepository: FavoriteRepository++ @Inject+ lateinit var playbackHistoryRepository: PlaybackHistoryRepository++ @Inject+ lateinit var channelRepository: ChannelRepository+@Injectlateinit var watchNextManager: WatchNextManagerdiff --git a/app/src/main/java/com/streamvault/app/navigation/AppNavigation.kt b/app/src/main/java/com/streamvault/app/navigation/AppNavigation.ktindex edd4121f..c19ddd22 100644--- a/app/src/main/java/com/streamvault/app/navigation/AppNavigation.kt+++ b/app/src/main/java/com/streamvault/app/navigation/AppNavigation.kt@@ -4,6 +4,8 @@ import android.net.Uriimport android.util.Logimport androidx.compose.runtime.Composableimport androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.produceStateimport androidx.lifecycle.Lifecycleimport androidx.lifecycle.LifecycleEventObserverimport androidx.lifecycle.compose.collectAsStateWithLifecycle@@ -35,11 +37,15 @@ import com.streamvault.app.ui.screens.downloads.DownloadsScreenimport com.streamvault.app.MainActivityimport com.streamvault.domain.model.AppLandingDestinationimport com.streamvault.domain.model.AppTopLevelDestination+import com.streamvault.domain.model.ContentTypeimport com.streamvault.domain.model.MovieDetailPresentationHint+import com.streamvault.domain.model.ActiveLiveSourceimport com.streamvault.domain.model.Seriesimport com.streamvault.domain.model.SeriesDetailPresentationHint+import com.streamvault.domain.model.VirtualCategoryIdsimport java.io.Serializableimport kotlin.coroutines.resume+import kotlinx.coroutines.flow.firstimport kotlinx.coroutines.suspendCancellableCoroutine@@ -48,6 +54,11 @@ internal const val MOVIE_DETAIL_PRESENTATION_HINT_KEY = "movie_detail_presentatiinternal const val SERIES_DETAIL_PRESENTATION_HINT_KEY = "series_detail_presentation_hint"private const val TAG = "AppNavigation"+private sealed interface StartupNavigationTarget {+ data class Route(val route: String) : StartupNavigationTarget+ data class Player(val request: PlayerNavigationRequest) : StartupNavigationTarget+}+data class PlayerNavigationRequest(val streamUrl: String,val title: String,@@ -303,6 +314,8 @@ private fun NavHostController.navigateToExternalPlayer(request: PlayerNavigationinternal fun AppLandingDestination.toAppRoute(): String = when (this) {AppLandingDestination.HOME -> Routes.HOMEAppLandingDestination.LIVE_TV -> Routes.LIVE_TV+ AppLandingDestination.FIRST_FAVORITE_LIVE -> Routes.LIVE_TV+ AppLandingDestination.LAST_WATCHED_LIVE -> Routes.LIVE_TVAppLandingDestination.MOVIES -> Routes.MOVIESAppLandingDestination.SERIES -> Routes.SERIESAppLandingDestination.GUIDE -> Routes.EPG@@ -334,10 +347,35 @@ fun AppNavigation(mainActivity: MainActivity) {val appLandingDestination = mainActivity.preferencesRepository.appLandingDestination.collectAsStateWithLifecycle(initialValue = AppLandingDestination.HOME).value- val landingRoute = AppTopLevelDestination.resolveLandingDestination(+ val resolvedLandingDestination = AppTopLevelDestination.resolveLandingDestination(preferred = appLandingDestination,destinations = topLevelDestinations- ).toAppRoute()+ )+ val startupTarget by produceState<StartupNavigationTarget>(+ initialValue = StartupNavigationTarget.Route(resolvedLandingDestination.toAppRoute()),+ resolvedLandingDestination,+ topLevelDestinations+ ) {+ value = resolveStartupNavigationTarget(+ mainActivity = mainActivity,+ landingDestination = resolvedLandingDestination,+ destinations = topLevelDestinations+ )+ }++ fun navigateToStartupTarget(popUpRoute: String): Boolean = when (val target = startupTarget) {+ is StartupNavigationTarget.Route -> navController.navigateIfResumed(target.route) {+ popUpTo(popUpRoute) { inclusive = true }+ }+ is StartupNavigationTarget.Player -> {+ if (navController.navigateToPlayer(target.request)) {+ navController.popBackStack(popUpRoute, inclusive = true)+ true+ } else {+ false+ }+ }+ }LaunchedEffect(externalNavigationRequest, currentBackStackEntry) {val entry = currentBackStackEntry ?: return@LaunchedEffect@@ -401,9 +439,7 @@ fun AppNavigation(mainActivity: MainActivity) {composable(Routes.WELCOME) {WelcomeScreen(onNavigateToHome = dropUnlessResumed {- navController.navigate(landingRoute) {- popUpTo(Routes.WELCOME) { inclusive = true }- }+ navigateToStartupTarget(Routes.WELCOME)},onNavigateToSetup = dropUnlessResumed {navController.navigate(Routes.providerSetup()) {@@ -428,9 +464,7 @@ fun AppNavigation(mainActivity: MainActivity) {initialImportUri = importUri,onBack = { navController.popBackStack() },onProviderAdded = dropUnlessResumed {- navController.navigate(landingRoute) {- popUpTo(Routes.PROVIDER_SETUP) { inclusive = true }- }+ navigateToStartupTarget(Routes.PROVIDER_SETUP)})}@@ -868,3 +902,117 @@ fun AppNavigation(mainActivity: MainActivity) {}}}++private suspend fun resolveStartupNavigationTarget(+ mainActivity: MainActivity,+ landingDestination: AppLandingDestination,+ destinations: List<AppTopLevelDestination>+): StartupNavigationTarget {+ val fallback = fallbackStartupNavigationTarget(destinations)+ return when (landingDestination) {+ AppLandingDestination.FIRST_FAVORITE_LIVE -> resolveFirstFavoriteStartupTarget(mainActivity) ?: fallback+ AppLandingDestination.LAST_WATCHED_LIVE -> resolveLastWatchedStartupTarget(mainActivity) ?: fallback+ else -> StartupNavigationTarget.Route(landingDestination.toAppRoute())+ }+}++private fun fallbackStartupNavigationTarget(+ destinations: List<AppTopLevelDestination>+): StartupNavigationTarget = StartupNavigationTarget.Route(+ AppTopLevelDestination.resolveLandingDestination(+ preferred = AppLandingDestination.LIVE_TV,+ destinations = destinations+ ).toAppRoute()+)++private suspend fun resolveFirstFavoriteStartupTarget(+ mainActivity: MainActivity+): StartupNavigationTarget.Player? {+ if (!mainActivity.preferencesRepository.showFavoritesCategory.first()) return null+ val context = resolveLiveStartupContext(mainActivity) ?: return null+ val favorites = when (context) {+ is LiveStartupContext.Provider -> mainActivity.favoriteRepository.getFavorites(context.providerId, ContentType.LIVE).first()+ is LiveStartupContext.Combined -> mainActivity.favoriteRepository.getFavorites(context.providerIds, ContentType.LIVE).first()+ }.sortedBy { it.position }+ return resolveStartupChannelTarget(+ mainActivity = mainActivity,+ channelIds = favorites.map { it.contentId },+ sourceContext = context,+ virtualCategoryId = VirtualCategoryIds.FAVORITES+ )+}++private suspend fun resolveLastWatchedStartupTarget(+ mainActivity: MainActivity+): StartupNavigationTarget.Player? {+ val context = resolveLiveStartupContext(mainActivity) ?: return null+ val recentHistory = when (context) {+ is LiveStartupContext.Provider -> mainActivity.playbackHistoryRepository.getRecentlyWatchedByProvider(context.providerId, limit = 24).first()+ is LiveStartupContext.Combined -> mainActivity.playbackHistoryRepository.getRecentlyWatchedByProviders(context.providerIds.toSet(), limit = 24).first()+ }+ return resolveStartupChannelTarget(+ mainActivity = mainActivity,+ channelIds = recentHistory+ .filter { it.contentType == ContentType.LIVE }+ .sortedByDescending { it.lastWatchedAt }+ .map { it.contentId },+ sourceContext = context,+ virtualCategoryId = VirtualCategoryIds.RECENT+ )+}++private suspend fun resolveStartupChannelTarget(+ mainActivity: MainActivity,+ channelIds: List<Long>,+ sourceContext: LiveStartupContext,+ virtualCategoryId: Long+): StartupNavigationTarget.Player? {+ if (channelIds.isEmpty()) return null+ val hiddenChannelIdsByProvider = sourceContext.providerIds.associateWith { providerId ->+ mainActivity.preferencesRepository.getHiddenChannelIds(providerId).first()+ }+ for (channelId in channelIds.distinct()) {+ val channel = mainActivity.channelRepository.getChannel(channelId) ?: continue+ if (channel.providerId !in sourceContext.providerIds) continue+ if (channel.id in hiddenChannelIdsByProvider[channel.providerId].orEmpty()) continue+ return StartupNavigationTarget.Player(+ Routes.livePlayer(+ channel = channel,+ categoryId = virtualCategoryId,+ providerId = channel.providerId,+ isVirtual = true,+ combinedProfileId = (sourceContext as? LiveStartupContext.Combined)?.profileId,+ returnRoute = Routes.LIVE_TV+ )+ )+ }+ return null+}++private suspend fun resolveLiveStartupContext(+ mainActivity: MainActivity+): LiveStartupContext? {+ return when (val activeSource = mainActivity.combinedM3uRepository.getActiveLiveSource().first()) {+ is ActiveLiveSource.ProviderSource -> LiveStartupContext.Provider(activeSource.providerId)+ is ActiveLiveSource.CombinedM3uSource -> {+ val providerIds = mainActivity.combinedM3uRepository.getProfile(activeSource.profileId)+ ?.members+ .orEmpty()+ .filter { it.enabled }+ .map { it.providerId }+ .distinct()+ if (providerIds.isEmpty()) null else LiveStartupContext.Combined(activeSource.profileId, providerIds)+ }+ null -> null+ }+}++private sealed interface LiveStartupContext {+ val providerIds: List<Long>++ data class Provider(val providerId: Long) : LiveStartupContext {+ override val providerIds: List<Long> = listOf(providerId)+ }++ data class Combined(val profileId: Long, override val providerIds: List<Long>) : LiveStartupContext+}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 3d29ee86..00bdbafb 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@@ -540,6 +540,29 @@ fun HomeScreen(}}+ LaunchedEffect(+ uiState.shouldAutoFocusFirstChannelOnEntry,+ uiState.selectedCategory?.id,+ uiState.isLoading,+ uiState.filteredChannels,+ hasOverlay,+ isReorderMode+ ) {+ if (!uiState.shouldAutoFocusFirstChannelOnEntry || hasOverlay || isReorderMode) {+ return@LaunchedEffect+ }+ if (uiState.isLoading) return@LaunchedEffect++ val firstChannelId = uiState.filteredChannels.firstOrNull()?.id+ if (firstChannelId != null) {+ lastFocusedChannelId = firstChannelId+ preferredRestoreTarget = FocusRestoreTarget.CHANNEL.name+ pendingRestoreTarget = FocusRestoreTarget.CHANNEL+ focusRestoreNonce+++ }+ viewModel.consumeInitialChannelFocusRequest()+ }+LaunchedEffect(uiState.showDialog,showPinDialog,diff --git a/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreenDialogs.kt b/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreenDialogs.ktindex dd378395..a10f6758 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreenDialogs.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/home/HomeScreenDialogs.kt@@ -143,9 +143,10 @@ internal fun HomeDialogsHost(onHide = if (!isCategoryLocked && !category.isVirtual && category.id != ChannelRepository.ALL_CHANNELS_ID) {{ viewModel.hideCategory(category) }} else null,- onHideFromLiveTV = if (!isCategoryLocked && category.id in setOf(VirtualCategoryIds.RECENT, ChannelRepository.ALL_CHANNELS_ID)) {+ onHideFromLiveTV = if (!isCategoryLocked && category.id in setOf(VirtualCategoryIds.FAVORITES, VirtualCategoryIds.RECENT, ChannelRepository.ALL_CHANNELS_ID)) {{when (category.id) {+ VirtualCategoryIds.FAVORITES -> viewModel.setShowFavoritesCategory(false)VirtualCategoryIds.RECENT -> viewModel.setShowRecentChannelsCategory(false)ChannelRepository.ALL_CHANNELS_ID -> viewModel.setShowAllChannelsCategory(false)}diff --git a/app/src/main/java/com/streamvault/app/ui/screens/home/HomeViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/home/HomeViewModel.ktindex 3b4af52c..1a29ce7e 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/home/HomeViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/home/HomeViewModel.kt@@ -511,6 +511,8 @@ class HomeViewModel @Inject constructor(pinnedCategoryIds = pinnedCategoryIds,hiddenLiveCategories = hiddenLiveCategoriesList)+ }.combine(preferencesRepository.showFavoritesCategory) { ctx, showFavorites ->+ if (!showFavorites) ctx.copy(categories = ctx.categories.filter { it.id != VirtualCategoryIds.FAVORITES }) else ctx}.combine(preferencesRepository.showRecentChannelsCategory) { ctx, showRecent ->if (!showRecent) ctx.copy(categories = ctx.categories.filter { it.id != VirtualCategoryIds.RECENT }) else ctx}.combine(preferencesRepository.showAllChannelsCategory) { ctx, showAll ->@@ -547,7 +549,10 @@ class HomeViewModel @Inject constructor(val defaultCat = defaultId?.let { id -> categories.find { it.id == id } }val favoritesCat = categories.find { it.id == VirtualCategoryIds.FAVORITES }- if (defaultCat != null) selectCategory(defaultCat)+ if (defaultCat != null) {+ _uiState.update { it.copy(shouldAutoFocusFirstChannelOnEntry = true) }+ selectCategory(defaultCat)+ }else if (favoritesCat != null) selectCategory(favoritesCat)else selectCategory(categories.first())} else if (currentSelected != null) {@@ -561,7 +566,10 @@ class HomeViewModel @Inject constructor(val defaultCat = defaultId?.let { id -> categories.find { it.id == id } }val favoritesCat = categories.find { it.id == VirtualCategoryIds.FAVORITES }- if (defaultCat != null) selectCategory(defaultCat)+ if (defaultCat != null) {+ _uiState.update { it.copy(shouldAutoFocusFirstChannelOnEntry = true) }+ selectCategory(defaultCat)+ }else if (favoritesCat != null) selectCategory(favoritesCat)else if (categories.isNotEmpty()) selectCategory(categories.first())}@@ -618,6 +626,8 @@ class HomeViewModel @Inject constructor(pinnedCategoryIds = emptySet(),hiddenLiveCategories = emptyList())+ }.combine(preferencesRepository.showFavoritesCategory) { ctx, showFavorites ->+ if (!showFavorites) ctx.copy(categories = ctx.categories.filter { it.id != VirtualCategoryIds.FAVORITES }) else ctx}.combine(preferencesRepository.showRecentChannelsCategory) { ctx, showRecent ->if (!showRecent) ctx.copy(categories = ctx.categories.filter { it.id != VirtualCategoryIds.RECENT }) else ctx}.combine(preferencesRepository.showAllChannelsCategory) { ctx, showAll ->@@ -1630,6 +1640,11 @@ class HomeViewModel @Inject constructor(}}+ fun consumeInitialChannelFocusRequest() {+ if (!_uiState.value.shouldAutoFocusFirstChannelOnEntry) return+ _uiState.update { it.copy(shouldAutoFocusFirstChannelOnEntry = false) }+ }+fun toggleCategoryLock(category: Category) {if (_uiState.value.isCombinedLiveSource) returnval providerId = _uiState.value.provider?.id ?: return@@ -1752,6 +1767,10 @@ class HomeViewModel @Inject constructor(viewModelScope.launch { preferencesRepository.setShowAllChannelsCategory(enabled) }}+ fun setShowFavoritesCategory(enabled: Boolean) {+ viewModelScope.launch { preferencesRepository.setShowFavoritesCategory(enabled) }+ }+fun setShowRecentChannelsCategory(enabled: Boolean) {viewModelScope.launch { preferencesRepository.setShowRecentChannelsCategory(enabled) }}@@ -2012,6 +2031,7 @@ data class HomeUiState(val unlockedCategoryIds: Set<Long> = emptySet(),val pinnedCategoryIds: Set<Long> = emptySet(),val hiddenLiveCategories: List<Category> = emptyList(),+ val shouldAutoFocusFirstChannelOnEntry: Boolean = false,val selectedCategoryForOptions: Category? = null,val isChannelReorderMode: Boolean = false,val reorderCategory: Category? = null,diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsBrowsingSection.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsBrowsingSection.ktindex 5ea2a061..59c557b7 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsBrowsingSection.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsBrowsingSection.kt@@ -117,6 +117,28 @@ internal fun LazyListScope.settingsBrowsingSection(Switch(checked = uiState.showLiveSourceSwitcher, onCheckedChange = { viewModel.setShowLiveSourceSwitcher(it) })}}+ TvClickableSurface(+ onClick = { viewModel.setShowFavoritesCategory(!uiState.showFavoritesCategory) },+ shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),+ colors = ClickableSurfaceDefaults.colors(+ containerColor = Color.Transparent,+ focusedContainerColor = Primary.copy(alpha = 0.15f)+ ),+ scale = ClickableSurfaceDefaults.scale(focusedScale = 1f),+ modifier = Modifier.fillMaxWidth()+ ) {+ Row(+ modifier = Modifier.fillMaxWidth().padding(horizontal = 8.dp, vertical = 12.dp),+ horizontalArrangement = Arrangement.SpaceBetween,+ verticalAlignment = Alignment.CenterVertically+ ) {+ Column(modifier = Modifier.weight(1f)) {+ Text(text = stringResource(R.string.settings_show_favorites_category), style = MaterialTheme.typography.bodyMedium, color = OnSurface)+ Text(text = stringResource(R.string.settings_show_favorites_category_subtitle), style = MaterialTheme.typography.bodySmall, color = OnBackground.copy(alpha = 0.6f))+ }+ Switch(checked = uiState.showFavoritesCategory, onCheckedChange = { viewModel.setShowFavoritesCategory(it) })+ }+ }TvClickableSurface(onClick = { viewModel.setShowAllChannelsCategory(!uiState.showAllChannelsCategory) },shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsPreferenceDialogs.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsPreferenceDialogs.ktindex d80aa257..471552ca 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsPreferenceDialogs.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsPreferenceDialogs.kt@@ -366,6 +366,8 @@ internal fun SettingsPreferenceDialogs(private fun AppLandingDestination.labelResId(): Int = when (this) {AppLandingDestination.HOME -> R.string.nav_homeAppLandingDestination.LIVE_TV -> R.string.nav_live_tv+ AppLandingDestination.FIRST_FAVORITE_LIVE -> R.string.settings_startup_first_favorite_live+ AppLandingDestination.LAST_WATCHED_LIVE -> R.string.settings_startup_last_watched_liveAppLandingDestination.MOVIES -> R.string.nav_moviesAppLandingDestination.SERIES -> R.string.nav_seriesAppLandingDestination.GUIDE -> R.string.nav_epgdiff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsPreferenceModels.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsPreferenceModels.ktindex 7534bc07..5d3b0b70 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsPreferenceModels.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsPreferenceModels.kt@@ -93,6 +93,7 @@ internal data class SettingsPreferenceSnapshot(val xtreamBase64TextCompatibility: Boolean,val liveTvChannelMode: LiveTvChannelMode,val showLiveSourceSwitcher: Boolean,+ val showFavoritesCategory: Boolean,val showAllChannelsCategory: Boolean,val showRecentChannelsCategory: Boolean,val remoteShortcutPreferences: RemoteShortcutPreferences,diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsPreferenceSnapshotMapper.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsPreferenceSnapshotMapper.ktindex f34576b3..b4ac7fe3 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsPreferenceSnapshotMapper.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsPreferenceSnapshotMapper.kt@@ -58,6 +58,7 @@ internal fun SettingsUiState.applyPreferenceSnapshot(snapshot: SettingsPreferencxtreamBase64TextCompatibility = snapshot.xtreamBase64TextCompatibility,liveTvChannelMode = snapshot.liveTvChannelMode,showLiveSourceSwitcher = snapshot.showLiveSourceSwitcher,+ showFavoritesCategory = snapshot.showFavoritesCategory,showAllChannelsCategory = snapshot.showAllChannelsCategory,showRecentChannelsCategory = snapshot.showRecentChannelsCategory,remoteShortcutPreferences = snapshot.remoteShortcutPreferences,diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsScreenState.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsScreenState.ktindex e8dc190c..b5444a85 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsScreenState.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsScreenState.kt@@ -242,6 +242,8 @@ private fun formatAppLandingDestinationLabel(when (destination) {AppLandingDestination.HOME -> R.string.nav_homeAppLandingDestination.LIVE_TV -> R.string.nav_live_tv+ AppLandingDestination.FIRST_FAVORITE_LIVE -> R.string.settings_startup_first_favorite_live+ AppLandingDestination.LAST_WATCHED_LIVE -> R.string.settings_startup_last_watched_liveAppLandingDestination.MOVIES -> R.string.nav_moviesAppLandingDestination.SERIES -> R.string.nav_seriesAppLandingDestination.GUIDE -> R.string.nav_epgdiff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsStateBindings.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsStateBindings.ktindex cef85f9c..fcc1e2c7 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsStateBindings.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsStateBindings.kt@@ -91,6 +91,7 @@ internal fun observeSettingsPreferenceSnapshot(xtreamBase64TextCompatibility = false,liveTvChannelMode = LiveTvChannelMode.PRO,showLiveSourceSwitcher = false,+ showFavoritesCategory = true,showAllChannelsCategory = true,showRecentChannelsCategory = true,remoteShortcutPreferences = com.streamvault.domain.model.RemoteShortcutPreferences(),@@ -214,6 +215,8 @@ internal fun observeSettingsPreferenceSnapshot(snapshot.copy(liveTvChannelMode = LiveTvChannelMode.fromStorage(liveTvChannelMode))}.combine(preferencesRepository.showLiveSourceSwitcher) { snapshot, showLiveSourceSwitcher ->snapshot.copy(showLiveSourceSwitcher = showLiveSourceSwitcher)+ }.combine(preferencesRepository.showFavoritesCategory) { snapshot, showFavoritesCategory ->+ snapshot.copy(showFavoritesCategory = showFavoritesCategory)}.combine(preferencesRepository.showAllChannelsCategory) { snapshot, showAllChannelsCategory ->snapshot.copy(showAllChannelsCategory = showAllChannelsCategory)}.combine(preferencesRepository.showRecentChannelsCategory) { snapshot, showRecentChannelsCategory ->diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsUiStateModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsUiStateModel.ktindex e134f2c4..ef8c61a6 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsUiStateModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsUiStateModel.kt@@ -129,6 +129,7 @@ data class SettingsUiState(val xtreamBase64TextCompatibility: Boolean = false,val liveTvChannelMode: LiveTvChannelMode = LiveTvChannelMode.PRO,val showLiveSourceSwitcher: Boolean = false,+ val showFavoritesCategory: Boolean = true,val showAllChannelsCategory: Boolean = true,val showRecentChannelsCategory: Boolean = true,val remoteShortcutPreferences: RemoteShortcutPreferences = RemoteShortcutPreferences(),diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsViewModel.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsViewModel.ktindex 1a7dd729..a35e7380 100644--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsViewModel.kt+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsViewModel.kt@@ -513,6 +513,12 @@ class SettingsViewModel @Inject constructor(}}+ fun setShowFavoritesCategory(enabled: Boolean) {+ viewModelScope.launch {+ preferencesRepository.setShowFavoritesCategory(enabled)+ }+ }+fun setShowRecentChannelsCategory(enabled: Boolean) {viewModelScope.launch {preferencesRepository.setShowRecentChannelsCategory(enabled)@@ -1048,6 +1054,8 @@ class SettingsViewModel @Inject constructor(private fun AppLandingDestination.labelResId(): Int = when (this) {AppLandingDestination.HOME -> R.string.nav_homeAppLandingDestination.LIVE_TV -> R.string.nav_live_tv+ AppLandingDestination.FIRST_FAVORITE_LIVE -> R.string.settings_startup_first_favorite_live+ AppLandingDestination.LAST_WATCHED_LIVE -> R.string.settings_startup_last_watched_liveAppLandingDestination.MOVIES -> R.string.nav_moviesAppLandingDestination.SERIES -> R.string.nav_seriesAppLandingDestination.GUIDE -> R.string.nav_epgdiff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xmlindex 3347f962..16a6f53f 100644--- a/app/src/main/res/values/strings.xml+++ b/app/src/main/res/values/strings.xml@@ -208,6 +208,8 @@<string name="settings_show_live_source_switcher_subtitle">Display the M3U source switcher inside Live TV browsing.</string><string name="settings_show_all_channels_category">Show All Channels category</string><string name="settings_show_all_channels_category_subtitle">Display the virtual All Channels group in Live TV and the EPG guide.</string>+ <string name="settings_show_favorites_category">Show Favorites category</string>+ <string name="settings_show_favorites_category_subtitle">Display the virtual Favorites group in Live TV browsing.</string><string name="settings_show_recent_channels_category">Show Recent Channels category</string><string name="settings_show_recent_channels_category_subtitle">Display recently watched channels in Live TV browsing and on the Home screen.</string><string name="settings_live_channel_grouping_mode">Channel grouping</string>@@ -391,6 +393,8 @@<string name="settings_home_dashboard_remove">Remove</string><string name="settings_default_landing_screen">Default landing screen</string><string name="settings_select_default_landing_screen">Select default landing screen</string>+ <string name="settings_startup_first_favorite_live">Play first favorite channel</string>+ <string name="settings_startup_last_watched_live">Play last watched live channel</string><plurals name="settings_top_navigation_count"><item quantity="one">%d tab</item><item quantity="other">%d tabs</item>diff --git a/app/src/test/java/com/streamvault/app/navigation/RoutesTest.kt b/app/src/test/java/com/streamvault/app/navigation/RoutesTest.ktindex 50d477c3..aaf2e7c3 100644--- a/app/src/test/java/com/streamvault/app/navigation/RoutesTest.kt+++ b/app/src/test/java/com/streamvault/app/navigation/RoutesTest.kt@@ -129,6 +129,8 @@ class RoutesTest {fun `app landing destinations map to routes`() {assertThat(AppLandingDestination.HOME.toAppRoute()).isEqualTo(Routes.HOME)assertThat(AppLandingDestination.LIVE_TV.toAppRoute()).isEqualTo(Routes.LIVE_TV)+ assertThat(AppLandingDestination.FIRST_FAVORITE_LIVE.toAppRoute()).isEqualTo(Routes.LIVE_TV)+ assertThat(AppLandingDestination.LAST_WATCHED_LIVE.toAppRoute()).isEqualTo(Routes.LIVE_TV)assertThat(AppLandingDestination.MOVIES.toAppRoute()).isEqualTo(Routes.MOVIES)assertThat(AppLandingDestination.SERIES.toAppRoute()).isEqualTo(Routes.SERIES)assertThat(AppLandingDestination.GUIDE.toAppRoute()).isEqualTo(Routes.EPG)@@ -160,6 +162,29 @@ class RoutesTest {assertThat(resolved).isEqualTo(AppLandingDestination.HOME)}+ @Test+ fun `live tv landing options include startup player modes when live tv is visible`() {+ val available = AppTopLevelDestination.availableLandingDestinations(+ listOf(AppTopLevelDestination.HOME, AppTopLevelDestination.LIVE_TV, AppTopLevelDestination.SETTINGS)+ )++ assertThat(available).containsAtLeast(+ AppLandingDestination.LIVE_TV,+ AppLandingDestination.FIRST_FAVORITE_LIVE,+ AppLandingDestination.LAST_WATCHED_LIVE+ )+ }++ @Test+ fun `startup player modes fall back when live tv is not visible`() {+ val resolved = AppTopLevelDestination.resolveLandingDestination(+ preferred = AppLandingDestination.FIRST_FAVORITE_LIVE,+ destinations = listOf(AppTopLevelDestination.HOME, AppTopLevelDestination.SETTINGS)+ )++ assertThat(resolved).isEqualTo(AppLandingDestination.HOME)+ }+@Testfun `player route preserves return route back to guide`() {val returnRoute = Routes.epg(diff --git a/app/src/test/java/com/streamvault/app/ui/screens/home/HomeViewModelTest.kt b/app/src/test/java/com/streamvault/app/ui/screens/home/HomeViewModelTest.ktindex 1755ab65..bfb6b70d 100644--- a/app/src/test/java/com/streamvault/app/ui/screens/home/HomeViewModelTest.kt+++ b/app/src/test/java/com/streamvault/app/ui/screens/home/HomeViewModelTest.kt@@ -89,6 +89,7 @@ class HomeViewModelTest {whenever(preferencesRepository.liveTvQuickFilterVisibility).thenReturn(flowOf(null))whenever(preferencesRepository.showRecentChannelsCategory).thenReturn(flowOf(true))whenever(preferencesRepository.showAllChannelsCategory).thenReturn(flowOf(true))+ whenever(preferencesRepository.showFavoritesCategory).thenReturn(flowOf(true))whenever(preferencesRepository.showLiveSourceSwitcher).thenReturn(flowOf(false))whenever(preferencesRepository.multiViewCenterTwoSlotLayout).thenReturn(flowOf(false))whenever(preferencesRepository.liveChannelNumberingMode).thenReturn(flowOf(ChannelNumberingMode.PROVIDER))@@ -258,6 +259,63 @@ class HomeViewModelTest {assertThat(viewModel.uiState.value.recentChannels.map { it.id }).containsExactly(21L)}+ @Test+ fun `default live category requests initial channel focus on entry`() = runTest {+ val provider = Provider(+ id = 5L,+ name = "Provider",+ type = ProviderType.M3U,+ serverUrl = "http://test"+ )+ val sportsCategory = Category(id = 12L, name = "Sports", type = ContentType.LIVE)++ whenever(providerRepository.getActiveProvider()).thenReturn(flowOf(provider))+ whenever(channelRepository.getCategories(provider.id)).thenReturn(flowOf(listOf(sportsCategory)))+ whenever(preferencesRepository.defaultCategoryId).thenReturn(flowOf(sportsCategory.id))+ whenever(channelRepository.getChannelsByCategoryPage(eq(provider.id), eq(sportsCategory.id), any())).thenReturn(flowOf(emptyList()))++ viewModel = createViewModel()+ advanceUntilIdle()++ val state = viewModel.uiState.value+ assertThat(state.selectedCategory?.id).isEqualTo(sportsCategory.id)+ assertThat(state.shouldAutoFocusFirstChannelOnEntry).isTrue()++ viewModel.consumeInitialChannelFocusRequest()++ assertThat(viewModel.uiState.value.shouldAutoFocusFirstChannelOnEntry).isFalse()+ }++ @Test+ fun `hidden favorites category is removed from live tv categories`() = runTest {+ val provider = Provider(+ id = 8L,+ name = "Provider",+ type = ProviderType.M3U,+ serverUrl = "http://test"+ )+ whenever(providerRepository.getActiveProvider()).thenReturn(flowOf(provider))+ whenever(channelRepository.getCategories(provider.id)).thenReturn(flowOf(emptyList()))+ whenever(getCustomCategories.invoke(eq(provider.id), eq(ContentType.LIVE))).thenReturn(+ flowOf(+ listOf(+ Category(+ id = VirtualCategoryIds.FAVORITES,+ name = "Favorites",+ type = ContentType.LIVE,+ isVirtual = true+ )+ )+ )+ )+ whenever(preferencesRepository.showFavoritesCategory).thenReturn(flowOf(false))++ viewModel = createViewModel()+ advanceUntilIdle()++ assertThat(viewModel.uiState.value.categories.map { it.id }).doesNotContain(VirtualCategoryIds.FAVORITES)+ }+@Testfun `recent category stays visible in live tv even when history is empty`() = runTest {val provider = Provider(diff --git a/data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt b/data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.ktindex d0b2936f..152c9293 100644--- a/data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt+++ b/data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt@@ -121,6 +121,7 @@ class PreferencesRepository @Inject constructor(val APP_TIME_FORMAT = stringPreferencesKey("app_time_format")val LIVE_TV_CHANNEL_MODE = stringPreferencesKey("live_tv_channel_mode")val SHOW_LIVE_SOURCE_SWITCHER = booleanPreferencesKey("show_live_source_switcher")+ val SHOW_FAVORITES_CATEGORY = booleanPreferencesKey("show_favorites_category")val SHOW_ALL_CHANNELS_CATEGORY = booleanPreferencesKey("show_all_channels_category")val SHOW_RECENT_CHANNELS_CATEGORY = booleanPreferencesKey("show_recent_channels_category")val LIVE_TV_CATEGORY_FILTERS = stringPreferencesKey("live_tv_category_filters")@@ -1400,6 +1401,16 @@ class PreferencesRepository @Inject constructor(}}+ val showFavoritesCategory: Flow<Boolean> = context.dataStore.data.map { preferences ->+ preferences[PreferencesKeys.SHOW_FAVORITES_CATEGORY] ?: true+ }++ suspend fun setShowFavoritesCategory(enabled: Boolean) {+ context.dataStore.edit { preferences ->+ preferences[PreferencesKeys.SHOW_FAVORITES_CATEGORY] = enabled+ }+ }+val showAllChannelsCategory: Flow<Boolean> = context.dataStore.data.map { preferences ->preferences[PreferencesKeys.SHOW_ALL_CHANNELS_CATEGORY] ?: true}diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex eb21939d..001ae7c0 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -9,11 +9,14 @@ All notable product changes are recorded in this document.- Added separate Audio Decoder Mode and Video Decoder Mode playback settings, so users can control audio and video decoder selection independently while existing combined decoder preferences continue migrating to both controls by default.- Added a selectable Local Live Rewind backend preference with `Automatic`, `Storage`, and `Memory` modes, so users can control whether live rewind prefers app storage or stays memory-backed when troubleshooting storage-wear or device-compatibility concerns.- Added provider-level guide-source and channel-logo source policies for supported IPTV providers, including setup and settings controls to prefer supplier data, prefer external XMLTV data, or disable guide usage entirely on a per-provider basis.+- Added a `Show Favorites category` Live TV setting plus a matching Live TV category action, so users can hide the virtual Favorites rail the same way they can already hide All Channels and Recent.+- Added two Live TV-aware startup landing options: `Play first favorite channel`, which launches the current number-one live favorite based on the saved favorites order, and `Play last watched live channel`, with both modes falling back to Live TV when no valid startup channel is available.### Fixed- Fixed Xtream raw live MPEG-TS playback using an HLS-specific Media3 TS extractor mode; direct `.ts` live streams now use the standard single-program TS path, improving compatibility with providers whose endless transport streams were failing during startup and retry recovery.- Fixed external-only guide behavior so providers can now strictly avoid supplier Xtream/Stalker guide fallback, clear stale external-vs-provider mapping behavior correctly when policy changes, and resolve channel logos from supplier or matched EPG icons without overwriting stored supplier logos.+- Fixed Live TV default-category entry so opening Live TV with a saved default category now moves focus into the first channel in that category instead of leaving focus stranded on the sidebar.## [1.0.15] - 2026-06-13diff --git a/domain/src/main/java/com/streamvault/domain/model/AppLandingDestination.kt b/domain/src/main/java/com/streamvault/domain/model/AppLandingDestination.ktindex a096b162..c6f8df40 100644--- a/domain/src/main/java/com/streamvault/domain/model/AppLandingDestination.kt+++ b/domain/src/main/java/com/streamvault/domain/model/AppLandingDestination.kt@@ -3,6 +3,8 @@ package com.streamvault.domain.modelenum class AppLandingDestination(val storageValue: String) {HOME("home"),LIVE_TV("live_tv"),+ FIRST_FAVORITE_LIVE("first_favorite_live"),+ LAST_WATCHED_LIVE("last_watched_live"),MOVIES("movies"),SERIES("series"),GUIDE("guide"),diff --git a/domain/src/main/java/com/streamvault/domain/model/AppTopLevelDestination.kt b/domain/src/main/java/com/streamvault/domain/model/AppTopLevelDestination.ktindex 2a5185e0..cf3923cc 100644--- a/domain/src/main/java/com/streamvault/domain/model/AppTopLevelDestination.kt+++ b/domain/src/main/java/com/streamvault/domain/model/AppTopLevelDestination.kt@@ -40,9 +40,26 @@ enum class AppTopLevelDestination(fun availableLandingDestinations(destinations: List<AppTopLevelDestination>- ): List<AppLandingDestination> = normalizeForStorage(destinations)- .mapNotNull { it.landingDestination }- .distinct()+ ): List<AppLandingDestination> {+ val normalized = normalizeForStorage(destinations)+ val available = normalized+ .mapNotNull { it.landingDestination }+ .distinct()+ .toMutableList()+ if (LIVE_TV in normalized) {+ val liveTvIndex = available.indexOf(AppLandingDestination.LIVE_TV)+ if (liveTvIndex >= 0) {+ available.add(liveTvIndex + 1, AppLandingDestination.FIRST_FAVORITE_LIVE)+ available.add(liveTvIndex + 2, AppLandingDestination.LAST_WATCHED_LIVE)+ } else {+ available += listOf(+ AppLandingDestination.FIRST_FAVORITE_LIVE,+ AppLandingDestination.LAST_WATCHED_LIVE+ )+ }+ }+ return available+ }fun resolveLandingDestination(preferred: AppLandingDestination,