From 9f95c26c2fbc772883f27d8246eb150a1891d280 Mon Sep 17 00:00:00 2001 From: Brian Yencho Date: Wed, 10 Jan 2024 14:26:33 -0600 Subject: [PATCH] BIT-1432: Add FifteenMinutes to VaultTimeout (#565) --- .../data/platform/repository/model/VaultTimeout.kt | 10 ++++++++++ .../accountsecurity/AccountSecurityViewModel.kt | 1 + .../ui/platform/util/VaultTimeoutExtensions.kt | 1 + .../accountsecurity/AccountSecurityScreenTest.kt | 5 +++++ .../ui/platform/util/VaultTimeoutExtensionsTest.kt | 1 + 5 files changed, 18 insertions(+) diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/repository/model/VaultTimeout.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/repository/model/VaultTimeout.kt index 47b53ea5d..8c54746c5 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/platform/repository/model/VaultTimeout.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/platform/repository/model/VaultTimeout.kt @@ -46,6 +46,15 @@ sealed class VaultTimeout : Parcelable { override val vaultTimeoutInMinutes: Int get() = 5 } + /** + * The vault should time out after fifteen minutes. + */ + @Parcelize + data object FifteenMinutes : VaultTimeout() { + override val type: Type get() = Type.FIFTEEN_MINUTES + override val vaultTimeoutInMinutes: Int get() = 15 + } + /** * The vault should time out after thirty minutes. */ @@ -108,6 +117,7 @@ sealed class VaultTimeout : Parcelable { IMMEDIATELY, ONE_MINUTE, FIVE_MINUTES, + FIFTEEN_MINUTES, THIRTY_MINUTES, ONE_HOUR, FOUR_HOURS, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityViewModel.kt index c30eef55f..c64302f4e 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityViewModel.kt @@ -133,6 +133,7 @@ class AccountSecurityViewModel @Inject constructor( VaultTimeout.Type.IMMEDIATELY -> VaultTimeout.Immediately VaultTimeout.Type.ONE_MINUTE -> VaultTimeout.OneMinute VaultTimeout.Type.FIVE_MINUTES -> VaultTimeout.FiveMinutes + VaultTimeout.Type.FIFTEEN_MINUTES -> VaultTimeout.FifteenMinutes VaultTimeout.Type.THIRTY_MINUTES -> VaultTimeout.ThirtyMinutes VaultTimeout.Type.ONE_HOUR -> VaultTimeout.OneHour VaultTimeout.Type.FOUR_HOURS -> VaultTimeout.FourHours diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/util/VaultTimeoutExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/util/VaultTimeoutExtensions.kt index 10c1eeabf..4ff25516c 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/util/VaultTimeoutExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/util/VaultTimeoutExtensions.kt @@ -13,6 +13,7 @@ val VaultTimeout.Type.displayLabel: Text VaultTimeout.Type.IMMEDIATELY -> R.string.immediately VaultTimeout.Type.ONE_MINUTE -> R.string.one_minute VaultTimeout.Type.FIVE_MINUTES -> R.string.five_minutes + VaultTimeout.Type.FIFTEEN_MINUTES -> R.string.fifteen_minutes VaultTimeout.Type.THIRTY_MINUTES -> R.string.thirty_minutes VaultTimeout.Type.ONE_HOUR -> R.string.one_hour VaultTimeout.Type.FOUR_HOURS -> R.string.four_hours diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityScreenTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityScreenTest.kt index 303426700..202dca2f0 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityScreenTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityScreenTest.kt @@ -164,6 +164,10 @@ class AccountSecurityScreenTest : BaseComposeTest() { .onAllNodesWithText("5 minutes") .filterToOne(hasAnyAncestor(isDialog())) .assertIsDisplayed() + composeTestRule + .onAllNodesWithText("15 minutes") + .filterToOne(hasAnyAncestor(isDialog())) + .assertIsDisplayed() composeTestRule .onAllNodesWithText("30 minutes") .filterToOne(hasAnyAncestor(isDialog())) @@ -179,6 +183,7 @@ class AccountSecurityScreenTest : BaseComposeTest() { composeTestRule .onAllNodesWithText("On app restart") .filterToOne(hasAnyAncestor(isDialog())) + .performScrollTo() .assertIsDisplayed() composeTestRule .onAllNodesWithText("Never") diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/platform/util/VaultTimeoutExtensionsTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/platform/util/VaultTimeoutExtensionsTest.kt index cdc2bb886..b1dcf3d7b 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/platform/util/VaultTimeoutExtensionsTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/platform/util/VaultTimeoutExtensionsTest.kt @@ -13,6 +13,7 @@ class VaultTimeoutExtensionsTest { VaultTimeout.Type.IMMEDIATELY to R.string.immediately.asText(), VaultTimeout.Type.ONE_MINUTE to R.string.one_minute.asText(), VaultTimeout.Type.FIVE_MINUTES to R.string.five_minutes.asText(), + VaultTimeout.Type.FIFTEEN_MINUTES to R.string.fifteen_minutes.asText(), VaultTimeout.Type.THIRTY_MINUTES to R.string.thirty_minutes.asText(), VaultTimeout.Type.ONE_HOUR to R.string.one_hour.asText(), VaultTimeout.Type.FOUR_HOURS to R.string.four_hours.asText(),