mirror of
https://github.com/bitwarden/android.git
synced 2024-11-27 12:00:19 +03:00
Remove now-unsupported Accessibility and Draw Over autofill options (#658)
This commit is contained in:
parent
514e9a79fd
commit
6f796725a1
4 changed files with 0 additions and 129 deletions
|
@ -112,29 +112,6 @@ fun AutoFillScreen(
|
|||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
BitwardenWideSwitch(
|
||||
label = stringResource(id = R.string.accessibility),
|
||||
description = stringResource(id = R.string.accessibility_description4),
|
||||
isChecked = state.isUseAccessibilityEnabled,
|
||||
onCheckedChange = remember(viewModel) {
|
||||
{ viewModel.trySendAction(AutoFillAction.UseAccessibilityClick(it)) }
|
||||
},
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
BitwardenWideSwitch(
|
||||
label = stringResource(id = R.string.draw_over),
|
||||
description = stringResource(id = R.string.draw_over_description3),
|
||||
isChecked = state.isUseDrawOverEnabled,
|
||||
onCheckedChange = remember(viewModel) {
|
||||
{ viewModel.trySendAction(AutoFillAction.UseDrawOverClick(it)) }
|
||||
},
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
BitwardenListHeaderText(
|
||||
label = stringResource(id = R.string.additional_options),
|
||||
|
|
|
@ -31,8 +31,6 @@ class AutoFillViewModel @Inject constructor(
|
|||
isAskToAddLoginEnabled = false,
|
||||
isAutoFillServicesEnabled = false,
|
||||
isCopyTotpAutomaticallyEnabled = false,
|
||||
isUseAccessibilityEnabled = false,
|
||||
isUseDrawOverEnabled = false,
|
||||
isUseInlineAutoFillEnabled = settingsRepository.isInlineAutofillEnabled,
|
||||
uriDetectionMethod = AutoFillState.UriDetectionMethod.DEFAULT,
|
||||
),
|
||||
|
@ -50,8 +48,6 @@ class AutoFillViewModel @Inject constructor(
|
|||
AutoFillAction.BackClick -> handleBackClick()
|
||||
is AutoFillAction.CopyTotpAutomaticallyClick -> handleCopyTotpAutomaticallyClick(action)
|
||||
is AutoFillAction.UriDetectionMethodSelect -> handleUriDetectionMethodSelect(action)
|
||||
is AutoFillAction.UseAccessibilityClick -> handleUseAccessibilityClick(action)
|
||||
is AutoFillAction.UseDrawOverClick -> handleUseDrawOverClick(action)
|
||||
is AutoFillAction.UseInlineAutofillClick -> handleUseInlineAutofillClick(action)
|
||||
}
|
||||
|
||||
|
@ -79,18 +75,6 @@ class AutoFillViewModel @Inject constructor(
|
|||
mutableStateFlow.update { it.copy(isCopyTotpAutomaticallyEnabled = action.isEnabled) }
|
||||
}
|
||||
|
||||
private fun handleUseAccessibilityClick(action: AutoFillAction.UseAccessibilityClick) {
|
||||
// TODO BIT-843: Persist selection
|
||||
sendEvent(AutoFillEvent.ShowToast("Not yet implemented.".asText()))
|
||||
mutableStateFlow.update { it.copy(isUseAccessibilityEnabled = action.isEnabled) }
|
||||
}
|
||||
|
||||
private fun handleUseDrawOverClick(action: AutoFillAction.UseDrawOverClick) {
|
||||
// TODO BIT-835: Persist selection
|
||||
sendEvent(AutoFillEvent.ShowToast("Not yet implemented.".asText()))
|
||||
mutableStateFlow.update { it.copy(isUseDrawOverEnabled = action.isEnabled) }
|
||||
}
|
||||
|
||||
private fun handleUseInlineAutofillClick(action: AutoFillAction.UseInlineAutofillClick) {
|
||||
settingsRepository.isInlineAutofillEnabled = action.isEnabled
|
||||
mutableStateFlow.update { it.copy(isUseInlineAutoFillEnabled = action.isEnabled) }
|
||||
|
@ -113,8 +97,6 @@ data class AutoFillState(
|
|||
val isAskToAddLoginEnabled: Boolean,
|
||||
val isAutoFillServicesEnabled: Boolean,
|
||||
val isCopyTotpAutomaticallyEnabled: Boolean,
|
||||
val isUseAccessibilityEnabled: Boolean,
|
||||
val isUseDrawOverEnabled: Boolean,
|
||||
val isUseInlineAutoFillEnabled: Boolean,
|
||||
val uriDetectionMethod: UriDetectionMethod,
|
||||
) : Parcelable {
|
||||
|
@ -186,20 +168,6 @@ sealed class AutoFillAction {
|
|||
val uriDetectionMethod: AutoFillState.UriDetectionMethod,
|
||||
) : AutoFillAction()
|
||||
|
||||
/**
|
||||
* User clicked use accessibility button.
|
||||
*/
|
||||
data class UseAccessibilityClick(
|
||||
val isEnabled: Boolean,
|
||||
) : AutoFillAction()
|
||||
|
||||
/**
|
||||
* User clicked use draw-over button.
|
||||
*/
|
||||
data class UseDrawOverClick(
|
||||
val isEnabled: Boolean,
|
||||
) : AutoFillAction()
|
||||
|
||||
/**
|
||||
* User clicked use inline autofill button.
|
||||
*/
|
||||
|
|
|
@ -87,50 +87,6 @@ class AutoFillScreenTest : BaseComposeTest() {
|
|||
.assertIsOn()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `on use accessibility toggle should send UseAccessibilityClick`() {
|
||||
composeTestRule
|
||||
.onNodeWithText("Use accessibility")
|
||||
.performScrollTo()
|
||||
.performClick()
|
||||
verify { viewModel.trySendAction(AutoFillAction.UseAccessibilityClick(true)) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `use accessibility should be toggled on or off according to state`() {
|
||||
composeTestRule
|
||||
.onNodeWithText("Use accessibility")
|
||||
.performScrollTo()
|
||||
.assertIsOff()
|
||||
mutableStateFlow.update { it.copy(isUseAccessibilityEnabled = true) }
|
||||
composeTestRule
|
||||
.onNodeWithText("Use accessibility")
|
||||
.performScrollTo()
|
||||
.assertIsOn()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `on use draw over toggle should send UseDrawOverClick`() {
|
||||
composeTestRule
|
||||
.onNodeWithText("Use draw-over")
|
||||
.performScrollTo()
|
||||
.performClick()
|
||||
verify { viewModel.trySendAction(AutoFillAction.UseDrawOverClick(true)) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `use draw-over should be toggled on or off according to state`() {
|
||||
composeTestRule
|
||||
.onNodeWithText("Use draw-over")
|
||||
.performScrollTo()
|
||||
.assertIsOff()
|
||||
mutableStateFlow.update { it.copy(isUseDrawOverEnabled = true) }
|
||||
composeTestRule
|
||||
.onNodeWithText("Use draw-over")
|
||||
.performScrollTo()
|
||||
.assertIsOn()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `on copy TOTP automatically toggle should send CopyTotpAutomaticallyClick`() {
|
||||
composeTestRule
|
||||
|
@ -224,8 +180,6 @@ private val DEFAULT_STATE: AutoFillState = AutoFillState(
|
|||
isAskToAddLoginEnabled = false,
|
||||
isAutoFillServicesEnabled = false,
|
||||
isCopyTotpAutomaticallyEnabled = false,
|
||||
isUseAccessibilityEnabled = false,
|
||||
isUseDrawOverEnabled = false,
|
||||
isUseInlineAutoFillEnabled = false,
|
||||
uriDetectionMethod = AutoFillState.UriDetectionMethod.DEFAULT,
|
||||
)
|
||||
|
|
|
@ -87,32 +87,6 @@ class AutoFillViewModelTest : BaseViewModelTest() {
|
|||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `on UseAccessibilityClick should emit ShowToast`() = runTest {
|
||||
val viewModel = createViewModel()
|
||||
viewModel.eventFlow.test {
|
||||
viewModel.trySendAction(AutoFillAction.UseAccessibilityClick(true))
|
||||
assertEquals(AutoFillEvent.ShowToast("Not yet implemented.".asText()), awaitItem())
|
||||
}
|
||||
assertEquals(
|
||||
DEFAULT_STATE.copy(isUseAccessibilityEnabled = true),
|
||||
viewModel.stateFlow.value,
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `on UseDrawOverClick should emit ShowToast`() = runTest {
|
||||
val viewModel = createViewModel()
|
||||
viewModel.eventFlow.test {
|
||||
viewModel.trySendAction(AutoFillAction.UseDrawOverClick(true))
|
||||
assertEquals(AutoFillEvent.ShowToast("Not yet implemented.".asText()), awaitItem())
|
||||
}
|
||||
assertEquals(
|
||||
DEFAULT_STATE.copy(isUseDrawOverEnabled = true),
|
||||
viewModel.stateFlow.value,
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `on UseInlineAutofillClick should update the state and save the new value to settings`() {
|
||||
val viewModel = createViewModel()
|
||||
|
@ -150,8 +124,6 @@ private val DEFAULT_STATE: AutoFillState = AutoFillState(
|
|||
isAskToAddLoginEnabled = false,
|
||||
isAutoFillServicesEnabled = false,
|
||||
isCopyTotpAutomaticallyEnabled = false,
|
||||
isUseAccessibilityEnabled = false,
|
||||
isUseDrawOverEnabled = false,
|
||||
isUseInlineAutoFillEnabled = true,
|
||||
uriDetectionMethod = AutoFillState.UriDetectionMethod.DEFAULT,
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue