Remove Premium+ Tiles when Premium+ is active (#1525)
This commit is contained in:
parent
8dd0982f33
commit
746d321dfe
10 changed files with 37 additions and 11 deletions
|
@ -7,11 +7,13 @@ import {
|
||||||
makeSelectTotalPagesInChannelSearch,
|
makeSelectTotalPagesInChannelSearch,
|
||||||
selectClaimForUri,
|
selectClaimForUri,
|
||||||
} from 'redux/selectors/claims';
|
} from 'redux/selectors/claims';
|
||||||
|
import { selectOdyseeMembershipIsPremiumPlus } from 'redux/selectors/user';
|
||||||
import { doResolveUris } from 'redux/actions/claims';
|
import { doResolveUris } from 'redux/actions/claims';
|
||||||
import * as SETTINGS from 'constants/settings';
|
import * as SETTINGS from 'constants/settings';
|
||||||
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
|
import { makeSelectChannelIsMuted } from 'redux/selectors/blocked';
|
||||||
import { withRouter } from 'react-router';
|
import { withRouter } from 'react-router';
|
||||||
import { selectClientSetting, selectShowMatureContent } from 'redux/selectors/settings';
|
import { selectClientSetting, selectShowMatureContent } from 'redux/selectors/settings';
|
||||||
|
import { selectAdBlockerFound } from 'redux/selectors/app';
|
||||||
import { doFetchChannelLiveStatus } from 'redux/actions/livestream';
|
import { doFetchChannelLiveStatus } from 'redux/actions/livestream';
|
||||||
import { selectActiveLivestreamForChannel, selectActiveLivestreamInitialized } from 'redux/selectors/livestream';
|
import { selectActiveLivestreamForChannel, selectActiveLivestreamInitialized } from 'redux/selectors/livestream';
|
||||||
import { getChannelIdFromClaim } from 'util/claim';
|
import { getChannelIdFromClaim } from 'util/claim';
|
||||||
|
@ -35,6 +37,8 @@ const select = (state, props) => {
|
||||||
tileLayout: selectClientSetting(state, SETTINGS.TILE_LAYOUT),
|
tileLayout: selectClientSetting(state, SETTINGS.TILE_LAYOUT),
|
||||||
activeLivestreamForChannel: selectActiveLivestreamForChannel(state, channelClaimId),
|
activeLivestreamForChannel: selectActiveLivestreamForChannel(state, channelClaimId),
|
||||||
activeLivestreamInitialized: selectActiveLivestreamInitialized(state),
|
activeLivestreamInitialized: selectActiveLivestreamInitialized(state),
|
||||||
|
adBlockerFound: selectAdBlockerFound(state),
|
||||||
|
hasPremiumPlus: selectOdyseeMembershipIsPremiumPlus(state),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ type Props = {
|
||||||
doFetchChannelLiveStatus: (string) => void,
|
doFetchChannelLiveStatus: (string) => void,
|
||||||
activeLivestreamForChannel: any,
|
activeLivestreamForChannel: any,
|
||||||
activeLivestreamInitialized: boolean,
|
activeLivestreamInitialized: boolean,
|
||||||
|
hasPremiumPlus: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
function ChannelContent(props: Props) {
|
function ChannelContent(props: Props) {
|
||||||
|
@ -62,6 +63,7 @@ function ChannelContent(props: Props) {
|
||||||
doFetchChannelLiveStatus,
|
doFetchChannelLiveStatus,
|
||||||
activeLivestreamForChannel,
|
activeLivestreamForChannel,
|
||||||
activeLivestreamInitialized,
|
activeLivestreamInitialized,
|
||||||
|
hasPremiumPlus,
|
||||||
} = props;
|
} = props;
|
||||||
// const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
|
// const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
|
||||||
|
|
||||||
|
@ -159,7 +161,11 @@ function ChannelContent(props: Props) {
|
||||||
defaultOrderBy={CS.ORDER_BY_NEW}
|
defaultOrderBy={CS.ORDER_BY_NEW}
|
||||||
pageSize={dynamicPageSize}
|
pageSize={dynamicPageSize}
|
||||||
infiniteScroll={defaultInfiniteScroll}
|
infiniteScroll={defaultInfiniteScroll}
|
||||||
injectedItem={{ node: <Ads small type="video" tileLayout /> }}
|
injectedItem={
|
||||||
|
!hasPremiumPlus && {
|
||||||
|
node: <Ads small type="video" tileLayout />,
|
||||||
|
}
|
||||||
|
}
|
||||||
meta={
|
meta={
|
||||||
showFilters && (
|
showFilters && (
|
||||||
<Form onSubmit={() => {}} className="wunderbar--inline">
|
<Form onSubmit={() => {}} className="wunderbar--inline">
|
||||||
|
|
|
@ -15,7 +15,7 @@ const select = (state, props) => {
|
||||||
recommendedContentUris,
|
recommendedContentUris,
|
||||||
nextRecommendedUri,
|
nextRecommendedUri,
|
||||||
isSearching: selectIsSearching(state),
|
isSearching: selectIsSearching(state),
|
||||||
userHasPremiumPlus: selectOdyseeMembershipIsPremiumPlus(state),
|
hasPremiumPlus: selectOdyseeMembershipIsPremiumPlus(state),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ type Props = {
|
||||||
claimId: string,
|
claimId: string,
|
||||||
metadata: any,
|
metadata: any,
|
||||||
location: UrlLocation,
|
location: UrlLocation,
|
||||||
userHasPremiumPlus: boolean,
|
hasPremiumPlus: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default React.memo<Props>(function RecommendedContent(props: Props) {
|
export default React.memo<Props>(function RecommendedContent(props: Props) {
|
||||||
|
@ -41,11 +41,11 @@ export default React.memo<Props>(function RecommendedContent(props: Props) {
|
||||||
isSearching,
|
isSearching,
|
||||||
claim,
|
claim,
|
||||||
location,
|
location,
|
||||||
userHasPremiumPlus,
|
hasPremiumPlus,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const claimId: ?string = claim && claim.claim_id;
|
const claimId: ?string = claim && claim.claim_id;
|
||||||
const injectAds = SHOW_ADS && IS_WEB && !userHasPremiumPlus;
|
const injectAds = SHOW_ADS && IS_WEB && !hasPremiumPlus;
|
||||||
|
|
||||||
function claimContainsBlockedWords(claim: ?StreamClaim) {
|
function claimContainsBlockedWords(claim: ?StreamClaim) {
|
||||||
if (BLOCKED_WORDS) {
|
if (BLOCKED_WORDS) {
|
||||||
|
@ -77,7 +77,7 @@ export default React.memo<Props>(function RecommendedContent(props: Props) {
|
||||||
const { onRecsLoaded: onRecommendationsLoaded, onClickedRecommended: onRecommendationClicked } = RecSys;
|
const { onRecsLoaded: onRecommendationsLoaded, onClickedRecommended: onRecommendationClicked } = RecSys;
|
||||||
|
|
||||||
const InjectedAd =
|
const InjectedAd =
|
||||||
injectAds && !blacklistTriggered
|
injectAds && !blacklistTriggered && !hasPremiumPlus
|
||||||
? {
|
? {
|
||||||
node: <Ads small type="video" className="ads__claim-item--recommended" noFallback />,
|
node: <Ads small type="video" className="ads__claim-item--recommended" noFallback />,
|
||||||
index: isMobile ? 0 : 3,
|
index: isMobile ? 0 : 3,
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { selectActiveLivestreams } from 'redux/selectors/livestream';
|
||||||
import { selectFollowedTags } from 'redux/selectors/tags';
|
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 { selectOdyseeMembershipIsPremiumPlus } from 'redux/selectors/user';
|
||||||
import DiscoverPage from './view';
|
import DiscoverPage from './view';
|
||||||
|
|
||||||
const select = (state, props) => {
|
const select = (state, props) => {
|
||||||
|
@ -23,6 +24,7 @@ const select = (state, props) => {
|
||||||
activeLivestreams: selectActiveLivestreams(state),
|
activeLivestreams: selectActiveLivestreams(state),
|
||||||
languageSetting: selectLanguage(state),
|
languageSetting: selectLanguage(state),
|
||||||
searchInLanguage: selectClientSetting(state, SETTINGS.SEARCH_IN_LANGUAGE),
|
searchInLanguage: selectClientSetting(state, SETTINGS.SEARCH_IN_LANGUAGE),
|
||||||
|
hasPremiumPlus: selectOdyseeMembershipIsPremiumPlus(state),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ type Props = {
|
||||||
tileLayout: boolean,
|
tileLayout: boolean,
|
||||||
activeLivestreams: ?LivestreamInfo,
|
activeLivestreams: ?LivestreamInfo,
|
||||||
doFetchActiveLivestreams: (orderBy: ?Array<string>, lang: ?Array<string>) => void,
|
doFetchActiveLivestreams: (orderBy: ?Array<string>, lang: ?Array<string>) => void,
|
||||||
|
hasPremiumPlus: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
function DiscoverPage(props: Props) {
|
function DiscoverPage(props: Props) {
|
||||||
|
@ -51,6 +52,7 @@ function DiscoverPage(props: Props) {
|
||||||
activeLivestreams,
|
activeLivestreams,
|
||||||
doFetchActiveLivestreams,
|
doFetchActiveLivestreams,
|
||||||
dynamicRouteProps,
|
dynamicRouteProps,
|
||||||
|
hasPremiumPlus,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const buttonRef = useRef();
|
const buttonRef = useRef();
|
||||||
|
@ -221,7 +223,7 @@ function DiscoverPage(props: Props) {
|
||||||
tags={tags}
|
tags={tags}
|
||||||
hiddenNsfwMessage={<HiddenNsfw type="page" />}
|
hiddenNsfwMessage={<HiddenNsfw type="page" />}
|
||||||
repostedClaimId={repostedClaim ? repostedClaim.claim_id : null}
|
repostedClaimId={repostedClaim ? repostedClaim.claim_id : null}
|
||||||
injectedItem={!isWildWest && { node: <Ads small type="video" tileLayout /> }}
|
injectedItem={!isWildWest && !hasPremiumPlus && { node: <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
|
||||||
// for now including && !tags so that
|
// for now including && !tags so that
|
||||||
releaseTime={releaseTime || undefined}
|
releaseTime={releaseTime || undefined}
|
||||||
|
|
|
@ -4,7 +4,12 @@ import { doOpenModal } from 'redux/actions/app';
|
||||||
import { doFetchActiveLivestreams } from 'redux/actions/livestream';
|
import { doFetchActiveLivestreams } from 'redux/actions/livestream';
|
||||||
import { selectActiveLivestreams, selectFetchingActiveLivestreams } from 'redux/selectors/livestream';
|
import { selectActiveLivestreams, selectFetchingActiveLivestreams } from 'redux/selectors/livestream';
|
||||||
import { selectFollowedTags } from 'redux/selectors/tags';
|
import { selectFollowedTags } from 'redux/selectors/tags';
|
||||||
import { selectHasOdyseeMembership, selectHomepageFetched, selectUserVerifiedEmail } from 'redux/selectors/user';
|
import {
|
||||||
|
selectOdyseeMembershipIsPremiumPlus,
|
||||||
|
selectHasOdyseeMembership,
|
||||||
|
selectHomepageFetched,
|
||||||
|
selectUserVerifiedEmail,
|
||||||
|
} from 'redux/selectors/user';
|
||||||
import { selectSubscriptions } from 'redux/selectors/subscriptions';
|
import { selectSubscriptions } from 'redux/selectors/subscriptions';
|
||||||
import {
|
import {
|
||||||
selectShowMatureContent,
|
selectShowMatureContent,
|
||||||
|
@ -28,6 +33,7 @@ const select = (state) => ({
|
||||||
hideScheduledLivestreams: selectClientSetting(state, SETTINGS.HIDE_SCHEDULED_LIVESTREAMS),
|
hideScheduledLivestreams: selectClientSetting(state, SETTINGS.HIDE_SCHEDULED_LIVESTREAMS),
|
||||||
homepageOrder: selectClientSetting(state, SETTINGS.HOMEPAGE_ORDER),
|
homepageOrder: selectClientSetting(state, SETTINGS.HOMEPAGE_ORDER),
|
||||||
hasMembership: selectHasOdyseeMembership(state),
|
hasMembership: selectHasOdyseeMembership(state),
|
||||||
|
hasPremiumPlus: selectOdyseeMembershipIsPremiumPlus(state),
|
||||||
});
|
});
|
||||||
|
|
||||||
const perform = (dispatch) => ({
|
const perform = (dispatch) => ({
|
||||||
|
|
|
@ -45,6 +45,7 @@ type Props = {
|
||||||
homepageOrder: HomepageOrder,
|
homepageOrder: HomepageOrder,
|
||||||
doOpenModal: (id: string, ?{}) => void,
|
doOpenModal: (id: string, ?{}) => void,
|
||||||
hasMembership: ?boolean,
|
hasMembership: ?boolean,
|
||||||
|
hasPremiumPlus: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
function HomePage(props: Props) {
|
function HomePage(props: Props) {
|
||||||
|
@ -63,6 +64,7 @@ function HomePage(props: Props) {
|
||||||
homepageOrder,
|
homepageOrder,
|
||||||
doOpenModal,
|
doOpenModal,
|
||||||
hasMembership,
|
hasMembership,
|
||||||
|
hasPremiumPlus,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const showPersonalizedChannels = (authenticated || !IS_WEB) && subscribedChannels && subscribedChannels.length > 0;
|
const showPersonalizedChannels = (authenticated || !IS_WEB) && subscribedChannels && subscribedChannels.length > 0;
|
||||||
|
@ -160,7 +162,7 @@ function HomePage(props: Props) {
|
||||||
hasSource
|
hasSource
|
||||||
prefixUris={getLivestreamUris(activeLivestreams, options.channelIds)}
|
prefixUris={getLivestreamUris(activeLivestreams, options.channelIds)}
|
||||||
pins={{ urls: pinUrls, claimIds: pinnedClaimIds }}
|
pins={{ urls: pinUrls, claimIds: pinnedClaimIds }}
|
||||||
injectedItem={index === 0 && { node: <Ads small type="video" tileLayout /> }}
|
injectedItem={index === 0 && !hasPremiumPlus && { node: <Ads small type="video" tileLayout /> }}
|
||||||
forceShowReposts={id !== 'FOLLOWING'}
|
forceShowReposts={id !== 'FOLLOWING'}
|
||||||
loading={id === 'FOLLOWING' ? fetchingActiveLivestreams : false}
|
loading={id === 'FOLLOWING' ? fetchingActiveLivestreams : false}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -9,11 +9,13 @@ import {
|
||||||
} from 'redux/selectors/search';
|
} from 'redux/selectors/search';
|
||||||
import { selectShowMatureContent } from 'redux/selectors/settings';
|
import { selectShowMatureContent } from 'redux/selectors/settings';
|
||||||
import { getSearchQueryString } from 'util/query-params';
|
import { getSearchQueryString } from 'util/query-params';
|
||||||
|
import { selectOdyseeMembershipIsPremiumPlus } from 'redux/selectors/user';
|
||||||
import SearchPage from './view';
|
import SearchPage from './view';
|
||||||
|
|
||||||
const select = (state, props) => {
|
const select = (state, props) => {
|
||||||
const showMature = selectShowMatureContent(state);
|
const showMature = selectShowMatureContent(state);
|
||||||
const urlParams = new URLSearchParams(props.location.search);
|
const urlParams = new URLSearchParams(props.location.search);
|
||||||
|
const hasPremiumPlus = selectOdyseeMembershipIsPremiumPlus(state);
|
||||||
|
|
||||||
let urlQuery = urlParams.get('q') || null;
|
let urlQuery = urlParams.get('q') || null;
|
||||||
if (urlQuery) {
|
if (urlQuery) {
|
||||||
|
@ -36,6 +38,7 @@ const select = (state, props) => {
|
||||||
isSearching: selectIsSearching(state),
|
isSearching: selectIsSearching(state),
|
||||||
uris: uris,
|
uris: uris,
|
||||||
hasReachedMaxResultsLength: hasReachedMaxResultsLength,
|
hasReachedMaxResultsLength: hasReachedMaxResultsLength,
|
||||||
|
hasPremiumPlus: hasPremiumPlus,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,11 @@ type Props = {
|
||||||
uris: Array<string>,
|
uris: Array<string>,
|
||||||
isAuthenticated: boolean,
|
isAuthenticated: boolean,
|
||||||
hasReachedMaxResultsLength: boolean,
|
hasReachedMaxResultsLength: boolean,
|
||||||
|
hasPremiumPlus: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function SearchPage(props: Props) {
|
export default function SearchPage(props: Props) {
|
||||||
const { urlQuery, searchOptions, search, uris, isSearching, hasReachedMaxResultsLength } = props;
|
const { urlQuery, searchOptions, search, uris, isSearching, hasReachedMaxResultsLength, hasPremiumPlus } = props;
|
||||||
const { push } = useHistory();
|
const { push } = useHistory();
|
||||||
const [from, setFrom] = React.useState(0);
|
const [from, setFrom] = React.useState(0);
|
||||||
|
|
||||||
|
@ -103,7 +104,7 @@ export default function SearchPage(props: Props) {
|
||||||
onSearchOptionsChanged={resetPage}
|
onSearchOptionsChanged={resetPage}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
injectedItem={{ node: <Ads small type="video" />, index: 3 }}
|
injectedItem={!hasPremiumPlus && { node: <Ads small type="video" />, index: 3 }}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="main--empty help">{__('These search results are provided by Odysee.')}</div>
|
<div className="main--empty help">{__('These search results are provided by Odysee.')}</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue