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,17 +349,28 @@ open class DefaultToolbarMenu(
|
||||
onItemTapped.invoke(ToolbarMenu.Item.Quit)
|
||||
}
|
||||
|
||||
private fun getSyncItemTitle() =
|
||||
accountManager.accountProfileEmail ?: context.getString(R.string.sync_menu_sign_in)
|
||||
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(),
|
||||
R.drawable.ic_signed_out,
|
||||
primaryTextColor()
|
||||
) {
|
||||
onItemTapped.invoke(
|
||||
ToolbarMenu.Item.SyncAccount(accountManager.accountState)
|
||||
)
|
||||
return when (syncItemTitle) {
|
||||
null -> null
|
||||
else -> {
|
||||
BrowserMenuImageText(
|
||||
syncItemTitle,
|
||||
R.drawable.ic_signed_out,
|
||||
primaryTextColor()
|
||||
) {
|
||||
onItemTapped.invoke(
|
||||
ToolbarMenu.Item.SyncAccount(accountManager.accountState)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting(otherwise = PRIVATE)
|
||||
@ -373,7 +384,7 @@ open class DefaultToolbarMenu(
|
||||
historyItem,
|
||||
downloadsItem,
|
||||
extensionsItem,
|
||||
syncMenuItem,
|
||||
syncMenuItem(),
|
||||
BrowserMenuDivider(),
|
||||
findInPageItem,
|
||||
desktopSiteItem,
|
||||
|
@ -96,15 +96,26 @@ class HomeMenu(
|
||||
}
|
||||
}
|
||||
|
||||
private fun getSyncItemTitle(): String =
|
||||
accountManager.accountProfileEmail ?: context.getString(R.string.sync_menu_sign_in)
|
||||
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,
|
||||
primaryTextColor
|
||||
) {
|
||||
onItemTapped.invoke(Item.SyncAccount(accountManager.accountState))
|
||||
return when (syncItemTitle) {
|
||||
null -> null
|
||||
else -> {
|
||||
BrowserMenuImageText(
|
||||
syncItemTitle,
|
||||
R.drawable.ic_signed_out,
|
||||
primaryTextColor
|
||||
) {
|
||||
onItemTapped.invoke(Item.SyncAccount(accountManager.accountState))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val desktopItem = BrowserMenuImageSwitch(
|
||||
@ -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