Bug 965606 - Part 0: Change home sync pref name, and type from boolean to ints. r=margaret

This commit is contained in:
Chenxia Liu 2014-03-07 15:28:48 -08:00
parent 5f6022aca3
commit bf75efda43
2 changed files with 6 additions and 4 deletions

View File

@ -833,8 +833,10 @@ pref("browser.webapps.updateCheckUrl", "http://dapk.net/app_updates");
#endif
// Whether or not to only sync home provider data when the user is on wifi.
pref("home.sync.wifiOnly", false);
// The mode of home provider syncing.
// 0: Sync always
// 1: Sync only when on wifi
pref("home.sync.updateMode", 0);
// How frequently to check if we should sync home provider data.
pref("home.sync.checkIntervalSecs", 3600);

View File

@ -28,7 +28,7 @@ XPCOMUtils.defineLazyGetter(this, "DB_PATH", function() {
});
const PREF_STORAGE_LAST_SYNC_TIME_PREFIX = "home.storage.lastSyncTime.";
const PREF_SYNC_WIFI_ONLY = "home.sync.wifiOnly";
const PREF_SYNC_UPDATE_MODE = "home.sync.updateMode";
const PREF_SYNC_CHECK_INTERVAL_SECS = "home.sync.checkIntervalSecs";
XPCOMUtils.defineLazyGetter(this, "gSyncCheckIntervalSecs", function() {
@ -135,7 +135,7 @@ this.HomeProvider = Object.freeze({
*/
requestSync: function(datasetId, callback) {
// Make sure it's a good time to sync.
if (Services.prefs.getBoolPref(PREF_SYNC_WIFI_ONLY) && !isUsingWifi()) {
if ((Services.prefs.getIntPref(PREF_SYNC_UPDATE_MODE) === 1) && !isUsingWifi()) {
Cu.reportError("HomeProvider: Failed to sync because device is not on a local network");
return false;
}