diff options
author | Moonchild <mcwerewolf@wolfbeast.com> | 2018-12-12 11:01:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-12 11:01:48 +0100 |
commit | bc8a25f5e33700f700b1e07b238bef5dae22f1ad (patch) | |
tree | c1f1ec816f1a85459d05bd6a4cf4f6170b01c602 /application/basilisk/components/preferences/in-content/sync.js | |
parent | f2d4bd1e395f903355cc157a1de7207e5b22b7fb (diff) | |
parent | 9697bfa68f32984b196748e388d743dddbe6aa7b (diff) | |
download | UXP-bc8a25f5e33700f700b1e07b238bef5dae22f1ad.tar UXP-bc8a25f5e33700f700b1e07b238bef5dae22f1ad.tar.gz UXP-bc8a25f5e33700f700b1e07b238bef5dae22f1ad.tar.lz UXP-bc8a25f5e33700f700b1e07b238bef5dae22f1ad.tar.xz UXP-bc8a25f5e33700f700b1e07b238bef5dae22f1ad.zip |
Merge pull request #898 from MoonchildProductions/Sync-weave
Remove FxA Phase 1
Diffstat (limited to 'application/basilisk/components/preferences/in-content/sync.js')
-rw-r--r-- | application/basilisk/components/preferences/in-content/sync.js | 119 |
1 files changed, 12 insertions, 107 deletions
diff --git a/application/basilisk/components/preferences/in-content/sync.js b/application/basilisk/components/preferences/in-content/sync.js index 27f7cd48c..2600677a8 100644 --- a/application/basilisk/components/preferences/in-content/sync.js +++ b/application/basilisk/components/preferences/in-content/sync.js @@ -306,113 +306,8 @@ var gSyncPane = { let service = Components.classes["@mozilla.org/weave/service;1"] .getService(Components.interfaces.nsISupports) .wrappedJSObject; - // service.fxAccountsEnabled is false iff sync is already configured for - // the legacy provider. - if (service.fxAccountsEnabled) { - let displayNameLabel = document.getElementById("fxaDisplayName"); - let fxaEmailAddress1Label = document.getElementById("fxaEmailAddress1"); - fxaEmailAddress1Label.hidden = false; - displayNameLabel.hidden = true; - - let profileInfoEnabled; - try { - profileInfoEnabled = Services.prefs.getBoolPref("identity.fxaccounts.profile_image.enabled"); - } catch (ex) {} - - // determine the fxa status... - this._showLoadPage(service); - - fxAccounts.getSignedInUser().then(data => { - if (!data) { - this.page = FXA_PAGE_LOGGED_OUT; - return false; - } - this.page = FXA_PAGE_LOGGED_IN; - // We are logged in locally, but maybe we are in a state where the - // server rejected our credentials (eg, password changed on the server) - let fxaLoginStatus = document.getElementById("fxaLoginStatus"); - let syncReady; - // Not Verfied implies login error state, so check that first. - if (!data.verified) { - fxaLoginStatus.selectedIndex = FXA_LOGIN_UNVERIFIED; - syncReady = false; - // So we think we are logged in, so login problems are next. - // (Although if the Sync identity manager is still initializing, we - // ignore login errors and assume all will eventually be good.) - // LOGIN_FAILED_LOGIN_REJECTED explicitly means "you must log back in". - // All other login failures are assumed to be transient and should go - // away by themselves, so aren't reflected here. - } else if (Weave.Status.login == Weave.LOGIN_FAILED_LOGIN_REJECTED) { - fxaLoginStatus.selectedIndex = FXA_LOGIN_FAILED; - syncReady = false; - // Else we must be golden (or in an error state we expect to magically - // resolve itself) - } else { - fxaLoginStatus.selectedIndex = FXA_LOGIN_VERIFIED; - syncReady = true; - } - fxaEmailAddress1Label.textContent = data.email; - document.getElementById("fxaEmailAddress2").textContent = data.email; - document.getElementById("fxaEmailAddress3").textContent = data.email; - this._populateComputerName(Weave.Service.clientsEngine.localName); - let engines = document.getElementById("fxaSyncEngines") - for (let checkbox of engines.querySelectorAll("checkbox")) { - checkbox.disabled = !syncReady; - } - document.getElementById("fxaChangeDeviceName").disabled = !syncReady; - - // Clear the profile image (if any) of the previously logged in account. - document.getElementById("fxaProfileImage").style.removeProperty("list-style-image"); - - // If the account is verified the next promise in the chain will - // fetch profile data. - return data.verified; - }).then(isVerified => { - if (isVerified) { - return fxAccounts.getSignedInUserProfile(); - } - return null; - }).then(data => { - let fxaLoginStatus = document.getElementById("fxaLoginStatus"); - if (data && profileInfoEnabled) { - if (data.displayName) { - fxaLoginStatus.setAttribute("hasName", true); - displayNameLabel.hidden = false; - displayNameLabel.textContent = data.displayName; - } else { - fxaLoginStatus.removeAttribute("hasName"); - } - if (data.avatar) { - let bgImage = "url(\"" + data.avatar + "\")"; - let profileImageElement = document.getElementById("fxaProfileImage"); - profileImageElement.style.listStyleImage = bgImage; - - let img = new Image(); - img.onerror = () => { - // Clear the image if it has trouble loading. Since this callback is asynchronous - // we check to make sure the image is still the same before we clear it. - if (profileImageElement.style.listStyleImage === bgImage) { - profileImageElement.style.removeProperty("list-style-image"); - } - }; - img.src = data.avatar; - } - } else { - fxaLoginStatus.removeAttribute("hasName"); - } - }, err => { - FxAccountsCommon.log.error(err); - }).catch(err => { - // If we get here something's really busted - Cu.reportError(String(err)); - }); - - // If fxAccountEnabled is false and we are in a "not configured" state, - // then fxAccounts is probably fully disabled rather than just unconfigured, - // so handle this case. This block can be removed once we remove support - // for fxAccounts being disabled. - } else if (Weave.Status.service == Weave.CLIENT_NOT_CONFIGURED || - Weave.Svc.Prefs.get("firstSync", "") == "notReady") { + if (Weave.Status.service == Weave.CLIENT_NOT_CONFIGURED || + Weave.Svc.Prefs.get("firstSync", "") == "notReady") { this.page = PAGE_NO_ACCOUNT; // else: sync was previously configured for the legacy provider, so we // make the "old" panels available. @@ -646,6 +541,16 @@ var gSyncPane = { }); }, + openQuotaDialog: function () { + let win = Services.wm.getMostRecentWindow("Sync:ViewQuota"); + if (win) { + win.focus(); + } else { + window.openDialog("chrome://browser/content/sync/quota.xul", "", + "centerscreen,chrome,dialog,modal"); + } + }, + openAddDevice: function () { if (!Weave.Utils.ensureMPUnlocked()) return; |