mirror of
https://github.com/bitwarden/android.git
synced 2026-03-12 05:04:17 -05:00
PM-23690: Remove pre-login settings feature flag (#5513)
This commit is contained in:
@@ -34,7 +34,6 @@ sealed class FlagKey<out T : Any> {
|
||||
ChromeAutofill,
|
||||
MobileErrorReporting,
|
||||
RestrictCipherItemDeletion,
|
||||
PreAuthSettings,
|
||||
UserManagedPrivilegedApps,
|
||||
RemoveCardPolicy,
|
||||
)
|
||||
@@ -157,14 +156,6 @@ sealed class FlagKey<out T : Any> {
|
||||
override val defaultValue: Boolean = false
|
||||
}
|
||||
|
||||
/**
|
||||
* Data object holding the feature flag key to enable the settings menu before login.
|
||||
*/
|
||||
data object PreAuthSettings : FlagKey<Boolean>() {
|
||||
override val keyName: String = "enable-pm-prelogin-settings"
|
||||
override val defaultValue: Boolean = false
|
||||
}
|
||||
|
||||
/**
|
||||
* Data object holding the feature flag key to enabled user-managed privileged apps.
|
||||
*/
|
||||
|
||||
@@ -319,17 +319,15 @@ private fun LandingScreenContent(
|
||||
.testTag("CreateAccountLabel"),
|
||||
)
|
||||
}
|
||||
if (state.showSettingsButton) {
|
||||
Spacer(modifier = Modifier.height(height = 8.dp))
|
||||
BitwardenTextButton(
|
||||
label = stringResource(id = R.string.app_settings),
|
||||
onClick = onAppSettingsClick,
|
||||
icon = rememberVectorPainter(id = BitwardenDrawable.ic_cog),
|
||||
modifier = Modifier
|
||||
.standardHorizontalMargin()
|
||||
.fillMaxWidth(),
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.height(height = 8.dp))
|
||||
BitwardenTextButton(
|
||||
label = stringResource(id = R.string.app_settings),
|
||||
onClick = onAppSettingsClick,
|
||||
icon = rememberVectorPainter(id = BitwardenDrawable.ic_cog),
|
||||
modifier = Modifier
|
||||
.standardHorizontalMargin()
|
||||
.fillMaxWidth(),
|
||||
)
|
||||
|
||||
Spacer(modifier = Modifier.height(height = 12.dp))
|
||||
Spacer(modifier = Modifier.navigationBarsPadding())
|
||||
|
||||
@@ -54,7 +54,6 @@ class LandingViewModel @Inject constructor(
|
||||
selectedEnvironmentLabel = environmentRepository.environment.label,
|
||||
dialog = null,
|
||||
accountSummaries = authRepository.userStateFlow.value?.toAccountSummaries().orEmpty(),
|
||||
showSettingsButton = featureFlagManager.getFeatureFlag(key = FlagKey.PreAuthSettings),
|
||||
),
|
||||
) {
|
||||
|
||||
@@ -108,11 +107,6 @@ class LandingViewModel @Inject constructor(
|
||||
.map { LandingAction.Internal.SnackbarDataReceived(it) }
|
||||
.onEach(::sendAction)
|
||||
.launchIn(viewModelScope)
|
||||
featureFlagManager
|
||||
.getFeatureFlagFlow(key = FlagKey.PreAuthSettings)
|
||||
.map { LandingAction.Internal.PreAuthSettingFlagReceive(it) }
|
||||
.onEach(::sendAction)
|
||||
.launchIn(viewModelScope)
|
||||
}
|
||||
|
||||
override fun handleAction(action: LandingAction) {
|
||||
@@ -142,10 +136,6 @@ class LandingViewModel @Inject constructor(
|
||||
handleUpdatedEnvironmentReceive(action)
|
||||
}
|
||||
|
||||
is LandingAction.Internal.PreAuthSettingFlagReceive -> {
|
||||
handlePreAuthSettingFlagReceive(action)
|
||||
}
|
||||
|
||||
is LandingAction.Internal.SnackbarDataReceived -> handleSnackbarDataReceived(action)
|
||||
}
|
||||
}
|
||||
@@ -271,12 +261,6 @@ class LandingViewModel @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun handlePreAuthSettingFlagReceive(
|
||||
action: LandingAction.Internal.PreAuthSettingFlagReceive,
|
||||
) {
|
||||
mutableStateFlow.update { it.copy(showSettingsButton = action.isEnabled) }
|
||||
}
|
||||
|
||||
private fun handleSnackbarDataReceived(action: LandingAction.Internal.SnackbarDataReceived) {
|
||||
sendEvent(LandingEvent.ShowSnackbar(action.data))
|
||||
}
|
||||
@@ -307,7 +291,6 @@ data class LandingState(
|
||||
val selectedEnvironmentLabel: String,
|
||||
val dialog: DialogState?,
|
||||
val accountSummaries: List<AccountSummary>,
|
||||
val showSettingsButton: Boolean,
|
||||
) : Parcelable {
|
||||
/**
|
||||
* Determines whether the app bar should be visible based on the presence of account summaries.
|
||||
@@ -458,13 +441,6 @@ sealed class LandingAction {
|
||||
* Actions for internal use by the ViewModel.
|
||||
*/
|
||||
sealed class Internal : LandingAction() {
|
||||
/**
|
||||
* Indicates that there has been a change to the pre-auth settings feature flag.
|
||||
*/
|
||||
data class PreAuthSettingFlagReceive(
|
||||
val isEnabled: Boolean,
|
||||
) : Internal()
|
||||
|
||||
/**
|
||||
* Indicates that snackbar data has been received.
|
||||
*/
|
||||
|
||||
@@ -39,7 +39,6 @@ fun <T : Any> FlagKey<T>.ListItemContent(
|
||||
FlagKey.ChromeAutofill,
|
||||
FlagKey.MobileErrorReporting,
|
||||
FlagKey.RestrictCipherItemDeletion,
|
||||
FlagKey.PreAuthSettings,
|
||||
FlagKey.UserManagedPrivilegedApps,
|
||||
FlagKey.RemoveCardPolicy,
|
||||
-> {
|
||||
@@ -100,9 +99,9 @@ private fun <T : Any> FlagKey<T>.getDisplayLabel(): String = when (this) {
|
||||
FlagKey.ChromeAutofill -> stringResource(R.string.enable_chrome_autofill)
|
||||
FlagKey.MobileErrorReporting -> stringResource(R.string.enable_error_reporting_dialog)
|
||||
FlagKey.RestrictCipherItemDeletion -> stringResource(R.string.restrict_item_deletion)
|
||||
FlagKey.PreAuthSettings -> stringResource(R.string.enable_pre_auth_settings)
|
||||
FlagKey.UserManagedPrivilegedApps -> {
|
||||
stringResource(R.string.user_trusted_privileged_app_management)
|
||||
}
|
||||
|
||||
FlagKey.RemoveCardPolicy -> stringResource(R.string.remove_card_policy)
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
<string name="enable_chrome_autofill">Enable chrome autofill</string>
|
||||
<string name="enable_error_reporting_dialog">Enable error reporting dialog</string>
|
||||
<string name="restrict_item_deletion">Restrict item deletion</string>
|
||||
<string name="enable_pre_auth_settings">Enabled pre-auth settings</string>
|
||||
<string name="generate_crash">Generate crash</string>
|
||||
<string name="generate_error_report">Generate error report</string>
|
||||
<string name="error_reports">Error reports</string>
|
||||
|
||||
@@ -61,10 +61,6 @@ class FlagKeyTest {
|
||||
FlagKey.RestrictCipherItemDeletion.keyName,
|
||||
"pm-15493-restrict-item-deletion-to-can-manage-permission",
|
||||
)
|
||||
assertEquals(
|
||||
FlagKey.PreAuthSettings.keyName,
|
||||
"enable-pm-prelogin-settings",
|
||||
)
|
||||
assertEquals(
|
||||
FlagKey.UserManagedPrivilegedApps.keyName,
|
||||
"pm-18970-user-managed-privileged-apps",
|
||||
@@ -92,7 +88,6 @@ class FlagKeyTest {
|
||||
FlagKey.ChromeAutofill,
|
||||
FlagKey.MobileErrorReporting,
|
||||
FlagKey.RestrictCipherItemDeletion,
|
||||
FlagKey.PreAuthSettings,
|
||||
FlagKey.UserManagedPrivilegedApps,
|
||||
FlagKey.RemoveCardPolicy,
|
||||
).all {
|
||||
|
||||
@@ -283,21 +283,8 @@ class LandingScreenTest : BitwardenComposeTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `app settings button should be displayed according to state`() {
|
||||
mutableStateFlow.update { it.copy(showSettingsButton = false) }
|
||||
composeTestRule
|
||||
.onNodeWithText(text = "App settings")
|
||||
.assertDoesNotExist()
|
||||
mutableStateFlow.update { it.copy(showSettingsButton = true) }
|
||||
composeTestRule
|
||||
.onNodeWithText(text = "App settings")
|
||||
.assertExists()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `on app settings click should send AppSettingsClick action`() {
|
||||
mutableStateFlow.update { it.copy(showSettingsButton = true) }
|
||||
composeTestRule
|
||||
.onNodeWithText(text = "App settings")
|
||||
.performScrollTo()
|
||||
@@ -527,5 +514,4 @@ private val DEFAULT_STATE = LandingState(
|
||||
selectedEnvironmentLabel = Environment.Us.label,
|
||||
dialog = null,
|
||||
accountSummaries = emptyList(),
|
||||
showSettingsButton = false,
|
||||
)
|
||||
|
||||
@@ -51,7 +51,6 @@ class LandingViewModelTest : BaseViewModelTest() {
|
||||
}
|
||||
private val featureFlagManager: FeatureFlagManager = mockk(relaxed = true) {
|
||||
every { getFeatureFlag(FlagKey.EmailVerification) } returns false
|
||||
every { getFeatureFlag(FlagKey.PreAuthSettings) } returns false
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -231,20 +230,6 @@ class LandingViewModelTest : BaseViewModelTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `PreAuthSettingFlagReceive should update the state accordingly`() = runTest {
|
||||
val viewModel = createViewModel()
|
||||
viewModel.stateFlow.test {
|
||||
assertEquals(DEFAULT_STATE, awaitItem())
|
||||
|
||||
viewModel.trySendAction(LandingAction.Internal.PreAuthSettingFlagReceive(true))
|
||||
assertEquals(DEFAULT_STATE.copy(showSettingsButton = true), awaitItem())
|
||||
|
||||
viewModel.trySendAction(LandingAction.Internal.PreAuthSettingFlagReceive(false))
|
||||
assertEquals(DEFAULT_STATE.copy(showSettingsButton = false), awaitItem())
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `ContinueButtonClick with an email input matching an existing account on same environment that is logged in should show the account already added dialog`() {
|
||||
@@ -654,5 +639,4 @@ private val DEFAULT_STATE = LandingState(
|
||||
selectedEnvironmentLabel = Environment.Us.label,
|
||||
dialog = null,
|
||||
accountSummaries = emptyList(),
|
||||
showSettingsButton = false,
|
||||
)
|
||||
|
||||
@@ -157,7 +157,6 @@ private val DEFAULT_MAP_VALUE: ImmutableMap<FlagKey<Any>, Any> = persistentMapOf
|
||||
FlagKey.ChromeAutofill to true,
|
||||
FlagKey.MobileErrorReporting to true,
|
||||
FlagKey.RestrictCipherItemDeletion to true,
|
||||
FlagKey.PreAuthSettings to true,
|
||||
FlagKey.UserManagedPrivilegedApps to true,
|
||||
FlagKey.RemoveCardPolicy to true,
|
||||
)
|
||||
@@ -176,7 +175,6 @@ private val UPDATED_MAP_VALUE: ImmutableMap<FlagKey<Any>, Any> = persistentMapOf
|
||||
FlagKey.ChromeAutofill to false,
|
||||
FlagKey.MobileErrorReporting to false,
|
||||
FlagKey.RestrictCipherItemDeletion to false,
|
||||
FlagKey.PreAuthSettings to false,
|
||||
FlagKey.UserManagedPrivilegedApps to false,
|
||||
FlagKey.RemoveCardPolicy to false,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user