Merge pull request #4228 from lbryio/fixEmbedsAfterPaidContent
Fix embeds after paid content
This commit is contained in:
commit
c6b649f2a5
3 changed files with 11 additions and 4 deletions
|
@ -142,7 +142,7 @@ export default function FileRenderInitiator(props: Props) {
|
|||
)}
|
||||
{!disabled && (
|
||||
<Button
|
||||
requiresAuth={IS_WEB}
|
||||
requiresAuth={shouldRedirect}
|
||||
onClick={viewFile}
|
||||
iconSize={30}
|
||||
title={isPlayable ? __('Play') : __('View')}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { connect } from 'react-redux';
|
||||
import EmbedWrapperPage from './view';
|
||||
import { doResolveUri, makeSelectClaimForUri, buildURI } from 'lbry-redux';
|
||||
import { doPlayUri } from 'redux/actions/content';
|
||||
|
||||
const select = (state, props) => {
|
||||
const { match } = props;
|
||||
|
@ -16,6 +17,7 @@ const select = (state, props) => {
|
|||
const perform = dispatch => {
|
||||
return {
|
||||
resolveUri: uri => dispatch(doResolveUri(uri)),
|
||||
doPlayUri: uri => dispatch(doPlayUri(uri)),
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -6,17 +6,22 @@ type Props = {
|
|||
uri: string,
|
||||
resolveUri: string => void,
|
||||
claim: Claim,
|
||||
doPlayUri: string => void,
|
||||
};
|
||||
// $FlowFixMe apparently flow thinks this is wrong.
|
||||
export const EmbedContext = React.createContext();
|
||||
const EmbedWrapperPage = (props: Props) => {
|
||||
const { resolveUri, claim, uri } = props;
|
||||
const { resolveUri, claim, uri, doPlayUri } = props;
|
||||
const haveClaim = Boolean(claim);
|
||||
|
||||
useEffect(() => {
|
||||
if (resolveUri && uri) {
|
||||
if (resolveUri && uri && !haveClaim) {
|
||||
resolveUri(uri);
|
||||
}
|
||||
}, [resolveUri, uri]);
|
||||
if (uri && haveClaim) {
|
||||
doPlayUri(uri);
|
||||
}
|
||||
}, [resolveUri, uri, doPlayUri, haveClaim]);
|
||||
|
||||
return (
|
||||
<div className={'embed__wrapper'}>
|
||||
|
|
Loading…
Reference in a new issue