Skip to content

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

Add configurable default landing screen

David Nashashbbec09335938
diff --git a/app/src/main/java/com/streamvault/app/navigation/AppNavigation.kt b/app/src/main/java/com/streamvault/app/navigation/AppNavigation.kt
index aa238617..2bb012c4 100644
--- a/app/src/main/java/com/streamvault/app/navigation/AppNavigation.kt
+++ b/app/src/main/java/com/streamvault/app/navigation/AppNavigation.kt
@@ -33,6 +33,7 @@ import com.streamvault.app.ui.screens.settings.SettingsScreen
import com.streamvault.app.ui.screens.welcome.WelcomeScreen
import com.streamvault.app.ui.screens.downloads.DownloadsScreen
import com.streamvault.app.MainActivity
+import com.streamvault.domain.model.AppLandingDestination
import java.io.Serializable
import kotlin.coroutines.resume
import kotlinx.coroutines.suspendCancellableCoroutine
@@ -259,11 +260,26 @@ private fun NavHostController.navigateToExternalPlayer(request: PlayerNavigation
return true
}
+internal fun AppLandingDestination.toAppRoute(): String = when (this) {
+ AppLandingDestination.HOME -> Routes.HOME
+ AppLandingDestination.LIVE_TV -> Routes.LIVE_TV
+ AppLandingDestination.MOVIES -> Routes.MOVIES
+ AppLandingDestination.SERIES -> Routes.SERIES
+ AppLandingDestination.GUIDE -> Routes.EPG
+ AppLandingDestination.DOWNLOADS -> Routes.DOWNLOADS
+ AppLandingDestination.PLUGINS -> Routes.PLUGINS
+ AppLandingDestination.SETTINGS -> Routes.SETTINGS
+}
+
@Composable
fun AppNavigation(mainActivity: MainActivity) {
val navController = rememberNavController()
val currentBackStackEntry = navController.currentBackStackEntryAsState().value
val externalNavigationRequest = mainActivity.externalNavigationRequestFlow.collectAsStateWithLifecycle().value
+ val appLandingDestination = mainActivity.preferencesRepository.appLandingDestination
+ .collectAsStateWithLifecycle(initialValue = AppLandingDestination.HOME)
+ .value
+ val landingRoute = appLandingDestination.toAppRoute()
LaunchedEffect(externalNavigationRequest, currentBackStackEntry) {
val entry = currentBackStackEntry ?: return@LaunchedEffect
@@ -327,7 +343,7 @@ fun AppNavigation(mainActivity: MainActivity) {
composable(Routes.WELCOME) {
WelcomeScreen(
onNavigateToHome = dropUnlessResumed {
- navController.navigate(Routes.HOME) {
+ navController.navigate(landingRoute) {
popUpTo(Routes.WELCOME) { inclusive = true }
}
},
@@ -354,7 +370,7 @@ fun AppNavigation(mainActivity: MainActivity) {
initialImportUri = importUri,
onBack = { navController.popBackStack() },
onProviderAdded = dropUnlessResumed {
- navController.navigate(Routes.HOME) {
+ navController.navigate(landingRoute) {
popUpTo(Routes.PROVIDER_SETUP) { inclusive = true }
}
}
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.kt
index 85f4c985..8f403f40 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
@@ -31,6 +31,7 @@ internal fun LazyListScope.settingsBrowsingSection(
uiState: SettingsUiState,
viewModel: SettingsViewModel,
context: android.content.Context,
+ appLandingDestinationLabel: String,
guideDefaultCategoryLabel: String,
timeFormatLabel: String,
appLanguageLabel: String,
@@ -41,6 +42,7 @@ internal fun LazyListScope.settingsBrowsingSection(
onShowLiveChannelGroupingDialogChange: (Boolean) -> Unit,
onShowGroupedChannelLabelDialogChange: (Boolean) -> Unit,
onShowLiveVariantPreferenceDialogChange: (Boolean) -> Unit,
+ onShowLandingScreenDialogChange: (Boolean) -> Unit,
onShowGuideDefaultCategoryDialogChange: (Boolean) -> Unit,
onShowTimeFormatDialogChange: (Boolean) -> Unit,
onShowVodViewModeDialogChange: (Boolean) -> Unit,
@@ -53,6 +55,11 @@ internal fun LazyListScope.settingsBrowsingSection(
value = stringResource(uiState.liveTvChannelMode.labelResId()),
onClick = { onShowLiveTvModeDialogChange(true) }
)
+ ClickableSettingsRow(
+ label = stringResource(R.string.settings_default_landing_screen),
+ value = appLandingDestinationLabel,
+ onClick = { onShowLandingScreenDialogChange(true) }
+ )
TvClickableSurface(
onClick = { viewModel.setShowLiveSourceSwitcher(!uiState.showLiveSourceSwitcher) },
shape = ClickableSurfaceDefaults.shape(RoundedCornerShape(8.dp)),
@@ -216,4 +223,4 @@ internal fun LazyListScope.settingsBrowsingSection(
}
}
}
-}
\ No newline at end of file
+}
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsContentPane.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsContentPane.kt
index bd7a1a3a..fab73846 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsContentPane.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsContentPane.kt
@@ -102,22 +102,24 @@ internal fun SettingsContentPane(
onShowEthernetQualityDialogChange = { dialogState.showEthernetQualityDialog = it }
)
} else if (dialogState.selectedCategory == 2) {
- settingsBrowsingSection(
- uiState = uiState,
- viewModel = viewModel,
- context = context,
- guideDefaultCategoryLabel = screenLabels.guideDefaultCategoryLabel,
- timeFormatLabel = screenLabels.timeFormatLabel,
- appLanguageLabel = screenLabels.appLanguageLabel,
+ settingsBrowsingSection(
+ uiState = uiState,
+ viewModel = viewModel,
+ context = context,
+ appLandingDestinationLabel = screenLabels.appLandingDestinationLabel,
+ guideDefaultCategoryLabel = screenLabels.guideDefaultCategoryLabel,
+ timeFormatLabel = screenLabels.timeFormatLabel,
+ appLanguageLabel = screenLabels.appLanguageLabel,
onShowLiveTvModeDialogChange = { dialogState.showLiveTvModeDialog = it },
onShowLiveTvFiltersDialogChange = { dialogState.showLiveTvFiltersDialog = it },
onShowLiveTvQuickFilterVisibilityDialogChange = { dialogState.showLiveTvQuickFilterVisibilityDialog = it },
onShowLiveChannelNumberingDialogChange = { dialogState.showLiveChannelNumberingDialog = it },
- onShowLiveChannelGroupingDialogChange = { dialogState.showLiveChannelGroupingDialog = it },
- onShowGroupedChannelLabelDialogChange = { dialogState.showGroupedChannelLabelDialog = it },
- onShowLiveVariantPreferenceDialogChange = { dialogState.showLiveVariantPreferenceDialog = it },
- onShowGuideDefaultCategoryDialogChange = { dialogState.showGuideDefaultCategoryDialog = it },
- onShowTimeFormatDialogChange = { dialogState.showTimeFormatDialog = it },
+ onShowLiveChannelGroupingDialogChange = { dialogState.showLiveChannelGroupingDialog = it },
+ onShowGroupedChannelLabelDialogChange = { dialogState.showGroupedChannelLabelDialog = it },
+ onShowLiveVariantPreferenceDialogChange = { dialogState.showLiveVariantPreferenceDialog = it },
+ onShowLandingScreenDialogChange = { dialogState.showLandingScreenDialog = it },
+ onShowGuideDefaultCategoryDialogChange = { dialogState.showGuideDefaultCategoryDialog = it },
+ onShowTimeFormatDialogChange = { dialogState.showTimeFormatDialog = it },
onShowVodViewModeDialogChange = { dialogState.showVodViewModeDialog = it },
onCategorySortDialogTypeChange = { dialogState.categorySortDialogType = it },
onShowLanguageDialogChange = { dialogState.showLanguageDialog = it }
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.kt
index db8910fa..9a409e23 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
@@ -6,6 +6,7 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.res.stringResource
import com.streamvault.app.R
import com.streamvault.domain.model.AppTimeFormat
+import com.streamvault.domain.model.AppLandingDestination
import com.streamvault.domain.model.CategorySortMode
import com.streamvault.domain.model.ContentType
import com.streamvault.domain.model.DecoderMode
@@ -16,6 +17,8 @@ internal fun SettingsPreferenceDialogs(
uiState: SettingsUiState,
viewModel: SettingsViewModel,
context: Context,
+ showLandingScreenDialog: Boolean,
+ onShowLandingScreenDialogChange: (Boolean) -> Unit,
showGuideDefaultCategoryDialog: Boolean,
onShowGuideDefaultCategoryDialogChange: (Boolean) -> Unit,
showPlaybackSpeedDialog: Boolean,
@@ -99,6 +102,25 @@ internal fun SettingsPreferenceDialogs(
onShowDiagnosticsTimeoutDialogChange = onShowDiagnosticsTimeoutDialogChange
)
+ if (showLandingScreenDialog) {
+ PremiumSelectionDialog(
+ title = stringResource(R.string.settings_select_default_landing_screen),
+ onDismiss = { onShowLandingScreenDialogChange(false) }
+ ) {
+ AppLandingDestination.entries.forEachIndexed { index, destination ->
+ LevelOption(
+ level = index,
+ text = stringResource(destination.labelResId()),
+ currentLevel = if (uiState.appLandingDestination == destination) index else -1,
+ onSelect = {
+ viewModel.setAppLandingDestination(destination)
+ onShowLandingScreenDialogChange(false)
+ }
+ )
+ }
+ }
+ }
+
if (showGuideDefaultCategoryDialog) {
PremiumSelectionDialog(
title = stringResource(R.string.settings_select_guide_default_category),
@@ -268,3 +290,14 @@ internal fun SettingsPreferenceDialogs(
}
}
}
+
+private fun AppLandingDestination.labelResId(): Int = when (this) {
+ AppLandingDestination.HOME -> R.string.nav_home
+ AppLandingDestination.LIVE_TV -> R.string.nav_live_tv
+ AppLandingDestination.MOVIES -> R.string.nav_movies
+ AppLandingDestination.SERIES -> R.string.nav_series
+ AppLandingDestination.GUIDE -> R.string.nav_epg
+ AppLandingDestination.DOWNLOADS -> R.string.nav_downloads
+ AppLandingDestination.PLUGINS -> R.string.nav_plugins
+ AppLandingDestination.SETTINGS -> R.string.nav_settings
+}
diff --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.kt
index 898b33a7..d4d132c7 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
@@ -6,6 +6,7 @@ import com.streamvault.app.ui.model.LiveTvChannelMode
import com.streamvault.app.ui.model.LiveTvQuickFilterVisibilityMode
import com.streamvault.app.ui.model.VodViewMode
import com.streamvault.domain.model.AppTimeFormat
+import com.streamvault.domain.model.AppLandingDestination
import com.streamvault.domain.model.AudioOutputPreference
import com.streamvault.domain.model.Category
import com.streamvault.domain.model.ExternalPlaybackMode
@@ -39,6 +40,7 @@ internal data class SettingsPreferenceSnapshot(
val parentalControlLevel: Int,
val hasParentalPin: Boolean,
val appLanguage: String,
+ val appLandingDestination: AppLandingDestination,
val appTimeFormat: AppTimeFormat,
val preferredAudioLanguage: String,
val playerMediaSessionEnabled: Boolean,
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.kt
index 687f35ed..842a608d 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
@@ -8,6 +8,7 @@ internal fun SettingsUiState.applyPreferenceSnapshot(snapshot: SettingsPreferenc
parentalControlLevel = snapshot.parentalControlLevel,
hasParentalPin = snapshot.hasParentalPin,
appLanguage = snapshot.appLanguage,
+ appLandingDestination = snapshot.appLandingDestination,
appTimeFormat = snapshot.appTimeFormat,
preferredAudioLanguage = snapshot.preferredAudioLanguage,
playerMediaSessionEnabled = snapshot.playerMediaSessionEnabled,
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsScreenDialogState.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsScreenDialogState.kt
index 4a0f59b7..711f3d7a 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsScreenDialogState.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsScreenDialogState.kt
@@ -19,6 +19,7 @@ internal class SettingsScreenDialogState(
private val showLiveChannelGroupingDialogState: MutableState<Boolean>,
private val showGroupedChannelLabelDialogState: MutableState<Boolean>,
private val showLiveVariantPreferenceDialogState: MutableState<Boolean>,
+ private val showLandingScreenDialogState: MutableState<Boolean>,
private val showVodViewModeDialogState: MutableState<Boolean>,
private val showGuideDefaultCategoryDialogState: MutableState<Boolean>,
private val showPlaybackSpeedDialogState: MutableState<Boolean>,
@@ -74,6 +75,7 @@ internal class SettingsScreenDialogState(
var showLiveChannelGroupingDialog by showLiveChannelGroupingDialogState
var showGroupedChannelLabelDialog by showGroupedChannelLabelDialogState
var showLiveVariantPreferenceDialog by showLiveVariantPreferenceDialogState
+ var showLandingScreenDialog by showLandingScreenDialogState
var showVodViewModeDialog by showVodViewModeDialogState
var showGuideDefaultCategoryDialog by showGuideDefaultCategoryDialogState
var showPlaybackSpeedDialog by showPlaybackSpeedDialogState
@@ -197,6 +199,7 @@ internal fun rememberSettingsScreenDialogState(): SettingsScreenDialogState {
val showLiveChannelGroupingDialogState = rememberSaveable { mutableStateOf(false) }
val showGroupedChannelLabelDialogState = rememberSaveable { mutableStateOf(false) }
val showLiveVariantPreferenceDialogState = rememberSaveable { mutableStateOf(false) }
+ val showLandingScreenDialogState = rememberSaveable { mutableStateOf(false) }
val showVodViewModeDialogState = rememberSaveable { mutableStateOf(false) }
val showGuideDefaultCategoryDialogState = rememberSaveable { mutableStateOf(false) }
val showPlaybackSpeedDialogState = rememberSaveable { mutableStateOf(false) }
@@ -261,6 +264,7 @@ internal fun rememberSettingsScreenDialogState(): SettingsScreenDialogState {
showLiveChannelGroupingDialogState = showLiveChannelGroupingDialogState,
showGroupedChannelLabelDialogState = showGroupedChannelLabelDialogState,
showLiveVariantPreferenceDialogState = showLiveVariantPreferenceDialogState,
+ showLandingScreenDialogState = showLandingScreenDialogState,
showVodViewModeDialogState = showVodViewModeDialogState,
showGuideDefaultCategoryDialogState = showGuideDefaultCategoryDialogState,
showPlaybackSpeedDialogState = showPlaybackSpeedDialogState,
diff --git a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsScreenDialogs.kt b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsScreenDialogs.kt
index b225997e..f33b09e1 100644
--- a/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsScreenDialogs.kt
+++ b/app/src/main/java/com/streamvault/app/ui/screens/settings/SettingsScreenDialogs.kt
@@ -138,6 +138,8 @@ internal fun SettingsScreenDialogs(
uiState = uiState,
viewModel = viewModel,
context = context,
+ showLandingScreenDialog = dialogState.showLandingScreenDialog,
+ onShowLandingScreenDialogChange = { dialogState.showLandingScreenDialog = it },
showGuideDefaultCategoryDialog = dialogState.showGuideDefaultCategoryDialog,
onShowGuideDefaultCategoryDialogChange = { dialogState.showGuideDefaultCategoryDialog = it },
showPlaybackSpeedDialog = dialogState.showPlaybackSpeedDialog,
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.kt
index db2fa7ec..c2051638 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
@@ -8,6 +8,7 @@ import com.streamvault.app.MainActivity
import com.streamvault.app.R
import com.streamvault.app.ui.time.createDateTimeFormat
import com.streamvault.app.util.OfficialBuildStatus
+import com.streamvault.domain.model.AppLandingDestination
import com.streamvault.domain.model.AppTimeFormat
import com.streamvault.domain.model.AudioOutputPreference
import com.streamvault.domain.model.VodHttpProtocolMode
@@ -15,6 +16,7 @@ import com.streamvault.domain.model.VodHttpProtocolMode
internal data class SettingsScreenLabels(
val buildVerificationLabel: String,
val appLanguageLabel: String,
+ val appLandingDestinationLabel: String,
val timeFormatLabel: String,
val preferredAudioLanguageLabel: String,
val playbackSpeedLabel: String,
@@ -55,6 +57,9 @@ internal fun rememberSettingsScreenLabels(
val appLanguageLabel = remember(uiState.appLanguage, context) {
displayLanguageLabel(uiState.appLanguage, context.getString(R.string.settings_system_default))
}
+ val appLandingDestinationLabel = remember(uiState.appLandingDestination, context) {
+ formatAppLandingDestinationLabel(uiState.appLandingDestination, context)
+ }
val timeFormatLabel = remember(uiState.appTimeFormat, context) {
formatAppTimeFormatLabel(uiState.appTimeFormat, context)
}
@@ -156,6 +161,7 @@ internal fun rememberSettingsScreenLabels(
return SettingsScreenLabels(
buildVerificationLabel = buildVerificationLabel,
appLanguageLabel = appLanguageLabel,
+ appLandingDestinationLabel = appLandingDestinationLabel,
timeFormatLabel = timeFormatLabel,
preferredAudioLanguageLabel = preferredAudioLanguageLabel,
playbackSpeedLabel = playbackSpeedLabel,
@@ -194,6 +200,22 @@ internal fun Context.findMainActivity(): MainActivity? {
return null
}
+private fun formatAppLandingDestinationLabel(
+ destination: AppLandingDestination,
+ context: Context
+): String = context.getString(
+ when (destination) {
+ AppLandingDestination.HOME -> R.string.nav_home
+ AppLandingDestination.LIVE_TV -> R.string.nav_live_tv
+ AppLandingDestination.MOVIES -> R.string.nav_movies
+ AppLandingDestination.SERIES -> R.string.nav_series
+ AppLandingDestination.GUIDE -> R.string.nav_epg
+ AppLandingDestination.DOWNLOADS -> R.string.nav_downloads
+ AppLandingDestination.PLUGINS -> R.string.nav_plugins
+ AppLandingDestination.SETTINGS -> R.string.nav_settings
+ }
+)
+
private fun formatOfficialBuildStatusLabel(
status: OfficialBuildStatus,
context: Context
diff --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.kt
index 54eb112b..4e7a1aaa 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
@@ -5,6 +5,7 @@ package com.streamvault.app.ui.screens.settings
import com.streamvault.app.ui.model.LiveTvChannelMode
import com.streamvault.app.ui.model.LiveTvQuickFilterVisibilityMode
import com.streamvault.app.ui.model.VodViewMode
+import com.streamvault.domain.model.AppLandingDestination
import com.streamvault.data.preferences.PreferencesRepository
import com.streamvault.domain.model.AppTimeFormat
import com.streamvault.domain.model.AudioOutputPreference
@@ -38,6 +39,7 @@ internal fun observeSettingsPreferenceSnapshot(
parentalControlLevel = level,
hasParentalPin = hasParentalPin,
appLanguage = "system",
+ appLandingDestination = AppLandingDestination.HOME,
appTimeFormat = AppTimeFormat.SYSTEM,
preferredAudioLanguage = "auto",
playerMediaSessionEnabled = true,
@@ -102,6 +104,8 @@ internal fun observeSettingsPreferenceSnapshot(
)
}.combine(preferencesRepository.appLanguage) { snapshot, language ->
snapshot.copy(appLanguage = language)
+ }.combine(preferencesRepository.appLandingDestination) { snapshot, destination ->
+ snapshot.copy(appLandingDestination = destination)
}.combine(preferencesRepository.appTimeFormat) { snapshot, timeFormat ->
snapshot.copy(appTimeFormat = timeFormat)
}.combine(preferencesRepository.preferredAudioLanguage) { snapshot, preferredAudioLanguage ->
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.kt
index 37e7c39c..5128dd87 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
@@ -10,6 +10,7 @@ import com.streamvault.domain.manager.DriveSignInRequest
import com.streamvault.domain.manager.DriveSyncStatus
import com.streamvault.domain.manager.ProviderCredentials
import com.streamvault.domain.model.ActiveLiveSource
+import com.streamvault.domain.model.AppLandingDestination
import com.streamvault.domain.model.AppTimeFormat
import com.streamvault.domain.model.AudioOutputPreference
import com.streamvault.domain.model.Category
@@ -58,6 +59,7 @@ data class SettingsUiState(
val parentalControlLevel: Int = 0,
val hasParentalPin: Boolean = false,
val appLanguage: String = "system",
+ val appLandingDestination: AppLandingDestination = AppLandingDestination.HOME,
val appTimeFormat: AppTimeFormat = AppTimeFormat.SYSTEM,
val preferredAudioLanguage: String = "auto",
val playerMediaSessionEnabled: Boolean = true,
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.kt
index db328191..a2e3ff16 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
@@ -34,6 +34,7 @@ import com.streamvault.domain.manager.DriveBackupSyncManager
import com.streamvault.domain.manager.ParentalControlManager
import com.streamvault.domain.manager.RecordingManager
import com.streamvault.domain.model.Category
+import com.streamvault.domain.model.AppLandingDestination
import com.streamvault.domain.model.AppTimeFormat
import com.streamvault.domain.model.CategorySortMode
import com.streamvault.domain.model.ChannelNumberingMode
@@ -420,6 +421,12 @@ class SettingsViewModel @Inject constructor(
}
}
+ fun setAppLandingDestination(destination: AppLandingDestination) {
+ viewModelScope.launch {
+ preferencesRepository.setAppLandingDestination(destination)
+ }
+ }
+
fun setLiveTvChannelMode(mode: LiveTvChannelMode) {
viewModelScope.launch {
preferencesRepository.setLiveTvChannelMode(mode.name)
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 0debe317..14bfd56c 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -362,6 +362,8 @@
<string name="settings_browsing">Browsing</string>
<string name="settings_live_tv_channel_mode">Live TV Channel Mode</string>
<string name="settings_live_tv_channel_mode_subtitle">Choose how the Live TV browser should present channels and whether it should preview before playback.</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_live_tv_quick_filters">Live TV Quick Filters</string>
<string name="settings_live_tv_quick_filters_none">None</string>
<plurals name="settings_live_tv_quick_filters_count">
diff --git a/app/src/test/java/com/streamvault/app/navigation/RoutesTest.kt b/app/src/test/java/com/streamvault/app/navigation/RoutesTest.kt
index 2ebde5e3..248dec65 100644
--- a/app/src/test/java/com/streamvault/app/navigation/RoutesTest.kt
+++ b/app/src/test/java/com/streamvault/app/navigation/RoutesTest.kt
@@ -1,6 +1,7 @@
package com.streamvault.app.navigation
import com.google.common.truth.Truth.assertThat
+import com.streamvault.domain.model.AppLandingDestination
import com.streamvault.domain.model.Channel
import com.streamvault.domain.model.Episode
import com.streamvault.domain.model.Movie
@@ -123,6 +124,18 @@ class RoutesTest {
)
}
+ @Test
+ 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.MOVIES.toAppRoute()).isEqualTo(Routes.MOVIES)
+ assertThat(AppLandingDestination.SERIES.toAppRoute()).isEqualTo(Routes.SERIES)
+ assertThat(AppLandingDestination.GUIDE.toAppRoute()).isEqualTo(Routes.EPG)
+ assertThat(AppLandingDestination.DOWNLOADS.toAppRoute()).isEqualTo(Routes.DOWNLOADS)
+ assertThat(AppLandingDestination.PLUGINS.toAppRoute()).isEqualTo(Routes.PLUGINS)
+ assertThat(AppLandingDestination.SETTINGS.toAppRoute()).isEqualTo(Routes.SETTINGS)
+ }
+
@Test
fun `player route preserves return route back to guide`() {
val returnRoute = Routes.epg(
diff --git a/data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.kt b/data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.kt
index ead4843c..cfa18247 100644
--- a/data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.kt
+++ b/data/src/main/java/com/streamvault/data/manager/BackupManagerImpl.kt
@@ -82,6 +82,7 @@ class BackupManagerImpl @Inject constructor(
put("parentalPinHash", parentalPinBackup?.hash ?: "")
put("parentalPinSalt", parentalPinBackup?.saltBase64 ?: "")
put("appLanguage", preferencesRepository.appLanguage.first())
+ put("appLandingDestination", preferencesRepository.appLandingDestination.first().storageValue)
put("liveTvCategoryFilters", preferencesRepository.liveTvCategoryFilters.first().joinToString("\n"))
put("liveTvQuickFilterVisibility", preferencesRepository.liveTvQuickFilterVisibility.first() ?: "always")
put("playerMediaSessionEnabled", preferencesRepository.playerMediaSessionEnabled.first().toString())
@@ -508,6 +509,11 @@ class BackupManagerImpl @Inject constructor(
).takeIf { it.hash.isNotBlank() && it.saltBase64.isNotBlank() }
)
prefs["appLanguage"]?.takeIf { it.isNotBlank() }?.let { preferencesRepository.setAppLanguage(it) }
+ prefs["appLandingDestination"]?.takeIf { it.isNotBlank() }?.let { savedDestination ->
+ preferencesRepository.setAppLandingDestination(
+ com.streamvault.domain.model.AppLandingDestination.fromStorage(savedDestination)
+ )
+ }
prefs["liveTvCategoryFilters"]?.let { preferencesRepository.setLiveTvCategoryFilters(it.split('\n')) }
prefs["liveTvQuickFilterVisibility"]?.takeIf { it.isNotBlank() }
?.let { preferencesRepository.setLiveTvQuickFilterVisibility(it) }
diff --git a/data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt b/data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt
index 0fd6b6fc..7975dcb4 100644
--- a/data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt
+++ b/data/src/main/java/com/streamvault/data/preferences/PreferencesRepository.kt
@@ -23,6 +23,7 @@ import com.streamvault.domain.model.CategorySortMode
import com.streamvault.domain.model.ContentType
import com.streamvault.domain.model.DecoderMode
import com.streamvault.domain.model.ActiveLiveSource
+import com.streamvault.domain.model.AppLandingDestination
import com.streamvault.domain.model.AppTimeFormat
import com.streamvault.domain.model.LiveChannelGroupingMode
import com.streamvault.domain.model.LiveChannelObservedQuality
@@ -89,6 +90,7 @@ class PreferencesRepository @Inject constructor(
val PARENTAL_PIN_SALT = stringPreferencesKey("parental_pin_salt")
val DEFAULT_CATEGORY_ID = longPreferencesKey("default_category_id")
val APP_LANGUAGE = stringPreferencesKey("app_language")
+ val APP_LANDING_DESTINATION = stringPreferencesKey("app_landing_destination")
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")
@@ -1199,6 +1201,16 @@ class PreferencesRepository @Inject constructor(
}
}
+ val appLandingDestination: Flow<AppLandingDestination> = context.dataStore.data.map { preferences ->
+ AppLandingDestination.fromStorage(preferences[PreferencesKeys.APP_LANDING_DESTINATION])
+ }
+
+ suspend fun setAppLandingDestination(destination: AppLandingDestination) {
+ context.dataStore.edit { preferences ->
+ preferences[PreferencesKeys.APP_LANDING_DESTINATION] = destination.storageValue
+ }
+ }
+
val appTimeFormat: Flow<AppTimeFormat> = context.dataStore.data.map { preferences ->
AppTimeFormat.fromStorage(preferences[PreferencesKeys.APP_TIME_FORMAT])
}
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index b2b4d33d..9b5faed6 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -9,6 +9,7 @@ All notable product changes are recorded in this document.
- Added offline VOD download management with a Downloads screen, foreground service, grouped episode downloads, pause/resume/restart controls, and local playback for completed files.
- Added external playback mode and chooser handling so users can hand streams off to external player apps more reliably.
- Added a stream format selector to the player so users can switch formats when decoder recovery needs an alternate stream variant.
+- Added a default landing screen setting so startup can open Home, Live TV, Movies, Series, Guide, Downloads, Plugins, or Settings instead of always opening Home.
### Changed
diff --git a/domain/src/main/java/com/streamvault/domain/model/AppLandingDestination.kt b/domain/src/main/java/com/streamvault/domain/model/AppLandingDestination.kt
new file mode 100644
index 00000000..a096b162
--- /dev/null
+++ b/domain/src/main/java/com/streamvault/domain/model/AppLandingDestination.kt
@@ -0,0 +1,17 @@
+package com.streamvault.domain.model
+
+enum class AppLandingDestination(val storageValue: String) {
+ HOME("home"),
+ LIVE_TV("live_tv"),
+ MOVIES("movies"),
+ SERIES("series"),
+ GUIDE("guide"),
+ DOWNLOADS("downloads"),
+ PLUGINS("plugins"),
+ SETTINGS("settings");
+
+ companion object {
+ fun fromStorage(value: String?): AppLandingDestination =
+ entries.firstOrNull { it.storageValue.equals(value, ignoreCase = true) } ?: HOME
+ }
+}