mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-25 20:01:50 +00:00
Bug 1584293 - Refactor the FxA disconnect dialog. r=markh,flod,fluent-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D48098 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
149c32195f
commit
179b1148ec
@ -50,13 +50,6 @@ var gSync = {
|
||||
));
|
||||
},
|
||||
|
||||
get brandStrings() {
|
||||
delete this.brandStrings;
|
||||
return (this.brandStrings = Services.strings.createBundle(
|
||||
"chrome://branding/locale/brand.properties"
|
||||
));
|
||||
},
|
||||
|
||||
// Returns true if FxA is configured, but the send tab targets list isn't
|
||||
// ready yet.
|
||||
get sendTabConfiguredAndLoading() {
|
||||
@ -153,6 +146,8 @@ var gSync = {
|
||||
return;
|
||||
}
|
||||
|
||||
MozXULElement.insertFTLIfNeeded("browser/sync.ftl");
|
||||
|
||||
this._generateNodeGetters();
|
||||
|
||||
// Label for the sync buttons.
|
||||
@ -999,9 +994,7 @@ var gSync = {
|
||||
},
|
||||
|
||||
_appendSendTabUnconfigured(fragment, createDeviceNodeFn) {
|
||||
const brandProductName = this.brandStrings.GetStringFromName(
|
||||
"brandProductName"
|
||||
);
|
||||
const brandProductName = gBrandBundle.GetStringFromName("brandProductName");
|
||||
const notConnected = this.fxaStrings.GetStringFromName(
|
||||
"sendTabToDevice.unconfigured.label2"
|
||||
);
|
||||
@ -1227,17 +1220,8 @@ var gSync = {
|
||||
// Returns true if the disconnection happened (ie, if the user didn't decline
|
||||
// when asked to confirm)
|
||||
async disconnect({ confirm = true, disconnectAccount = true } = {}) {
|
||||
if (confirm) {
|
||||
let args = { disconnectAccount, confirmed: false };
|
||||
window.openDialog(
|
||||
"chrome://browser/content/fxaDisconnect.xul",
|
||||
"_blank",
|
||||
"chrome,modal,centerscreen,resizable=no",
|
||||
args
|
||||
);
|
||||
if (!args.confirmed) {
|
||||
return false;
|
||||
}
|
||||
if (confirm && !(await this._confirmDisconnect(disconnectAccount))) {
|
||||
return false;
|
||||
}
|
||||
await Weave.Service.promiseInitialized;
|
||||
await Weave.Service.startOver();
|
||||
@ -1247,6 +1231,39 @@ var gSync = {
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Prompts the user whether or not they want to proceed with
|
||||
* disconnecting from their Firefox Account or Sync.
|
||||
* @param {Boolean} disconnectAccount True if we are disconnecting both Sync and FxA.
|
||||
* @returns {Boolean} True if the user confirmed.
|
||||
*/
|
||||
async _confirmDisconnect(disconnectAccount) {
|
||||
const l10nPrefix = `${
|
||||
disconnectAccount ? "fxa" : "sync"
|
||||
}-disconnect-dialog`;
|
||||
const [title, body, button] = await document.l10n.formatValues([
|
||||
{ id: `${l10nPrefix}-title` },
|
||||
{ id: `${l10nPrefix}-body` },
|
||||
{ id: "sync-disconnect-dialog-button" },
|
||||
]);
|
||||
// buttonPressed will be 0 for disconnect, 1 for cancel.
|
||||
const flags =
|
||||
Services.prompt.BUTTON_TITLE_IS_STRING * Services.prompt.BUTTON_POS_0 +
|
||||
Services.prompt.BUTTON_TITLE_CANCEL * Services.prompt.BUTTON_POS_1;
|
||||
const buttonPressed = Services.prompt.confirmEx(
|
||||
window,
|
||||
title,
|
||||
body,
|
||||
flags,
|
||||
button,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
{}
|
||||
);
|
||||
return buttonPressed == 0;
|
||||
},
|
||||
|
||||
// doSync forces a sync - it *does not* return a promise as it is called
|
||||
// via the various UI components.
|
||||
doSync() {
|
||||
|
@ -1,15 +0,0 @@
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// 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/.
|
||||
|
||||
function onLoad() {
|
||||
if (window.arguments[0].disconnectAccount) {
|
||||
document.getElementById("disconnectSync").hidden = true;
|
||||
} else {
|
||||
document.getElementById("disconnectAcct").hidden = true;
|
||||
}
|
||||
document.addEventListener(
|
||||
"dialogaccept",
|
||||
() => (window.arguments[0].confirmed = true)
|
||||
);
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- 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/. -->
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/"?>
|
||||
<?xml-stylesheet href="chrome://browser/skin/preferences/in-content/preferences.css" type="text/css"?>
|
||||
|
||||
<dialog id="fxaDisconnectDialog"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
onload="onLoad();"
|
||||
buttons="accept,cancel"
|
||||
data-l10n-id="fxa-disconnect-dialog"
|
||||
data-l10n-attrs="title, style, buttonlabelaccept, buttonaccesskeyaccept">
|
||||
|
||||
<linkset>
|
||||
<html:link rel="localization" href="branding/brand.ftl"/>
|
||||
<html:link rel="localization" href="browser/branding/sync-brand.ftl"/>
|
||||
<html:link rel="localization" href="browser/fxaDisconnect.ftl"/>
|
||||
</linkset>
|
||||
<script src="chrome://browser/content/fxaDisconnect.js"/>
|
||||
|
||||
<vbox id="deleteOptionsContent">
|
||||
<label id="disconnectAcct" data-l10n-id="disconnect-account"/>
|
||||
<label id="disconnectSync" data-l10n-id="disconnect-sync"/>
|
||||
</vbox>
|
||||
</dialog>
|
@ -78,8 +78,6 @@ browser.jar:
|
||||
content/browser/defaultthemes/5.header.png (content/defaultthemes/5.header.png)
|
||||
content/browser/defaultthemes/5.icon.jpg (content/defaultthemes/5.icon.jpg)
|
||||
content/browser/defaultthemes/5.preview.jpg (content/defaultthemes/5.preview.jpg)
|
||||
content/browser/fxaDisconnect.js (content/fxaDisconnect.js)
|
||||
content/browser/fxaDisconnect.xul (content/fxaDisconnect.xul)
|
||||
content/browser/history-swipe-arrow.svg (content/history-swipe-arrow.svg)
|
||||
* content/browser/pageinfo/pageInfo.xul (content/pageinfo/pageInfo.xul)
|
||||
content/browser/pageinfo/pageInfo.js (content/pageinfo/pageInfo.js)
|
||||
|
@ -1,13 +0,0 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# 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-disconnect-dialog =
|
||||
.title = Disconnect { -sync-brand-short-name }?
|
||||
.style = max-width: 400px
|
||||
.buttonlabelaccept = Disconnect
|
||||
.buttonaccesskeyaccept = D
|
||||
|
||||
disconnect-account = { -brand-short-name } will disconnect from your account but won’t delete any of your browsing data on this device.
|
||||
disconnect-sync = { -brand-short-name } will stop syncing your account but won’t delete any of your browsing data on this device.
|
||||
|
9
browser/locales/en-US/browser/sync.ftl
Normal file
9
browser/locales/en-US/browser/sync.ftl
Normal file
@ -0,0 +1,9 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# 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/.
|
||||
|
||||
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.
|
||||
fxa-disconnect-dialog-title = Disconnect { -brand-product-name }?
|
||||
fxa-disconnect-dialog-body = { -brand-product-name } will disconnect from your account but won’t delete any of your browsing data on this device.
|
||||
sync-disconnect-dialog-button = Disconnect
|
Loading…
x
Reference in New Issue
Block a user