From 3ee74d3ec56a19c47906e0e12c87824ceb763c7a Mon Sep 17 00:00:00 2001 From: David Perez Date: Fri, 27 Jun 2025 11:50:14 -0500 Subject: [PATCH] PM-19776: Change 'Move to Bitwarden' to 'Copy to Bitwarden vault' (#5435) --- .../feature/itemlisting/ItemListingViewModel.kt | 10 +++++----- .../itemlisting/VaultVerificationCodeItem.kt | 10 ++++++---- .../itemlisting/model/VaultDropdownMenuAction.kt | 4 ++-- .../SharedVerificationCodesStateExtensions.kt | 2 +- .../util/VerificationCodeItemExtensions.kt | 4 ++-- authenticator/src/main/res/values/strings.xml | 2 +- .../feature/itemlisting/ItemListingScreenTest.kt | 11 ++++++----- .../itemlisting/ItemListingViewModelTest.kt | 15 +++++++++------ 8 files changed, 32 insertions(+), 26 deletions(-) diff --git a/authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/ItemListingViewModel.kt b/authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/ItemListingViewModel.kt index 484c3a5a08..46eca399f4 100644 --- a/authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/ItemListingViewModel.kt +++ b/authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/ItemListingViewModel.kt @@ -119,7 +119,7 @@ class ItemListingViewModel @Inject constructor( } is ItemListingAction.ItemClick -> { - handleCopyItemClick(action.authCode) + handleCopyCodeClick(action.authCode) } is ItemListingAction.DialogDismiss -> { @@ -164,7 +164,7 @@ class ItemListingViewModel @Inject constructor( sendEvent(ItemListingEvent.NavigateToAppSettings) } - private fun handleCopyItemClick(authCode: String) { + private fun handleCopyCodeClick(authCode: String) { clipboardManager.setText(authCode) } @@ -172,7 +172,7 @@ class ItemListingViewModel @Inject constructor( sendEvent(ItemListingEvent.NavigateToEditItem(itemId)) } - private fun handleMoveToBitwardenClick(itemId: String) { + private fun handleCopyToBitwardenClick(itemId: String) { viewModelScope.launch { val item = authenticatorRepository .getItemStateFlow(itemId) @@ -521,9 +521,9 @@ class ItemListingViewModel @Inject constructor( private fun handleDropdownMenuClick(action: ItemListingAction.DropdownMenuClick) { when (action.menuAction) { - VaultDropdownMenuAction.COPY -> handleCopyItemClick(action.item.authCode) + VaultDropdownMenuAction.COPY_CODE -> handleCopyCodeClick(action.item.authCode) VaultDropdownMenuAction.EDIT -> handleEditItemClick(action.item.id) - VaultDropdownMenuAction.MOVE -> handleMoveToBitwardenClick(action.item.id) + VaultDropdownMenuAction.COPY_TO_BITWARDEN -> handleCopyToBitwardenClick(action.item.id) VaultDropdownMenuAction.DELETE -> handleDeleteItemClick(action.item.id) } } diff --git a/authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/VaultVerificationCodeItem.kt b/authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/VaultVerificationCodeItem.kt index 6e40cb63ae..dd53d9ca6a 100644 --- a/authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/VaultVerificationCodeItem.kt +++ b/authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/VaultVerificationCodeItem.kt @@ -161,7 +161,7 @@ fun VaultVerificationCodeItem( }, onClick = { shouldShowDropdownMenu = false - onDropdownMenuClick(VaultDropdownMenuAction.COPY) + onDropdownMenuClick(VaultDropdownMenuAction.COPY_CODE) }, leadingIcon = { Icon( @@ -190,16 +190,18 @@ fun VaultVerificationCodeItem( HorizontalDivider() DropdownMenuItem( text = { - Text(text = stringResource(id = R.string.move_to_bitwarden)) + Text(text = stringResource(id = R.string.copy_to_bitwarden_vault)) }, onClick = { shouldShowDropdownMenu = false - onDropdownMenuClick(VaultDropdownMenuAction.MOVE) + onDropdownMenuClick(VaultDropdownMenuAction.COPY_TO_BITWARDEN) }, leadingIcon = { Icon( painter = painterResource(id = R.drawable.ic_arrow_right), - contentDescription = stringResource(id = R.string.move_to_bitwarden), + contentDescription = stringResource( + id = R.string.copy_to_bitwarden_vault, + ), ) }, ) diff --git a/authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/model/VaultDropdownMenuAction.kt b/authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/model/VaultDropdownMenuAction.kt index 0247844a10..256275d2d9 100644 --- a/authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/model/VaultDropdownMenuAction.kt +++ b/authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/model/VaultDropdownMenuAction.kt @@ -4,8 +4,8 @@ package com.bitwarden.authenticator.ui.authenticator.feature.itemlisting.model * Enum representing the available actions in the Vault dropdown menu. */ enum class VaultDropdownMenuAction { - COPY, + COPY_CODE, + COPY_TO_BITWARDEN, EDIT, - MOVE, DELETE, } diff --git a/authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/util/SharedVerificationCodesStateExtensions.kt b/authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/util/SharedVerificationCodesStateExtensions.kt index bfff0fe4b4..b1e8b6724a 100644 --- a/authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/util/SharedVerificationCodesStateExtensions.kt +++ b/authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/util/SharedVerificationCodesStateExtensions.kt @@ -23,7 +23,7 @@ fun SharedVerificationCodesState.Success.toSharedCodesDisplayState( it.toDisplayItem( alertThresholdSeconds = alertThresholdSeconds, // Always map based on Error state, because shared codes will never - // show "Move to Bitwarden" action. + // show "Copy to Bitwarden vault" action. sharedVerificationCodesState = SharedVerificationCodesState.Error, ), ) diff --git a/authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/util/VerificationCodeItemExtensions.kt b/authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/util/VerificationCodeItemExtensions.kt index c9a27d0b2b..159dc404c2 100644 --- a/authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/util/VerificationCodeItemExtensions.kt +++ b/authenticator/src/main/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/util/VerificationCodeItemExtensions.kt @@ -30,10 +30,10 @@ fun VerificationCodeItem.toDisplayItem( }, favorite = (source as? AuthenticatorItem.Source.Local)?.isFavorite ?: false, showMoveToBitwarden = when (source) { - // Shared items should never show Move to Bitwarden action: + // Shared items should never show "Copy to Bitwarden vault" action: is AuthenticatorItem.Source.Shared -> false - // Local items should only show Move to Bitwarden if we are successfully syncing: = + // Local items should only show "Copy to Bitwarden vault" if we are successfully syncing: = is AuthenticatorItem.Source.Local -> when (sharedVerificationCodesState) { SharedVerificationCodesState.AppNotInstalled, SharedVerificationCodesState.Error, diff --git a/authenticator/src/main/res/values/strings.xml b/authenticator/src/main/res/values/strings.xml index 96b4f58586..1eb88ca751 100644 --- a/authenticator/src/main/res/values/strings.xml +++ b/authenticator/src/main/res/values/strings.xml @@ -124,7 +124,7 @@ Take me to the app settings Something went wrong Please try again - Move to Bitwarden + Copy to Bitwarden vault Default save option Save to Bitwarden Save here diff --git a/authenticator/src/test/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/ItemListingScreenTest.kt b/authenticator/src/test/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/ItemListingScreenTest.kt index 0c83ff28c5..26a70bfb81 100644 --- a/authenticator/src/test/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/ItemListingScreenTest.kt +++ b/authenticator/src/test/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/ItemListingScreenTest.kt @@ -346,7 +346,7 @@ class ItemListingScreenTest : AuthenticatorComposeTest() { } @Test - fun `clicking Move to Bitwarden should send MoveToBitwardenClick`() { + fun `clicking Copy to Bitwarden vault should send DropdownMenuClick with COPY_TO_BITWARDEN`() { mutableStateFlow.value = DEFAULT_STATE.copy( viewState = ItemListingState.ViewState.Content( actionCard = ItemListingState.ActionCardState.None, @@ -360,21 +360,22 @@ class ItemListingScreenTest : AuthenticatorComposeTest() { .performTouchInput { longClick() } composeTestRule - .onNodeWithText("Move to Bitwarden") + .onNodeWithText(text = "Copy to Bitwarden vault") .performClick() verify { viewModel.trySendAction( ItemListingAction.DropdownMenuClick( - menuAction = VaultDropdownMenuAction.MOVE, + menuAction = VaultDropdownMenuAction.COPY_TO_BITWARDEN, item = LOCAL_CODE, ), ) } } + @Suppress("MaxLineLength") @Test - fun `Move to Bitwarden long press action should not show when showMoveToBitwarden is false`() { + fun `Copy to Bitwarden vault long press action should not show when showMoveToBitwarden is false`() { mutableStateFlow.value = DEFAULT_STATE.copy( viewState = ItemListingState.ViewState.Content( actionCard = ItemListingState.ActionCardState.None, @@ -388,7 +389,7 @@ class ItemListingScreenTest : AuthenticatorComposeTest() { .performTouchInput { longClick() } composeTestRule - .onNodeWithText("Move to Bitwarden") + .onNodeWithText(text = "Copy to Bitwarden vault") .assertDoesNotExist() } diff --git a/authenticator/src/test/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/ItemListingViewModelTest.kt b/authenticator/src/test/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/ItemListingViewModelTest.kt index 12f7207950..28c15ab64a 100644 --- a/authenticator/src/test/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/ItemListingViewModelTest.kt +++ b/authenticator/src/test/kotlin/com/bitwarden/authenticator/ui/authenticator/feature/itemlisting/ItemListingViewModelTest.kt @@ -378,7 +378,7 @@ class ItemListingViewModelTest : BaseViewModelTest() { } @Test - fun `on MoveToBitwardenClick receive should call startAddTotpLoginItemFlow`() { + fun `on CopyToBitwardenClick receive should call startAddTotpLoginItemFlow`() { val expectedUriString = "expectedUriString" val entity: AuthenticatorItemEntity = mockk { every { toOtpAuthUriString() } returns expectedUriString @@ -394,7 +394,7 @@ class ItemListingViewModelTest : BaseViewModelTest() { viewModel.trySendAction( ItemListingAction.DropdownMenuClick( - menuAction = VaultDropdownMenuAction.MOVE, + menuAction = VaultDropdownMenuAction.COPY_TO_BITWARDEN, item = LOCAL_CODE, ), ) @@ -403,7 +403,7 @@ class ItemListingViewModelTest : BaseViewModelTest() { @Test @Suppress("MaxLineLength") - fun `on MoveToBitwardenClick should show error dialog when startAddTotpLoginItemFlow returns false`() { + fun `on CopyToBitwardenClick should show error dialog when startAddTotpLoginItemFlow returns false`() { val expectedState = DEFAULT_STATE.copy( dialog = ItemListingState.DialogState.Error( title = R.string.something_went_wrong.asText(), @@ -423,7 +423,10 @@ class ItemListingViewModelTest : BaseViewModelTest() { val viewModel = createViewModel() viewModel.trySendAction( - ItemListingAction.DropdownMenuClick(VaultDropdownMenuAction.MOVE, LOCAL_CODE), + ItemListingAction.DropdownMenuClick( + menuAction = VaultDropdownMenuAction.COPY_TO_BITWARDEN, + item = LOCAL_CODE, + ), ) assertEquals( expectedState, @@ -442,7 +445,7 @@ class ItemListingViewModelTest : BaseViewModelTest() { } @Test - fun `should copy text to clipboard when DropdownMenuClick COPY is triggered`() = runTest { + fun `should copy text to clipboard when DropdownMenuClick COPY_CODE is triggered`() = runTest { val viewModel = createViewModel() every { clipboardManager.setText(text = LOCAL_CODE.authCode) } just runs @@ -450,7 +453,7 @@ class ItemListingViewModelTest : BaseViewModelTest() { viewModel.eventFlow.test { viewModel.trySendAction( ItemListingAction.DropdownMenuClick( - menuAction = VaultDropdownMenuAction.COPY, + menuAction = VaultDropdownMenuAction.COPY_CODE, item = LOCAL_CODE, ), )