mirror of
https://github.com/bitwarden/android.git
synced 2024-11-21 17:05:44 +03:00
PM-14597 remove notification if device login is decleined (#4256)
This commit is contained in:
parent
771e719963
commit
fd4a7c5716
2 changed files with 11 additions and 40 deletions
|
@ -157,31 +157,8 @@ class LoginWithDeviceViewModel @Inject constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateAuthRequestResult.Declined -> {
|
// Do nothing, the user should not be informed of this state
|
||||||
when (state.loginWithDeviceType) {
|
CreateAuthRequestResult.Declined -> Unit
|
||||||
LoginWithDeviceType.OTHER_DEVICE,
|
|
||||||
LoginWithDeviceType.SSO_OTHER_DEVICE,
|
|
||||||
-> {
|
|
||||||
mutableStateFlow.update {
|
|
||||||
it.copy(
|
|
||||||
viewState = LoginWithDeviceState.ViewState.Content(
|
|
||||||
loginWithDeviceType = it.loginWithDeviceType,
|
|
||||||
fingerprintPhrase = "",
|
|
||||||
isResendNotificationLoading = false,
|
|
||||||
),
|
|
||||||
dialogState = LoginWithDeviceState.DialogState.Error(
|
|
||||||
title = null,
|
|
||||||
message = R.string.this_request_is_no_longer_valid.asText(),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LoginWithDeviceType.SSO_ADMIN_APPROVAL -> {
|
|
||||||
// Do nothing, the user should not be informed of this state
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CreateAuthRequestResult.Expired -> {
|
CreateAuthRequestResult.Expired -> {
|
||||||
mutableStateFlow.update {
|
mutableStateFlow.update {
|
||||||
|
|
|
@ -524,23 +524,17 @@ class LoginWithDeviceViewModelTest : BaseViewModelTest() {
|
||||||
|
|
||||||
@Suppress("MaxLineLength")
|
@Suppress("MaxLineLength")
|
||||||
@Test
|
@Test
|
||||||
fun `on createAuthRequestWithUpdates with OTHER_DEVICE, Declined received should show error dialog`() {
|
fun `on createAuthRequestWithUpdates with OTHER_DEVICE, Declined received should show unchanged content`() {
|
||||||
val viewModel = createViewModel()
|
val initialState = DEFAULT_STATE.copy(
|
||||||
assertEquals(DEFAULT_STATE, viewModel.stateFlow.value)
|
loginWithDeviceType = LoginWithDeviceType.OTHER_DEVICE,
|
||||||
mutableCreateAuthRequestWithUpdatesFlow.tryEmit(CreateAuthRequestResult.Declined)
|
viewState = DEFAULT_CONTENT_VIEW_STATE.copy(
|
||||||
assertEquals(
|
loginWithDeviceType = LoginWithDeviceType.OTHER_DEVICE,
|
||||||
DEFAULT_STATE.copy(
|
|
||||||
viewState = DEFAULT_CONTENT_VIEW_STATE.copy(
|
|
||||||
fingerprintPhrase = "",
|
|
||||||
isResendNotificationLoading = false,
|
|
||||||
),
|
|
||||||
dialogState = LoginWithDeviceState.DialogState.Error(
|
|
||||||
title = null,
|
|
||||||
message = R.string.this_request_is_no_longer_valid.asText(),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
viewModel.stateFlow.value,
|
|
||||||
)
|
)
|
||||||
|
val viewModel = createViewModel(state = initialState)
|
||||||
|
assertEquals(initialState, viewModel.stateFlow.value)
|
||||||
|
mutableCreateAuthRequestWithUpdatesFlow.tryEmit(CreateAuthRequestResult.Declined)
|
||||||
|
assertEquals(initialState, viewModel.stateFlow.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("MaxLineLength")
|
@Suppress("MaxLineLength")
|
||||||
|
|
Loading…
Reference in a new issue