For 17798: Sync Menu Item

upstream-sync
Kate Glazko 3 years ago committed by kglazko
parent 92a99542e6
commit 841dacb69e

@ -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))))
}

@ -402,13 +402,21 @@ open class DefaultToolbarMenu(
id = WebExtensionPlaceholderMenuItem.MAIN_EXTENSIONS_MENU_ID
)
val syncedTabs = BrowserMenuImageText(
label = context.getString(R.string.synced_tabs),
imageResource = R.drawable.ic_synced_tabs,
iconTintColorResource = primaryTextColor()
) {
onItemTapped.invoke(ToolbarMenu.Item.SyncedTabs)
}
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(
syncItemTitle,
R.drawable.ic_synced_tabs,
primaryTextColor()
) {
onItemTapped.invoke(ToolbarMenu.Item.SyncedTabs)
}
val findInPageItem = BrowserMenuImageText(
label = context.getString(R.string.browser_menu_find_in_page),

@ -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,13 +223,11 @@ 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
} else {
null
}
val accountAuthItem = if (context.components.backgroundServices.accountManagerAvailableQueue.isReady()) {
if (context.components.backgroundServices.accountManager.accountNeedsReauth()) reconnectToSyncItem else null
} else {
null
}
val settings = context.components.settings

@ -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 -->

Loading…
Cancel
Save