File downloads and refactoring #3918

Merged
kauffj merged 6 commits from file_downloads_and_refactoring into master 2020-04-01 20:43:50 +02:00
3 changed files with 5 additions and 7 deletions
Showing only changes of commit 700bc17bb1 - Show all commits

View file

@ -91,7 +91,6 @@ export default function FloatingViewer(props: Props) {
}, [isNewView, uri]); }, [isNewView, uri]);
useEffect(() => { useEffect(() => {
console.log('effect');
if (playTime && isReadyToPlay && !hasRecordedView) { if (playTime && isReadyToPlay && !hasRecordedView) {
const timeToStart = Date.now() - playTime; const timeToStart = Date.now() - playTime;
triggerAnalyticsView(uri, timeToStart).then(() => { triggerAnalyticsView(uri, timeToStart).then(() => {

View file

@ -74,7 +74,7 @@ class FilePage extends React.Component<Props> {
markSubscriptionRead(channelUri, uri); markSubscriptionRead(channelUri, uri);
} }
renderFilePageLayout(uri, mode, cost) { renderFilePageLayout(uri: string, mode: string, cost: ?number) {
if (RENDER_MODES.FLOATING_MODES.includes(mode)) { if (RENDER_MODES.FLOATING_MODES.includes(mode)) {
return ( return (
<React.Fragment> <React.Fragment>

View file

@ -13,14 +13,12 @@ import {
selectBlockedChannels, selectBlockedChannels,
parseURI, parseURI,
makeSelectContentTypeForUri, makeSelectContentTypeForUri,
makeSelectUriIsStreamable,
makeSelectFileNameForUri, makeSelectFileNameForUri,
} from 'lbry-redux'; } from 'lbry-redux';
import { selectAllCostInfoByUri, makeSelectCostInfoForUri } from 'lbryinc'; import { selectAllCostInfoByUri, makeSelectCostInfoForUri } from 'lbryinc';
import { selectShowMatureContent } from 'redux/selectors/settings'; import { selectShowMatureContent } from 'redux/selectors/settings';
import * as RENDER_MODES from 'constants/file_render_modes'; import * as RENDER_MODES from 'constants/file_render_modes';
import path from 'path'; import path from 'path';
import React from 'react';
import { FORCE_CONTENT_TYPE_PLAYER } from 'constants/claim'; import { FORCE_CONTENT_TYPE_PLAYER } from 'constants/claim';
// @if TARGET='web' // @if TARGET='web'
import { generateStreamUrl } from 'util/lbrytv'; import { generateStreamUrl } from 'util/lbrytv';
@ -147,14 +145,15 @@ export const makeSelectFileExtensionForUri = (uri: string) =>
return fileName && path.extname(fileName).substring(1); return fileName && path.extname(fileName).substring(1);
}); });
let makeSelectStreamingUrlForUriWebProxy;
// @if TARGET='web' // @if TARGET='web'
export const makeSelectStreamingUrlForUriWebProxy = (uri: string) => makeSelectStreamingUrlForUriWebProxy = (uri: string) =>
createSelector(makeSelectClaimForUri(uri), claim => (claim ? generateStreamUrl(claim.name, claim.claim_id) : null)); createSelector(makeSelectClaimForUri(uri), claim => (claim ? generateStreamUrl(claim.name, claim.claim_id) : null));
// @endif // @endif
// @if TARGET='app' // @if TARGET='app'
export const makeSelectStreamingUrlForUriWebProxy = (uri: string) => makeSelectStreamingUrlForUriWebProxy = (uri: string) => createSelector(makeSelectStreamingUrlForUri(uri), url => url);
createSelector(makeSelectStreamingUrlForUri, url => url);
// @endif // @endif
export { makeSelectStreamingUrlForUriWebProxy };
export const makeSelectFileRenderModeForUri = (uri: string) => export const makeSelectFileRenderModeForUri = (uri: string) =>
createSelector( createSelector(