Bug 1695264, display sync settings in fxa panel only when more than 1 device is connected r=mconley

Differential Revision: https://phabricator.services.mozilla.com/D106654
This commit is contained in:
Emma Malysz
2021-03-01 16:04:17 +00:00
parent 8dcbfe492d
commit 780d56ea92

View File

@@ -111,6 +111,10 @@ this.SyncedTabsPanelList = class SyncedTabsPanelList {
// resolving and now.
return undefined;
}
const syncPrefsButtonEl = PanelMultiView.getViewNode(
document,
"PanelUI-fxa-menu-sync-prefs-button"
);
return SyncedTabs.getTabClients()
.then(clients => {
let noTabs = !UIState.get().syncEnabled || !clients.length;
@@ -119,6 +123,9 @@ this.SyncedTabsPanelList = class SyncedTabsPanelList {
this.separator.hidden = noTabs;
}
syncPrefsButtonEl.hidden =
!UIState.get().syncEnabled || clients.length <= 1;
// The view may have been hidden while the promise was resolving.
if (!this.tabsList) {
return;
@@ -819,11 +826,6 @@ var gSync = {
"PanelUI-fxa-menu-setup-sync-button"
);
const syncPrefsButtonEl = PanelMultiView.getViewNode(
document,
"PanelUI-fxa-menu-sync-prefs-button"
);
const syncNowButtonEl = PanelMultiView.getViewNode(
document,
"PanelUI-fxa-menu-syncnow-button"
@@ -861,7 +863,6 @@ var gSync = {
syncNowButtonEl.hidden = true;
fxaMenuAccountButtonEl.classList.remove("subviewbutton-nav");
fxaMenuAccountButtonEl.removeAttribute("closemenu");
syncPrefsButtonEl.hidden = true;
syncSetupButtonEl.removeAttribute("hidden");
if (state.status === UIState.STATUS_NOT_CONFIGURED) {
@@ -909,7 +910,6 @@ var gSync = {
if (state.syncEnabled) {
syncNowButtonEl.removeAttribute("hidden");
syncPrefsButtonEl.removeAttribute("hidden");
syncSetupButtonEl.hidden = true;
document.l10n.setAttributes(
syncNowLabel,