Merge pull request #5482 from element-hq/feature/bma/improveAnnouncementService

Improve AnnouncementService.
This commit is contained in:
Benoit Marty 2025-10-08 12:08:29 +02:00 committed by GitHub
commit 1a8bf8b8a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 223 additions and 86 deletions

View file

@ -37,8 +37,5 @@ interface AppPreferencesStore {
suspend fun setTracingLogPacks(targets: Set<TraceLogPack>)
fun getTracingLogPacksFlow(): Flow<Set<TraceLogPack>>
suspend fun setShowNewNotificationSoundBanner(show: Boolean)
fun showNewNotificationSoundBanner(): Flow<Boolean>
suspend fun reset()
}

View file

@ -30,7 +30,6 @@ 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
@ -146,19 +145,6 @@ 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() }
}

View file

@ -22,7 +22,6 @@ class InMemoryAppPreferencesStore(
theme: String? = null,
logLevel: LogLevel = LogLevel.INFO,
traceLockPacks: Set<TraceLogPack> = emptySet(),
showNewNotificationSoundBanner: Boolean = false,
) : AppPreferencesStore {
private val isDeveloperModeEnabled = MutableStateFlow(isDeveloperModeEnabled)
private val customElementCallBaseUrl = MutableStateFlow(customElementCallBaseUrl)
@ -31,7 +30,6 @@ class InMemoryAppPreferencesStore(
private val tracingLogPacks = MutableStateFlow(traceLockPacks)
private val hideInviteAvatars = MutableStateFlow(hideInviteAvatars)
private val timelineMediaPreviewValue = MutableStateFlow(timelineMediaPreviewValue)
private val showNewNotificationSoundBanner = MutableStateFlow(showNewNotificationSoundBanner)
override suspend fun setDeveloperModeEnabled(enabled: Boolean) {
isDeveloperModeEnabled.value = enabled
@ -93,14 +91,6 @@ class InMemoryAppPreferencesStore(
return tracingLogPacks
}
override suspend fun setShowNewNotificationSoundBanner(show: Boolean) {
showNewNotificationSoundBanner.value = show
}
override fun showNewNotificationSoundBanner(): Flow<Boolean> {
return showNewNotificationSoundBanner
}
override suspend fun reset() {
// No op
}