From cf5d208516287480a846fb8cc56f285ce4379cde Mon Sep 17 00:00:00 2001 From: David Perez Date: Tue, 23 Sep 2025 11:04:36 -0500 Subject: [PATCH] Display the CipherKeyEncryption flag in debug menu (#5923) --- .../debugmenu/DebugMenuViewModelTest.kt | 18 +++++++++--------- .../debugmenu/DebugMenuViewModelTest.kt | 16 +++++++++------- .../core/data/manager/model/FlagKey.kt | 1 + 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/app/src/test/kotlin/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt b/app/src/test/kotlin/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt index 32aa056127..275fb0c149 100644 --- a/app/src/test/kotlin/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt +++ b/app/src/test/kotlin/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt @@ -16,7 +16,7 @@ import io.mockk.mockk import io.mockk.runs import io.mockk.verify import kotlinx.collections.immutable.ImmutableMap -import kotlinx.collections.immutable.persistentMapOf +import kotlinx.collections.immutable.toImmutableMap import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Assertions.assertEquals @@ -143,15 +143,15 @@ class DebugMenuViewModelTest : BaseViewModelTest() { ) } -private val DEFAULT_MAP_VALUE: ImmutableMap, Any> = persistentMapOf( - FlagKey.CredentialExchangeProtocolImport to true, - FlagKey.CredentialExchangeProtocolExport to true, -) +private val DEFAULT_MAP_VALUE: ImmutableMap, Any> = FlagKey + .activePasswordManagerFlags + .associateWith { true } + .toImmutableMap() -private val UPDATED_MAP_VALUE: ImmutableMap, Any> = persistentMapOf( - FlagKey.CredentialExchangeProtocolImport to false, - FlagKey.CredentialExchangeProtocolExport to false, -) +private val UPDATED_MAP_VALUE: ImmutableMap, Any> = FlagKey + .activePasswordManagerFlags + .associateWith { false } + .toImmutableMap() private val DEFAULT_STATE = DebugMenuState( featureFlags = DEFAULT_MAP_VALUE, diff --git a/authenticator/src/test/kotlin/com/bitwarden/authenticator/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt b/authenticator/src/test/kotlin/com/bitwarden/authenticator/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt index 32301ea822..e4e1b2e323 100644 --- a/authenticator/src/test/kotlin/com/bitwarden/authenticator/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt +++ b/authenticator/src/test/kotlin/com/bitwarden/authenticator/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt @@ -13,7 +13,7 @@ import io.mockk.mockk import io.mockk.runs import io.mockk.verify import kotlinx.collections.immutable.ImmutableMap -import kotlinx.collections.immutable.persistentMapOf +import kotlinx.collections.immutable.toImmutableMap import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Assertions.assertEquals @@ -79,13 +79,15 @@ class DebugMenuViewModelTest : BaseViewModelTest() { ) } -private val DEFAULT_MAP_VALUE: ImmutableMap, Any> = persistentMapOf( - FlagKey.BitwardenAuthenticationEnabled to true, -) +private val DEFAULT_MAP_VALUE: ImmutableMap, Any> = FlagKey + .activeAuthenticatorFlags + .associateWith { true } + .toImmutableMap() -private val UPDATED_MAP_VALUE: ImmutableMap, Any> = persistentMapOf( - FlagKey.BitwardenAuthenticationEnabled to false, -) +private val UPDATED_MAP_VALUE: ImmutableMap, Any> = FlagKey + .activeAuthenticatorFlags + .associateWith { false } + .toImmutableMap() private val DEFAULT_STATE = DebugMenuState( featureFlags = DEFAULT_MAP_VALUE, diff --git a/core/src/main/kotlin/com/bitwarden/core/data/manager/model/FlagKey.kt b/core/src/main/kotlin/com/bitwarden/core/data/manager/model/FlagKey.kt index e3a814195a..2e3efffd1c 100644 --- a/core/src/main/kotlin/com/bitwarden/core/data/manager/model/FlagKey.kt +++ b/core/src/main/kotlin/com/bitwarden/core/data/manager/model/FlagKey.kt @@ -32,6 +32,7 @@ sealed class FlagKey { listOf( CredentialExchangeProtocolImport, CredentialExchangeProtocolExport, + CipherKeyEncryption, ) } }