diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupUnlockViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupUnlockViewModel.kt index 1e61245af..458e2a454 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupUnlockViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupUnlockViewModel.kt @@ -76,6 +76,11 @@ class SetupUnlockViewModel @Inject constructor( } private fun handleCloseClick() { + // If the user has enabled biometric or PIN lock, but then closes the screen we + // want to dismiss the action card. + if (state.isContinueButtonEnabled) { + firstTimeActionManager.storeShowUnlockSettingBadge(showBadge = false) + } sendEvent(SetupUnlockEvent.NavigateBack) } diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupUnlockViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupUnlockViewModelTest.kt index 03ecc23e8..cabde2dbb 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupUnlockViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/accountsetup/SetupUnlockViewModelTest.kt @@ -352,8 +352,23 @@ class SetupUnlockViewModelTest : BaseViewModelTest() { awaitItem(), ) } + verify(exactly = 0) { + firstTimeActionManager.storeShowUnlockSettingBadge(showBadge = false) + } } + @Suppress("MaxLineLength") + @Test + fun `CloseClick action should update the first time state to false if continue button is enabled`() = + runTest { + val viewModel = + createViewModel(state = DEFAULT_STATE.copy(isUnlockWithPinEnabled = true)) + viewModel.trySendAction(SetupUnlockAction.CloseClick) + verify { + firstTimeActionManager.storeShowUnlockSettingBadge(showBadge = false) + } + } + private fun createViewModel( state: SetupUnlockState? = null, ): SetupUnlockViewModel =