From dfeb87be103058287381358e8ea153ad9fafa49c Mon Sep 17 00:00:00 2001 From: Dave Severns <149429124+dseverns-livefront@users.noreply.github.com> Date: Mon, 11 Nov 2024 10:31:21 -0500 Subject: [PATCH] PM-13988 Hide the action card if the user makes a selection but does not click continue on setup unlock (#4249) --- .../feature/accountsetup/SetupUnlockViewModel.kt | 5 +++++ .../accountsetup/SetupUnlockViewModelTest.kt | 15 +++++++++++++++ 2 files changed, 20 insertions(+) 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 =