diff --git a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SyncedTabsRobot.kt b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SyncedTabsRobot.kt index 9add0cd59b..43aad7ccfc 100644 --- a/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SyncedTabsRobot.kt +++ b/app/src/androidTest/java/org/mozilla/fenix/ui/robots/SyncedTabsRobot.kt @@ -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)))) } diff --git a/app/src/main/java/org/mozilla/fenix/components/toolbar/DefaultToolbarMenu.kt b/app/src/main/java/org/mozilla/fenix/components/toolbar/DefaultToolbarMenu.kt index b8397e209a..ca3c39ba5d 100644 --- a/app/src/main/java/org/mozilla/fenix/components/toolbar/DefaultToolbarMenu.kt +++ b/app/src/main/java/org/mozilla/fenix/components/toolbar/DefaultToolbarMenu.kt @@ -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), diff --git a/app/src/main/java/org/mozilla/fenix/home/HomeMenu.kt b/app/src/main/java/org/mozilla/fenix/home/HomeMenu.kt index 7d95afed2b..87002ce56e 100644 --- a/app/src/main/java/org/mozilla/fenix/home/HomeMenu.kt +++ b/app/src/main/java/org/mozilla/fenix/home/HomeMenu.kt @@ -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 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 217fc9d8aa..58f6ff7d36 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -954,6 +954,10 @@ All actions Recently used + + Signed in as %1$s + + Sign in to sync Sign in to Sync