commit 4c3f085cf338be513ac07a55a3d03bdfc59fbeaa
parent e159d8fe7b3fd07483961f9616daa9b08eec7ce8
Author: Gabriel Luong <gabriel.luong@gmail.com>
Date: Tue, 18 Nov 2025 21:46:23 +0000
Bug 2000090 - Part 6: Migrate GleanDebugToolsScreen to use M3 color tokens r=android-reviewers,007
Differential Revision: https://phabricator.services.mozilla.com/D272576
Diffstat:
1 file changed, 82 insertions(+), 57 deletions(-)
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/debugsettings/gleandebugtools/ui/GleanDebugToolsScreen.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/debugsettings/gleandebugtools/ui/GleanDebugToolsScreen.kt
@@ -4,7 +4,6 @@
package org.mozilla.fenix.debugsettings.gleandebugtools.ui
-import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
@@ -16,6 +15,7 @@ import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
@@ -23,6 +23,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.KeyboardType
+import androidx.compose.ui.tooling.preview.Preview
import mozilla.components.compose.base.Dropdown
import mozilla.components.compose.base.annotation.FlexibleWindowLightDarkPreview
import mozilla.components.compose.base.button.FilledButton
@@ -37,6 +38,7 @@ import org.mozilla.fenix.debugsettings.gleandebugtools.GleanDebugToolsAction
import org.mozilla.fenix.debugsettings.gleandebugtools.GleanDebugToolsState
import org.mozilla.fenix.debugsettings.gleandebugtools.GleanDebugToolsStore
import org.mozilla.fenix.theme.FirefoxTheme
+import org.mozilla.fenix.theme.Theme
/**
* Glean Debug Tools UI that allows for glean test pings to be sent.
@@ -51,49 +53,57 @@ fun GleanDebugToolsScreen(
) {
val gleanDebugToolsState by gleanDebugToolsStore.observeAsState(gleanDebugToolsStore.state) { it }
- Column(
- modifier = modifier
- .fillMaxSize()
- .verticalScroll(rememberScrollState())
- .padding(top = FirefoxTheme.layout.space.dynamic400),
- ) {
- GleanDebugLoggingSection(logPingsToConsoleEnabled = gleanDebugToolsState.logPingsToConsoleEnabled) {
- gleanDebugToolsStore.dispatch(GleanDebugToolsAction.LogPingsToConsoleToggled)
- }
+ Surface {
+ Column(
+ modifier = modifier
+ .fillMaxSize()
+ .verticalScroll(rememberScrollState())
+ .padding(top = FirefoxTheme.layout.space.dynamic400),
+ ) {
+ GleanDebugLoggingSection(logPingsToConsoleEnabled = gleanDebugToolsState.logPingsToConsoleEnabled) {
+ gleanDebugToolsStore.dispatch(GleanDebugToolsAction.LogPingsToConsoleToggled)
+ }
- Spacer(modifier = Modifier.height(FirefoxTheme.layout.space.dynamic150))
+ Spacer(modifier = Modifier.height(FirefoxTheme.layout.space.dynamic150))
- GleanDebugViewSection(
- buttonsEnabled = gleanDebugToolsState.isDebugTagButtonEnabled,
- debugViewTag = gleanDebugToolsState.debugViewTag,
- hasDebugViewTagError = gleanDebugToolsStore.state.hasDebugViewTagError,
- onOpenDebugView = { useDebugViewTag ->
- gleanDebugToolsStore.dispatch(
- GleanDebugToolsAction.OpenDebugView(
- useDebugViewTag = useDebugViewTag,
- ),
- )
- },
- onCopyDebugViewLink = { useDebugViewTag ->
- gleanDebugToolsStore.dispatch(
- GleanDebugToolsAction.CopyDebugViewLink(
- useDebugViewTag = useDebugViewTag,
- ),
- )
- },
- ) { newTag ->
- gleanDebugToolsStore.dispatch(GleanDebugToolsAction.DebugViewTagChanged(newTag))
- }
+ GleanDebugViewSection(
+ buttonsEnabled = gleanDebugToolsState.isDebugTagButtonEnabled,
+ debugViewTag = gleanDebugToolsState.debugViewTag,
+ hasDebugViewTagError = gleanDebugToolsStore.state.hasDebugViewTagError,
+ onOpenDebugView = { useDebugViewTag ->
+ gleanDebugToolsStore.dispatch(
+ GleanDebugToolsAction.OpenDebugView(
+ useDebugViewTag = useDebugViewTag,
+ ),
+ )
+ },
+ onCopyDebugViewLink = { useDebugViewTag ->
+ gleanDebugToolsStore.dispatch(
+ GleanDebugToolsAction.CopyDebugViewLink(
+ useDebugViewTag = useDebugViewTag,
+ ),
+ )
+ },
+ ) { newTag ->
+ gleanDebugToolsStore.dispatch(GleanDebugToolsAction.DebugViewTagChanged(newTag))
+ }
- Spacer(modifier = Modifier.height(FirefoxTheme.layout.space.dynamic150))
+ Spacer(modifier = Modifier.height(FirefoxTheme.layout.space.dynamic150))
- GleanDebugSendPingsSection(
- isButtonEnabled = gleanDebugToolsState.isDebugTagButtonEnabled,
- curPing = gleanDebugToolsState.pingType,
- pingTypes = gleanDebugToolsState.pingTypes,
- onPingItemClicked = { gleanDebugToolsStore.dispatch(GleanDebugToolsAction.ChangePingType(it)) },
- onSendPing = { gleanDebugToolsStore.dispatch(GleanDebugToolsAction.SendPing) },
- )
+ GleanDebugSendPingsSection(
+ isButtonEnabled = gleanDebugToolsState.isDebugTagButtonEnabled,
+ curPing = gleanDebugToolsState.pingType,
+ pingTypes = gleanDebugToolsState.pingTypes,
+ onPingItemClicked = {
+ gleanDebugToolsStore.dispatch(
+ GleanDebugToolsAction.ChangePingType(
+ it,
+ ),
+ )
+ },
+ onSendPing = { gleanDebugToolsStore.dispatch(GleanDebugToolsAction.SendPing) },
+ )
+ }
}
}
@@ -267,25 +277,40 @@ private fun getPingDropdownMenu(
@FlexibleWindowLightDarkPreview
private fun GleanDebugToolsPreview() {
FirefoxTheme {
- Column(
- modifier = Modifier.background(
- color = FirefoxTheme.colors.layer1,
+ GleanDebugToolsScreen(
+ gleanDebugToolsStore = GleanDebugToolsStore(
+ initialState = GleanDebugToolsState(
+ logPingsToConsoleEnabled = false,
+ debugViewTag = "",
+ pingTypes = listOf(
+ "metrics",
+ "baseline",
+ "ping type 3",
+ "ping type 4",
+ ),
+ ),
),
- ) {
- GleanDebugToolsScreen(
- gleanDebugToolsStore = GleanDebugToolsStore(
- initialState = GleanDebugToolsState(
- logPingsToConsoleEnabled = false,
- debugViewTag = "",
- pingTypes = listOf(
- "metrics",
- "baseline",
- "ping type 3",
- "ping type 4",
- ),
+ )
+ }
+}
+
+@Composable
+@Preview
+private fun GleanDebugToolsPrivatePreview() {
+ FirefoxTheme(theme = Theme.Private) {
+ GleanDebugToolsScreen(
+ gleanDebugToolsStore = GleanDebugToolsStore(
+ initialState = GleanDebugToolsState(
+ logPingsToConsoleEnabled = false,
+ debugViewTag = "",
+ pingTypes = listOf(
+ "metrics",
+ "baseline",
+ "ping type 3",
+ "ping type 4",
),
),
- )
- }
+ ),
+ )
}
}