Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flushSignal action added - updated browser-core dep #110

Merged
merged 2 commits into from Jun 22, 2018
Merged
Changes from all commits
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -155,9 +155,8 @@ class OfferCard extends Component {
}

disableRewards() {
this.sendSignal('rewards_off', null, false);
sendMessage('ping', 'rewards_off');
this.messageBackground('rewardsDisabled');
this.sendSignal('rewards_off', null, false);
}

disableRewardsNotification() {
@@ -41,7 +41,6 @@ export default (state = initialState, action) => {
}
case TOGGLE_OFFERS_ENABLED: {
const enable_offers = action.data.enabled;
sendMessage('setPanelData', { enable_offers });
return Object.assign({}, state, { enable_offers });
}

@@ -424,6 +424,13 @@ function handleRewards(name, message, tab_id, callback) {
switch (name) {
case 'rewardSignal':
rewards.sendSignal(message);
if (message.actionId === 'rewards_off') {
cliqz.modules['offers-v2'].background.actions.flushSignals();
conf.enable_offers = false;
} else if (message.actionId === 'rewards_on') {
cliqz.modules['offers-v2'].background.actions.flushSignals();
conf.enable_offers = true;
}
break;
case 'rewardSeen':
rewards.markRewardRead(message.offerId);
@@ -158,7 +158,7 @@ class EventHandlers {
// we look for a cliqz offer which does not have urls specified (meaning good for any site)
// All Cliqz offers have Dismiss === 1, so the found one is injected and removed.
// Lastly we look for non-cliqz offers (classic CMPs)
if (!rewards.currentOffer && cmp.CMP_DATA.length !== 0) {
if (cmp.CMP_DATA.length !== 0) {
const CMPS = cmp.CMP_DATA;
const numOffers = CMPS.length;
let cliqzOffer;
ProTip! Use n and p to navigate between commits in a pull request.