Skip to content

Commit

Permalink
[PM-15113] Disable add button in SSH Keys screen (#4364)
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintPatrck authored Nov 22, 2024
1 parent 89935ac commit 76b6853
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2084,7 +2084,7 @@ data class VaultItemListingState(
*/
data object SshKey : Vault() {
override val titleText: Text get() = R.string.ssh_keys.asText()
override val hasFab: Boolean get() = true
override val hasFab: Boolean get() = false
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ fun VaultData.toViewState(
val shouldShowAddButton = when (itemListingType) {
is VaultItemListingState.ItemListingType.Vault.Folder,
VaultItemListingState.ItemListingType.Vault.Trash,
VaultItemListingState.ItemListingType.Vault.SshKey,
-> false

else -> true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,16 @@ class VaultItemListingScreenTest : BaseComposeTest() {
)
}

composeTestRule
.onNodeWithContentDescription("Add item")
.assertDoesNotExist()

mutableStateFlow.update {
it.copy(
itemListingType = VaultItemListingState.ItemListingType.Vault.SshKey,
)
}

composeTestRule
.onNodeWithContentDescription("Add item")
.assertDoesNotExist()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,28 @@ class VaultItemListingDataExtensionsTest {
),
)

// SSH keys
assertEquals(
VaultItemListingState.ViewState.NoItems(
header = R.string.save_and_protect_your_data.asText(),
message = R.string.no_items.asText(),
shouldShowAddButton = false,
buttonText = R.string.add_an_item.asText(),
),
vaultData.toViewState(
itemListingType = VaultItemListingState.ItemListingType.Vault.SshKey,
vaultFilterType = VaultFilterType.AllVaults,
hasMasterPassword = true,
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
isIconLoadingDisabled = false,
autofillSelectionData = null,
fido2CreationData = null,
fido2CredentialAutofillViews = null,
totpData = null,
isPremiumUser = true,
),
)

// Other ciphers
assertEquals(
VaultItemListingState.ViewState.NoItems(
Expand Down

0 comments on commit 76b6853

Please sign in to comment.