Auto commit Tue Mar 24 05:01:02 PM CDT 2026

This commit is contained in:
Tretzi
2026-03-24 17:01:02 -05:00
parent 1beb6ffa69
commit 2a548edc9a
4 changed files with 83 additions and 3 deletions

View File

@@ -20,6 +20,7 @@ class SettingsRepository(private val context: Context) {
val countdownSeconds = intPreferencesKey("countdown_seconds")
val forceAudioWithoutHeadphones = booleanPreferencesKey("force_audio_without_headphones")
val showImmersiveProgressBar = booleanPreferencesKey("show_immersive_progress_bar")
val immersiveBrightnessPercent = intPreferencesKey("immersive_brightness_percent")
val lastPresetId = stringPreferencesKey("last_preset")
}
@@ -32,6 +33,7 @@ class SettingsRepository(private val context: Context) {
?: 5,
forceAudioWithoutHeadphones = p[Keys.forceAudioWithoutHeadphones] ?: false,
showImmersiveProgressBar = p[Keys.showImmersiveProgressBar] ?: true,
immersiveBrightnessPercent = (p[Keys.immersiveBrightnessPercent] ?: 100).coerceIn(5, 100),
lastPresetId = p[Keys.lastPresetId],
)
}
@@ -55,6 +57,10 @@ class SettingsRepository(private val context: Context) {
it[Keys.showImmersiveProgressBar] = value
}
suspend fun updateImmersiveBrightnessPercent(value: Int) = context.dataStore.edit {
it[Keys.immersiveBrightnessPercent] = value.coerceIn(5, 100)
}
suspend fun updateLastPreset(id: String) = context.dataStore.edit { it[Keys.lastPresetId] = id }
private fun legacyCountdownStringToSeconds(raw: String?): Int? = when (raw) {