From bdb6136d36c199ff86204e21161984197264c022 Mon Sep 17 00:00:00 2001 From: Patrick Honkonen <1883101+SaintPatrck@users.noreply.github.com> Date: Thu, 24 Oct 2024 09:16:31 -0400 Subject: [PATCH] [PM-13980] Add SSH Key Cipher Item Types feature flag (#4144) --- .../bitwarden/data/platform/manager/model/FlagKey.kt | 10 ++++++++++ .../debugmenu/components/FeatureFlagListItems.kt | 2 ++ app/src/main/res/values/strings.xml | 1 + .../bitwarden/data/platform/manager/FlagKeyTest.kt | 5 +++++ .../feature/debugmenu/DebugMenuViewModelTest.kt | 2 ++ 5 files changed, 20 insertions(+) diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/model/FlagKey.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/model/FlagKey.kt index 88ccd5f74..861711879 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/model/FlagKey.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/model/FlagKey.kt @@ -31,6 +31,7 @@ sealed class FlagKey { OnboardingFlow, OnboardingCarousel, ImportLoginsFlow, + SshKeyCipherItems, ) } } @@ -80,6 +81,15 @@ sealed class FlagKey { override val isRemotelyConfigured: Boolean = false } + /** + * Data object holding the feature flag key for the SSH key cipher items feature. + */ + data object SshKeyCipherItems : FlagKey() { + override val keyName: String = "ssh-key-vault-item" + override val defaultValue: Boolean = false + override val isRemotelyConfigured: Boolean = true + } + /** * Data object holding the key for a [Boolean] flag to be used in tests. */ diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/debugmenu/components/FeatureFlagListItems.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/debugmenu/components/FeatureFlagListItems.kt index 6d264cb92..59b932eaa 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/debugmenu/components/FeatureFlagListItems.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/debugmenu/components/FeatureFlagListItems.kt @@ -27,6 +27,7 @@ fun FlagKey.ListItemContent( FlagKey.OnboardingCarousel, FlagKey.OnboardingFlow, FlagKey.ImportLoginsFlow, + FlagKey.SshKeyCipherItems, -> BooleanFlagItem( label = flagKey.getDisplayLabel(), key = flagKey as FlagKey, @@ -69,4 +70,5 @@ private fun FlagKey.getDisplayLabel(): String = when (this) { FlagKey.OnboardingCarousel -> stringResource(R.string.onboarding_carousel) FlagKey.OnboardingFlow -> stringResource(R.string.onboarding_flow) FlagKey.ImportLoginsFlow -> stringResource(R.string.import_logins_flow) + FlagKey.SshKeyCipherItems -> stringResource(R.string.ssh_key_cipher_item_types) } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index eb62ccf51..f6e398948 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1061,4 +1061,5 @@ Do you want to switch to this account? Save the exported file This is not a recognized Bitwarden server. You may need to check with your provider or update your server. Syncing logins... + SSH Key Cipher Item Types diff --git a/app/src/test/java/com/x8bit/bitwarden/data/platform/manager/FlagKeyTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/platform/manager/FlagKeyTest.kt index 350b6d576..6be73357a 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/platform/manager/FlagKeyTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/platform/manager/FlagKeyTest.kt @@ -30,4 +30,9 @@ class FlagKeyTest { fun `ImportLoginsFlow default value should be false`() { assertFalse(FlagKey.ImportLoginsFlow.defaultValue) } + + @Test + fun `SshKeyCipherItems default value should be false`() { + assertFalse(FlagKey.SshKeyCipherItems.defaultValue) + } } diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt index da866387d..68e509623 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt @@ -112,6 +112,7 @@ private val DEFAULT_MAP_VALUE: Map, Any> = mapOf( FlagKey.OnboardingCarousel to true, FlagKey.OnboardingFlow to true, FlagKey.ImportLoginsFlow to true, + FlagKey.SshKeyCipherItems to true, ) private val UPDATED_MAP_VALUE: Map, Any> = mapOf( @@ -120,6 +121,7 @@ private val UPDATED_MAP_VALUE: Map, Any> = mapOf( FlagKey.OnboardingCarousel to true, FlagKey.OnboardingFlow to false, FlagKey.ImportLoginsFlow to false, + FlagKey.SshKeyCipherItems to false, ) private val DEFAULT_STATE = DebugMenuState(