mirror of
https://github.com/bitwarden/android.git
synced 2024-12-18 07:11:51 +03:00
PM-13021: Update empty state for TOTP flow (#4051)
This commit is contained in:
parent
ccb52ae6c5
commit
2af96988ab
10 changed files with 158 additions and 7 deletions
|
@ -29,6 +29,8 @@ fun VaultItemListingEmpty(
|
|||
if (state.shouldShowAddButton) {
|
||||
VaultNoItems(
|
||||
policyDisablesSend = policyDisablesSend,
|
||||
vectorRes = state.vectorRes,
|
||||
headerText = state.header(),
|
||||
message = state.message(),
|
||||
buttonText = state.buttonText(),
|
||||
modifier = modifier,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.x8bit.bitwarden.ui.vault.feature.itemlisting
|
||||
|
||||
import android.os.Parcelable
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.lifecycle.SavedStateHandle
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.bitwarden.fido.Fido2CredentialAutofillView
|
||||
|
@ -1559,6 +1560,7 @@ class VaultItemListingViewModel @Inject constructor(
|
|||
fido2CreationData = state.fido2CredentialRequest,
|
||||
fido2CredentialAutofillViews = vaultData
|
||||
.fido2CredentialAutofillViewList,
|
||||
totpData = state.totpData,
|
||||
isPremiumUser = state.isPremium,
|
||||
)
|
||||
}
|
||||
|
@ -1897,9 +1899,11 @@ data class VaultItemListingState(
|
|||
* Represents a state where the [VaultItemListingScreen] has no items to display.
|
||||
*/
|
||||
data class NoItems(
|
||||
val header: Text,
|
||||
val message: Text,
|
||||
val shouldShowAddButton: Boolean,
|
||||
val buttonText: Text,
|
||||
@DrawableRes val vectorRes: Int = R.drawable.img_vault_items,
|
||||
val shouldShowAddButton: Boolean,
|
||||
) : ViewState() {
|
||||
override val isPullToRefreshEnabled: Boolean get() = true
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import com.x8bit.bitwarden.ui.vault.feature.util.toOverflowActions
|
|||
import com.x8bit.bitwarden.ui.vault.feature.vault.model.VaultFilterType
|
||||
import com.x8bit.bitwarden.ui.vault.feature.vault.util.toFilteredList
|
||||
import com.x8bit.bitwarden.ui.vault.feature.vault.util.toLoginIconData
|
||||
import com.x8bit.bitwarden.ui.vault.model.TotpData
|
||||
import java.time.Clock
|
||||
|
||||
private const val DELETION_DATE_PATTERN: String = "MMM d, uuuu, hh:mm a"
|
||||
|
@ -104,6 +105,7 @@ fun VaultData.toViewState(
|
|||
autofillSelectionData: AutofillSelectionData?,
|
||||
fido2CreationData: Fido2CredentialRequest?,
|
||||
fido2CredentialAutofillViews: List<Fido2CredentialAutofillView>?,
|
||||
totpData: TotpData?,
|
||||
isPremiumUser: Boolean,
|
||||
): VaultItemListingState.ViewState {
|
||||
val filteredCipherViewList = cipherViewList
|
||||
|
@ -171,6 +173,7 @@ fun VaultData.toViewState(
|
|||
?.origin
|
||||
?.toHostOrPathOrNull()
|
||||
?.let { R.string.no_items_for_uri.asText(it) }
|
||||
?: totpData?.let { R.string.search_for_a_login_or_add_a_new_login.asText() }
|
||||
?: run {
|
||||
when (itemListingType) {
|
||||
is VaultItemListingState.ItemListingType.Vault.Folder -> {
|
||||
|
@ -197,13 +200,17 @@ fun VaultData.toViewState(
|
|||
else -> true
|
||||
}
|
||||
VaultItemListingState.ViewState.NoItems(
|
||||
header = totpData
|
||||
?.let { R.string.no_items_for_uri.asText(it.issuer ?: it.accountName ?: "--") }
|
||||
?: R.string.save_and_protect_your_data.asText(),
|
||||
message = message,
|
||||
shouldShowAddButton = shouldShowAddButton,
|
||||
buttonText = if (fido2CreationData != null) {
|
||||
R.string.save_passkey_as_new_login.asText()
|
||||
} else {
|
||||
R.string.add_an_item.asText()
|
||||
},
|
||||
buttonText = fido2CreationData
|
||||
?.let { R.string.save_passkey_as_new_login.asText() }
|
||||
?: R.string.add_an_item.asText(),
|
||||
vectorRes = totpData
|
||||
?.let { R.drawable.img_folder_question }
|
||||
?: R.drawable.img_vault_items,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -226,6 +233,7 @@ fun List<SendView>.toViewState(
|
|||
)
|
||||
} else {
|
||||
VaultItemListingState.ViewState.NoItems(
|
||||
header = R.string.save_and_protect_your_data.asText(),
|
||||
message = R.string.no_items.asText(),
|
||||
shouldShowAddButton = true,
|
||||
buttonText = R.string.add_an_item.asText(),
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.x8bit.bitwarden.ui.vault.feature.vault
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Column
|
||||
|
@ -34,6 +35,7 @@ fun VaultNoItems(
|
|||
addItemClickAction: () -> Unit,
|
||||
policyDisablesSend: Boolean,
|
||||
modifier: Modifier = Modifier,
|
||||
@DrawableRes vectorRes: Int = R.drawable.img_vault_items,
|
||||
headerText: String = stringResource(id = R.string.save_and_protect_your_data),
|
||||
message: String = stringResource(R.string.the_vault_protects_more_than_just_passwords),
|
||||
buttonText: String = stringResource(R.string.new_login),
|
||||
|
@ -54,7 +56,7 @@ fun VaultNoItems(
|
|||
Spacer(modifier = Modifier.weight(1F))
|
||||
|
||||
Image(
|
||||
painter = rememberVectorPainter(id = R.drawable.img_vault_items),
|
||||
painter = rememberVectorPainter(id = vectorRes),
|
||||
contentDescription = null,
|
||||
modifier = Modifier
|
||||
.standardHorizontalMargin()
|
||||
|
|
37
app/src/main/res/drawable-night/img_folder_question.xml
Normal file
37
app/src/main/res/drawable-night/img_folder_question.xml
Normal file
|
@ -0,0 +1,37 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="200dp"
|
||||
android:height="201dp"
|
||||
android:viewportWidth="200"
|
||||
android:viewportHeight="201">
|
||||
<path
|
||||
android:fillColor="#79A1E9"
|
||||
android:pathData="M4.17,44.42C4.17,37.51 9.76,31.92 16.67,31.92H52.58C56.23,31.92 59.7,33.51 62.07,36.28L70.83,46.5H179.17C183.77,46.5 187.5,50.23 187.5,54.83V129.83C187.5,155.15 166.98,175.67 141.67,175.67H14.58C8.83,175.67 4.17,171 4.17,165.25V44.42Z" />
|
||||
<path
|
||||
android:fillColor="#175DDC"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M68.92,50.67L58.91,38.99C57.33,37.15 55.02,36.08 52.58,36.08H16.67C12.06,36.08 8.33,39.81 8.33,44.42V165.25C8.33,168.7 11.13,171.5 14.58,171.5H141.67C164.68,171.5 183.33,152.85 183.33,129.83V54.83C183.33,52.53 181.47,50.67 179.17,50.67H68.92ZM70.83,46.5L62.07,36.28C59.7,33.51 56.23,31.92 52.58,31.92H16.67C9.76,31.92 4.17,37.51 4.17,44.42V165.25C4.17,171 8.83,175.67 14.58,175.67H141.67C166.98,175.67 187.5,155.15 187.5,129.83V54.83C187.5,50.23 183.77,46.5 179.17,46.5H70.83Z" />
|
||||
<path
|
||||
android:fillColor="#AAC3EF"
|
||||
android:pathData="M22.96,83.58C24.15,77.76 29.27,73.58 35.21,73.58H189.79C195.07,73.58 199.01,78.42 197.96,83.58L181.21,165.67C180.02,171.49 174.9,175.67 168.96,175.67H14.37C9.1,175.67 5.15,170.83 6.21,165.67L22.96,83.58Z" />
|
||||
<path
|
||||
android:fillColor="#175DDC"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M189.79,77.75H35.21C31.25,77.75 27.83,80.54 27.04,84.42L10.29,166.5C9.76,169.08 11.74,171.5 14.37,171.5H168.96C172.92,171.5 176.33,168.71 177.13,164.83L193.88,82.75C194.4,80.17 192.43,77.75 189.79,77.75ZM35.21,73.58C29.27,73.58 24.15,77.76 22.96,83.58L6.21,165.67C5.15,170.83 9.1,175.67 14.37,175.67H168.96C174.9,175.67 180.02,171.49 181.21,165.67L197.96,83.58C199.01,78.42 195.07,73.58 189.79,73.58H35.21Z" />
|
||||
<path
|
||||
android:fillColor="#F3F6F9"
|
||||
android:pathData="M175,67.33C175,90.35 156.35,109 133.33,109C110.32,109 91.67,90.35 91.67,67.33C91.67,44.32 110.32,25.67 133.33,25.67C156.35,25.67 175,44.32 175,67.33Z" />
|
||||
<path
|
||||
android:fillColor="#175DDC"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M133.33,104.83C154.04,104.83 170.83,88.04 170.83,67.33C170.83,46.62 154.04,29.83 133.33,29.83C112.62,29.83 95.83,46.62 95.83,67.33C95.83,88.04 112.62,104.83 133.33,104.83ZM133.33,109C156.35,109 175,90.35 175,67.33C175,44.32 156.35,25.67 133.33,25.67C110.32,25.67 91.67,44.32 91.67,67.33C91.67,90.35 110.32,109 133.33,109Z" />
|
||||
<path
|
||||
android:fillColor="#FFBF00"
|
||||
android:pathData="M164.58,67.33C164.58,84.59 150.59,98.58 133.33,98.58C116.07,98.58 102.08,84.59 102.08,67.33C102.08,50.07 116.07,36.08 133.33,36.08C150.59,36.08 164.58,50.07 164.58,67.33Z" />
|
||||
<path
|
||||
android:fillColor="#175DDC"
|
||||
android:pathData="M197.93,127.93L163.54,95.46L159.38,99.62L191.85,134.01C193.46,135.71 196.16,135.75 197.82,134.09L198.01,133.91C199.67,132.25 199.63,129.54 197.93,127.93Z" />
|
||||
<path
|
||||
android:fillColor="#175DDC"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M128.28,71.66C128.31,72.73 129.18,73.58 130.25,73.58H131.36C132.45,73.58 133.34,72.7 133.34,71.61L133.34,69.42C139.21,69.33 143.75,66.08 143.75,60.04C143.75,53.64 139.51,50.67 133.34,50.67C127.94,50.67 123.09,54.23 122.84,59.37C122.79,60.36 123.65,61.08 124.63,61.08H125.11C126.2,61.08 127.05,60.18 127.37,59.14C128.21,56.43 130.77,54.83 133.34,54.83C136.46,54.83 139.06,56.68 139.06,60.04C139.06,65.01 133.72,65.92 129.65,66.06C128.81,66.09 128.15,66.77 128.17,67.6L128.28,71.66ZM130.73,82.96C133.03,82.96 134.9,81.56 134.9,79.83C134.9,78.11 133.03,76.71 130.73,76.71C128.43,76.71 126.56,78.11 126.56,79.83C126.56,81.56 128.43,82.96 130.73,82.96Z" />
|
||||
</vector>
|
37
app/src/main/res/drawable/img_folder_question.xml
Normal file
37
app/src/main/res/drawable/img_folder_question.xml
Normal file
|
@ -0,0 +1,37 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="200dp"
|
||||
android:height="201dp"
|
||||
android:viewportWidth="200"
|
||||
android:viewportHeight="201">
|
||||
<path
|
||||
android:fillColor="#AAC3EF"
|
||||
android:pathData="M4.17,44.42C4.17,37.51 9.76,31.92 16.67,31.92H52.58C56.23,31.92 59.7,33.51 62.07,36.28L70.83,46.5H179.17C183.77,46.5 187.5,50.23 187.5,54.83V129.83C187.5,155.15 166.98,175.67 141.67,175.67H14.58C8.83,175.67 4.17,171 4.17,165.25V44.42Z" />
|
||||
<path
|
||||
android:fillColor="#020F66"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M68.92,50.67L58.91,38.99C57.33,37.15 55.02,36.08 52.58,36.08H16.67C12.06,36.08 8.33,39.81 8.33,44.42V165.25C8.33,168.7 11.13,171.5 14.58,171.5H141.67C164.68,171.5 183.33,152.85 183.33,129.83V54.83C183.33,52.53 181.47,50.67 179.17,50.67H68.92ZM70.83,46.5L62.07,36.28C59.7,33.51 56.23,31.92 52.58,31.92H16.67C9.76,31.92 4.17,37.51 4.17,44.42V165.25C4.17,171 8.83,175.67 14.58,175.67H141.67C166.98,175.67 187.5,155.15 187.5,129.83V54.83C187.5,50.23 183.77,46.5 179.17,46.5H70.83Z" />
|
||||
<path
|
||||
android:fillColor="#DBE5F6"
|
||||
android:pathData="M22.96,83.58C24.15,77.76 29.27,73.58 35.21,73.58H189.79C195.07,73.58 199.01,78.42 197.96,83.58L181.21,165.67C180.02,171.49 174.9,175.67 168.96,175.67H14.37C9.1,175.67 5.15,170.83 6.21,165.67L22.96,83.58Z" />
|
||||
<path
|
||||
android:fillColor="#020F66"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M189.79,77.75H35.21C31.25,77.75 27.83,80.54 27.04,84.42L10.29,166.5C9.76,169.08 11.74,171.5 14.37,171.5H168.96C172.92,171.5 176.33,168.71 177.13,164.83L193.88,82.75C194.4,80.17 192.43,77.75 189.79,77.75ZM35.21,73.58C29.27,73.58 24.15,77.76 22.96,83.58L6.21,165.67C5.15,170.83 9.1,175.67 14.37,175.67H168.96C174.9,175.67 180.02,171.49 181.21,165.67L197.96,83.58C199.01,78.42 195.07,73.58 189.79,73.58H35.21Z" />
|
||||
<path
|
||||
android:fillColor="#ffffff"
|
||||
android:pathData="M175,67.33C175,90.35 156.35,109 133.33,109C110.32,109 91.67,90.35 91.67,67.33C91.67,44.32 110.32,25.67 133.33,25.67C156.35,25.67 175,44.32 175,67.33Z" />
|
||||
<path
|
||||
android:fillColor="#020F66"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M133.33,104.83C154.04,104.83 170.83,88.04 170.83,67.33C170.83,46.62 154.04,29.83 133.33,29.83C112.62,29.83 95.83,46.62 95.83,67.33C95.83,88.04 112.62,104.83 133.33,104.83ZM133.33,109C156.35,109 175,90.35 175,67.33C175,44.32 156.35,25.67 133.33,25.67C110.32,25.67 91.67,44.32 91.67,67.33C91.67,90.35 110.32,109 133.33,109Z" />
|
||||
<path
|
||||
android:fillColor="#FFBF00"
|
||||
android:pathData="M164.58,67.33C164.58,84.59 150.59,98.58 133.33,98.58C116.07,98.58 102.08,84.59 102.08,67.33C102.08,50.07 116.07,36.08 133.33,36.08C150.59,36.08 164.58,50.07 164.58,67.33Z" />
|
||||
<path
|
||||
android:fillColor="#020F66"
|
||||
android:pathData="M197.93,127.93L163.54,95.46L159.38,99.62L191.85,134.01C193.46,135.71 196.16,135.75 197.82,134.09L198.01,133.91C199.67,132.25 199.63,129.54 197.93,127.93Z" />
|
||||
<path
|
||||
android:fillColor="#020F66"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M128.28,71.66C128.31,72.73 129.18,73.58 130.25,73.58H131.36C132.45,73.58 133.33,72.7 133.33,71.61L133.33,69.42C139.2,69.33 143.75,66.08 143.75,60.04C143.75,53.64 139.51,50.67 133.33,50.67C127.94,50.67 123.09,54.23 122.83,59.37C122.79,60.36 123.65,61.08 124.63,61.08H125.11C126.2,61.08 127.05,60.18 127.37,59.14C128.21,56.43 130.77,54.83 133.33,54.83C136.46,54.83 139.06,56.68 139.06,60.04C139.06,65.01 133.72,65.92 129.65,66.06C128.81,66.09 128.14,66.77 128.17,67.6L128.28,71.66ZM130.73,82.96C133.03,82.96 134.9,81.56 134.9,79.83C134.9,78.11 133.03,76.71 130.73,76.71C128.43,76.71 126.56,78.11 126.56,79.83C126.56,81.56 128.43,82.96 130.73,82.96Z" />
|
||||
</vector>
|
|
@ -195,6 +195,7 @@
|
|||
<string name="translations">Translations</string>
|
||||
<string name="items_for_uri">Items for %1$s</string>
|
||||
<string name="no_items_for_uri">There are no items in your vault for %1$s.</string>
|
||||
<string name="search_for_a_login_or_add_a_new_login">Search for a login or add a new login</string>
|
||||
<string name="bitwarden_autofill_service_overlay">When you select an input field and see a Bitwarden auto-fill overlay, you can tap it to launch the auto-fill service.</string>
|
||||
<string name="bitwarden_autofill_service_notification_content">Tap this notification to auto-fill an item from your vault.</string>
|
||||
<string name="bitwarden_autofill_service_open_accessibility_settings">Open Accessibility Settings</string>
|
||||
|
|
|
@ -383,6 +383,7 @@ class VaultItemListingScreenTest : BaseComposeTest() {
|
|||
it.copy(
|
||||
itemListingType = VaultItemListingState.ItemListingType.Send.SendFile,
|
||||
viewState = VaultItemListingState.ViewState.NoItems(
|
||||
header = "Save and protect your data".asText(),
|
||||
message = "There are no Sends in your account.".asText(),
|
||||
shouldShowAddButton = true,
|
||||
buttonText = "Add an Item".asText(),
|
||||
|
@ -419,6 +420,7 @@ class VaultItemListingScreenTest : BaseComposeTest() {
|
|||
mutableStateFlow.update {
|
||||
it.copy(
|
||||
viewState = VaultItemListingState.ViewState.NoItems(
|
||||
header = "Save and protect your data".asText(),
|
||||
message = "There are no items in your vault.".asText(),
|
||||
shouldShowAddButton = true,
|
||||
buttonText = "Add an Item".asText(),
|
||||
|
@ -519,6 +521,7 @@ class VaultItemListingScreenTest : BaseComposeTest() {
|
|||
mutableStateFlow.update {
|
||||
it.copy(
|
||||
viewState = VaultItemListingState.ViewState.NoItems(
|
||||
header = "Save and protect your data".asText(),
|
||||
message = "There are no items in your vault.".asText(),
|
||||
shouldShowAddButton = true,
|
||||
buttonText = "Add an Item".asText(),
|
||||
|
@ -541,6 +544,7 @@ class VaultItemListingScreenTest : BaseComposeTest() {
|
|||
mutableStateFlow.update {
|
||||
it.copy(
|
||||
viewState = VaultItemListingState.ViewState.NoItems(
|
||||
header = "Save and protect your data".asText(),
|
||||
message = "There are no items in your vault.".asText(),
|
||||
shouldShowAddButton = true,
|
||||
buttonText = "Add an Item".asText(),
|
||||
|
@ -569,6 +573,7 @@ class VaultItemListingScreenTest : BaseComposeTest() {
|
|||
mutableStateFlow.update {
|
||||
it.copy(
|
||||
viewState = VaultItemListingState.ViewState.NoItems(
|
||||
header = "Save and protect your data".asText(),
|
||||
message = "There are no items in your vault.".asText(),
|
||||
shouldShowAddButton = true,
|
||||
buttonText = "Add an Item".asText(),
|
||||
|
@ -583,6 +588,7 @@ class VaultItemListingScreenTest : BaseComposeTest() {
|
|||
mutableStateFlow.update {
|
||||
it.copy(
|
||||
viewState = VaultItemListingState.ViewState.NoItems(
|
||||
header = "Save and protect your data".asText(),
|
||||
message = "There are no items in your vault.".asText(),
|
||||
shouldShowAddButton = false,
|
||||
buttonText = "Add an Item".asText(),
|
||||
|
@ -599,12 +605,16 @@ class VaultItemListingScreenTest : BaseComposeTest() {
|
|||
mutableStateFlow.update {
|
||||
it.copy(
|
||||
viewState = VaultItemListingState.ViewState.NoItems(
|
||||
header = "Save and protect your data".asText(),
|
||||
message = "There are no items in your vault.".asText(),
|
||||
shouldShowAddButton = true,
|
||||
buttonText = "Save passkey as new login".asText(),
|
||||
),
|
||||
)
|
||||
}
|
||||
composeTestRule
|
||||
.onNodeWithText(text = "Save and protect your data")
|
||||
.assertIsDisplayed()
|
||||
composeTestRule
|
||||
.onNodeWithText(text = "There are no items in your vault.")
|
||||
.assertIsDisplayed()
|
||||
|
|
|
@ -1654,6 +1654,7 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
|
|||
assertEquals(
|
||||
createVaultItemListingState(
|
||||
viewState = VaultItemListingState.ViewState.NoItems(
|
||||
header = R.string.save_and_protect_your_data.asText(),
|
||||
message = R.string.no_items.asText(),
|
||||
shouldShowAddButton = true,
|
||||
buttonText = R.string.add_an_item.asText(),
|
||||
|
@ -1681,6 +1682,7 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
|
|||
assertEquals(
|
||||
createVaultItemListingState(
|
||||
viewState = VaultItemListingState.ViewState.NoItems(
|
||||
header = R.string.save_and_protect_your_data.asText(),
|
||||
message = R.string.no_items.asText(),
|
||||
shouldShowAddButton = true,
|
||||
buttonText = R.string.add_an_item.asText(),
|
||||
|
@ -1752,6 +1754,7 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
|
|||
assertEquals(
|
||||
createVaultItemListingState(
|
||||
viewState = VaultItemListingState.ViewState.NoItems(
|
||||
header = R.string.save_and_protect_your_data.asText(),
|
||||
message = R.string.no_items.asText(),
|
||||
shouldShowAddButton = true,
|
||||
buttonText = R.string.add_an_item.asText(),
|
||||
|
@ -1779,6 +1782,7 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
|
|||
assertEquals(
|
||||
createVaultItemListingState(
|
||||
viewState = VaultItemListingState.ViewState.NoItems(
|
||||
header = R.string.save_and_protect_your_data.asText(),
|
||||
message = R.string.no_items.asText(),
|
||||
shouldShowAddButton = true,
|
||||
buttonText = R.string.add_an_item.asText(),
|
||||
|
@ -1862,6 +1866,7 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
|
|||
assertEquals(
|
||||
createVaultItemListingState(
|
||||
viewState = VaultItemListingState.ViewState.NoItems(
|
||||
header = R.string.save_and_protect_your_data.asText(),
|
||||
message = R.string.no_items.asText(),
|
||||
shouldShowAddButton = true,
|
||||
buttonText = R.string.add_an_item.asText(),
|
||||
|
@ -1890,6 +1895,7 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
|
|||
assertEquals(
|
||||
createVaultItemListingState(
|
||||
viewState = VaultItemListingState.ViewState.NoItems(
|
||||
header = R.string.save_and_protect_your_data.asText(),
|
||||
message = R.string.no_items.asText(),
|
||||
shouldShowAddButton = true,
|
||||
buttonText = R.string.add_an_item.asText(),
|
||||
|
@ -1974,6 +1980,7 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
|
|||
assertEquals(
|
||||
createVaultItemListingState(
|
||||
viewState = VaultItemListingState.ViewState.NoItems(
|
||||
header = R.string.save_and_protect_your_data.asText(),
|
||||
message = R.string.no_items.asText(),
|
||||
shouldShowAddButton = true,
|
||||
buttonText = R.string.add_an_item.asText(),
|
||||
|
@ -2001,6 +2008,7 @@ class VaultItemListingViewModelTest : BaseViewModelTest() {
|
|||
assertEquals(
|
||||
createVaultItemListingState(
|
||||
viewState = VaultItemListingState.ViewState.NoItems(
|
||||
header = R.string.save_and_protect_your_data.asText(),
|
||||
message = R.string.no_items.asText(),
|
||||
shouldShowAddButton = true,
|
||||
buttonText = R.string.add_an_item.asText(),
|
||||
|
|
|
@ -25,6 +25,7 @@ import com.x8bit.bitwarden.ui.platform.base.util.asText
|
|||
import com.x8bit.bitwarden.ui.platform.components.model.IconData
|
||||
import com.x8bit.bitwarden.ui.vault.feature.itemlisting.VaultItemListingState
|
||||
import com.x8bit.bitwarden.ui.vault.feature.vault.model.VaultFilterType
|
||||
import com.x8bit.bitwarden.ui.vault.model.TotpData
|
||||
import io.mockk.every
|
||||
import io.mockk.mockk
|
||||
import io.mockk.mockkStatic
|
||||
|
@ -401,6 +402,7 @@ class VaultItemListingDataExtensionsTest {
|
|||
autofillSelectionData = null,
|
||||
fido2CreationData = null,
|
||||
fido2CredentialAutofillViews = null,
|
||||
totpData = null,
|
||||
isPremiumUser = true,
|
||||
)
|
||||
|
||||
|
@ -493,6 +495,7 @@ class VaultItemListingDataExtensionsTest {
|
|||
),
|
||||
fido2CreationData = null,
|
||||
fido2CredentialAutofillViews = fido2CredentialAutofillViews,
|
||||
totpData = null,
|
||||
isPremiumUser = true,
|
||||
)
|
||||
|
||||
|
@ -578,6 +581,7 @@ class VaultItemListingDataExtensionsTest {
|
|||
),
|
||||
fido2CreationData = null,
|
||||
fido2CredentialAutofillViews = fido2CredentialAutofillViews,
|
||||
totpData = null,
|
||||
isPremiumUser = true,
|
||||
)
|
||||
|
||||
|
@ -622,6 +626,7 @@ class VaultItemListingDataExtensionsTest {
|
|||
// Trash
|
||||
assertEquals(
|
||||
VaultItemListingState.ViewState.NoItems(
|
||||
header = R.string.save_and_protect_your_data.asText(),
|
||||
message = R.string.no_items_trash.asText(),
|
||||
shouldShowAddButton = false,
|
||||
buttonText = R.string.add_an_item.asText(),
|
||||
|
@ -635,6 +640,7 @@ class VaultItemListingDataExtensionsTest {
|
|||
autofillSelectionData = null,
|
||||
fido2CreationData = null,
|
||||
fido2CredentialAutofillViews = null,
|
||||
totpData = null,
|
||||
isPremiumUser = true,
|
||||
),
|
||||
)
|
||||
|
@ -642,6 +648,7 @@ class VaultItemListingDataExtensionsTest {
|
|||
// Folders
|
||||
assertEquals(
|
||||
VaultItemListingState.ViewState.NoItems(
|
||||
header = R.string.save_and_protect_your_data.asText(),
|
||||
message = R.string.no_items_folder.asText(),
|
||||
shouldShowAddButton = false,
|
||||
buttonText = R.string.add_an_item.asText(),
|
||||
|
@ -657,6 +664,7 @@ class VaultItemListingDataExtensionsTest {
|
|||
autofillSelectionData = null,
|
||||
fido2CreationData = null,
|
||||
fido2CredentialAutofillViews = null,
|
||||
totpData = null,
|
||||
isPremiumUser = true,
|
||||
),
|
||||
)
|
||||
|
@ -664,6 +672,7 @@ class VaultItemListingDataExtensionsTest {
|
|||
// Other ciphers
|
||||
assertEquals(
|
||||
VaultItemListingState.ViewState.NoItems(
|
||||
header = R.string.save_and_protect_your_data.asText(),
|
||||
message = R.string.no_items.asText(),
|
||||
shouldShowAddButton = true,
|
||||
buttonText = R.string.add_an_item.asText(),
|
||||
|
@ -677,6 +686,7 @@ class VaultItemListingDataExtensionsTest {
|
|||
autofillSelectionData = null,
|
||||
fido2CreationData = null,
|
||||
fido2CredentialAutofillViews = null,
|
||||
totpData = null,
|
||||
isPremiumUser = true,
|
||||
),
|
||||
)
|
||||
|
@ -684,6 +694,7 @@ class VaultItemListingDataExtensionsTest {
|
|||
// Autofill
|
||||
assertEquals(
|
||||
VaultItemListingState.ViewState.NoItems(
|
||||
header = R.string.save_and_protect_your_data.asText(),
|
||||
message = R.string.no_items_for_uri.asText("www.test.com"),
|
||||
shouldShowAddButton = true,
|
||||
buttonText = R.string.add_an_item.asText(),
|
||||
|
@ -701,6 +712,7 @@ class VaultItemListingDataExtensionsTest {
|
|||
),
|
||||
fido2CreationData = null,
|
||||
fido2CredentialAutofillViews = null,
|
||||
totpData = null,
|
||||
isPremiumUser = true,
|
||||
),
|
||||
)
|
||||
|
@ -708,6 +720,7 @@ class VaultItemListingDataExtensionsTest {
|
|||
// Autofill passkey
|
||||
assertEquals(
|
||||
VaultItemListingState.ViewState.NoItems(
|
||||
header = R.string.save_and_protect_your_data.asText(),
|
||||
message = R.string.no_items_for_uri.asText("www.test.com"),
|
||||
shouldShowAddButton = true,
|
||||
buttonText = R.string.save_passkey_as_new_login.asText(),
|
||||
|
@ -727,6 +740,33 @@ class VaultItemListingDataExtensionsTest {
|
|||
origin = "https://www.test.com",
|
||||
),
|
||||
fido2CredentialAutofillViews = null,
|
||||
totpData = null,
|
||||
isPremiumUser = true,
|
||||
),
|
||||
)
|
||||
|
||||
// Totp
|
||||
assertEquals(
|
||||
VaultItemListingState.ViewState.NoItems(
|
||||
header = R.string.no_items_for_uri.asText("issuer"),
|
||||
message = R.string.search_for_a_login_or_add_a_new_login.asText(),
|
||||
shouldShowAddButton = false,
|
||||
buttonText = R.string.add_an_item.asText(),
|
||||
vectorRes = R.drawable.img_folder_question,
|
||||
),
|
||||
vaultData.toViewState(
|
||||
itemListingType = VaultItemListingState.ItemListingType.Vault.Trash,
|
||||
vaultFilterType = VaultFilterType.AllVaults,
|
||||
hasMasterPassword = true,
|
||||
baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl,
|
||||
isIconLoadingDisabled = false,
|
||||
autofillSelectionData = null,
|
||||
fido2CreationData = null,
|
||||
fido2CredentialAutofillViews = null,
|
||||
totpData = mockk<TotpData> {
|
||||
every { accountName } returns "accountName"
|
||||
every { issuer } returns "issuer"
|
||||
},
|
||||
isPremiumUser = true,
|
||||
),
|
||||
)
|
||||
|
@ -869,6 +909,7 @@ class VaultItemListingDataExtensionsTest {
|
|||
autofillSelectionData = null,
|
||||
fido2CreationData = null,
|
||||
fido2CredentialAutofillViews = null,
|
||||
totpData = null,
|
||||
isPremiumUser = true,
|
||||
)
|
||||
|
||||
|
@ -912,6 +953,7 @@ class VaultItemListingDataExtensionsTest {
|
|||
autofillSelectionData = null,
|
||||
fido2CreationData = null,
|
||||
fido2CredentialAutofillViews = null,
|
||||
totpData = null,
|
||||
isPremiumUser = true,
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue