зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 962540b712f9 (bug 1694678) for causing failure at browser_sync.js. CLOSED TREE
This commit is contained in:
Родитель
bb3fe218a4
Коммит
8ed8707b3d
|
@ -344,7 +344,7 @@ var gSync = {
|
|||
get fluentStrings() {
|
||||
delete this.fluentStrings;
|
||||
return (this.fluentStrings = new Localization(
|
||||
["branding/brand.ftl", "browser/appmenu.ftl", "browser/sync.ftl"],
|
||||
["branding/brand.ftl", "browser/appmenu.ftl"],
|
||||
true
|
||||
));
|
||||
},
|
||||
|
@ -840,6 +840,15 @@ var gSync = {
|
|||
"defaultLabel"
|
||||
);
|
||||
|
||||
const syncNowLabel = PanelMultiView.getViewNode(
|
||||
document,
|
||||
"PanelUI-fxa-menu-syncnow-label"
|
||||
);
|
||||
const lastSyncedLabel = PanelMultiView.getViewNode(
|
||||
document,
|
||||
"PanelUI-appMenu-fxa-label-last-synced"
|
||||
);
|
||||
|
||||
if (PanelUI.protonAppMenuEnabled) {
|
||||
// TODO: sign out button icon is still showing despite removing class
|
||||
let toolbarbuttons = fxaMenuPanel.querySelectorAll("toolbarbutton");
|
||||
|
@ -902,6 +911,20 @@ var gSync = {
|
|||
syncNowButtonEl.removeAttribute("hidden");
|
||||
syncPrefsButtonEl.removeAttribute("hidden");
|
||||
syncSetupButtonEl.hidden = true;
|
||||
document.l10n.setAttributes(
|
||||
syncNowLabel,
|
||||
"appmenuitem-fxa-toolbar-sync-now"
|
||||
);
|
||||
let lastSyncDate = this.formatLastSyncDate(state.lastSync);
|
||||
if (lastSyncDate) {
|
||||
document.l10n.setAttributes(
|
||||
lastSyncedLabel,
|
||||
"appmenu-fxa-last-sync",
|
||||
{
|
||||
time: lastSyncDate,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
headerTitle = this.fluentStrings.formatValueSync(
|
||||
|
@ -1601,16 +1624,10 @@ var gSync = {
|
|||
clearTimeout(this._syncAnimationTimer);
|
||||
this._syncStartTime = Date.now();
|
||||
|
||||
let syncingLabel = this.fluentStrings.formatValueSync(
|
||||
"fxa-toolbar-sync-syncing2"
|
||||
);
|
||||
|
||||
document.querySelectorAll(".syncnow-label").forEach(el => {
|
||||
el.value = syncingLabel;
|
||||
});
|
||||
|
||||
document.querySelectorAll(".syncNowBtn").forEach(el => {
|
||||
el.setAttribute("syncstatus", "active");
|
||||
el.setAttribute("disabled", "true");
|
||||
document.l10n.setAttributes(el, el.getAttribute("syncinglabel"));
|
||||
});
|
||||
|
||||
document
|
||||
|
@ -1618,6 +1635,8 @@ var gSync = {
|
|||
.content.querySelectorAll(".syncNowBtn")
|
||||
.forEach(el => {
|
||||
el.setAttribute("syncstatus", "active");
|
||||
el.setAttribute("disabled", "true");
|
||||
document.l10n.setAttributes(el, el.getAttribute("syncinglabel"));
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -1626,16 +1645,10 @@ var gSync = {
|
|||
return;
|
||||
}
|
||||
|
||||
let syncingLabel = this.fluentStrings.formatValueSync(
|
||||
"appmenuitem-fxa-toolbar-sync-now2"
|
||||
);
|
||||
|
||||
document.querySelectorAll(".syncnow-label").forEach(el => {
|
||||
el.value = syncingLabel;
|
||||
});
|
||||
|
||||
document.querySelectorAll(".syncNowBtn").forEach(el => {
|
||||
el.removeAttribute("syncstatus");
|
||||
el.removeAttribute("disabled");
|
||||
document.l10n.setAttributes(el, "appmenuitem-fxa-toolbar-sync-now");
|
||||
});
|
||||
|
||||
document
|
||||
|
@ -1643,6 +1656,8 @@ var gSync = {
|
|||
.content.querySelectorAll(".syncNowBtn")
|
||||
.forEach(el => {
|
||||
el.removeAttribute("syncstatus");
|
||||
el.removeAttribute("disabled");
|
||||
document.l10n.setAttributes(el, "appmenuitem-fxa-toolbar-sync-now");
|
||||
});
|
||||
|
||||
Services.obs.notifyObservers(null, "test:browser-sync:activity-stop");
|
||||
|
@ -1864,18 +1879,24 @@ var gSync = {
|
|||
}
|
||||
}
|
||||
|
||||
let syncNowBtns = [
|
||||
"PanelUI-remotetabs-syncnow",
|
||||
"PanelUI-fxa-menu-syncnow-button",
|
||||
];
|
||||
syncNowBtns.forEach(id => {
|
||||
let el = PanelMultiView.getViewNode(document, id);
|
||||
document.querySelectorAll(".syncNowBtn").forEach(el => {
|
||||
if (tooltiptext) {
|
||||
el.setAttribute("tooltiptext", tooltiptext);
|
||||
} else {
|
||||
el.removeAttribute("tooltiptext");
|
||||
}
|
||||
});
|
||||
|
||||
document
|
||||
.getElementById("appMenu-viewCache")
|
||||
.content.querySelectorAll(".syncNowBtn")
|
||||
.forEach(el => {
|
||||
if (tooltiptext) {
|
||||
el.setAttribute("tooltiptext", tooltiptext);
|
||||
} else {
|
||||
el.removeAttribute("tooltiptext");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
get relativeTimeFormat() {
|
||||
|
@ -1887,17 +1908,24 @@ var gSync = {
|
|||
},
|
||||
|
||||
formatLastSyncDate(date) {
|
||||
const lastSyncedImage = PanelMultiView.getViewNode(
|
||||
document,
|
||||
"PanelUI-appMenu-fxa-image-last-synced"
|
||||
);
|
||||
if (!date) {
|
||||
lastSyncedImage.hidden = true;
|
||||
// Date can be null before the first sync!
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
lastSyncedImage.hidden = false;
|
||||
let adjustedDate = new Date(Date.now() - 1000);
|
||||
let relativeDateStr = this.relativeTimeFormat.formatBestUnit(
|
||||
date < adjustedDate ? date : adjustedDate
|
||||
);
|
||||
return relativeDateStr;
|
||||
} catch (ex) {
|
||||
lastSyncedImage.hidden = true;
|
||||
// shouldn't happen, but one client having an invalid date shouldn't
|
||||
// break the entire feature.
|
||||
this.log.warn("failed to format lastSync time", date, ex);
|
||||
|
|
|
@ -1383,18 +1383,12 @@
|
|||
<observes element="sidebar-box" attribute="positionend"/>
|
||||
</toolbarbutton>
|
||||
<toolbarbutton id="PanelUI-remotetabs-syncnow"
|
||||
align="center"
|
||||
class="subviewbutton subviewbutton-iconic"
|
||||
data-l10n-id="appmenuitem-fxa-toolbar-sync-now"
|
||||
syncinglabel="fxa-toolbar-sync-syncing-tabs"
|
||||
class="syncNowBtn subviewbutton subviewbutton-iconic"
|
||||
oncommand="gSync.doSync();"
|
||||
onmouseover="gSync.refreshSyncButtonsTooltip();"
|
||||
closemenu="none">
|
||||
<hbox flex="1">
|
||||
<image class="syncNowBtn"/>
|
||||
<label class="syncnow-label"
|
||||
data-l10n-id="appmenuitem-fxa-toolbar-sync-now2"
|
||||
crop="end"/>
|
||||
</hbox>
|
||||
</toolbarbutton>
|
||||
closemenu="none"/>
|
||||
<toolbarseparator id="PanelUI-remotetabs-separator"/>
|
||||
</vbox>
|
||||
<deck id="PanelUI-remotetabs-deck">
|
||||
|
@ -1522,15 +1516,18 @@
|
|||
align="center"
|
||||
class="subviewbutton subviewbutton-iconic"
|
||||
oncommand="gSync.doSyncFromFxaMenu(this);"
|
||||
onmouseover="gSync.refreshSyncButtonsTooltip();"
|
||||
closemenu="none">
|
||||
<hbox flex="1">
|
||||
<image id="PanelUI-appMenu-fxa-image-last-synced"
|
||||
class="syncNowBtn"/>
|
||||
<label class="syncnow-label"
|
||||
data-l10n-id="appmenuitem-fxa-toolbar-sync-now2"
|
||||
<vbox flex="1">
|
||||
<label id="PanelUI-fxa-menu-syncnow-label"
|
||||
crop="end"/>
|
||||
</hbox>
|
||||
<hbox>
|
||||
<label id="PanelUI-appMenu-fxa-label-last-synced"
|
||||
crop="end"/>
|
||||
<image id="PanelUI-appMenu-fxa-image-last-synced"
|
||||
class="syncNowBtn"
|
||||
syncinglabel="fxa-toolbar-sync-syncing-tabs"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</toolbarbutton>
|
||||
<toolbarbutton id="PanelUI-fxa-menu-setup-sync-button"
|
||||
class="subviewbutton subviewbutton-iconic"
|
||||
|
|
|
@ -426,23 +426,22 @@ function checkSyncNowButtons(syncing, tooltip = null) {
|
|||
"button tooltiptext is set to the right value"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const syncLabels = document.querySelectorAll(".syncnow-label");
|
||||
|
||||
for (const syncLabel of syncLabels) {
|
||||
is(
|
||||
syncButton.hasAttribute("disabled"),
|
||||
syncing,
|
||||
"disabled has the right value"
|
||||
);
|
||||
if (syncing) {
|
||||
is(
|
||||
syncLabel.value,
|
||||
gSync.fluentStrings.formatValueSync("fxa-toolbar-sync-syncing2"),
|
||||
document.l10n.getAttributes(syncButton).id,
|
||||
syncButton.getAttribute("syncinglabel"),
|
||||
"label is set to the right value"
|
||||
);
|
||||
} else {
|
||||
is(
|
||||
syncLabel.value,
|
||||
gSync.fluentStrings.formatValueSync(
|
||||
"appmenuitem-fxa-toolbar-sync-now2"
|
||||
),
|
||||
document.l10n.getAttributes(syncButton).id,
|
||||
"appmenuitem-fxa-toolbar-sync-now",
|
||||
"label is set to the right value"
|
||||
);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,9 @@ appmenuitem-fullscreen =
|
|||
|
||||
## Firefox Account toolbar button and Sync panel in App menu.
|
||||
|
||||
appmenuitem-fxa-toolbar-sync-now2 = Sync Now
|
||||
appmenuitem-fxa-toolbar-sync-now =
|
||||
.label = Sync Now
|
||||
.value = Sync Now
|
||||
appmenuitem-fxa-manage-account = Manage Account
|
||||
appmenu-fxa-header =
|
||||
.title = { -fxaccount-brand-name }
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
fxa-toolbar-sync-syncing2 = Syncing…
|
||||
fxa-toolbar-sync-syncing =
|
||||
.label = Syncing…
|
||||
fxa-toolbar-sync-syncing-tabs =
|
||||
.label = Syncing Tabs…
|
||||
|
||||
sync-disconnect-dialog-title = Disconnect { -sync-brand-short-name }?
|
||||
sync-disconnect-dialog-body = { -brand-product-name } will stop syncing your account but won’t delete any of your browsing data on this device.
|
||||
|
|
|
@ -685,19 +685,18 @@ toolbarbutton[constrain-size="true"][cui-areatype="menu-panel"] > .toolbarbutton
|
|||
@media (prefers-reduced-motion: no-preference) {
|
||||
#PanelUI-fxa-menu-syncnow-button[syncstatus="active"] > .toolbarbutton-icon,
|
||||
#PanelUI-remotetabs-syncnow[syncstatus="active"] > .toolbarbutton-icon,
|
||||
.syncNowBtn[syncstatus="active"] {
|
||||
#PanelUI-appMenu-fxa-image-last-synced[syncstatus="active"] {
|
||||
animation: syncRotate 0.8s linear infinite;
|
||||
-moz-context-properties: fill;
|
||||
fill: var(--toolbarbutton-icon-fill-attention);
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
|
||||
.syncNowBtn {
|
||||
#PanelUI-appMenu-fxa-image-last-synced {
|
||||
-moz-context-properties: fill;
|
||||
fill: currentColor;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
list-style-image: url("chrome://browser/skin/sync.svg");
|
||||
fill: var(--panel-description-color);
|
||||
height: 8px;
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
#appMenu-fxa-status {
|
||||
|
@ -795,13 +794,14 @@ toolbarbutton[constrain-size="true"][cui-areatype="menu-panel"] > .toolbarbutton
|
|||
}
|
||||
|
||||
#fxa-manage-account-button > vbox > label,
|
||||
#PanelUI-fxa-menu-syncnow-button > hbox > label {
|
||||
#PanelUI-fxa-menu-syncnow-button > vbox > label,
|
||||
#PanelUI-fxa-menu-syncnow-button > vbox > hbox > label {
|
||||
margin-inline-start: 0;
|
||||
}
|
||||
|
||||
.syncNowBtn {
|
||||
visibility: collapse;
|
||||
-moz-box-ordinal-group: 2;
|
||||
#PanelUI-appMenu-fxa-image-last-synced {
|
||||
height: 8px;
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
.PanelUI-remotetabs-clientcontainer > label[itemtype="client"] {
|
||||
|
|
|
@ -110,7 +110,9 @@
|
|||
list-style-image: url("chrome://browser/skin/tab.svg");
|
||||
}
|
||||
|
||||
#PanelUI-fxa-menu-setup-sync-button {
|
||||
#PanelUI-fxa-menu-syncnow-button,
|
||||
#PanelUI-fxa-menu-setup-sync-button,
|
||||
#PanelUI-remotetabs-syncnow {
|
||||
list-style-image: url("chrome://browser/skin/sync.svg");
|
||||
}
|
||||
|
||||
|
@ -198,4 +200,8 @@ toolbarpaletteitem[place="palette"] > #bookmarks-menu-button,
|
|||
#appMenu-fullscreen-button2[checked] {
|
||||
list-style-image: url(chrome://browser/skin/fullscreen-exit.svg);
|
||||
}
|
||||
|
||||
#PanelUI-appMenu-fxa-image-last-synced {
|
||||
list-style-image: url("chrome://browser/skin/sync.svg");
|
||||
}
|
||||
} /** END Proton **/
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
# coding=utf8
|
||||
|
||||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
from __future__ import absolute_import
|
||||
from fluent.migrate.helpers import transforms_from
|
||||
from fluent.migrate import COPY_PATTERN
|
||||
|
||||
|
||||
def migrate(ctx):
|
||||
"""Bug 1694678: update fxa and remote tabs sync now buttons, part {index}."""
|
||||
ctx.add_transforms(
|
||||
"browser/browser/sync.ftl",
|
||||
"browser/browser/sync.ftl",
|
||||
transforms_from(
|
||||
"""
|
||||
fxa-toolbar-sync-syncing2 = { COPY_PATTERN(from_path, "fxa-toolbar-sync-syncing.label") }
|
||||
""",
|
||||
from_path="browser/browser/sync.ftl",
|
||||
),
|
||||
)
|
||||
|
||||
ctx.add_transforms(
|
||||
"browser/browser/appmenu.ftl",
|
||||
"browser/browser/appmenu.ftl",
|
||||
transforms_from(
|
||||
"""
|
||||
appmenuitem-fxa-toolbar-sync-now2 = { COPY_PATTERN(from_path, "appmenuitem-fxa-toolbar-sync-now.label") }
|
||||
""",
|
||||
from_path="browser/browser/appmenu.ftl",
|
||||
),
|
||||
)
|
Загрузка…
Ссылка в новой задаче