From 7275cd1be0a41396007264bbbdc4784bb012ee29 Mon Sep 17 00:00:00 2001 From: Quad-Plex Date: Mon, 16 Nov 2026 10:38:16 +0100 Subject: [PATCH] Remember the TV Guide's own category per profile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "TV Guide follows Live TV" promised that with the switch off the Guide "keeps a category of its own", but nothing stored it: the filter lived in the view model, so every app start put the Guide back on All and the user had to pick Favorites again. With the switch on, a pick in the Guide did reach Live TV's memory, so only the default configuration was broken. `last_guide_category` is stored beside the other remembered positions — one per profile, portable in a backup the same way, and dropped with the profile. The app writes it from a pick only; a startup choice or the jump to the playing channel's folder stays a placement. --- .../owntv/core/settings/SettingsRepository.kt | 18 +++++++++++++----- tools/i18n/safe_literals.txt | 3 ++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/tv/own/owntv/core/settings/SettingsRepository.kt b/core/src/main/java/tv/own/owntv/core/settings/SettingsRepository.kt index 6bf306ed..25036b3e 100644 --- a/core/src/main/java/tv/own/owntv/core/settings/SettingsRepository.kt +++ b/core/src/main/java/tv/own/owntv/core/settings/SettingsRepository.kt @@ -662,14 +662,19 @@ class SettingsRepository(private val context: Context, private val localeStore: val LIVE_SHOW_CATCHUP_RAIL = booleanPreferencesKey("live_show_catchup_rail") val LAST_MOVIES_CATEGORY = stringPreferencesKey("last_movies_category") val LAST_SERIES_CATEGORY = stringPreferencesKey("last_series_category") + // The TV Guide's own list. Separate from LAST_LIVE_CATEGORY: the Guide is a section of its own and + // keeps its own choice unless "TV Guide follows Live TV" is on. + val LAST_GUIDE_CATEGORY = stringPreferencesKey("last_guide_category") val GUIDE_FOLLOWS_LIVE_CATEGORY = booleanPreferencesKey("guide_follows_live_category") /** - * Written while browsing, so kept in their own store rather than the settings file. These four + * Written while browsing, so kept in their own store rather than the settings file. These five * are the values the whole device shared; each profile now keeps its own copy beside them * (see profilePositionFlow), and these are read only by a profile that has none yet. */ - val POSITIONS: List> = listOf(LAST_LIVE_CHANNEL, LAST_LIVE_CATEGORY, LAST_MOVIES_CATEGORY, LAST_SERIES_CATEGORY) + val POSITIONS: List> = listOf( + LAST_LIVE_CHANNEL, LAST_LIVE_CATEGORY, LAST_MOVIES_CATEGORY, LAST_SERIES_CATEGORY, LAST_GUIDE_CATEGORY, + ) // Background picture (Glass & background). bg_image_path holds the absolute path of the image we // COPIED into app-private storage (so a USB unplug or source-folder delete never blanks it); // blank = no background (feature off, panels stay solid). glass_scope is Glass on (any bit set, @@ -843,9 +848,12 @@ class SettingsRepository(private val context: Context, private val localeStore: suspend fun setLastMoviesCategory(key: String) = setProfilePosition(Keys.LAST_MOVIES_CATEGORY, key) val lastSeriesCategory: Flow = profilePositionFlow(Keys.LAST_SERIES_CATEGORY).map { it ?: "" } suspend fun setLastSeriesCategory(key: String) = setProfilePosition(Keys.LAST_SERIES_CATEGORY, key) + val lastGuideCategory: Flow = profilePositionFlow(Keys.LAST_GUIDE_CATEGORY).map { it ?: "" } + suspend fun setLastGuideCategory(key: String) = setProfilePosition(Keys.LAST_GUIDE_CATEGORY, key) - // --- "TV Guide follows Live TV's category" (default off: the Guide keeps a category of its own). On, - // the Guide opens on Live TV's remembered category and a category picked there becomes it. --- + // --- "TV Guide follows Live TV's category" (default off: the Guide keeps a category of its own, + // remembered per profile like Live TV's). On, the Guide opens on Live TV's remembered category + // and a category picked there becomes it, so the two screens always share one list. --- val guideFollowsLiveCategory: Flow = prefsFlow { it[Keys.GUIDE_FOLLOWS_LIVE_CATEGORY] ?: false } suspend fun setGuideFollowsLiveCategory(enabled: Boolean) { context.dataStore.edit { it[Keys.GUIDE_FOLLOWS_LIVE_CATEGORY] = enabled } @@ -3319,7 +3327,7 @@ class SettingsRepository(private val context: Context, private val localeStore: * it is a Room channel id, so there is nothing here worth carrying. */ private val backupLastCategoryKeys = listOf( - Keys.LAST_LIVE_CATEGORY, Keys.LAST_MOVIES_CATEGORY, Keys.LAST_SERIES_CATEGORY, + Keys.LAST_LIVE_CATEGORY, Keys.LAST_MOVIES_CATEGORY, Keys.LAST_SERIES_CATEGORY, Keys.LAST_GUIDE_CATEGORY, ) private fun isPortableCategoryKey(value: String): Boolean = diff --git a/tools/i18n/safe_literals.txt b/tools/i18n/safe_literals.txt index d0f46c00..603a673a 100644 --- a/tools/i18n/safe_literals.txt +++ b/tools/i18n/safe_literals.txt @@ -3108,7 +3108,7 @@ 1 technical core/src/main/java/tv/own/owntv/core/settings/SettingsImportRules.kt player_hold_ok 1 technical core/src/main/java/tv/own/owntv/core/settings/SettingsImportRules.kt player_short_ok 1 technical core/src/main/java/tv/own/owntv/core/settings/SettingsImportRules.kt seek_step_sec -36 empty core/src/main/java/tv/own/owntv/core/settings/SettingsRepository.kt \0 +37 empty core/src/main/java/tv/own/owntv/core/settings/SettingsRepository.kt \0 1 preference-key core/src/main/java/tv/own/owntv/core/settings/SettingsRepository.kt $DOWNLOADS_ALLOWED_PREFIX$profileId 1 preference-key core/src/main/java/tv/own/owntv/core/settings/SettingsRepository.kt $SPORTS_CONFIG_PREFIX$profileId 2 log core/src/main/java/tv/own/owntv/core/settings/SettingsRepository.kt ${mode.name}$SEPARATOR$manualDays @@ -3215,6 +3215,7 @@ 1 preference-key core/src/main/java/tv/own/owntv/core/settings/SettingsRepository.kt last_backup_bytes 1 preference-key core/src/main/java/tv/own/owntv/core/settings/SettingsRepository.kt last_backup_encrypted 1 preference-key core/src/main/java/tv/own/owntv/core/settings/SettingsRepository.kt last_backup_path +1 preference-key core/src/main/java/tv/own/owntv/core/settings/SettingsRepository.kt last_guide_category 1 preference-key core/src/main/java/tv/own/owntv/core/settings/SettingsRepository.kt last_live_category 1 preference-key core/src/main/java/tv/own/owntv/core/settings/SettingsRepository.kt last_live_channel 1 preference-key core/src/main/java/tv/own/owntv/core/settings/SettingsRepository.kt last_movies_category