commit f5d96ad1050da7cb8f96d443fbc20c7bdf5b7d9e parent eea9eb667177019786167e95a1b566b06c76f610 Author: fmasalha <fmasalha@mozilla.com> Date: Thu, 30 Oct 2025 16:47:13 +0000 Bug 1991177 - Subdivided the following debug drawer screens under a new autofill screen; Logins, Addresses, and Credit Cards. r=android-reviewers,android-l10n-reviewers,delphine,007,matt-tighe Differential Revision: https://phabricator.services.mozilla.com/D268933 Diffstat:
7 files changed, 99 insertions(+), 2 deletions(-)
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/debugsettings/autofill/AutofillTools.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/debugsettings/autofill/AutofillTools.kt @@ -0,0 +1,65 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +package org.mozilla.fenix.debugsettings.autofill + +import androidx.compose.foundation.background +import androidx.compose.foundation.layout.Column +import androidx.compose.material3.HorizontalDivider +import androidx.compose.material3.MaterialTheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource +import mozilla.components.compose.base.annotation.FlexibleWindowLightDarkPreview +import org.mozilla.fenix.R +import org.mozilla.fenix.compose.list.TextListItem +import org.mozilla.fenix.debugsettings.store.DebugDrawerAction +import org.mozilla.fenix.debugsettings.store.DebugDrawerStore +import org.mozilla.fenix.theme.FirefoxTheme + +@Composable +internal fun AutofillTools( + debugDrawerStore: DebugDrawerStore, + modifier: Modifier = Modifier, +) { + Column(modifier = modifier) { + TextListItem( + label = stringResource(id = R.string.debug_drawer_logins_title), + onClick = { + debugDrawerStore.dispatch(DebugDrawerAction.NavigateTo.Logins) + }, + ) + + HorizontalDivider() + + TextListItem( + label = stringResource(id = R.string.debug_drawer_addresses_title), + onClick = { + debugDrawerStore.dispatch(DebugDrawerAction.NavigateTo.Addresses) + }, + ) + + HorizontalDivider() + + TextListItem( + label = stringResource(id = R.string.debug_drawer_credit_cards_title), + onClick = { + debugDrawerStore.dispatch(DebugDrawerAction.NavigateTo.CreditCards) + }, + ) + + HorizontalDivider() + } +} + +@FlexibleWindowLightDarkPreview +@Composable +internal fun AutofillToolsPreview() { + FirefoxTheme { + AutofillTools( + debugDrawerStore = DebugDrawerStore(), + modifier = Modifier.background(MaterialTheme.colorScheme.surface), + ) + } +} diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/debugsettings/navigation/DebugDrawerDestination.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/debugsettings/navigation/DebugDrawerDestination.kt @@ -13,12 +13,15 @@ import androidx.compose.runtime.Composable * @property route The unique route used to navigate to the destination. This string can also contain * optional parameters for arguments or deep linking. * @property title The string ID of the destination's title. + * @property isChildDestination The value representing if this destination should be automatically + * displayed at the top layer of the debug drawer * @property onClick Invoked when the destination is clicked to be navigated to. * @property content The destination's [Composable]. */ data class DebugDrawerDestination( val route: String, @param:StringRes val title: Int, + val isChildDestination: Boolean = false, val onClick: () -> Unit, val content: @Composable () -> Unit, ) diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/debugsettings/navigation/DebugDrawerRoute.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/debugsettings/navigation/DebugDrawerRoute.kt @@ -14,6 +14,7 @@ import org.mozilla.fenix.R import org.mozilla.fenix.debugsettings.addons.ui.AddonsDebugToolsScreen import org.mozilla.fenix.debugsettings.addresses.AddressesDebugRegionRepository import org.mozilla.fenix.debugsettings.addresses.AddressesTools +import org.mozilla.fenix.debugsettings.autofill.AutofillTools import org.mozilla.fenix.debugsettings.cfrs.CfrToolsState import org.mozilla.fenix.debugsettings.cfrs.CfrToolsStore import org.mozilla.fenix.debugsettings.crashtools.CrashTools @@ -54,6 +55,10 @@ enum class DebugDrawerRoute(val route: String, @param:StringRes val title: Int) route = "credit_cards", title = R.string.debug_drawer_credit_cards_title, ), + Autofill( + route = "autofill", + title = R.string.debug_drawer_autofill_title, + ), CfrTools( route = "cfr_tools", title = R.string.debug_drawer_cfr_tools_title, @@ -101,6 +106,7 @@ enum class DebugDrawerRoute(val route: String, @param:StringRes val title: Int) inactiveTabsEnabled: Boolean, ): List<DebugDrawerDestination> = entries.map { debugDrawerRoute -> + var isChildDestination: Boolean = false val onClick: () -> Unit val content: @Composable () -> Unit when (debugDrawerRoute) { @@ -117,6 +123,7 @@ enum class DebugDrawerRoute(val route: String, @param:StringRes val title: Int) } Logins -> { + isChildDestination = true onClick = { debugDrawerStore.dispatch(DebugDrawerAction.NavigateTo.Logins) } @@ -129,6 +136,7 @@ enum class DebugDrawerRoute(val route: String, @param:StringRes val title: Int) } Addresses -> { + isChildDestination = true onClick = { debugDrawerStore.dispatch(DebugDrawerAction.NavigateTo.Addresses) } @@ -141,6 +149,7 @@ enum class DebugDrawerRoute(val route: String, @param:StringRes val title: Int) } CreditCards -> { + isChildDestination = true onClick = { debugDrawerStore.dispatch(DebugDrawerAction.NavigateTo.CreditCards) } @@ -150,6 +159,16 @@ enum class DebugDrawerRoute(val route: String, @param:StringRes val title: Int) ) } } + Autofill -> { + onClick = { + debugDrawerStore.dispatch(DebugDrawerAction.NavigateTo.Autofill) + } + content = { + AutofillTools( + debugDrawerStore = debugDrawerStore, + ) + } + } CfrTools -> { onClick = { @@ -202,6 +221,7 @@ enum class DebugDrawerRoute(val route: String, @param:StringRes val title: Int) DebugDrawerDestination( route = debugDrawerRoute.route, title = debugDrawerRoute.title, + isChildDestination = isChildDestination, onClick = onClick, content = content, ) diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/debugsettings/store/DebugDrawerAction.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/debugsettings/store/DebugDrawerAction.kt @@ -5,6 +5,7 @@ package org.mozilla.fenix.debugsettings.store import mozilla.components.lib.state.Action +import org.mozilla.fenix.debugsettings.autofill.AutofillTools import org.mozilla.fenix.debugsettings.gleandebugtools.ui.GleanDebugToolsScreen import org.mozilla.fenix.debugsettings.ui.DebugDrawerHome import org.mozilla.fenix.debugsettings.addresses.AddressesTools as AddressesScreen @@ -59,6 +60,11 @@ sealed class DebugDrawerAction : Action { data object CreditCards : NavigateTo() /** + * [NavigateTo] action fired when the debug drawer needs to navigate to [AutofillTools]. + */ + object Autofill : NavigateTo() + + /** * [NavigateTo] action fired when the debug drawer needs to navigate to [CfrToolsScreen]. */ object CfrTools : NavigateTo() diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/debugsettings/store/DebugDrawerNavigationMiddleware.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/debugsettings/store/DebugDrawerNavigationMiddleware.kt @@ -43,6 +43,8 @@ class DebugDrawerNavigationMiddleware( navController.navigate(route = DebugDrawerRoute.Addresses.route) is DebugDrawerAction.NavigateTo.CreditCards -> navController.navigate(route = DebugDrawerRoute.CreditCards.route) + is DebugDrawerAction.NavigateTo.Autofill -> + navController.navigate(route = DebugDrawerRoute.Autofill.route) is DebugDrawerAction.NavigateTo.CfrTools -> navController.navigate(route = DebugDrawerRoute.CfrTools.route) is DebugDrawerAction.NavigateTo.GleanDebugTools -> diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/debugsettings/ui/DebugDrawer.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/debugsettings/ui/DebugDrawer.kt @@ -100,7 +100,7 @@ fun DebugDrawer( composable(route = DEBUG_DRAWER_HOME_ROUTE) { toolbarTitle = stringResource(id = R.string.debug_drawer_title) backButtonVisible = false - DebugDrawerHome(destinations = destinations) + DebugDrawerHome(destinations = destinations.filter { !it.isChildDestination }) } destinations.forEach { destination -> diff --git a/mobile/android/fenix/app/src/main/res/values/strings.xml b/mobile/android/fenix/app/src/main/res/values/strings.xml @@ -3307,7 +3307,8 @@ <string name="microsurvey_close_handle_content_description">Close survey</string> <!-- Content description for "X" button that is closing microsurvey. --> <string name="microsurvey_close_button_content_description">Close</string> - + <!-- The title of the autofill tab in the Debug Drawer. --> + <string name="debug_drawer_autofill_title">Autofill tools</string> <!-- Debug drawer logins --> <!-- The title of the Logins feature in the Debug Drawer. --> <string name="debug_drawer_logins_title">Logins</string>