2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-11 13:11:01 +00:00

For 17798: Sync Menu Item

This commit is contained in:
Kate Glazko 2021-03-23 13:23:06 -07:00 committed by kglazko
parent 92a99542e6
commit 841dacb69e
4 changed files with 36 additions and 16 deletions

View File

@ -39,6 +39,8 @@ private fun goBackButton() =
onView(allOf(withContentDescription("Navigate up")))
private fun assertSyncedTabsMenuHeader() {
onView(withText(R.string.synced_tabs))
// Replaced with the new string here, the test is assuming we are NOT signed in
// Sync tests in SettingsSyncTest are still TO-DO, so I'm not sure that we have a test for signing into Sync
onView(withText(R.string.sync_menu_sign_in))
.check((matches(withEffectiveVisibility(Visibility.VISIBLE))))
}

View File

@ -402,10 +402,18 @@ open class DefaultToolbarMenu(
id = WebExtensionPlaceholderMenuItem.MAIN_EXTENSIONS_MENU_ID
)
val accountManager = context.components.backgroundServices.accountManager
val account = accountManager.authenticatedAccount()
val syncItemTitle = if (account != null && accountManager.accountProfile()?.email != null) {
context.getString(R.string.sync_signed_as, accountManager.accountProfile()?.email)
} else {
context.getString(R.string.sync_menu_sign_in)
}
val syncedTabs = BrowserMenuImageText(
label = context.getString(R.string.synced_tabs),
imageResource = R.drawable.ic_synced_tabs,
iconTintColorResource = primaryTextColor()
syncItemTitle,
R.drawable.ic_synced_tabs,
primaryTextColor()
) {
onItemTapped.invoke(ToolbarMenu.Item.SyncedTabs)
}

View File

@ -189,8 +189,16 @@ class HomeMenu(
onItemTapped.invoke(Item.Settings)
}
val accountManager = context.components.backgroundServices.accountManager
val account = accountManager.authenticatedAccount()
val syncItemTitle = if (account != null && accountManager.accountProfile()?.email != null) {
context.getString(R.string.sync_signed_as, accountManager.accountProfile()?.email)
} else {
context.getString(R.string.sync_menu_sign_in)
}
val syncedTabsItem = BrowserMenuImageText(
context.getString(R.string.library_synced_tabs),
syncItemTitle,
R.drawable.ic_synced_tabs,
primaryTextColor
) {
@ -215,10 +223,8 @@ class HomeMenu(
// Only query account manager if it has been initialized.
// We don't want to cause its initialization just for this check.
val accountAuthItem =
if (context.components.backgroundServices.accountManagerAvailableQueue.isReady() &&
context.components.backgroundServices.accountManager.accountNeedsReauth()) {
reconnectToSyncItem
val accountAuthItem = if (context.components.backgroundServices.accountManagerAvailableQueue.isReady()) {
if (context.components.backgroundServices.accountManager.accountNeedsReauth()) reconnectToSyncItem else null
} else {
null
}

View File

@ -954,6 +954,10 @@
<string name="share_link_all_apps_subheader">All actions</string>
<!-- Sub-header in the dialog to share a link to an app from the most-recent sorted list -->
<string name="share_link_recent_apps_subheader">Recently used</string>
<!-- An string shown when an account is signed in where %1$s is a placeholder for the email-->
<string name="sync_signed_as">Signed in as %1$s</string>
<!-- An option from the three dot menu to into sync -->
<string name="sync_menu_sign_in">Sign in to sync</string>
<!-- An option from the share dialog to sign into sync -->
<string name="sync_sign_in">Sign in to Sync</string>
<!-- An option from the share dialog to send link to all other sync devices -->