Adding new override setting in the debug private settings
This commit is contained in:
parent
93876737e7
commit
424f70bc58
@ -46,6 +46,9 @@ class DebugPrivateSettingsFragment : VectorBaseFragment<FragmentDebugPrivateSett
|
|||||||
views.forceLoginFallback.setOnCheckedChangeListener { _, isChecked ->
|
views.forceLoginFallback.setOnCheckedChangeListener { _, isChecked ->
|
||||||
viewModel.handle(DebugPrivateSettingsViewActions.SetForceLoginFallbackEnabled(isChecked))
|
viewModel.handle(DebugPrivateSettingsViewActions.SetForceLoginFallbackEnabled(isChecked))
|
||||||
}
|
}
|
||||||
|
views.forceEnableLiveLocationSharing.setOnCheckedChangeListener { _, isChecked ->
|
||||||
|
viewModel.handle(DebugPrivateSettingsViewActions.SetEnableLiveLocationSharing(isChecked))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun invalidate() = withState(viewModel) {
|
override fun invalidate() = withState(viewModel) {
|
||||||
@ -57,5 +60,6 @@ class DebugPrivateSettingsFragment : VectorBaseFragment<FragmentDebugPrivateSett
|
|||||||
viewModel.handle(DebugPrivateSettingsViewActions.SetAvatarCapabilityOverride(option))
|
viewModel.handle(DebugPrivateSettingsViewActions.SetAvatarCapabilityOverride(option))
|
||||||
}
|
}
|
||||||
views.forceLoginFallback.isChecked = it.forceLoginFallback
|
views.forceLoginFallback.isChecked = it.forceLoginFallback
|
||||||
|
views.forceEnableLiveLocationSharing.isChecked = it.forceEnableLiveLocationSharing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,4 +23,5 @@ sealed interface DebugPrivateSettingsViewActions : VectorViewModelAction {
|
|||||||
data class SetForceLoginFallbackEnabled(val force: Boolean) : DebugPrivateSettingsViewActions
|
data class SetForceLoginFallbackEnabled(val force: Boolean) : DebugPrivateSettingsViewActions
|
||||||
data class SetDisplayNameCapabilityOverride(val option: BooleanHomeserverCapabilitiesOverride?) : DebugPrivateSettingsViewActions
|
data class SetDisplayNameCapabilityOverride(val option: BooleanHomeserverCapabilitiesOverride?) : DebugPrivateSettingsViewActions
|
||||||
data class SetAvatarCapabilityOverride(val option: BooleanHomeserverCapabilitiesOverride?) : DebugPrivateSettingsViewActions
|
data class SetAvatarCapabilityOverride(val option: BooleanHomeserverCapabilitiesOverride?) : DebugPrivateSettingsViewActions
|
||||||
|
data class SetEnableLiveLocationSharing(val force: Boolean) : DebugPrivateSettingsViewActions
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,9 @@ class DebugPrivateSettingsViewModel @AssistedInject constructor(
|
|||||||
avatar = homeserverCapabilityOverrides.avatar.copy(activeOption = activeAvatarOption),
|
avatar = homeserverCapabilityOverrides.avatar.copy(activeOption = activeAvatarOption),
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
debugVectorOverrides.forceEnableLiveLocationSharing.setOnEach {
|
||||||
|
copy(forceEnableLiveLocationSharing = it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun handle(action: DebugPrivateSettingsViewActions) {
|
override fun handle(action: DebugPrivateSettingsViewActions) {
|
||||||
@ -70,6 +73,7 @@ class DebugPrivateSettingsViewModel @AssistedInject constructor(
|
|||||||
is DebugPrivateSettingsViewActions.SetForceLoginFallbackEnabled -> handleSetForceLoginFallbackEnabled(action)
|
is DebugPrivateSettingsViewActions.SetForceLoginFallbackEnabled -> handleSetForceLoginFallbackEnabled(action)
|
||||||
is SetDisplayNameCapabilityOverride -> handSetDisplayNameCapabilityOverride(action)
|
is SetDisplayNameCapabilityOverride -> handSetDisplayNameCapabilityOverride(action)
|
||||||
is SetAvatarCapabilityOverride -> handSetAvatarCapabilityOverride(action)
|
is SetAvatarCapabilityOverride -> handSetAvatarCapabilityOverride(action)
|
||||||
|
is DebugPrivateSettingsViewActions.SetEnableLiveLocationSharing -> handleSetEnableLiveLocationSharingOverride(action)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,17 +89,23 @@ class DebugPrivateSettingsViewModel @AssistedInject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handSetDisplayNameCapabilityOverride(action: SetDisplayNameCapabilityOverride) {
|
private fun handleSetDisplayNameCapabilityOverride(action: SetDisplayNameCapabilityOverride) {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
val forceDisplayName = action.option.toBoolean()
|
val forceDisplayName = action.option.toBoolean()
|
||||||
debugVectorOverrides.setHomeserverCapabilities { copy(canChangeDisplayName = forceDisplayName) }
|
debugVectorOverrides.setHomeserverCapabilities { copy(canChangeDisplayName = forceDisplayName) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun handSetAvatarCapabilityOverride(action: SetAvatarCapabilityOverride) {
|
private fun handleSetAvatarCapabilityOverride(action: SetAvatarCapabilityOverride) {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
val forceAvatar = action.option.toBoolean()
|
val forceAvatar = action.option.toBoolean()
|
||||||
debugVectorOverrides.setHomeserverCapabilities { copy(canChangeAvatar = forceAvatar) }
|
debugVectorOverrides.setHomeserverCapabilities { copy(canChangeAvatar = forceAvatar) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun handleSetEnableLiveLocationSharingOverride(action: DebugPrivateSettingsViewActions.SetEnableLiveLocationSharing) {
|
||||||
|
viewModelScope.launch {
|
||||||
|
debugVectorOverrides.setForceEnableLiveLocationSharing(action.force)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,8 @@ import im.vector.app.features.debug.settings.OverrideDropdownView.OverrideDropdo
|
|||||||
data class DebugPrivateSettingsViewState(
|
data class DebugPrivateSettingsViewState(
|
||||||
val dialPadVisible: Boolean = false,
|
val dialPadVisible: Boolean = false,
|
||||||
val forceLoginFallback: Boolean = false,
|
val forceLoginFallback: Boolean = false,
|
||||||
val homeserverCapabilityOverrides: HomeserverCapabilityOverrides = HomeserverCapabilityOverrides()
|
val homeserverCapabilityOverrides: HomeserverCapabilityOverrides = HomeserverCapabilityOverrides(),
|
||||||
|
val forceEnableLiveLocationSharing: Boolean = false
|
||||||
) : MavericksState
|
) : MavericksState
|
||||||
|
|
||||||
data class HomeserverCapabilityOverrides(
|
data class HomeserverCapabilityOverrides(
|
||||||
|
@ -49,6 +49,12 @@
|
|||||||
android:layout_marginEnd="16dp"
|
android:layout_marginEnd="16dp"
|
||||||
android:layout_marginBottom="4dp" />
|
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>
|
</LinearLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
Loading…
Reference in New Issue
Block a user