зеркало из https://github.com/mozilla/gecko-dev.git
Bug 965641 - [Australis] prompt user to sign-in again UI in the menu panel r=markh
This commit is contained in:
Родитель
aa79e9da0a
Коммит
7b84b52ad4
|
@ -11,7 +11,6 @@ const PREF_SYNC_START_DOORHANGER = "services.sync.ui.showSyncStartDoorhanger";
|
||||||
let gFxAccounts = {
|
let gFxAccounts = {
|
||||||
|
|
||||||
_initialized: false,
|
_initialized: false,
|
||||||
_originalLabel: null,
|
|
||||||
_inCustomizationMode: false,
|
_inCustomizationMode: false,
|
||||||
|
|
||||||
get weave() {
|
get weave() {
|
||||||
|
@ -25,10 +24,11 @@ let gFxAccounts = {
|
||||||
// Do all this dance to lazy-load FxAccountsCommon.
|
// Do all this dance to lazy-load FxAccountsCommon.
|
||||||
delete this.topics;
|
delete this.topics;
|
||||||
return this.topics = [
|
return this.topics = [
|
||||||
|
"weave:service:sync:start",
|
||||||
|
"weave:service:login:error",
|
||||||
FxAccountsCommon.ONLOGIN_NOTIFICATION,
|
FxAccountsCommon.ONLOGIN_NOTIFICATION,
|
||||||
FxAccountsCommon.ONVERIFIED_NOTIFICATION,
|
FxAccountsCommon.ONVERIFIED_NOTIFICATION,
|
||||||
FxAccountsCommon.ONLOGOUT_NOTIFICATION,
|
FxAccountsCommon.ONLOGOUT_NOTIFICATION
|
||||||
"weave:service:sync:start"
|
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -47,6 +47,11 @@ let gFxAccounts = {
|
||||||
return this.button = document.getElementById("PanelUI-fxa-status");
|
return this.button = document.getElementById("PanelUI-fxa-status");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get loginFailed() {
|
||||||
|
return Weave.Service.identity.readyToAuthenticate &&
|
||||||
|
Weave.Status.login != Weave.LOGIN_SUCCEEDED;
|
||||||
|
},
|
||||||
|
|
||||||
get isActiveWindow() {
|
get isActiveWindow() {
|
||||||
let mostRecentNonPopupWindow =
|
let mostRecentNonPopupWindow =
|
||||||
RecentWindow.getMostRecentBrowserWindow({allowPopups: false});
|
RecentWindow.getMostRecentBrowserWindow({allowPopups: false});
|
||||||
|
@ -66,9 +71,6 @@ let gFxAccounts = {
|
||||||
gNavToolbox.addEventListener("customizationstarting", this);
|
gNavToolbox.addEventListener("customizationstarting", this);
|
||||||
gNavToolbox.addEventListener("customizationending", this);
|
gNavToolbox.addEventListener("customizationending", this);
|
||||||
|
|
||||||
// Save the button's original label so that
|
|
||||||
// we can restore it if overridden later.
|
|
||||||
this._originalLabel = this.button.getAttribute("label");
|
|
||||||
this._initialized = true;
|
this._initialized = true;
|
||||||
|
|
||||||
this.updateUI();
|
this.updateUI();
|
||||||
|
@ -159,17 +161,27 @@ let gFxAccounts = {
|
||||||
this.button.removeAttribute("disabled");
|
this.button.removeAttribute("disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let defaultLabel = this.button.getAttribute("defaultlabel");
|
||||||
|
let errorLabel = this.button.getAttribute("errorlabel");
|
||||||
|
|
||||||
// If the user is signed into their Firefox account and we are not
|
// If the user is signed into their Firefox account and we are not
|
||||||
// currently in customization mode, show their email address.
|
// currently in customization mode, show their email address.
|
||||||
fxAccounts.getSignedInUser().then(userData => {
|
fxAccounts.getSignedInUser().then(userData => {
|
||||||
if (userData && !this._inCustomizationMode) {
|
// Reset the button to its original state.
|
||||||
|
this.button.setAttribute("label", defaultLabel);
|
||||||
|
this.button.removeAttribute("tooltiptext");
|
||||||
|
this.button.removeAttribute("signedin");
|
||||||
|
this.button.removeAttribute("failed");
|
||||||
|
|
||||||
|
if (!this._inCustomizationMode) {
|
||||||
|
if (this.loginFailed) {
|
||||||
|
this.button.setAttribute("failed", "true");
|
||||||
|
this.button.setAttribute("label", errorLabel);
|
||||||
|
} else if (userData) {
|
||||||
this.button.setAttribute("signedin", "true");
|
this.button.setAttribute("signedin", "true");
|
||||||
this.button.setAttribute("label", userData.email);
|
this.button.setAttribute("label", userData.email);
|
||||||
this.button.setAttribute("tooltiptext", userData.email);
|
this.button.setAttribute("tooltiptext", userData.email);
|
||||||
} else {
|
}
|
||||||
this.button.removeAttribute("signedin");
|
|
||||||
this.button.setAttribute("label", this._originalLabel);
|
|
||||||
this.button.removeAttribute("tooltiptext");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -15,7 +15,9 @@
|
||||||
</vbox>
|
</vbox>
|
||||||
|
|
||||||
<footer id="PanelUI-footer">
|
<footer id="PanelUI-footer">
|
||||||
<toolbarbutton id="PanelUI-fxa-status" label="&fxaSignIn.label;"
|
<toolbarbutton id="PanelUI-fxa-status"
|
||||||
|
defaultlabel="&fxaSignIn.label;"
|
||||||
|
errorlabel="&fxaSignInError.label;"
|
||||||
oncommand="gFxAccounts.toggle(event);"
|
oncommand="gFxAccounts.toggle(event);"
|
||||||
hidden="true"/>
|
hidden="true"/>
|
||||||
|
|
||||||
|
|
|
@ -97,6 +97,7 @@ These should match what Safari and other Apple applications use on OS X Lion. --
|
||||||
<!ENTITY showAllTabsCmd.accesskey "A">
|
<!ENTITY showAllTabsCmd.accesskey "A">
|
||||||
|
|
||||||
<!ENTITY fxaSignIn.label "Sign in to &syncBrand.shortName.label;">
|
<!ENTITY fxaSignIn.label "Sign in to &syncBrand.shortName.label;">
|
||||||
|
<!ENTITY fxaSignInError.label "Reconnect to &syncBrand.shortName.label;">
|
||||||
<!ENTITY syncStartPanel.title "&brandShortName; is now syncing.">
|
<!ENTITY syncStartPanel.title "&brandShortName; is now syncing.">
|
||||||
<!ENTITY syncStartPanel.subTitle "You can manage &syncBrand.shortName.label; in Options.">
|
<!ENTITY syncStartPanel.subTitle "You can manage &syncBrand.shortName.label; in Options.">
|
||||||
<!ENTITY syncStartPanel.subTitleUnix "You can manage &syncBrand.shortName.label; in Preferences.">
|
<!ENTITY syncStartPanel.subTitleUnix "You can manage &syncBrand.shortName.label; in Preferences.">
|
||||||
|
|
Загрузка…
Ссылка в новой задаче