Bug 1406475 - Convert tps sync module to using Services.prefs. r=sync-reviewers,skhamis

Depends on D180808

Differential Revision: https://phabricator.services.mozilla.com/D180809
This commit is contained in:
Marco Castelluccio 2023-06-14 23:15:37 +00:00
Родитель 0e065aac1e
Коммит d744ff76dd
1 изменённых файлов: 14 добавлений и 8 удалений

Просмотреть файл

@ -215,7 +215,10 @@ var TPS = {
this._setupComplete = true;
if (this._syncWipeAction) {
lazy.Weave.Svc.Prefs.set("firstSync", this._syncWipeAction);
lazy.Weave.Svc.PrefBranch.setCharPref(
"firstSync",
this._syncWipeAction
);
this._syncWipeAction = null;
}
@ -292,10 +295,10 @@ var TPS = {
* directly called via TPS.Sync()!
*/
delayAutoSync: function TPS_delayAutoSync() {
lazy.Weave.Svc.Prefs.set("scheduler.immediateInterval", 7200);
lazy.Weave.Svc.Prefs.set("scheduler.idleInterval", 7200);
lazy.Weave.Svc.Prefs.set("scheduler.activeInterval", 7200);
lazy.Weave.Svc.Prefs.set("syncThreshold", 10000000);
lazy.Weave.Svc.PrefBranch.setIntPref("scheduler.immediateInterval", 7200);
lazy.Weave.Svc.PrefBranch.setIntPref("scheduler.idleInterval", 7200);
lazy.Weave.Svc.PrefBranch.setIntPref("scheduler.activeInterval", 7200);
lazy.Weave.Svc.PrefBranch.setIntPref("syncThreshold", 10000000);
},
quit: function TPS__quit() {
@ -1170,7 +1173,10 @@ var TPS = {
lazy.Logger.logInfo(
"setting client.name to " + this.phases[this._currentPhase]
);
lazy.Weave.Svc.Prefs.set("client.name", this.phases[this._currentPhase]);
lazy.Weave.Svc.PrefBranch.setStringPref(
"client.name",
this.phases[this._currentPhase]
);
this._interceptSyncTelemetry();
@ -1395,9 +1401,9 @@ var TPS = {
// also handle it via the "weave:service:setup-complete" notification.
if (wipeAction) {
this._syncWipeAction = wipeAction;
lazy.Weave.Svc.Prefs.set("firstSync", wipeAction);
lazy.Weave.Svc.PrefBranch.setCharPref("firstSync", wipeAction);
} else {
lazy.Weave.Svc.Prefs.reset("firstSync");
lazy.Weave.Svc.PrefBranch.clearUserPref("firstSync");
}
if (!(await lazy.Weave.Service.login())) {
// We need to complete verification.