diff --git a/CHANGELOG.md b/CHANGELOG.md index 28fc5dbe7..07c979183 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ -### GHOSTERY 8.4.8 () +### GHOSTERY 8.4.8 (March 30, 2019) + Fixes issue that could intermittently cause some cookies to be reset (Fixes #514) ++ Handle legacy opt-in settings for Firefox (#518) ### GHOSTERY 8.4.7 (March 16, 2020) diff --git a/src/background.js b/src/background.js index 68cbb0d02..923e798e0 100644 --- a/src/background.js +++ b/src/background.js @@ -1471,6 +1471,8 @@ function initializeVersioning() { if (globals.JUST_UPGRADED) { log('THIS IS AN UPGRADE'); conf.previous_version = globals.EXTENSION_VERSION; + const { version_history } = conf; + const earliestVersion = version_history[0].split('.'); const prevVersion = PREVIOUS_EXTENSION_VERSION.split('.'); const currentVersion = globals.EXTENSION_VERSION.split('.'); @@ -1487,13 +1489,12 @@ function initializeVersioning() { conf.enable_smart_block = false; } - // Are we upgrading from Ghostery 8 prior to 8.2? - if ((+prevVersion[0] === 8) && (prevVersion[1] < 2)) { - globals.JUST_UPGRADED_FROM_8_1 = true; + // Check if the earliest version is < 8.4.2 + if (earliestVersion[0] <= 8 && earliestVersion[1] <= 4 && earliestVersion[2] < 2) { + globals.REQUIRE_LEGACY_OPT_IN = true; } // Establish version history - const { version_history } = conf; version_history.push(globals.EXTENSION_VERSION); conf.version_history = version_history; } else { @@ -1512,14 +1513,6 @@ function initializeVersioning() { function initializeGhosteryModules() { if (globals.JUST_UPGRADED) { log('JUST UPGRADED'); - - const { version_history } = conf; - const size = version_history.length; - if (!size || version_history[size - 1] !== globals.EXTENSION_VERSION) { - version_history.push(globals.EXTENSION_VERSION); - } - conf.version_history = version_history; - metrics.ping('upgrade'); // We don't want install_complete pings for upgrade conf.metrics.install_complete_all = Number(new Date().getTime()); @@ -1563,28 +1556,20 @@ function initializeGhosteryModules() { initialiseWebRequestPipeline(), ]).then(() => { if (!IS_CLIQZ) { - if (globals.JUST_UPGRADED_FROM_7) { - // These users had human web already, so we respect their choice - conf.enable_human_web = !humanweb.isDisabled; - // These users did not have adblocking and antitracking. - // We introduce these new features initially disabled. - conf.enable_ad_block = false; - conf.enable_anti_tracking = false; - // Enable Offers except or Cliqz - conf.enable_offers = true; - } else if (globals.JUST_UPGRADED_FROM_8_1) { - // These users already had human web, adblocker and antitracking, so we respect their choice - conf.enable_ad_block = !adblocker.isDisabled; - conf.enable_anti_tracking = !antitracking.isDisabled; - conf.enable_human_web = !humanweb.isDisabled; - // These users did not have Offers, so we enable them on upgrade. - conf.enable_offers = true; - } else { - // Otherwise we respect browser-core default settings - conf.enable_ad_block = !adblocker.isDisabled; - conf.enable_anti_tracking = !antitracking.isDisabled; - conf.enable_human_web = !humanweb.isDisabled && !(IS_FIREFOX && globals.JUST_INSTALLED); - conf.enable_offers = !offers.isDisabled && !(IS_FIREFOX && globals.JUST_INSTALLED); + conf.enable_ad_block = !adblocker.isDisabled; + conf.enable_anti_tracking = !antitracking.isDisabled; + conf.enable_human_web = !humanweb.isDisabled; + conf.enable_offers = !offers.isDisabled; + + if (IS_FIREFOX) { + if (globals.JUST_INSTALLED) { + conf.enable_human_web = false; + conf.enable_offers = false; + } else if (globals.REQUIRE_LEGACY_OPT_IN && !conf.cliqz_legacy_opt_in) { + conf.enable_human_web = false; + conf.enable_offers = cliqz.prefs.get('myoffrz.opted_in') || false; + conf.cliqz_legacy_opt_in = true; + } } const myoffrzShouldMigrate = conf.rewards_opted_in !== undefined && cliqz.prefs.get('myoffrz.opted_in', undefined) === undefined; @@ -1592,6 +1577,7 @@ function initializeGhosteryModules() { cliqz.prefs.set('myoffrz.opted_in', conf.rewards_opted_in); conf.rewards_opted_in = undefined; } + cliqz.events.subscribe('myoffrz:turnoff', () => { panelData.set({ enable_offers: false }); rewards.sendSignal({ diff --git a/src/classes/ConfData.js b/src/classes/ConfData.js index 082b12c9b..09b38f48d 100644 --- a/src/classes/ConfData.js +++ b/src/classes/ConfData.js @@ -100,6 +100,7 @@ class ConfData { _initProperty('block_by_default', false); _initProperty('bugs_last_checked', 0); _initProperty('bugs_last_updated', nowTime); + _initProperty('cliqz_legacy_opt_in', false); _initProperty('cliqz_import_state', 0); _initProperty('cmp_version', 0); _initProperty('current_theme', 'default'); @@ -129,7 +130,7 @@ class ConfData { _initProperty('plus_promo_modal_last_seen', 0); _initProperty('premium_promo_modal_last_seen', 0); _initProperty('rewards_accepted', false); - _initProperty('rewards_opted_in', false); + _initProperty('rewards_opted_in', false); // Migrated to Cliqz pref myoffrz.opted_in _initProperty('settings_last_imported', 0); _initProperty('settings_last_exported', 0); _initProperty('show_alert', BROWSER_INFO.os !== 'android' && !IS_FIREFOX); diff --git a/src/classes/Globals.js b/src/classes/Globals.js index 900874ff8..e05ddee87 100644 --- a/src/classes/Globals.js +++ b/src/classes/Globals.js @@ -38,7 +38,7 @@ class Globals { this.JUST_INSTALLED = false; this.JUST_UPGRADED = false; this.JUST_UPGRADED_FROM_7 = false; - this.JUST_UPGRADED_FROM_8_1 = false; + this.REQUIRE_LEGACY_OPT_IN = false; this.HOTFIX = false; this.LET_REDIRECTS_THROUGH = false; this.C2P_LOADED = false;