Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<Preferences.Key<*>> = listOf(LAST_LIVE_CHANNEL, LAST_LIVE_CATEGORY, LAST_MOVIES_CATEGORY, LAST_SERIES_CATEGORY)
val POSITIONS: List<Preferences.Key<*>> = 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,
Expand Down Expand Up @@ -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<String> = profilePositionFlow(Keys.LAST_SERIES_CATEGORY).map { it ?: "" }
suspend fun setLastSeriesCategory(key: String) = setProfilePosition(Keys.LAST_SERIES_CATEGORY, key)
val lastGuideCategory: Flow<String> = 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<Boolean> = prefsFlow { it[Keys.GUIDE_FOLLOWS_LIVE_CATEGORY] ?: false }
suspend fun setGuideFollowsLiveCategory(enabled: Boolean) {
context.dataStore.edit { it[Keys.GUIDE_FOLLOWS_LIVE_CATEGORY] = enabled }
Expand Down Expand Up @@ -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 =
Expand Down
3 changes: 2 additions & 1 deletion tools/i18n/safe_literals.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down