@@ -63,10 +63,7 @@ import mozilla.components.feature.addons.Addon
6363import mozilla.components.feature.addons.ui.displayName
6464import mozilla.components.feature.addons.ui.summary
6565import mozilla.components.service.fxa.manager.AccountState
66- import mozilla.components.service.fxa.manager.AccountState.Authenticated
67- import mozilla.components.service.fxa.manager.AccountState.Authenticating
6866import mozilla.components.service.fxa.manager.AccountState.AuthenticationProblem
69- import mozilla.components.service.fxa.manager.AccountState.NotAuthenticated
7067import mozilla.components.service.fxa.store.Account
7168import org.mozilla.fenix.R
7269import org.mozilla.fenix.components.menu.MenuAccessPoint
@@ -76,6 +73,7 @@ import org.mozilla.fenix.components.menu.MenuDialogTestTag.EXTENSIONS
7673import org.mozilla.fenix.components.menu.MenuDialogTestTag.EXTENSIONS_OPTION_CHEVRON
7774import org.mozilla.fenix.components.menu.MenuDialogTestTag.MORE_OPTION_CHEVRON
7875import org.mozilla.fenix.components.menu.compose.header.MenuNavHeader
76+ import org.mozilla.fenix.components.menu.compose.header.MozillaAccountMenuItem
7977import org.mozilla.fenix.components.menu.store.WebExtensionMenuItem
8078import org.mozilla.fenix.theme.FirefoxTheme
8179import org.mozilla.fenix.theme.Theme
@@ -273,8 +271,8 @@ fun MainMenu(
273271 MozillaAccountMenuItem (
274272 account = account,
275273 accountState = accountState,
276- onClick = onMozillaAccountButtonClick,
277274 isPrivate = isPrivate,
275+ onClick = onMozillaAccountButtonClick,
278276 )
279277
280278 MenuItem (
@@ -722,64 +720,6 @@ private fun HomepageMenuGroup(
722720 }
723721}
724722
725- @Composable
726- internal fun MozillaAccountMenuItem (
727- account : Account ? ,
728- accountState : AccountState ,
729- onClick : () -> Unit ,
730- isPrivate : Boolean ,
731- ) {
732- val label: String
733- val description: String?
734-
735- when (accountState) {
736- NotAuthenticated -> {
737- label = stringResource(id = R .string.browser_menu_sign_in)
738- description = stringResource(id = R .string.browser_menu_sign_in_caption_3)
739- }
740-
741- AuthenticationProblem -> {
742- label = account?.displayName ? : account?.email
743- ? : stringResource(id = R .string.browser_menu_sign_back_in_to_sync)
744- description = stringResource(id = R .string.browser_menu_syncing_paused_caption)
745- }
746-
747- Authenticated -> {
748- label = account?.displayName ? : account?.email
749- ? : stringResource(id = R .string.browser_menu_account_settings)
750- description = stringResource(id = R .string.browser_menu_signed_in_caption)
751- }
752-
753- is Authenticating -> {
754- label = " "
755- description = null
756- }
757- }
758-
759- MenuItem (
760- label = label,
761- beforeIconPainter = if (accountState is AuthenticationProblem && isPrivate) {
762- painterResource(id = R .drawable.mozac_ic_avatar_warning_circle_fill_critical_private_24)
763- } else if (accountState is AuthenticationProblem ) {
764- painterResource(id = R .drawable.mozac_ic_avatar_warning_circle_fill_critical_24)
765- } else {
766- painterResource(id = R .drawable.mozac_ic_avatar_circle_24)
767- },
768- description = description,
769- state = if (accountState is AuthenticationProblem ) {
770- MenuItemState .CRITICAL
771- } else {
772- MenuItemState .ENABLED
773- },
774- descriptionState = if (accountState is AuthenticationProblem ) {
775- MenuItemState .WARNING
776- } else {
777- MenuItemState .ENABLED
778- },
779- onClick = onClick,
780- )
781- }
782-
783723@Suppress(" LongParameterList" )
784724@Composable
785725internal fun Addons (
0 commit comments