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)
|
onItemTapped.invoke(ToolbarMenu.Item.Quit)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getSyncItemTitle() =
|
private fun syncMenuItem(): BrowserMenuImageText? {
|
||||||
accountManager.accountProfileEmail ?: context.getString(R.string.sync_menu_sign_in)
|
val syncItemTitle =
|
||||||
|
if (context.components.backgroundServices.accountManagerAvailableQueue.isReady()) {
|
||||||
|
accountManager.accountProfileEmail ?: context.getString(R.string.sync_menu_sign_in)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
private val syncMenuItem = BrowserMenuImageText(
|
return when (syncItemTitle) {
|
||||||
getSyncItemTitle(),
|
null -> null
|
||||||
R.drawable.ic_signed_out,
|
else -> {
|
||||||
primaryTextColor()
|
BrowserMenuImageText(
|
||||||
) {
|
syncItemTitle,
|
||||||
onItemTapped.invoke(
|
R.drawable.ic_signed_out,
|
||||||
ToolbarMenu.Item.SyncAccount(accountManager.accountState)
|
primaryTextColor()
|
||||||
)
|
) {
|
||||||
|
onItemTapped.invoke(
|
||||||
|
ToolbarMenu.Item.SyncAccount(accountManager.accountState)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting(otherwise = PRIVATE)
|
@VisibleForTesting(otherwise = PRIVATE)
|
||||||
@ -373,7 +384,7 @@ open class DefaultToolbarMenu(
|
|||||||
historyItem,
|
historyItem,
|
||||||
downloadsItem,
|
downloadsItem,
|
||||||
extensionsItem,
|
extensionsItem,
|
||||||
syncMenuItem,
|
syncMenuItem(),
|
||||||
BrowserMenuDivider(),
|
BrowserMenuDivider(),
|
||||||
findInPageItem,
|
findInPageItem,
|
||||||
desktopSiteItem,
|
desktopSiteItem,
|
||||||
|
@ -96,15 +96,26 @@ class HomeMenu(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getSyncItemTitle(): String =
|
private fun syncSignInMenuItem(): BrowserMenuImageText? {
|
||||||
accountManager.accountProfileEmail ?: context.getString(R.string.sync_menu_sign_in)
|
val syncItemTitle =
|
||||||
|
if (context.components.backgroundServices.accountManagerAvailableQueue.isReady()) {
|
||||||
|
accountManager.accountProfileEmail ?: context.getString(R.string.sync_menu_sign_in)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
private val syncSignInMenuItem = BrowserMenuImageText(
|
return when (syncItemTitle) {
|
||||||
getSyncItemTitle(),
|
null -> null
|
||||||
R.drawable.ic_synced_tabs,
|
else -> {
|
||||||
primaryTextColor
|
BrowserMenuImageText(
|
||||||
) {
|
syncItemTitle,
|
||||||
onItemTapped.invoke(Item.SyncAccount(accountManager.accountState))
|
R.drawable.ic_signed_out,
|
||||||
|
primaryTextColor
|
||||||
|
) {
|
||||||
|
onItemTapped.invoke(Item.SyncAccount(accountManager.accountState))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val desktopItem = BrowserMenuImageSwitch(
|
val desktopItem = BrowserMenuImageSwitch(
|
||||||
@ -212,7 +223,7 @@ class HomeMenu(
|
|||||||
historyItem,
|
historyItem,
|
||||||
downloadsItem,
|
downloadsItem,
|
||||||
extensionsItem,
|
extensionsItem,
|
||||||
syncSignInMenuItem,
|
syncSignInMenuItem(),
|
||||||
accountAuthItem,
|
accountAuthItem,
|
||||||
if (Config.channel.isMozillaOnline) manageAccountAndDevicesItem else null,
|
if (Config.channel.isMozillaOnline) manageAccountAndDevicesItem else null,
|
||||||
BrowserMenuDivider(),
|
BrowserMenuDivider(),
|
||||||
|
Loading…
Reference in New Issue
Block a user