From eaa7923d1f4ceb14dc04013e85ee333f4c338907 Mon Sep 17 00:00:00 2001 From: Patrick Honkonen <1883101+SaintPatrck@users.noreply.github.com> Date: Wed, 30 Oct 2024 14:42:33 -0400 Subject: [PATCH 1/2] [PM-14186] Update SDK to make SSH key properties required (#4200) --- .../network/model/SyncResponseJson.kt | 6 +- .../feature/item/VaultItemSshKeyContent.kt | 90 +++++++++---------- .../vault/feature/item/VaultItemViewModel.kt | 6 +- .../ui/vault/feature/vault/VaultViewModel.kt | 6 +- .../vault/util/VaultAddItemStateExtensions.kt | 6 +- .../feature/vault/util/VaultDataExtensions.kt | 9 +- .../vault/feature/item/VaultItemScreenTest.kt | 18 ---- .../feature/item/util/VaultItemTestUtil.kt | 14 +-- .../vault/util/VaultDataExtensionsTest.kt | 18 ++-- gradle/libs.versions.toml | 2 +- 10 files changed, 77 insertions(+), 98 deletions(-) diff --git a/app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/network/model/SyncResponseJson.kt b/app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/network/model/SyncResponseJson.kt index 384e2599f..a476fa672 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/network/model/SyncResponseJson.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/network/model/SyncResponseJson.kt @@ -731,13 +731,13 @@ data class SyncResponseJson( @Serializable data class SshKey( @SerialName("publicKey") - val publicKey: String?, + val publicKey: String, @SerialName("privateKey") - val privateKey: String?, + val privateKey: String, @SerialName("keyFingerprint") - val keyFingerprint: String?, + val keyFingerprint: String, ) /** diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemSshKeyContent.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemSshKeyContent.kt index bac0d17c5..505ccb8e3 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemSshKeyContent.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemSshKeyContent.kt @@ -53,58 +53,52 @@ fun VaultItemSshKeyContent( ) } - sshKeyItemState.publicKey?.let { publicKey -> - item { - Spacer(modifier = Modifier.height(8.dp)) - BitwardenTextField( - label = stringResource(id = R.string.public_key), - value = publicKey, - onValueChange = { }, - singleLine = false, - readOnly = true, - modifier = Modifier - .testTag("SshKeyItemPublicKeyEntry") - .fillMaxWidth() - .padding(horizontal = 16.dp), - ) - } + item { + Spacer(modifier = Modifier.height(8.dp)) + BitwardenTextField( + label = stringResource(id = R.string.public_key), + value = sshKeyItemState.publicKey, + onValueChange = { }, + singleLine = false, + readOnly = true, + modifier = Modifier + .testTag("SshKeyItemPublicKeyEntry") + .fillMaxWidth() + .padding(horizontal = 16.dp), + ) } - sshKeyItemState.privateKey?.let { privateKey -> - item { - Spacer(modifier = Modifier.height(8.dp)) - BitwardenPasswordField( - label = stringResource(id = R.string.private_key), - value = privateKey, - onValueChange = { }, - singleLine = false, - readOnly = true, - showPassword = sshKeyItemState.showPrivateKey, - showPasswordTestTag = "ViewPrivateKeyButton", - showPasswordChange = vaultSshKeyItemTypeHandlers.onShowPrivateKeyClick, - modifier = Modifier - .testTag("SshKeyItemPrivateKeyEntry") - .fillMaxWidth() - .padding(horizontal = 16.dp), - ) - } + item { + Spacer(modifier = Modifier.height(8.dp)) + BitwardenPasswordField( + label = stringResource(id = R.string.private_key), + value = sshKeyItemState.privateKey, + onValueChange = { }, + singleLine = false, + readOnly = true, + showPassword = sshKeyItemState.showPrivateKey, + showPasswordTestTag = "ViewPrivateKeyButton", + showPasswordChange = vaultSshKeyItemTypeHandlers.onShowPrivateKeyClick, + modifier = Modifier + .testTag("SshKeyItemPrivateKeyEntry") + .fillMaxWidth() + .padding(horizontal = 16.dp), + ) } - sshKeyItemState.fingerprint?.let { fingerprint -> - item { - Spacer(modifier = Modifier.height(8.dp)) - BitwardenTextField( - label = stringResource(id = R.string.fingerprint), - value = fingerprint, - onValueChange = { }, - singleLine = false, - readOnly = true, - modifier = Modifier - .testTag("SshKeyItemFingerprintEntry") - .fillMaxWidth() - .padding(horizontal = 16.dp), - ) - } + item { + Spacer(modifier = Modifier.height(8.dp)) + BitwardenTextField( + label = stringResource(id = R.string.fingerprint), + value = sshKeyItemState.fingerprint, + onValueChange = { }, + singleLine = false, + readOnly = true, + modifier = Modifier + .testTag("SshKeyItemFingerprintEntry") + .fillMaxWidth() + .padding(horizontal = 16.dp), + ) } item { diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModel.kt index 72063980c..0168b289d 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModel.kt @@ -1410,9 +1410,9 @@ data class VaultItemState( */ data class SshKey( val name: String?, - val publicKey: String?, - val privateKey: String?, - val fingerprint: String?, + val publicKey: String, + val privateKey: String, + val fingerprint: String, val showPrivateKey: Boolean, ) : ItemType() } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModel.kt index 37a321337..879701c60 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModel.kt @@ -995,9 +995,9 @@ data class VaultState( override val extraIconList: List<IconRes> = emptyList(), override val overflowOptions: List<ListingItemOverflowAction.VaultAction>, override val shouldShowMasterPasswordReprompt: Boolean, - val publicKey: Text?, - val privateKey: Text?, - val fingerprint: Text?, + val publicKey: Text, + val privateKey: Text, + val fingerprint: Text, ) : VaultItem() { override val supportingLabel: Text? get() = null } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultAddItemStateExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultAddItemStateExtensions.kt index 78b4ea852..efcf83e7d 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultAddItemStateExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultAddItemStateExtensions.kt @@ -74,9 +74,9 @@ private fun VaultAddEditState.ViewState.Content.ItemType.toCipherType(): CipherT private fun VaultAddEditState.ViewState.Content.ItemType.toSshKeyView(): SshKeyView? = (this as? VaultAddEditState.ViewState.Content.ItemType.SshKey)?.let { SshKeyView( - publicKey = it.publicKey.orNullIfBlank(), - privateKey = it.privateKey.orNullIfBlank(), - fingerprint = it.fingerprint.orNullIfBlank(), + publicKey = it.publicKey, + privateKey = it.privateKey, + fingerprint = it.fingerprint, ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultDataExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultDataExtensions.kt index b4acd8860..4cc2f9502 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultDataExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultDataExtensions.kt @@ -276,13 +276,16 @@ private fun CipherView.toVaultItemOrNull( name = name.asText(), publicKey = sshKey ?.publicKey - ?.asText(), + .orEmpty() + .asText(), privateKey = sshKey ?.privateKey - ?.asText(), + .orEmpty() + .asText(), fingerprint = sshKey ?.fingerprint - ?.asText(), + .orEmpty() + .asText(), overflowOptions = toOverflowActions( hasMasterPassword = hasMasterPassword, isPremiumUser = isPremiumUser, diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemScreenTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemScreenTest.kt index 22d67c1d4..07f9dd129 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemScreenTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemScreenTest.kt @@ -2151,12 +2151,6 @@ class VaultItemScreenTest : BaseComposeTest() { val publicKey = "the public key" mutableStateFlow.update { it.copy(viewState = DEFAULT_SSH_KEY_VIEW_STATE) } composeTestRule.onNodeWithTextAfterScroll(publicKey).assertIsDisplayed() - - mutableStateFlow.update { currentState -> - updateSshKeyType(currentState) { copy(publicKey = null) } - } - - composeTestRule.assertScrollableNodeDoesNotExist(publicKey) } @Test @@ -2173,12 +2167,6 @@ class VaultItemScreenTest : BaseComposeTest() { composeTestRule .onNodeWithText(privateKey) .assertIsDisplayed() - - mutableStateFlow.update { currentState -> - updateSshKeyType(currentState) { copy(privateKey = null) } - } - - composeTestRule.assertScrollableNodeDoesNotExist(privateKey) } @Test @@ -2205,12 +2193,6 @@ class VaultItemScreenTest : BaseComposeTest() { val fingerprint = "the fingerprint" mutableStateFlow.update { it.copy(viewState = DEFAULT_SSH_KEY_VIEW_STATE) } composeTestRule.onNodeWithTextAfterScroll(fingerprint).assertIsDisplayed() - - mutableStateFlow.update { currentState -> - updateSshKeyType(currentState) { copy(fingerprint = null) } - } - - composeTestRule.assertScrollableNodeDoesNotExist(fingerprint) } //endregion ssh key diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/util/VaultItemTestUtil.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/util/VaultItemTestUtil.kt index c07c29879..6b0d0c0cb 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/util/VaultItemTestUtil.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/util/VaultItemTestUtil.kt @@ -75,9 +75,9 @@ fun createIdentityView(isEmpty: Boolean): IdentityView = fun createSshKeyView(isEmpty: Boolean): SshKeyView = SshKeyView( - privateKey = "privateKey".takeUnless { isEmpty }, - publicKey = "publicKey".takeUnless { isEmpty }, - fingerprint = "fingerprint".takeUnless { isEmpty }, + privateKey = "privateKey".takeUnless { isEmpty }.orEmpty(), + publicKey = "publicKey".takeUnless { isEmpty }.orEmpty(), + fingerprint = "fingerprint".takeUnless { isEmpty }.orEmpty(), ) fun createCipherView(type: CipherType, isEmpty: Boolean): CipherView = @@ -154,7 +154,7 @@ fun createCipherView(type: CipherType, isEmpty: Boolean): CipherView = creationDate = Instant.ofEpochSecond(1_000L), deletedDate = null, revisionDate = Instant.ofEpochSecond(1_000L), - sshKey = createSshKeyView(isEmpty = isEmpty), + sshKey = createSshKeyView(isEmpty), ) fun createCommonContent( @@ -272,8 +272,8 @@ fun createIdentityContent( fun createSshKeyContent(isEmpty: Boolean): VaultItemState.ViewState.Content.ItemType.SshKey = VaultItemState.ViewState.Content.ItemType.SshKey( name = "mockName".takeUnless { isEmpty }, - privateKey = "privateKey".takeUnless { isEmpty }, - publicKey = "publicKey".takeUnless { isEmpty }, - fingerprint = "fingerprint".takeUnless { isEmpty }, + privateKey = "privateKey".takeUnless { isEmpty }.orEmpty(), + publicKey = "publicKey".takeUnless { isEmpty }.orEmpty(), + fingerprint = "fingerprint".takeUnless { isEmpty }.orEmpty(), showPrivateKey = false, ) diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultDataExtensionsTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultDataExtensionsTest.kt index 17e257de1..21540694f 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultDataExtensionsTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultDataExtensionsTest.kt @@ -906,9 +906,9 @@ class VaultDataExtensionsTest { folderId = null, sshKey = createMockSshKeyView(number = 1) .copy( - publicKey = null, - privateKey = null, - fingerprint = null, + publicKey = "publicKey", + privateKey = "privateKey", + fingerprint = "fingerprint", ), ), createMockCipherView( @@ -945,16 +945,16 @@ class VaultDataExtensionsTest { createMockSshKeyVaultItem(number = 1), createMockSshKeyVaultItem(number = 2) .copy( - publicKey = null, - privateKey = null, - fingerprint = null, + publicKey = "publicKey".asText(), + privateKey = "privateKey".asText(), + fingerprint = "fingerprint".asText(), shouldShowMasterPasswordReprompt = true, ), createMockSshKeyVaultItem(number = 3) .copy( - publicKey = null, - privateKey = null, - fingerprint = null, + publicKey = "".asText(), + privateKey = "".asText(), + fingerprint = "".asText(), ), ), trashItemsCount = 0, diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a652db318..f70d28209 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -24,7 +24,7 @@ androidxSplash = "1.1.0-rc01" androidXAppCompat = "1.7.0" androdixAutofill = "1.1.0" androidxWork = "2.9.1" -bitwardenSdk = "1.0.0-20241024.173753-4" +bitwardenSdk = "1.0.0-20241030.101847-8" crashlytics = "3.0.2" detekt = "1.23.7" firebaseBom = "33.5.1" From c99e5ce2de86b2f017a5807c8bd886c5bd49c1b1 Mon Sep 17 00:00:00 2001 From: David Perez <david@livefront.com> Date: Wed, 30 Oct 2024 15:13:15 -0500 Subject: [PATCH 2/2] PM-13842: Hide ownership when the user has no organizations (#4199) --- .../feature/addedit/VaultAddEditCardItems.kt | 2 +- .../addedit/VaultAddEditIdentityItems.kt | 2 +- .../feature/addedit/VaultAddEditLoginItems.kt | 2 +- .../addedit/VaultAddEditSecureNotesItems.kt | 2 +- .../feature/addedit/VaultAddEditViewModel.kt | 2 ++ .../addedit/util/CipherViewExtensions.kt | 2 ++ .../feature/addedit/VaultAddEditScreenTest.kt | 27 +++++++++++++++++++ .../addedit/VaultAddEditViewModelTest.kt | 2 ++ .../addedit/util/CipherViewExtensionsTest.kt | 1 + 9 files changed, 38 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditCardItems.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditCardItems.kt index 6ceb8200b..e3b60ac4f 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditCardItems.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditCardItems.kt @@ -300,7 +300,7 @@ fun LazyListScope.vaultAddEditCardItems( ) } - if (isAddItemMode) { + if (isAddItemMode && commonState.hasOrganizations) { item { Spacer(modifier = Modifier.height(24.dp)) BitwardenListHeaderText( diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditIdentityItems.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditIdentityItems.kt index 1727352b7..1c7b4a59b 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditIdentityItems.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditIdentityItems.kt @@ -414,7 +414,7 @@ fun LazyListScope.vaultAddEditIdentityItems( ) } - if (isAddItemMode) { + if (isAddItemMode && commonState.hasOrganizations) { item { Spacer(modifier = Modifier.height(24.dp)) BitwardenListHeaderText( diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditLoginItems.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditLoginItems.kt index 7021bd5e6..236e12748 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditLoginItems.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditLoginItems.kt @@ -317,7 +317,7 @@ fun LazyListScope.vaultAddEditLoginItems( ) } - if (isAddItemMode) { + if (isAddItemMode && commonState.hasOrganizations) { item { Spacer(modifier = Modifier.height(24.dp)) BitwardenListHeaderText( diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditSecureNotesItems.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditSecureNotesItems.kt index 20b38feac..f4c6c4478 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditSecureNotesItems.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditSecureNotesItems.kt @@ -176,7 +176,7 @@ fun LazyListScope.vaultAddEditSecureNotesItems( ) } - if (isAddItemMode) { + if (isAddItemMode && commonState.hasOrganizations) { item { Spacer(modifier = Modifier.height(24.dp)) BitwardenListHeaderText( diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModel.kt index 3c2e0b6e3..480372568 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModel.kt @@ -2114,6 +2114,7 @@ data class VaultAddEditState( * @property availableFolders The list of folders that this item could be added too. * @property selectedOwnerId The ID of the owner associated with the item. * @property availableOwners A list of available owners. + * @property hasOrganizations Indicates if the user is part of any organizations. */ @Parcelize data class Common( @@ -2129,6 +2130,7 @@ data class VaultAddEditState( val availableFolders: List<Folder> = emptyList(), val selectedOwnerId: String? = null, val availableOwners: List<Owner> = emptyList(), + val hasOrganizations: Boolean = false, ) : Parcelable { /** diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensions.kt index 749e8e051..a68834588 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensions.kt @@ -106,6 +106,7 @@ fun CipherView.toViewState( masterPasswordReprompt = this.reprompt == CipherRepromptType.PASSWORD, notes = this.notes.orEmpty(), availableOwners = emptyList(), + hasOrganizations = false, customFieldData = this.fields.orEmpty().map { it.toCustomField() }, ), isIndividualVaultDisabled = isIndividualVaultDisabled, @@ -139,6 +140,7 @@ fun VaultAddEditState.ViewState.appendFolderAndOwnerData( isIndividualVaultDisabled = isIndividualVaultDisabled, ), isUnlockWithPasswordEnabled = activeAccount.hasMasterPassword, + hasOrganizations = activeAccount.organizations.isNotEmpty(), ), ) } ?: this diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditScreenTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditScreenTest.kt index 1956f980a..b29a3eb12 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditScreenTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditScreenTest.kt @@ -2361,6 +2361,31 @@ class VaultAddEditScreenTest : BaseComposeTest() { } } + @Test + fun `ownership section should not be displayed when no organizations present`() { + updateStateWithOwners(selectedOwnerId = "mockOwnerId-2") + + composeTestRule + .onNodeWithTextAfterScroll(text = "mockCollectionName-2") + .assertIsDisplayed() + + updateStateWithOwners( + selectedOwnerId = null, + availableOwners = listOf( + VaultAddEditState.Owner( + id = null, + name = "placeholder@email.com", + collections = DEFAULT_COLLECTIONS, + ), + ), + hasOrganizations = false, + ) + + composeTestRule + .onNodeWithText(text = "mockCollectionName-2") + .assertDoesNotExist() + } + @Test fun `Collection list should display according to state`() { updateStateWithOwners(selectedOwnerId = "mockOwnerId-2") @@ -3482,12 +3507,14 @@ class VaultAddEditScreenTest : BaseComposeTest() { private fun updateStateWithOwners( selectedOwnerId: String? = null, availableOwners: List<VaultAddEditState.Owner> = DEFAULT_OWNERS, + hasOrganizations: Boolean = true, ) { mutableStateFlow.update { currentState -> updateCommonContent(currentState) { copy( selectedOwnerId = selectedOwnerId, availableOwners = availableOwners, + hasOrganizations = hasOrganizations, ) } } diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModelTest.kt index 4bd49bbd4..1109fcac7 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModelTest.kt @@ -4026,6 +4026,7 @@ class VaultAddEditViewModelTest : BaseViewModelTest() { ), availableOwners: List<VaultAddEditState.Owner> = createOwnerList(), selectedOwnerId: String? = null, + hasOrganizations: Boolean = true, ): VaultAddEditState.ViewState.Content.Common = VaultAddEditState.ViewState.Content.Common( name = name, @@ -4038,6 +4039,7 @@ class VaultAddEditViewModelTest : BaseViewModelTest() { originalCipher = originalCipher, availableFolders = availableFolders, availableOwners = availableOwners, + hasOrganizations = hasOrganizations, ) @Suppress("LongParameterList") diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensionsTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensionsTest.kt index 02c551f71..0d6328799 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensionsTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensionsTest.kt @@ -505,6 +505,7 @@ class CipherViewExtensionsTest { name = "mockName-1", ), ), + hasOrganizations = true, availableOwners = listOf( VaultAddEditState.Owner( id = null,