[PM-13980] Add SSH Key Cipher Item Types feature flag (#4144)

This commit is contained in:
Patrick Honkonen 2024-10-24 09:16:31 -04:00 committed by GitHub
parent 2d9451cc34
commit bdb6136d36
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 20 additions and 0 deletions

View file

@ -31,6 +31,7 @@ sealed class FlagKey<out T : Any> {
OnboardingFlow,
OnboardingCarousel,
ImportLoginsFlow,
SshKeyCipherItems,
)
}
}
@ -80,6 +81,15 @@ sealed class FlagKey<out T : Any> {
override val isRemotelyConfigured: Boolean = false
}
/**
* Data object holding the feature flag key for the SSH key cipher items feature.
*/
data object SshKeyCipherItems : FlagKey<Boolean>() {
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.
*/

View file

@ -27,6 +27,7 @@ fun <T : Any> FlagKey<T>.ListItemContent(
FlagKey.OnboardingCarousel,
FlagKey.OnboardingFlow,
FlagKey.ImportLoginsFlow,
FlagKey.SshKeyCipherItems,
-> BooleanFlagItem(
label = flagKey.getDisplayLabel(),
key = flagKey as FlagKey<Boolean>,
@ -69,4 +70,5 @@ private fun <T : Any> FlagKey<T>.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)
}

View file

@ -1061,4 +1061,5 @@ Do you want to switch to this account?</string>
<string name="save_the_exported_file_highlight">Save the exported file</string>
<string name="this_is_not_a_recognized_bitwarden_server_you_may_need_to_check_with_your_provider_or_update_your_server">This is not a recognized Bitwarden server. You may need to check with your provider or update your server.</string>
<string name="syncing_logins_loading_message">Syncing logins...</string>
<string name="ssh_key_cipher_item_types">SSH Key Cipher Item Types</string>
</resources>

View file

@ -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)
}
}

View file

@ -112,6 +112,7 @@ private val DEFAULT_MAP_VALUE: Map<FlagKey<Any>, Any> = mapOf(
FlagKey.OnboardingCarousel to true,
FlagKey.OnboardingFlow to true,
FlagKey.ImportLoginsFlow to true,
FlagKey.SshKeyCipherItems to true,
)
private val UPDATED_MAP_VALUE: Map<FlagKey<Any>, Any> = mapOf(
@ -120,6 +121,7 @@ private val UPDATED_MAP_VALUE: Map<FlagKey<Any>, Any> = mapOf(
FlagKey.OnboardingCarousel to true,
FlagKey.OnboardingFlow to false,
FlagKey.ImportLoginsFlow to false,
FlagKey.SshKeyCipherItems to false,
)
private val DEFAULT_STATE = DebugMenuState(