mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1114445 - update sync migration flows to reflect latest requirements. r=adw
This commit is contained in:
parent
4bb4b66108
commit
7848b2fe1e
@ -274,11 +274,22 @@ let gFxAccounts = {
|
||||
let note = null;
|
||||
switch (this._migrationInfo.state) {
|
||||
case this.fxaMigrator.STATE_USER_FXA: {
|
||||
let msg = this.strings.GetStringFromName("needUserLong");
|
||||
let upgradeLabel =
|
||||
this.strings.GetStringFromName("upgradeToFxA.label");
|
||||
let upgradeAccessKey =
|
||||
this.strings.GetStringFromName("upgradeToFxA.accessKey");
|
||||
// There are 2 cases here - no email address means it is an offer on
|
||||
// the first device (so the user is prompted to create an account).
|
||||
// If there is an email address it is the "join the party" flow, so the
|
||||
// user is prompted to sign in with the address they previously used.
|
||||
let msg, upgradeLabel, upgradeAccessKey;
|
||||
if (this._migrationInfo.email) {
|
||||
msg = this.strings.formatStringFromName("signInAfterUpgradeOnOtherDevice.description",
|
||||
[this._migrationInfo.email],
|
||||
1);
|
||||
upgradeLabel = this.strings.GetStringFromName("signInAfterUpgradeOnOtherDevice.label");
|
||||
upgradeAccessKey = this.strings.GetStringFromName("signInAfterUpgradeOnOtherDevice.accessKey");
|
||||
} else {
|
||||
msg = this.strings.GetStringFromName("needUserLong");
|
||||
upgradeLabel = this.strings.GetStringFromName("upgradeToFxA.label");
|
||||
upgradeAccessKey = this.strings.GetStringFromName("upgradeToFxA.accessKey");
|
||||
}
|
||||
note = new Weave.Notification(
|
||||
undefined, msg, undefined, Weave.Notifications.PRIORITY_WARNING, [
|
||||
new Weave.NotificationButton(upgradeLabel, upgradeAccessKey, () => {
|
||||
|
@ -114,12 +114,6 @@ let gSyncPane = {
|
||||
Weave.Svc.Obs.remove(migrateTopic, gSyncPane.updateMigrationState, gSyncPane);
|
||||
}, false);
|
||||
|
||||
// ask the migration module to broadcast its current state (and nothing will
|
||||
// happen if it's not loaded - which is good, as that means no migration
|
||||
// is pending/necessary) - we don't want to suck that module in just to
|
||||
// find there's nothing to do.
|
||||
Services.obs.notifyObservers(null, "fxa-migration:state-request", null);
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, '_stringBundle', () => {
|
||||
return Services.strings.createBundle("chrome://browser/locale/preferences/preferences.properties");
|
||||
}),
|
||||
@ -218,6 +212,9 @@ let gSyncPane = {
|
||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
fxaMigrator.createFxAccount(win);
|
||||
});
|
||||
setEventListener("sync-migrate-unlink", "click", function () {
|
||||
gSyncPane.startOverMigration();
|
||||
});
|
||||
setEventListener("sync-migrate-forget", "click", function () {
|
||||
fxaMigrator.forgetFxAccount();
|
||||
});
|
||||
@ -228,6 +225,12 @@ let gSyncPane = {
|
||||
},
|
||||
|
||||
updateWeavePrefs: function () {
|
||||
// ask the migration module to broadcast its current state (and nothing will
|
||||
// happen if it's not loaded - which is good, as that means no migration
|
||||
// is pending/necessary) - we don't want to suck that module in just to
|
||||
// find there's nothing to do.
|
||||
Services.obs.notifyObservers(null, "fxa-migration:state-request", null);
|
||||
|
||||
let service = Components.classes["@mozilla.org/weave/service;1"]
|
||||
.getService(Components.interfaces.nsISupports)
|
||||
.wrappedJSObject;
|
||||
@ -299,9 +302,35 @@ let gSyncPane = {
|
||||
switch (state) {
|
||||
case fxaMigrator.STATE_USER_FXA: {
|
||||
let sb = this._accountsStringBundle;
|
||||
// There are 2 cases here - no email address means it is an offer on
|
||||
// the first device (so the user is prompted to create an account).
|
||||
// If there is an email address it is the "join the party" flow, so the
|
||||
// user is prompted to sign in with the address they previously used.
|
||||
let email = subject ? subject.QueryInterface(Components.interfaces.nsISupportsString).data : null;
|
||||
let elt = document.getElementById("sync-migrate-upgrade-description");
|
||||
elt.textContent = email ?
|
||||
sb.formatStringFromName("signInAfterUpgradeOnOtherDevice.description",
|
||||
[email], 1) :
|
||||
sb.GetStringFromName("needUserLong");
|
||||
|
||||
// The "upgrade" button.
|
||||
let button = document.getElementById("sync-migrate-upgrade");
|
||||
button.setAttribute("label", sb.GetStringFromName("upgradeToFxA.label"));
|
||||
button.setAttribute("accesskey", sb.GetStringFromName("upgradeToFxA.accessKey"));
|
||||
button.setAttribute("label",
|
||||
sb.GetStringFromName(email
|
||||
? "signInAfterUpgradeOnOtherDevice.label"
|
||||
: "upgradeToFxA.label"));
|
||||
button.setAttribute("accesskey",
|
||||
sb.GetStringFromName(email
|
||||
? "signInAfterUpgradeOnOtherDevice.accessKey"
|
||||
: "upgradeToFxA.accessKey"));
|
||||
// The "unlink" button - this is only shown for first migration
|
||||
button = document.getElementById("sync-migrate-unlink");
|
||||
if (email) {
|
||||
button.hidden = true;
|
||||
} else {
|
||||
button.setAttribute("label", sb.GetStringFromName("unlinkMigration.label"));
|
||||
button.setAttribute("accesskey", sb.GetStringFromName("unlinkMigration.accessKey"));
|
||||
}
|
||||
selIndex = 0;
|
||||
break;
|
||||
}
|
||||
@ -355,6 +384,29 @@ let gSyncPane = {
|
||||
this.updateWeavePrefs();
|
||||
},
|
||||
|
||||
// When the "Unlink" button in the migration header is selected we display
|
||||
// a slightly different message.
|
||||
startOverMigration: function () {
|
||||
let flags = Services.prompt.BUTTON_POS_0 * Services.prompt.BUTTON_TITLE_IS_STRING +
|
||||
Services.prompt.BUTTON_POS_1 * Services.prompt.BUTTON_TITLE_CANCEL +
|
||||
Services.prompt.BUTTON_POS_1_DEFAULT;
|
||||
let sb = this._accountsStringBundle;
|
||||
let buttonChoice =
|
||||
Services.prompt.confirmEx(window,
|
||||
sb.GetStringFromName("unlinkVerificationTitle"),
|
||||
sb.GetStringFromName("unlinkVerificationDescription"),
|
||||
flags,
|
||||
sb.GetStringFromName("unlinkVerificationConfirm"),
|
||||
null, null, null, {});
|
||||
|
||||
// If the user selects cancel, just bail
|
||||
if (buttonChoice == 1)
|
||||
return;
|
||||
|
||||
Weave.Service.startOver();
|
||||
this.updateWeavePrefs();
|
||||
},
|
||||
|
||||
updatePass: function () {
|
||||
if (Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED)
|
||||
gSyncUtils.changePassword();
|
||||
|
@ -46,8 +46,9 @@
|
||||
<deck id="sync-migration-deck">
|
||||
<!-- When we are in the "need FxA user" state -->
|
||||
<hbox align="center">
|
||||
<label>&migrate.upgradeNeeded;</label>
|
||||
<description id="sync-migrate-upgrade-description" flex="1"/>
|
||||
<spacer flex="1"/>
|
||||
<button id="sync-migrate-unlink"/>
|
||||
<button id="sync-migrate-upgrade"/>
|
||||
</hbox>
|
||||
|
||||
|
@ -10,6 +10,12 @@ needUserLong = We've rebuilt Sync to make it easier for everyone. Please upgrade
|
||||
upgradeToFxA.label = Upgrade
|
||||
upgradeToFxA.accessKey = U
|
||||
|
||||
# LOCALIZATION NOTE (signInAfterUpgradeOnOtherDevice.description)
|
||||
# %S = Email address of user's Firefox Account
|
||||
signInAfterUpgradeOnOtherDevice.description = Sync was upgraded on another device by %S. Resume syncing?
|
||||
signInAfterUpgradeOnOtherDevice.label = Sign In
|
||||
signInAfterUpgradeOnOtherDevice.accessKey = S
|
||||
|
||||
# LOCALIZATION NOTE (needVerifiedUserShort, needVerifiedUserLong)
|
||||
# %S = Email address of user's Firefox Account
|
||||
needVerifiedUserShort = %S not verified
|
||||
@ -21,6 +27,13 @@ resendVerificationEmail.accessKey = R
|
||||
forgetMigration.label = Forget
|
||||
forgetMigration.accessKey = F
|
||||
|
||||
unlinkMigration.label = Unlink Sync
|
||||
unlinkMigration.accessKey = L
|
||||
|
||||
unlinkVerificationTitle = Unlink old version of Sync?
|
||||
unlinkVerificationDescription = If you no longer want to be reminded about upgrading Sync, you can unlink your old Sync account to remove it.
|
||||
unlinkVerificationConfirm = Unlink
|
||||
|
||||
# These strings are used in a dialog we display after the user requests we resend
|
||||
# a verification email.
|
||||
verificationSentTitle = Verification Sent
|
||||
|
@ -78,6 +78,3 @@ both, to better adapt this sentence to their language.
|
||||
<!ENTITY welcome.createAccount.label "Create Account">
|
||||
|
||||
<!ENTITY welcome.useOldSync.label "Using an older version of Sync?">
|
||||
|
||||
<!-- Sync Migration -->
|
||||
<!ENTITY migrate.upgradeNeeded "The sync account system is being discontinued. A new Firefox Account is required to sync.">
|
||||
|
@ -291,6 +291,11 @@ description > html|a {
|
||||
/**
|
||||
* Sync migration
|
||||
*/
|
||||
#sync-migrate-upgrade-description {
|
||||
/* description elts need a min-width to wrap correctly - bug 630864? */
|
||||
min-width: 100px
|
||||
}
|
||||
|
||||
#sync-migration {
|
||||
border: 1px solid rgba(0, 0, 0, 0.32);
|
||||
background-color: InfoBackground;
|
||||
|
@ -138,11 +138,14 @@ Migrator.prototype = {
|
||||
|
||||
_promiseCurrentUserState: Task.async(function* (forceObserver) {
|
||||
this.log.trace("starting _promiseCurrentUserState");
|
||||
let update = (newState, subject=null) => {
|
||||
let update = (newState, email=null) => {
|
||||
this.log.info("Migration state: '${state}' => '${newState}'",
|
||||
{state: this._state, newState: newState});
|
||||
if (forceObserver || newState !== this._state) {
|
||||
this._state = newState;
|
||||
let subject = Cc["@mozilla.org/supports-string;1"]
|
||||
.createInstance(Ci.nsISupportsString);
|
||||
subject.data = email || "";
|
||||
Services.obs.notifyObservers(subject, OBSERVER_STATE_CHANGE_TOPIC, newState);
|
||||
}
|
||||
return newState;
|
||||
@ -173,13 +176,14 @@ Migrator.prototype = {
|
||||
// So we are in EOL mode - have we a user?
|
||||
let fxauser = yield fxAccounts.getSignedInUser();
|
||||
if (!fxauser) {
|
||||
return update(this.STATE_USER_FXA);
|
||||
// See if there is a migration sentinel so we can send the email
|
||||
// address that was used on a different device for this account (ie, if
|
||||
// this is a "join the party" migration rather than the first)
|
||||
let sentinel = yield this._getSyncMigrationSentinel();
|
||||
return update(this.STATE_USER_FXA, sentinel && sentinel.email);
|
||||
}
|
||||
if (!fxauser.verified) {
|
||||
let email = Cc["@mozilla.org/supports-string;1"].
|
||||
createInstance(Ci.nsISupportsString);
|
||||
email.data = fxauser.email || "";
|
||||
return update(this.STATE_USER_FXA_VERIFIED, email);
|
||||
return update(this.STATE_USER_FXA_VERIFIED, fxauser.email);
|
||||
}
|
||||
|
||||
// So we just have housekeeping to do - we aren't blocked on a user, so
|
||||
@ -388,7 +392,7 @@ Migrator.prototype = {
|
||||
let customize = !this._allEnginesEnabled();
|
||||
tail += "&customizeSync=" + customize;
|
||||
|
||||
win.switchToTabHavingURI("about:accounts?" + action + tail, true,
|
||||
win.switchToTabHavingURI("about:accounts?action=" + action + tail, true,
|
||||
{ignoreFragment: true, replaceQueryString: true});
|
||||
// An FxA observer will fire when the user completes this, which will
|
||||
// cause us to move to the next "user blocked" state and notify via our
|
||||
|
Loading…
Reference in New Issue
Block a user