From 67aad85f5382bfa601646e6bfdd93890f02295b8 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Fri, 15 Mar 2019 12:15:31 -0400 Subject: [PATCH 1/2] don't call file_list on web --- package.json | 2 +- src/ui/component/fileViewer/view.jsx | 12 ++++++++++-- src/ui/page/file/view.jsx | 6 +++++- src/ui/redux/actions/content.js | 2 ++ yarn.lock | 8 ++++---- 5 files changed, 22 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 644453953b7..30e9ba5e149 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/ui/component/fileViewer/view.jsx b/src/ui/component/fileViewer/view.jsx index 21b3bb1ec17..691f34423f3 100644 --- a/src/ui/component/fileViewer/view.jsx +++ b/src/ui/component/fileViewer/view.jsx @@ -209,7 +209,7 @@ class FileViewer extends React.PureComponent { isLoading, isDownloading, playingUri, - fileInfo, + fileInfo = {}, contentType, changeVolume, volume, @@ -223,9 +223,17 @@ class FileViewer extends React.PureComponent { } = 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)) { diff --git a/src/ui/page/file/view.jsx b/src/ui/page/file/view.jsx index d7b6ba71200..e980c25cba3 100644 --- a/src/ui/page/file/view.jsx +++ b/src/ui/page/file/view.jsx @@ -79,8 +79,10 @@ class FilePage extends React.Component { 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 { 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); diff --git a/src/ui/redux/actions/content.js b/src/ui/redux/actions/content.js index 7a1ea5402fe..b453b8de952 100644 --- a/src/ui/redux/actions/content.js +++ b/src/ui/redux/actions/content.js @@ -342,7 +342,9 @@ export function doFetchClaimsByChannel( export function doPlayUri(uri) { return dispatch => { dispatch(doSetPlayingUri(uri)); + // @if TARGET='app' dispatch(doPurchaseUri(uri)); + // @endif }; } diff --git a/yarn.lock b/yarn.lock index ab1b6b13ba1..f998bdb0ce3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" From cee30476bece0480a145e5493939d826aff23d59 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Fri, 15 Mar 2019 12:17:03 -0400 Subject: [PATCH 2/2] update lbry-redux --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 30e9ba5e149..8f62b3e1e50 100644 --- a/package.json +++ b/package.json @@ -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#c2c85a49674662724c943c83afb6141bb41019b7", + "lbry-redux": "lbryio/lbry-redux#2a7e05940f892f104428eeb37bd1f178da811a09", "lbryinc": "lbryio/lbryinc#351d0a08806b0f770b50066b61a806171f6424d4", "localforage": "^1.7.1", "mammoth": "^1.4.6",