mirror of
https://github.com/bitwarden/android.git
synced 2026-03-21 22:00:42 -05:00
PM-19543: Add flight recorder feature flag (#4929)
This commit is contained in:
@@ -45,6 +45,7 @@ sealed class FlagKey<out T : Any> {
|
||||
SimpleLoginSelfHostAlias,
|
||||
ChromeAutofill,
|
||||
MobileErrorReporting,
|
||||
FlightRecorder,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -76,6 +77,15 @@ sealed class FlagKey<out T : Any> {
|
||||
override val isRemotelyConfigured: Boolean = false
|
||||
}
|
||||
|
||||
/**
|
||||
* Data object holding the key for enabling the flught recorder feature.
|
||||
*/
|
||||
data object FlightRecorder : FlagKey<Boolean>() {
|
||||
override val keyName: String = "enable-pm-flight-recorder"
|
||||
override val defaultValue: Boolean = false
|
||||
override val isRemotelyConfigured: Boolean = false
|
||||
}
|
||||
|
||||
/**
|
||||
* Data object holding the feature flag key for the Onboarding Carousel feature.
|
||||
*/
|
||||
|
||||
@@ -21,7 +21,9 @@ fun <T : Any> FlagKey<T>.ListItemContent(
|
||||
FlagKey.DummyBoolean,
|
||||
is FlagKey.DummyInt,
|
||||
FlagKey.DummyString,
|
||||
-> Unit
|
||||
-> {
|
||||
Unit
|
||||
}
|
||||
|
||||
FlagKey.AuthenticatorSync,
|
||||
FlagKey.EmailVerification,
|
||||
@@ -43,6 +45,7 @@ fun <T : Any> FlagKey<T>.ListItemContent(
|
||||
FlagKey.SimpleLoginSelfHostAlias,
|
||||
FlagKey.ChromeAutofill,
|
||||
FlagKey.MobileErrorReporting,
|
||||
FlagKey.FlightRecorder,
|
||||
-> {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
BooleanFlagItem(
|
||||
@@ -107,4 +110,5 @@ private fun <T : Any> FlagKey<T>.getDisplayLabel(): String = when (this) {
|
||||
FlagKey.SimpleLoginSelfHostAlias -> stringResource(R.string.simple_login_self_hosted_aliases)
|
||||
FlagKey.ChromeAutofill -> stringResource(R.string.enable_chrome_autofill)
|
||||
FlagKey.MobileErrorReporting -> stringResource(R.string.enable_error_reporting_dialog)
|
||||
FlagKey.FlightRecorder -> stringResource(R.string.enable_flight_recorder)
|
||||
}
|
||||
|
||||
@@ -30,5 +30,6 @@
|
||||
<string name="simple_login_self_hosted_aliases">SimpleLogin self-hosted aliases</string>
|
||||
<string name="enable_chrome_autofill">Enable chrome autofill</string>
|
||||
<string name="enable_error_reporting_dialog">Enable error reporting dialog</string>
|
||||
<string name="enable_flight_recorder">Enable flight recorder</string>
|
||||
<!-- /Debug Menu -->
|
||||
</resources>
|
||||
|
||||
@@ -81,6 +81,14 @@ class FlagKeyTest {
|
||||
FlagKey.ChromeAutofill.keyName,
|
||||
"android-chrome-autofill",
|
||||
)
|
||||
assertEquals(
|
||||
FlagKey.MobileErrorReporting.keyName,
|
||||
"mobile-error-reporting",
|
||||
)
|
||||
assertEquals(
|
||||
FlagKey.FlightRecorder.keyName,
|
||||
"enable-pm-flight-recorder",
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -104,6 +112,8 @@ class FlagKeyTest {
|
||||
FlagKey.SimpleLoginSelfHostAlias,
|
||||
FlagKey.CipherKeyEncryption,
|
||||
FlagKey.ChromeAutofill,
|
||||
FlagKey.MobileErrorReporting,
|
||||
FlagKey.FlightRecorder,
|
||||
).all {
|
||||
!it.defaultValue
|
||||
},
|
||||
@@ -140,6 +150,8 @@ class FlagKeyTest {
|
||||
assertTrue(
|
||||
listOf(
|
||||
FlagKey.IgnoreEnvironmentCheck,
|
||||
FlagKey.MobileErrorReporting,
|
||||
FlagKey.FlightRecorder,
|
||||
).all {
|
||||
!it.isRemotelyConfigured
|
||||
},
|
||||
|
||||
@@ -139,6 +139,7 @@ private val DEFAULT_MAP_VALUE: ImmutableMap<FlagKey<Any>, Any> = persistentMapOf
|
||||
FlagKey.SimpleLoginSelfHostAlias to true,
|
||||
FlagKey.ChromeAutofill to true,
|
||||
FlagKey.MobileErrorReporting to true,
|
||||
FlagKey.FlightRecorder to true,
|
||||
)
|
||||
|
||||
private val UPDATED_MAP_VALUE: ImmutableMap<FlagKey<Any>, Any> = persistentMapOf(
|
||||
@@ -161,6 +162,7 @@ private val UPDATED_MAP_VALUE: ImmutableMap<FlagKey<Any>, Any> = persistentMapOf
|
||||
FlagKey.SimpleLoginSelfHostAlias to false,
|
||||
FlagKey.ChromeAutofill to false,
|
||||
FlagKey.MobileErrorReporting to false,
|
||||
FlagKey.FlightRecorder to false,
|
||||
)
|
||||
|
||||
private val DEFAULT_STATE = DebugMenuState(
|
||||
|
||||
Reference in New Issue
Block a user