update fileGetStarted logic

This commit is contained in:
Akinwale Ariwodola 2020-01-17 06:43:02 +01:00
parent 5df8b8c4aa
commit df3a9587c0

View file

@ -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();
}