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