Show new notification sound banner logic

This commit is contained in:
Benoit Marty
2025-10-07 12:20:24 +02:00
committed by Benoit Marty
parent 71d2c1d9df
commit 4475ed0d37
11 changed files with 150 additions and 2 deletions

View File

@@ -30,6 +30,7 @@ private val hideInviteAvatarsKey = booleanPreferencesKey("hideInviteAvatars")
private val timelineMediaPreviewValueKey = stringPreferencesKey("timelineMediaPreviewValue")
private val logLevelKey = stringPreferencesKey("logLevel")
private val traceLogPacksKey = stringPreferencesKey("traceLogPacks")
private val showNewNotificationSoundBannerKey = booleanPreferencesKey("showNewNotificationSoundBanner")
@ContributesBinding(AppScope::class)
@Inject
@@ -145,6 +146,19 @@ class DefaultAppPreferencesStore(
}
}
override suspend fun setShowNewNotificationSoundBanner(show: Boolean) {
store.edit { prefs ->
prefs[showNewNotificationSoundBannerKey] = show
}
}
override fun showNewNotificationSoundBanner(): Flow<Boolean> {
return store.data.map { prefs ->
// Default is false, but a migration will set it to true on application upgrade (see AppMigration08)
prefs[showNewNotificationSoundBannerKey] ?: false
}
}
override suspend fun reset() {
store.edit { it.clear() }
}