From bf75efda43b8911446a55ae0fd2424713acd5f4a Mon Sep 17 00:00:00 2001 From: Chenxia Liu Date: Fri, 7 Mar 2014 15:28:48 -0800 Subject: [PATCH] Bug 965606 - Part 0: Change home sync pref name, and type from boolean to ints. r=margaret --- mobile/android/app/mobile.js | 6 ++++-- mobile/android/modules/HomeProvider.jsm | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/mobile/android/app/mobile.js b/mobile/android/app/mobile.js index 445f461dbc0..c3e21aa8fce 100644 --- a/mobile/android/app/mobile.js +++ b/mobile/android/app/mobile.js @@ -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); diff --git a/mobile/android/modules/HomeProvider.jsm b/mobile/android/modules/HomeProvider.jsm index e42f11e0330..7e83e70f592 100644 --- a/mobile/android/modules/HomeProvider.jsm +++ b/mobile/android/modules/HomeProvider.jsm @@ -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; }