Remove non necessary DebugOverrides

This commit is contained in:
Maxime Naturel 2022-03-28 18:02:26 +02:00 committed by Maxime NATUREL
parent 78b2ccb2b5
commit 90c53b9dd5
7 changed files with 1 additions and 36 deletions

View file

@ -33,7 +33,6 @@ 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 {
@ -52,10 +51,6 @@ 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
@ -81,10 +76,4 @@ class DebugVectorOverrides(private val context: Context) : VectorOverrides {
}
}
}
suspend fun setForceEnableLiveLocationSharing(force: Boolean) {
context.dataStore.edit { settings ->
settings[keyForceEnableLiveLocationSharing] = force
}
}
}

View file

@ -46,9 +46,6 @@ class DebugPrivateSettingsFragment : VectorBaseFragment<FragmentDebugPrivateSett
views.forceLoginFallback.setOnCheckedChangeListener { _, isChecked ->
viewModel.handle(DebugPrivateSettingsViewActions.SetForceLoginFallbackEnabled(isChecked))
}
views.forceEnableLiveLocationSharing.setOnCheckedChangeListener { _, isChecked ->
viewModel.handle(DebugPrivateSettingsViewActions.SetEnableLiveLocationSharing(isChecked))
}
}
override fun invalidate() = withState(viewModel) {
@ -60,6 +57,5 @@ class DebugPrivateSettingsFragment : VectorBaseFragment<FragmentDebugPrivateSett
viewModel.handle(DebugPrivateSettingsViewActions.SetAvatarCapabilityOverride(option))
}
views.forceLoginFallback.isChecked = it.forceLoginFallback
views.forceEnableLiveLocationSharing.isChecked = it.forceEnableLiveLocationSharing
}
}

View file

@ -23,5 +23,4 @@ sealed interface DebugPrivateSettingsViewActions : VectorViewModelAction {
data class SetForceLoginFallbackEnabled(val force: Boolean) : DebugPrivateSettingsViewActions
data class SetDisplayNameCapabilityOverride(val option: BooleanHomeserverCapabilitiesOverride?) : DebugPrivateSettingsViewActions
data class SetAvatarCapabilityOverride(val option: BooleanHomeserverCapabilitiesOverride?) : DebugPrivateSettingsViewActions
data class SetEnableLiveLocationSharing(val force: Boolean) : DebugPrivateSettingsViewActions
}

View file

@ -62,9 +62,6 @@ class DebugPrivateSettingsViewModel @AssistedInject constructor(
avatar = homeserverCapabilityOverrides.avatar.copy(activeOption = activeAvatarOption),
))
}
debugVectorOverrides.forceEnableLiveLocationSharing.setOnEach {
copy(forceEnableLiveLocationSharing = it)
}
}
override fun handle(action: DebugPrivateSettingsViewActions) {
@ -73,7 +70,6 @@ class DebugPrivateSettingsViewModel @AssistedInject constructor(
is DebugPrivateSettingsViewActions.SetForceLoginFallbackEnabled -> handleSetForceLoginFallbackEnabled(action)
is SetDisplayNameCapabilityOverride -> handSetDisplayNameCapabilityOverride(action)
is SetAvatarCapabilityOverride -> handSetAvatarCapabilityOverride(action)
is DebugPrivateSettingsViewActions.SetEnableLiveLocationSharing -> handleSetEnableLiveLocationSharingOverride(action)
}
}
@ -102,10 +98,4 @@ class DebugPrivateSettingsViewModel @AssistedInject constructor(
debugVectorOverrides.setHomeserverCapabilities { copy(canChangeAvatar = forceAvatar) }
}
}
private fun handleSetEnableLiveLocationSharingOverride(action: DebugPrivateSettingsViewActions.SetEnableLiveLocationSharing) {
viewModelScope.launch {
debugVectorOverrides.setForceEnableLiveLocationSharing(action.force)
}
}
}

View file

@ -22,8 +22,7 @@ import im.vector.app.features.debug.settings.OverrideDropdownView.OverrideDropdo
data class DebugPrivateSettingsViewState(
val dialPadVisible: Boolean = false,
val forceLoginFallback: Boolean = false,
val homeserverCapabilityOverrides: HomeserverCapabilityOverrides = HomeserverCapabilityOverrides(),
val forceEnableLiveLocationSharing: Boolean = false
val homeserverCapabilityOverrides: HomeserverCapabilityOverrides = HomeserverCapabilityOverrides()
) : MavericksState
data class HomeserverCapabilityOverrides(

View file

@ -49,12 +49,6 @@
android:layout_marginEnd="16dp"
android:layout_marginBottom="4dp" />
<CheckBox
android:id="@+id/forceEnableLiveLocationSharing"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Force enable of live location sharing" />
</LinearLayout>
</ScrollView>

View file

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