mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Move user status next to the current account header.
Also make the other account section collapsable
This commit is contained in:
+13
@@ -33,6 +33,7 @@ private val developerModeKey = booleanPreferencesKey("developerMode")
|
||||
private val customElementCallBaseUrlKey = stringPreferencesKey("elementCallBaseUrl")
|
||||
private val themeKey = stringPreferencesKey("theme")
|
||||
private val hideInviteAvatarsKey = booleanPreferencesKey("hideInviteAvatars")
|
||||
private val otherAccountsExpandedKey = booleanPreferencesKey("otherAccountsExpanded")
|
||||
private val timelineMediaPreviewValueKey = stringPreferencesKey("timelineMediaPreviewValue")
|
||||
private val liveLocationMinimumDistanceUpdateKey = intPreferencesKey("liveLocationMinimumDistanceUpdate")
|
||||
private val logLevelKey = stringPreferencesKey("logLevel")
|
||||
@@ -97,6 +98,18 @@ class DefaultAppPreferencesStore(
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun setOtherAccountsExpanded(expanded: Boolean) {
|
||||
store.edit { prefs ->
|
||||
prefs[otherAccountsExpandedKey] = expanded
|
||||
}
|
||||
}
|
||||
|
||||
override fun isOtherAccountsExpandedFlow(): Flow<Boolean> {
|
||||
return store.data.map { prefs ->
|
||||
prefs[otherAccountsExpandedKey] ?: true
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun setLiveLocationMinimumDistanceInMetersUpdate(value: Int) {
|
||||
store.edit { prefs ->
|
||||
prefs[liveLocationMinimumDistanceUpdateKey] = value
|
||||
|
||||
+18
@@ -120,6 +120,24 @@ class DefaultAppPreferencesStoreTest {
|
||||
assertThat(history.last()).isEqualTo("https://server5.org")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `other accounts section is expanded by default`() = runTest {
|
||||
val store = createStore()
|
||||
|
||||
assertThat(store.isOtherAccountsExpandedFlow().first()).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `other accounts expanded state persists updates`() = runTest {
|
||||
val store = createStore()
|
||||
|
||||
store.setOtherAccountsExpanded(false)
|
||||
assertThat(store.isOtherAccountsExpandedFlow().first()).isFalse()
|
||||
|
||||
store.setOtherAccountsExpanded(true)
|
||||
assertThat(store.isOtherAccountsExpandedFlow().first()).isTrue()
|
||||
}
|
||||
|
||||
private fun createStore() = DefaultAppPreferencesStore(
|
||||
buildMeta = buildMeta,
|
||||
preferenceDataStoreFactory = FakePreferenceDataStoreFactory(),
|
||||
|
||||
Reference in New Issue
Block a user