Skip to content

Commit

Permalink
[PM-13980] Add SSH Key Cipher Item Types feature flag (#4144)
Browse files Browse the repository at this point in the history
  • Loading branch information
SaintPatrck authored Oct 24, 2024
1 parent 2d9451c commit bdb6136
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ sealed class FlagKey<out T : Any> {
OnboardingFlow,
OnboardingCarousel,
ImportLoginsFlow,
SshKeyCipherItems,
)
}
}
Expand Down Expand Up @@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down Expand Up @@ -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)
}
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down

0 comments on commit bdb6136

Please sign in to comment.