Skip to content

Commit ef01f27

Browse files
PM-14597 Remove notification for declined approval requests (#4287)
1 parent 966a521 commit ef01f27

File tree

2 files changed

+11
-40
lines changed

2 files changed

+11
-40
lines changed

app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/loginwithdevice/LoginWithDeviceViewModel.kt

+2-25
Original file line numberDiff line numberDiff line change
@@ -157,31 +157,8 @@ class LoginWithDeviceViewModel @Inject constructor(
157157
}
158158
}
159159

160-
CreateAuthRequestResult.Declined -> {
161-
when (state.loginWithDeviceType) {
162-
LoginWithDeviceType.OTHER_DEVICE,
163-
LoginWithDeviceType.SSO_OTHER_DEVICE,
164-
-> {
165-
mutableStateFlow.update {
166-
it.copy(
167-
viewState = LoginWithDeviceState.ViewState.Content(
168-
loginWithDeviceType = it.loginWithDeviceType,
169-
fingerprintPhrase = "",
170-
isResendNotificationLoading = false,
171-
),
172-
dialogState = LoginWithDeviceState.DialogState.Error(
173-
title = null,
174-
message = R.string.this_request_is_no_longer_valid.asText(),
175-
),
176-
)
177-
}
178-
}
179-
180-
LoginWithDeviceType.SSO_ADMIN_APPROVAL -> {
181-
// Do nothing, the user should not be informed of this state
182-
}
183-
}
184-
}
160+
// Do nothing, the user should not be informed of this state
161+
CreateAuthRequestResult.Declined -> Unit
185162

186163
CreateAuthRequestResult.Expired -> {
187164
mutableStateFlow.update {

app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/loginwithdevice/LoginWithDeviceViewModelTest.kt

+9-15
Original file line numberDiff line numberDiff line change
@@ -505,23 +505,17 @@ class LoginWithDeviceViewModelTest : BaseViewModelTest() {
505505

506506
@Suppress("MaxLineLength")
507507
@Test
508-
fun `on createAuthRequestWithUpdates with OTHER_DEVICE, Declined received should show error dialog`() {
509-
val viewModel = createViewModel()
510-
assertEquals(DEFAULT_STATE, viewModel.stateFlow.value)
511-
mutableCreateAuthRequestWithUpdatesFlow.tryEmit(CreateAuthRequestResult.Declined)
512-
assertEquals(
513-
DEFAULT_STATE.copy(
514-
viewState = DEFAULT_CONTENT_VIEW_STATE.copy(
515-
fingerprintPhrase = "",
516-
isResendNotificationLoading = false,
517-
),
518-
dialogState = LoginWithDeviceState.DialogState.Error(
519-
title = null,
520-
message = R.string.this_request_is_no_longer_valid.asText(),
521-
),
508+
fun `on createAuthRequestWithUpdates with OTHER_DEVICE, Declined received should show unchanged content`() {
509+
val initialState = DEFAULT_STATE.copy(
510+
loginWithDeviceType = LoginWithDeviceType.OTHER_DEVICE,
511+
viewState = DEFAULT_CONTENT_VIEW_STATE.copy(
512+
loginWithDeviceType = LoginWithDeviceType.OTHER_DEVICE,
522513
),
523-
viewModel.stateFlow.value,
524514
)
515+
val viewModel = createViewModel(state = initialState)
516+
assertEquals(initialState, viewModel.stateFlow.value)
517+
mutableCreateAuthRequestWithUpdatesFlow.tryEmit(CreateAuthRequestResult.Declined)
518+
assertEquals(initialState, viewModel.stateFlow.value)
525519
}
526520

527521
@Suppress("MaxLineLength")

0 commit comments

Comments
 (0)