Show premium ads for users outside the US (#1521)
This commit is contained in:
parent
ffdb5abf63
commit
c16516fab5
4 changed files with 18 additions and 7 deletions
|
@ -9,7 +9,7 @@ import { selectFollowedTags } from 'redux/selectors/tags';
|
||||||
import { doToggleTagFollowDesktop } from 'redux/actions/tags';
|
import { doToggleTagFollowDesktop } from 'redux/actions/tags';
|
||||||
import { selectClientSetting, selectLanguage } from 'redux/selectors/settings';
|
import { selectClientSetting, selectLanguage } from 'redux/selectors/settings';
|
||||||
import { selectAdBlockerFound } from 'redux/selectors/app';
|
import { selectAdBlockerFound } from 'redux/selectors/app';
|
||||||
import { selectOdyseeMembershipIsPremiumPlus } from 'redux/selectors/user';
|
import { selectOdyseeMembershipIsPremiumPlus, selectUserCountry } from 'redux/selectors/user';
|
||||||
import DiscoverPage from './view';
|
import DiscoverPage from './view';
|
||||||
|
|
||||||
const select = (state, props) => {
|
const select = (state, props) => {
|
||||||
|
@ -27,6 +27,7 @@ const select = (state, props) => {
|
||||||
searchInLanguage: selectClientSetting(state, SETTINGS.SEARCH_IN_LANGUAGE),
|
searchInLanguage: selectClientSetting(state, SETTINGS.SEARCH_IN_LANGUAGE),
|
||||||
adBlockerFound: selectAdBlockerFound(state),
|
adBlockerFound: selectAdBlockerFound(state),
|
||||||
hasPremiumPlus: selectOdyseeMembershipIsPremiumPlus(state),
|
hasPremiumPlus: selectOdyseeMembershipIsPremiumPlus(state),
|
||||||
|
userCountry: selectUserCountry(state),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ type Props = {
|
||||||
doFetchActiveLivestreams: (orderBy: ?Array<string>, lang: ?Array<string>) => void,
|
doFetchActiveLivestreams: (orderBy: ?Array<string>, lang: ?Array<string>) => void,
|
||||||
adBlockerFound: ?boolean,
|
adBlockerFound: ?boolean,
|
||||||
hasPremiumPlus: ?boolean,
|
hasPremiumPlus: ?boolean,
|
||||||
|
userCountry: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
function DiscoverPage(props: Props) {
|
function DiscoverPage(props: Props) {
|
||||||
|
@ -56,6 +57,7 @@ function DiscoverPage(props: Props) {
|
||||||
dynamicRouteProps,
|
dynamicRouteProps,
|
||||||
adBlockerFound,
|
adBlockerFound,
|
||||||
hasPremiumPlus,
|
hasPremiumPlus,
|
||||||
|
userCountry,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const buttonRef = useRef();
|
const buttonRef = useRef();
|
||||||
|
@ -63,6 +65,7 @@ function DiscoverPage(props: Props) {
|
||||||
const isMobile = useIsMobile();
|
const isMobile = useIsMobile();
|
||||||
const isWildWest = dynamicRouteProps && dynamicRouteProps.id === 'WILD_WEST';
|
const isWildWest = dynamicRouteProps && dynamicRouteProps.id === 'WILD_WEST';
|
||||||
const isCategory = Boolean(dynamicRouteProps);
|
const isCategory = Boolean(dynamicRouteProps);
|
||||||
|
const userIsInUS = userCountry === 'US';
|
||||||
|
|
||||||
const urlParams = new URLSearchParams(search);
|
const urlParams = new URLSearchParams(search);
|
||||||
const langParam = urlParams.get(CS.LANGUAGE_KEY) || null;
|
const langParam = urlParams.get(CS.LANGUAGE_KEY) || null;
|
||||||
|
@ -229,11 +232,12 @@ function DiscoverPage(props: Props) {
|
||||||
injectedItem={
|
injectedItem={
|
||||||
!isWildWest &&
|
!isWildWest &&
|
||||||
!hasPremiumPlus && {
|
!hasPremiumPlus && {
|
||||||
node: adBlockerFound ? (
|
node:
|
||||||
<PremiumPlusTile tileLayout={tileLayout} />
|
adBlockerFound || !userIsInUS ? (
|
||||||
) : (
|
<PremiumPlusTile tileLayout={tileLayout} />
|
||||||
<Ads small type="video" tileLayout />
|
) : (
|
||||||
),
|
<Ads small type="video" tileLayout />
|
||||||
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: find a better way to determine discover / wild west vs other modes release times
|
// TODO: find a better way to determine discover / wild west vs other modes release times
|
||||||
|
|
|
@ -10,6 +10,7 @@ import {
|
||||||
selectHasOdyseeMembership,
|
selectHasOdyseeMembership,
|
||||||
selectHomepageFetched,
|
selectHomepageFetched,
|
||||||
selectUserVerifiedEmail,
|
selectUserVerifiedEmail,
|
||||||
|
selectUserCountry,
|
||||||
} from 'redux/selectors/user';
|
} from 'redux/selectors/user';
|
||||||
import { selectSubscriptions } from 'redux/selectors/subscriptions';
|
import { selectSubscriptions } from 'redux/selectors/subscriptions';
|
||||||
import {
|
import {
|
||||||
|
@ -36,6 +37,7 @@ const select = (state) => ({
|
||||||
homepageOrder: selectClientSetting(state, SETTINGS.HOMEPAGE_ORDER),
|
homepageOrder: selectClientSetting(state, SETTINGS.HOMEPAGE_ORDER),
|
||||||
hasMembership: selectHasOdyseeMembership(state),
|
hasMembership: selectHasOdyseeMembership(state),
|
||||||
hasPremiumPlus: selectOdyseeMembershipIsPremiumPlus(state),
|
hasPremiumPlus: selectOdyseeMembershipIsPremiumPlus(state),
|
||||||
|
userCountry: selectUserCountry(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = (dispatch) => ({
|
const perform = (dispatch) => ({
|
||||||
|
|
|
@ -48,6 +48,7 @@ type Props = {
|
||||||
doOpenModal: (id: string, ?{}) => void,
|
doOpenModal: (id: string, ?{}) => void,
|
||||||
hasMembership: ?boolean,
|
hasMembership: ?boolean,
|
||||||
hasPremiumPlus: ?boolean,
|
hasPremiumPlus: ?boolean,
|
||||||
|
userCountry: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
function HomePage(props: Props) {
|
function HomePage(props: Props) {
|
||||||
|
@ -68,6 +69,7 @@ function HomePage(props: Props) {
|
||||||
doOpenModal,
|
doOpenModal,
|
||||||
hasMembership,
|
hasMembership,
|
||||||
hasPremiumPlus,
|
hasPremiumPlus,
|
||||||
|
userCountry,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const showPersonalizedChannels = (authenticated || !IS_WEB) && subscribedChannels && subscribedChannels.length > 0;
|
const showPersonalizedChannels = (authenticated || !IS_WEB) && subscribedChannels && subscribedChannels.length > 0;
|
||||||
|
@ -75,6 +77,7 @@ function HomePage(props: Props) {
|
||||||
const showIndividualTags = showPersonalizedTags && followedTags.length < 5;
|
const showIndividualTags = showPersonalizedTags && followedTags.length < 5;
|
||||||
const isLargeScreen = useIsLargeScreen();
|
const isLargeScreen = useIsLargeScreen();
|
||||||
const channelIds = subscribedChannels.map((sub) => splitBySeparator(sub.uri)[1]);
|
const channelIds = subscribedChannels.map((sub) => splitBySeparator(sub.uri)[1]);
|
||||||
|
const userIsInUS = userCountry === 'US';
|
||||||
|
|
||||||
const rowData: Array<RowDataItem> = GetLinksData(
|
const rowData: Array<RowDataItem> = GetLinksData(
|
||||||
homepageData,
|
homepageData,
|
||||||
|
@ -168,7 +171,8 @@ function HomePage(props: Props) {
|
||||||
injectedItem={
|
injectedItem={
|
||||||
index === 0 &&
|
index === 0 &&
|
||||||
!hasPremiumPlus && {
|
!hasPremiumPlus && {
|
||||||
node: adBlockerFound ? <PremiumPlusTile tileLayout /> : <Ads small type="video" tileLayout />,
|
node:
|
||||||
|
adBlockerFound || !userIsInUS ? <PremiumPlusTile tileLayout /> : <Ads small type="video" tileLayout />,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
forceShowReposts={id !== 'FOLLOWING'}
|
forceShowReposts={id !== 'FOLLOWING'}
|
||||||
|
|
Loading…
Reference in a new issue