don't call file_list on web

This commit is contained in:
Sean Yesmunt 2019-03-15 12:15:31 -04:00
parent 9119d18544
commit 67aad85f53
5 changed files with 22 additions and 8 deletions

View file

@ -59,7 +59,7 @@
"hast-util-sanitize": "^1.1.2",
"keytar": "^4.3.0",
"lbry-format": "https://github.com/lbryio/lbry-format.git",
"lbry-redux": "lbryio/lbry-redux#f140db38dd73cead9e87549340fa9434da62ba8a",
"lbry-redux": "lbryio/lbry-redux#c2c85a49674662724c943c83afb6141bb41019b7",
"lbryinc": "lbryio/lbryinc#351d0a08806b0f770b50066b61a806171f6424d4",
"localforage": "^1.7.1",
"mammoth": "^1.4.6",

View file

@ -209,7 +209,7 @@ class FileViewer extends React.PureComponent<Props> {
isLoading,
isDownloading,
playingUri,
fileInfo,
fileInfo = {},
contentType,
changeVolume,
volume,
@ -223,9 +223,17 @@ class FileViewer extends React.PureComponent<Props> {
} = this.props;
const isPlaying = playingUri === uri;
/* eslint-disable no-redeclare */
// @if TARGET='app'
const isReadyToPlay = fileInfo && fileInfo.download_path && fileInfo.written_bytes > 0;
const shouldObscureNsfw = obscureNsfw && metadata && metadata.nsfw;
// @endif
// @if TARGET='web'
// try to play immediately on web, we don't need to call file_list since we are streaming from reflector
const isReadyToPlay = isPlaying;
// @endif
/* eslint-enable */
const shouldObscureNsfw = obscureNsfw && metadata && metadata.nsfw;
let loadStatusMessage = '';
if (fileInfo && fileInfo.completed && (!fileInfo.download_path || !fileInfo.written_bytes)) {

View file

@ -79,8 +79,10 @@ class FilePage extends React.Component<Props> {
fetchViewCount(claim.claim_id);
}
// always refresh file info when entering file page
// always refresh file info when entering file page to see if we have the file
// @if TARGET='app'
fetchFileInfo(uri);
// @endif
// See https://github.com/lbryio/lbry-desktop/pull/1563 for discussion
fetchCostInfo(uri);
@ -89,9 +91,11 @@ class FilePage extends React.Component<Props> {
componentWillReceiveProps(nextProps: Props) {
const { fetchFileInfo, uri, setViewed } = this.props;
// @if TARGET='app'
if (nextProps.fileInfo === undefined) {
fetchFileInfo(uri);
}
// @endif
if (uri !== nextProps.uri) {
setViewed(nextProps.uri);

View file

@ -342,7 +342,9 @@ export function doFetchClaimsByChannel(
export function doPlayUri(uri) {
return dispatch => {
dispatch(doSetPlayingUri(uri));
// @if TARGET='app'
dispatch(doPurchaseUri(uri));
// @endif
};
}

View file

@ -5972,17 +5972,17 @@ lazy-val@^1.0.3, lazy-val@^1.0.4:
tar-stream "^1.6.2"
zstd-codec "^0.1.1"
lbry-redux@lbryio/lbry-redux#f140db38dd73cead9e87549340fa9434da62ba8a:
lbry-redux@lbryio/lbry-redux#c2c85a49674662724c943c83afb6141bb41019b7:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/f140db38dd73cead9e87549340fa9434da62ba8a"
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/c2c85a49674662724c943c83afb6141bb41019b7"
dependencies:
proxy-polyfill "0.1.6"
reselect "^3.0.0"
uuid "^3.3.2"
lbryinc@lbryio/lbryinc#0f74a896e1b42b86e3143d79398ab27217901b01:
lbryinc@lbryio/lbryinc#351d0a08806b0f770b50066b61a806171f6424d4:
version "0.0.1"
resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/0f74a896e1b42b86e3143d79398ab27217901b01"
resolved "https://codeload.github.com/lbryio/lbryinc/tar.gz/351d0a08806b0f770b50066b61a806171f6424d4"
dependencies:
bluebird "^3.5.1"
reselect "^3.0.0"