tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 708d0264fcb074f69bbb5f142aee8ed12be033c8
parent 1ba9d806f109eb58d669f01270ee564300948d18
Author: Gabriel Luong <gabriel.luong@gmail.com>
Date:   Thu, 18 Dec 2025 18:38:07 +0000

Bug 2005850 - Part 4: Remove unused InfoTypes in InfoCard r=007,android-reviewers

- Confirmed with Crystal and Maggie that we can drop the InfoTypes that we don't currently use in https://mozilla.slack.com/archives/C08MZ1Z840K/p1765820551820239?thread_ts=1762269235.741289&cid=C08MZ1Z840K
- Cleaned up Acorn color tokens that are no longer needed with this removal.

Differential Revision: https://phabricator.services.mozilla.com/D277038

Diffstat:
Mmobile/android/android-components/components/compose/base/src/main/java/mozilla/components/compose/base/theme/AcornColors.kt | 40----------------------------------------
Mmobile/android/fenix/app/src/main/java/org/mozilla/fenix/compose/InfoCard.kt | 77+++++++++++++++++++++++++++++++++++++----------------------------------------
2 files changed, 37 insertions(+), 80 deletions(-)

diff --git a/mobile/android/android-components/components/compose/base/src/main/java/mozilla/components/compose/base/theme/AcornColors.kt b/mobile/android/android-components/components/compose/base/src/main/java/mozilla/components/compose/base/theme/AcornColors.kt @@ -29,17 +29,13 @@ class AcornColors( layerGradientStart: Color, layerGradientEnd: Color, layerWarning: Color, - layerSuccess: Color, layerCritical: Color, layerInformation: Color, - actionSecondary: Color, actionWarning: Color, - actionSuccess: Color, actionCritical: Color, actionInformation: Color, formDefault: Color, textOnColorPrimary: Color, - textActionSecondary: Color, iconPrimaryInactive: Color, iconActive: Color, iconOnColor: Color, @@ -82,10 +78,6 @@ class AcornColors( var layerWarning by mutableStateOf(layerWarning) private set - // Confirmation background - var layerSuccess by mutableStateOf(layerSuccess) - private set - // Error Background var layerCritical by mutableStateOf(layerCritical) private set @@ -96,18 +88,10 @@ class AcornColors( // Actions - // Secondary button - var actionSecondary by mutableStateOf(actionSecondary) - private set - // Warning button var actionWarning by mutableStateOf(actionWarning) private set - // Confirmation button - var actionSuccess by mutableStateOf(actionSuccess) - private set - // Error button var actionCritical by mutableStateOf(actionCritical) private set @@ -126,10 +110,6 @@ class AcornColors( var textOnColorPrimary by mutableStateOf(textOnColorPrimary) private set - // Action Secondary text - var textActionSecondary by mutableStateOf(textActionSecondary) - private set - // Icon // Inactive tab @@ -200,17 +180,13 @@ class AcornColors( layerGradientStart = other.layerGradientStart layerGradientEnd = other.layerGradientEnd layerWarning = other.layerWarning - layerSuccess = other.layerSuccess layerCritical = other.layerCritical layerInformation = other.layerInformation - actionSecondary = other.actionSecondary actionWarning = other.actionWarning - actionSuccess = other.actionSuccess actionCritical = other.actionCritical actionInformation = other.actionInformation formDefault = other.formDefault textOnColorPrimary = other.textOnColorPrimary - textActionSecondary = other.textActionSecondary iconPrimaryInactive = other.iconPrimaryInactive iconActive = other.iconActive iconOnColor = other.iconOnColor @@ -236,17 +212,13 @@ class AcornColors( layerGradientStart: Color = this.layerGradientStart, layerGradientEnd: Color = this.layerGradientEnd, layerWarning: Color = this.layerWarning, - layerSuccess: Color = this.layerSuccess, layerCritical: Color = this.layerCritical, layerInformation: Color = this.layerInformation, - actionSecondary: Color = this.actionSecondary, actionWarning: Color = this.actionWarning, - actionSuccess: Color = this.actionSuccess, actionCritical: Color = this.actionCritical, actionInformation: Color = this.actionInformation, formDefault: Color = this.formDefault, textOnColorPrimary: Color = this.textOnColorPrimary, - textActionSecondary: Color = this.textActionSecondary, iconPrimaryInactive: Color = this.iconPrimaryInactive, iconActive: Color = this.iconActive, iconOnColor: Color = this.iconOnColor, @@ -266,17 +238,13 @@ class AcornColors( layerGradientStart = layerGradientStart, layerGradientEnd = layerGradientEnd, layerWarning = layerWarning, - layerSuccess = layerSuccess, layerCritical = layerCritical, layerInformation = layerInformation, - actionSecondary = actionSecondary, actionWarning = actionWarning, - actionSuccess = actionSuccess, actionCritical = actionCritical, actionInformation = actionInformation, formDefault = formDefault, textOnColorPrimary = textOnColorPrimary, - textActionSecondary = textActionSecondary, iconPrimaryInactive = iconPrimaryInactive, iconActive = iconActive, iconOnColor = iconOnColor, @@ -299,17 +267,13 @@ val darkColorPalette = AcornColors( layerGradientStart = PhotonColors.Violet70, layerGradientEnd = PhotonColors.Violet60, layerWarning = PhotonColors.Yellow70A77, - layerSuccess = PhotonColors.Green80, layerCritical = PhotonColors.Pink80, layerInformation = PhotonColors.Blue50, - actionSecondary = PhotonColors.DarkGrey05, actionWarning = PhotonColors.Yellow40A41, - actionSuccess = PhotonColors.Green70, actionCritical = PhotonColors.Pink70A69, actionInformation = PhotonColors.Blue60, formDefault = PhotonColors.LightGrey05, textOnColorPrimary = PhotonColors.LightGrey05, - textActionSecondary = PhotonColors.LightGrey05, iconPrimaryInactive = PhotonColors.LightGrey05A60, iconActive = PhotonColors.Violet40, iconOnColor = PhotonColors.LightGrey05, @@ -331,17 +295,13 @@ val lightColorPalette = AcornColors( layerGradientStart = PhotonColors.Violet70, layerGradientEnd = PhotonColors.Violet60, layerWarning = PhotonColors.Yellow20, - layerSuccess = PhotonColors.Green20, layerCritical = PhotonColors.Red10, layerInformation = PhotonColors.Blue50A44, - actionSecondary = PhotonColors.LightGrey30, actionWarning = PhotonColors.Yellow60A40, - actionSuccess = PhotonColors.Green60, actionCritical = PhotonColors.Red30, actionInformation = PhotonColors.Blue50, formDefault = PhotonColors.DarkGrey90, textOnColorPrimary = PhotonColors.LightGrey05, - textActionSecondary = PhotonColors.DarkGrey90, iconPrimaryInactive = PhotonColors.DarkGrey90A60, iconActive = PhotonColors.Ink20, iconOnColor = PhotonColors.LightGrey05, diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/compose/InfoCard.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/compose/InfoCard.kt @@ -28,6 +28,7 @@ import androidx.compose.ui.semantics.contentDescription import androidx.compose.ui.semantics.heading import androidx.compose.ui.semantics.semantics import androidx.compose.ui.text.style.TextDecoration +import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.tooling.preview.PreviewParameterProvider @@ -35,6 +36,7 @@ import androidx.compose.ui.unit.dp import mozilla.components.compose.base.button.FilledButton import org.mozilla.fenix.shopping.ui.ext.headingResource import org.mozilla.fenix.theme.FirefoxTheme +import org.mozilla.fenix.theme.Theme import mozilla.components.ui.icons.R as iconsR /** @@ -78,17 +80,11 @@ fun InfoCard( InfoCardIcon(iconId = iconsR.drawable.mozac_ic_warning_fill_24) } - InfoType.Confirmation -> { - InfoCardIcon(iconId = iconsR.drawable.mozac_ic_checkmark_24) - } - InfoType.Error -> { InfoCardIcon(iconId = iconsR.drawable.mozac_ic_critical_fill_24) } - InfoType.Info, - InfoType.InfoPlain, - -> { + InfoType.Info -> { InfoCardIcon(iconId = iconsR.drawable.mozac_ic_information_fill_24) } } @@ -170,11 +166,6 @@ enum class InfoType { Warning, /** - * Stylizes the card to indicate an action occurred successfully or to confirm an action. - */ - Confirmation, - - /** * Stylizes the card to indicate a serious error has occurred. */ Error, @@ -184,10 +175,6 @@ enum class InfoType { */ Info, - /** - * Stylizes the card for informative messages in muted tones. - */ - InfoPlain, ; val cardBackgroundColor: Color @@ -195,10 +182,8 @@ enum class InfoType { @ReadOnlyComposable get() = when (this) { Warning -> FirefoxTheme.colors.layerWarning - Confirmation -> FirefoxTheme.colors.layerSuccess Error -> FirefoxTheme.colors.layerCritical Info -> FirefoxTheme.colors.layerInformation - InfoPlain -> Color.Transparent } val buttonBackgroundColor: Color @@ -206,10 +191,8 @@ enum class InfoType { @ReadOnlyComposable get() = when (this) { Warning -> FirefoxTheme.colors.actionWarning - Confirmation -> FirefoxTheme.colors.actionSuccess Error -> FirefoxTheme.colors.actionCritical Info -> FirefoxTheme.colors.actionInformation - InfoPlain -> FirefoxTheme.colors.actionSecondary } val buttonTextColor: Color @@ -217,7 +200,6 @@ enum class InfoType { @ReadOnlyComposable get() = when { this == Info && !isSystemInDarkTheme() -> FirefoxTheme.colors.textOnColorPrimary - this == InfoPlain -> FirefoxTheme.colors.textActionSecondary else -> MaterialTheme.colorScheme.onSurface } } @@ -238,30 +220,45 @@ private class PreviewModelParameterProvider : PreviewParameterProvider<InfoType> override val values = enumValues<InfoType>().asSequence() } +@Composable +private fun InfoCardPreviewContent(type: InfoType) { + Surface { + InfoCard( + title = "Title text", + type = type, + modifier = Modifier + .fillMaxWidth() + .padding(all = 16.dp), + description = "Description text", + footer = "Primary link text with an underlined hyperlink." to LinkTextState( + text = "underlined hyperlink", + url = "https://www.mozilla.org", + onClick = {}, + ), + buttonText = InfoCardButtonText( + text = "Button text", + onClick = {}, + ), + ) + } +} + @PreviewLightDark @Composable private fun InfoCardPreview( @PreviewParameter(PreviewModelParameterProvider::class) type: InfoType, ) { FirefoxTheme { - Surface { - InfoCard( - title = "Title text", - type = type, - modifier = Modifier - .fillMaxWidth() - .padding(all = 16.dp), - description = "Description text", - footer = "Primary link text with an underlined hyperlink." to LinkTextState( - text = "underlined hyperlink", - url = "https://www.mozilla.org", - onClick = {}, - ), - buttonText = InfoCardButtonText( - text = "Button text", - onClick = {}, - ), - ) - } + InfoCardPreviewContent(type = type) + } +} + +@Preview +@Composable +private fun InfoCardPrivatePreview( + @PreviewParameter(PreviewModelParameterProvider::class) type: InfoType, +) { + FirefoxTheme(theme = Theme.Private) { + InfoCardPreviewContent(type = type) } }