mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Add simplified sliding sync toggle to developer options
This commit is contained in:
+13
@@ -38,6 +38,7 @@ private val Context.dataStore: DataStore<Preferences> by preferencesDataStore(na
|
||||
private val developerModeKey = booleanPreferencesKey("developerMode")
|
||||
private val customElementCallBaseUrlKey = stringPreferencesKey("elementCallBaseUrl")
|
||||
private val themeKey = stringPreferencesKey("theme")
|
||||
private val simplifiedSlidingSyncKey = booleanPreferencesKey("useSimplifiedSlidingSync")
|
||||
|
||||
@ContributesBinding(AppScope::class)
|
||||
class DefaultAppPreferencesStore @Inject constructor(
|
||||
@@ -87,6 +88,18 @@ class DefaultAppPreferencesStore @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun setSimplifiedSlidingSyncEnabled(enabled: Boolean) {
|
||||
store.edit { prefs ->
|
||||
prefs[simplifiedSlidingSyncKey] = enabled
|
||||
}
|
||||
}
|
||||
|
||||
override fun isSimplifiedSlidingSyncEnabledFlow(): Flow<Boolean> {
|
||||
return store.data.map { prefs ->
|
||||
prefs[simplifiedSlidingSyncKey] ?: false
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun reset() {
|
||||
store.edit { it.clear() }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user