deb95cd443
Using that global variable was a bad idea. Stick to redux as the source of truth. The flag is not listed for rehydration, so it will always start off as `undefined`, which is what we need anyways. `undefined` indicates we haven't tested for ad-blockers, so we'll run the fetch and update the store with a true|false value.
20 lines
760 B
JavaScript
20 lines
760 B
JavaScript
import { connect } from 'react-redux';
|
|
import { doSetAdBlockerFound } from 'redux/actions/app';
|
|
import { selectAdBlockerFound } from 'redux/selectors/app';
|
|
import { makeSelectClaimForUri, selectClaimIsNsfwForUri } from 'redux/selectors/claims';
|
|
import { selectOdyseeMembershipIsPremiumPlus, selectUserCountry } from 'redux/selectors/user';
|
|
import Ads from './view';
|
|
|
|
const select = (state, props) => ({
|
|
claim: makeSelectClaimForUri(props.uri)(state),
|
|
isMature: selectClaimIsNsfwForUri(state, props.uri),
|
|
isAdBlockerFound: selectAdBlockerFound(state),
|
|
userHasPremiumPlus: selectOdyseeMembershipIsPremiumPlus(state),
|
|
userCountry: selectUserCountry(state),
|
|
});
|
|
|
|
const perform = {
|
|
doSetAdBlockerFound,
|
|
};
|
|
|
|
export default connect(select, perform)(Ads);
|