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

fix hotdog signals #73

Merged
merged 4 commits into from May 23, 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

@@ -16,7 +16,7 @@ import { withRouter } from 'react-router-dom';
import msgModule from '../utils/msg';
import { log } from '../../../src/utils/common';

const msg = msgModule('hotdog');
const msg = msgModule('rewards');
const { sendMessage } = msg;

/**
@@ -29,23 +29,24 @@ class HotDog extends Component {
this.state = {
closed: false
};

this.shownSignal = false;
this.iframeEl = window.parent.document.getElementById('ghostery-iframe-container');

if (this.iframeEl) {
this.iframeEl.classList = '';
this.iframeEl.classList.add('hot-dog');
}

this.ghostyStar = `url(${chrome.extension.getURL('app/images/rewards/ghosty-star.svg')})`;
this.closeIcon = `url(${chrome.extension.getURL('app/images/rewards/light-x.svg')})`;

this.close = this.close.bind(this);
this.navigate = this.navigate.bind(this);
}

componentWillReceiveProps(nextProps) {
if (nextProps.reward && nextProps.reward !== null) {
if (nextProps.reward && nextProps.reward !== null && !this.shownSignal) {
this.sendSignal('offer_notification_hotdog', nextProps);
this.shownSignal = true;
}
}

@@ -58,6 +58,7 @@ class OfferCard extends Component {
this.toggleSettings = this.toggleSettings.bind(this);
this.handleImageLoaded = this.handleImageLoaded.bind(this);
this.handlePrompt = this.handlePrompt.bind(this);
this.redeem = this.redeem.bind(this);

this.notifications = [
{
@@ -254,7 +255,7 @@ class OfferCard extends Component {
{ this.state.showSettings &&
<div className="rewards-settings-container">
<ClickOutside excludeEl={this.kebabRef} onClickOutside={this.toggleSettings}>
<Settings signal={this.sendSignal('about_ghostery_rewards')} disable={this.disableRewardsNotification} />
<Settings signal={() => { this.sendSignal('about_ghostery_rewards'); }} disable={this.disableRewardsNotification} />
</ClickOutside>
</div>
}
@@ -88,8 +88,8 @@ class RewardsApp {
<Router history={history}>
<ShadowDOM include={[chrome.extension.getURL('dist/css/rewards_styles.css')]}>
<div id="ghostery-shadow-root">
<Route exact path="/" render={() => <HotDog reward={props.reward} />} />
<Route path="/hotdog" render={() => <HotDog reward={props.reward} />} />
<Route exact path="/" render={() => <HotDog reward={props.reward} port={this.port} />} />
<Route path="/hotdog" render={() => <HotDog reward={props.reward} port={this.port} />} />
<Route path="/offercard" render={() => <OfferCard reward={props.reward} conf={props.conf} port={this.port} />} />
</div>
</ShadowDOM>
@@ -117,8 +117,8 @@ class RewardsApp {
this.mainView = props => (
<Router history={history}>
<div>
<Route exact path="/" render={() => <HotDog reward={props.reward} />} />
<Route path="/hotdog" render={() => <HotDog reward={props.reward} />} />
<Route exact path="/" render={() => <HotDog reward={props.reward} port={this.port} />} />
<Route path="/hotdog" render={() => <HotDog reward={props.reward} port={this.port} />} />
<Route path="/offercard" render={() => <OfferCard reward={props.reward} conf={props.conf} port={this.port} />} />
</div>
</Router>
ProTip! Use n and p to navigate between commits in a pull request.