diff --git a/_locales/en/messages.json b/_locales/en/messages.json index ac933fcdd..fcc4118af 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -727,6 +727,9 @@ "panel_detail_rewards_cliqz_text": { "message": "Feature already active in the Cliqz MyOffrz control panel." }, + "panel_detail_rewards_edge_text": { + "message": "Ghostery Rewards are not supported in Edge browser" + }, "panel_detail_rewards_loading": { "message": "Loading Rewards..." }, diff --git a/app/panel/components/Rewards.jsx b/app/panel/components/Rewards.jsx index 3a36932bf..2ed96ff38 100644 --- a/app/panel/components/Rewards.jsx +++ b/app/panel/components/Rewards.jsx @@ -21,6 +21,7 @@ import globals from '../../../src/classes/Globals'; import { log } from '../../../src/utils/common'; const IS_CLIQZ = (globals.BROWSER_INFO.name === 'cliqz'); +const IS_EDGE = (globals.BROWSER_INFO.name === 'edge'); /** * @class The Rewards Panel shows offers generated by Ghostery Rewards. @@ -93,6 +94,7 @@ class Rewards extends React.Component { } sendToIframe(message) { + if (!this.iframe.current) { return; } this.iframe.current.contentWindow.postMessage(JSON.stringify({ target: 'cliqz-offers-cc', origin: 'window', @@ -106,10 +108,12 @@ class Rewards extends React.Component { log('myoffrzSendRuntimeMessage, runtime.lastError', chrome.runtime.lastError); return; } - if (result.action !== 'pushData' || !this.iframe.current) { return; } + if (result.action !== 'pushData') { return; } const { data: { vouchers = [] } = {} } = result; const rewardsCount = vouchers.length; this.setState({ shouldHideRewards: rewardsCount === 0, rewardsCount }); + + if (!this.iframe.current) { return; } this.iframe.current.frameBorder = 0; this.sendToIframe(result); }); @@ -174,11 +178,12 @@ class Rewards extends React.Component { const { enable_offers } = this.props; const headerClassNames = ClassNames('RewardsPanel__header', 'flex-container', 'align-middle', 'align-justify'); const headerTitleClassNames = ClassNames('RewardsPanel__title'); + const shouldHideSlider = IS_CLIQZ || IS_EDGE; return (
{ t('ghostery_rewards') } - {!IS_CLIQZ && ( + {!shouldHideSlider && ( {enable_offers ? t('rewards_on') : t('rewards_off')} @@ -224,6 +229,15 @@ class Rewards extends React.Component { ); } + renderEDGEtext() { + return ( +
+ { this.renderRewardSvg() } +
{ t('panel_detail_rewards_edge_text') }
+
+ ); + } + renderRewardsTurnoffText() { return (
@@ -248,6 +262,7 @@ class Rewards extends React.Component { */ renderRewardListComponent() { if (IS_CLIQZ) { return this.renderCLIQZtext(); } + if (IS_EDGE) { return this.renderEDGEtext(); } const { enable_offers, is_expanded } = this.props; if (!enable_offers) { return this.renderRewardsTurnoffText(); } diff --git a/src/background.js b/src/background.js index e54fbb533..ef34dda8e 100644 --- a/src/background.js +++ b/src/background.js @@ -1612,7 +1612,7 @@ function initializeGhosteryModules() { 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_offers = !offers.isDisabled && !(IS_FIREFOX && globals.JUST_INSTALLED) && !IS_EDGE; } const myoffrzShouldMigrate = conf.rewards_opted_in !== undefined && cliqz.prefs.get('myoffrz.opted_in', undefined) === undefined;