[PM-15064] Add feature flags for CXP import and export

This commit introduces two new feature flags:

- `cxp-import-mobile`: Enables Credential Exchange Protocol (CXP) import functionality.
- `cxp-export-mobile`: Enables Credential Exchange Protocol (CXP) export functionality.

These flags are added to the debug menu for testing and can be remotely configured.
This commit is contained in:
Patrick Honkonen 2024-11-19 12:53:05 -05:00
parent d418444dc0
commit f675eb7388
No known key found for this signature in database
GPG key ID: B63AF42A5531C877
4 changed files with 35 additions and 0 deletions

View file

@ -33,6 +33,8 @@ sealed class FlagKey<out T : Any> {
ImportLoginsFlow,
SshKeyCipherItems,
VerifiedSsoDomainEndpoint,
CredentialExchangeProtocolImport,
CredentialExchangeProtocolExport,
)
}
}
@ -90,6 +92,7 @@ sealed class FlagKey<out T : Any> {
override val defaultValue: Boolean = false
override val isRemotelyConfigured: Boolean = true
}
/**
* Data object holding the feature flag key for the new verified SSO domain endpoint feature.
*/
@ -99,6 +102,27 @@ sealed class FlagKey<out T : Any> {
override val isRemotelyConfigured: Boolean = true
}
/**
* Data object holding hte feature flag key for the Credential Exchange Protocol (CXP) import
* feature.
*/
data object CredentialExchangeProtocolImport : FlagKey<Boolean>() {
override val keyName: String = "cxp-import-mobile"
override val defaultValue: Boolean = false
override val isRemotelyConfigured: Boolean = true
}
/**
* Data object holding the feature flag key for the Credential Exchange Protocol (CXP) export
* feature.
*/
data object CredentialExchangeProtocolExport : FlagKey<Boolean>() {
override val keyName: String = "cxp-export-mobile"
override val defaultValue: Boolean = false
override val isRemotelyConfigured: Boolean = true
}
//region Dummy keys for testing
/**
* Data object holding the key for a [Boolean] flag to be used in tests.
*/
@ -126,4 +150,5 @@ sealed class FlagKey<out T : Any> {
override val defaultValue: String = "defaultValue"
override val isRemotelyConfigured: Boolean = true
}
//endregion Dummy keys for testing
}

View file

@ -29,6 +29,8 @@ fun <T : Any> FlagKey<T>.ListItemContent(
FlagKey.ImportLoginsFlow,
FlagKey.SshKeyCipherItems,
FlagKey.VerifiedSsoDomainEndpoint,
FlagKey.CredentialExchangeProtocolImport,
FlagKey.CredentialExchangeProtocolExport,
-> BooleanFlagItem(
label = flagKey.getDisplayLabel(),
key = flagKey as FlagKey<Boolean>,
@ -73,4 +75,6 @@ private fun <T : Any> FlagKey<T>.getDisplayLabel(): String = when (this) {
FlagKey.ImportLoginsFlow -> stringResource(R.string.import_logins_flow)
FlagKey.SshKeyCipherItems -> stringResource(R.string.ssh_key_cipher_item_types)
FlagKey.VerifiedSsoDomainEndpoint -> stringResource(R.string.verified_sso_domain_verified)
FlagKey.CredentialExchangeProtocolImport -> stringResource(R.string.cxp_import)
FlagKey.CredentialExchangeProtocolExport -> stringResource(R.string.cxp_export)
}

View file

@ -1095,4 +1095,6 @@ Do you want to switch to this account?</string>
<string name="copy_email">Copy email</string>
<string name="copy_phone">Copy phone number</string>
<string name="copy_address">Copy address</string>
<string name="cxp_import">CXP Import</string>
<string name="cxp_export">CXP Export</string>
</resources>

View file

@ -114,6 +114,8 @@ private val DEFAULT_MAP_VALUE: Map<FlagKey<Any>, Any> = mapOf(
FlagKey.ImportLoginsFlow to true,
FlagKey.SshKeyCipherItems to true,
FlagKey.VerifiedSsoDomainEndpoint to true,
FlagKey.CredentialExchangeProtocolImport to true,
FlagKey.CredentialExchangeProtocolExport to true,
)
private val UPDATED_MAP_VALUE: Map<FlagKey<Any>, Any> = mapOf(
@ -124,6 +126,8 @@ private val UPDATED_MAP_VALUE: Map<FlagKey<Any>, Any> = mapOf(
FlagKey.ImportLoginsFlow to false,
FlagKey.SshKeyCipherItems to false,
FlagKey.VerifiedSsoDomainEndpoint to false,
FlagKey.CredentialExchangeProtocolImport to false,
FlagKey.CredentialExchangeProtocolExport to false,
)
private val DEFAULT_STATE = DebugMenuState(