From df3a9587c04a7730338d835b2ecad066855ca1af Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Fri, 17 Jan 2020 06:43:02 +0100 Subject: [PATCH] update fileGetStarted logic --- src/page/file/view.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/page/file/view.js b/src/page/file/view.js index e3f96c3..8a6c083 100644 --- a/src/page/file/view.js +++ b/src/page/file/view.js @@ -196,16 +196,18 @@ class FilePage extends React.PureComponent { const mediaType = Lbry.getMediaType(contentType); const isPlayable = mediaType === 'video' || mediaType === 'audio'; if (this.state.fileGetStarted || prevPurchasedUris.length !== purchasedUris.length) { - const { permanent_url: permanentUrl } = claim; - if (purchasedUris.includes(uri) || purchasedUris.includes(permanentUrl)) { - const { nout, txid } = claim; - const outpoint = `${txid}:${nout}`; + const { permanent_url: permanentUrl, nout, txid } = claim; + const outpoint = `${txid}:${nout}`; + if (this.state.fileGetStarted) { NativeModules.UtilityModule.queueDownload(outpoint); + this.setState({ fileGetStarted: false }); + } + + if (purchasedUris.includes(uri) || purchasedUris.includes(permanentUrl)) { // If the media is playable, file/view will be done in onPlaybackStarted if (!isPlayable && !this.state.fileViewLogged) { this.logFileView(uri, claim); } - this.setState({ fileGetStarted: false }); } NativeModules.UtilityModule.checkDownloads(); }