mirror of
https://github.com/fork-maintainers/iceraven-browser
synced 2024-11-17 15:26:23 +00:00
[fenix] Close https://github.com/mozilla-mobile/fenix/issues/26072: Don't show sync menu item until account manager is available
This commit is contained in:
parent
4daac14987
commit
af25894e05
@ -349,11 +349,19 @@ open class DefaultToolbarMenu(
|
||||
onItemTapped.invoke(ToolbarMenu.Item.Quit)
|
||||
}
|
||||
|
||||
private fun getSyncItemTitle() =
|
||||
private fun syncMenuItem(): BrowserMenuImageText? {
|
||||
val syncItemTitle =
|
||||
if (context.components.backgroundServices.accountManagerAvailableQueue.isReady()) {
|
||||
accountManager.accountProfileEmail ?: context.getString(R.string.sync_menu_sign_in)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
private val syncMenuItem = BrowserMenuImageText(
|
||||
getSyncItemTitle(),
|
||||
return when (syncItemTitle) {
|
||||
null -> null
|
||||
else -> {
|
||||
BrowserMenuImageText(
|
||||
syncItemTitle,
|
||||
R.drawable.ic_signed_out,
|
||||
primaryTextColor()
|
||||
) {
|
||||
@ -361,6 +369,9 @@ open class DefaultToolbarMenu(
|
||||
ToolbarMenu.Item.SyncAccount(accountManager.accountState)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting(otherwise = PRIVATE)
|
||||
val coreMenuItems by lazy {
|
||||
@ -373,7 +384,7 @@ open class DefaultToolbarMenu(
|
||||
historyItem,
|
||||
downloadsItem,
|
||||
extensionsItem,
|
||||
syncMenuItem,
|
||||
syncMenuItem(),
|
||||
BrowserMenuDivider(),
|
||||
findInPageItem,
|
||||
desktopSiteItem,
|
||||
|
@ -96,16 +96,27 @@ class HomeMenu(
|
||||
}
|
||||
}
|
||||
|
||||
private fun getSyncItemTitle(): String =
|
||||
private fun syncSignInMenuItem(): BrowserMenuImageText? {
|
||||
val syncItemTitle =
|
||||
if (context.components.backgroundServices.accountManagerAvailableQueue.isReady()) {
|
||||
accountManager.accountProfileEmail ?: context.getString(R.string.sync_menu_sign_in)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
|
||||
private val syncSignInMenuItem = BrowserMenuImageText(
|
||||
getSyncItemTitle(),
|
||||
R.drawable.ic_synced_tabs,
|
||||
return when (syncItemTitle) {
|
||||
null -> null
|
||||
else -> {
|
||||
BrowserMenuImageText(
|
||||
syncItemTitle,
|
||||
R.drawable.ic_signed_out,
|
||||
primaryTextColor
|
||||
) {
|
||||
onItemTapped.invoke(Item.SyncAccount(accountManager.accountState))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val desktopItem = BrowserMenuImageSwitch(
|
||||
imageResource = R.drawable.ic_desktop,
|
||||
@ -212,7 +223,7 @@ class HomeMenu(
|
||||
historyItem,
|
||||
downloadsItem,
|
||||
extensionsItem,
|
||||
syncSignInMenuItem,
|
||||
syncSignInMenuItem(),
|
||||
accountAuthItem,
|
||||
if (Config.channel.isMozillaOnline) manageAccountAndDevicesItem else null,
|
||||
BrowserMenuDivider(),
|
||||
|
Loading…
Reference in New Issue
Block a user