Adding forceEnableLiveLocationSharing field in VectorOverride interface

This commit is contained in:
Maxime Naturel 2022-03-18 16:57:43 +01:00 committed by Maxime NATUREL
parent 9d3d574d28
commit 93876737e7
2 changed files with 13 additions and 0 deletions

View file

@ -33,6 +33,7 @@ private val keyForceDialPadDisplay = booleanPreferencesKey("force_dial_pad_displ
private val keyForceLoginFallback = booleanPreferencesKey("force_login_fallback")
private val forceCanChangeDisplayName = booleanPreferencesKey("force_can_change_display_name")
private val forceCanChangeAvatar = booleanPreferencesKey("force_can_change_avatar")
private val keyForceEnableLiveLocationSharing = booleanPreferencesKey("force_enable_live_location_sharing")
class DebugVectorOverrides(private val context: Context) : VectorOverrides {
@ -51,6 +52,10 @@ class DebugVectorOverrides(private val context: Context) : VectorOverrides {
)
}
override val forceEnableLiveLocationSharing = context.dataStore.data.map { preferences ->
preferences[keyForceEnableLiveLocationSharing].orFalse()
}
suspend fun setForceDialPadDisplay(force: Boolean) {
context.dataStore.edit { settings ->
settings[keyForceDialPadDisplay] = force
@ -76,4 +81,10 @@ class DebugVectorOverrides(private val context: Context) : VectorOverrides {
}
}
}
suspend fun setForceEnableLiveLocationSharing(force: Boolean) {
context.dataStore.edit { settings ->
settings[keyForceEnableLiveLocationSharing] = force
}
}
}

View file

@ -23,6 +23,7 @@ interface VectorOverrides {
val forceDialPad: Flow<Boolean>
val forceLoginFallback: Flow<Boolean>
val forceHomeserverCapabilities: Flow<HomeserverCapabilitiesOverride>?
val forceEnableLiveLocationSharing: Flow<Boolean>
}
data class HomeserverCapabilitiesOverride(
@ -34,4 +35,5 @@ class DefaultVectorOverrides : VectorOverrides {
override val forceDialPad = flowOf(false)
override val forceLoginFallback = flowOf(false)
override val forceHomeserverCapabilities: Flow<HomeserverCapabilitiesOverride>? = null
override val forceEnableLiveLocationSharing = flowOf(false)
}