From 1bd625f0c6e9e36d14eb0c520a3eb99f9600705d Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Wed, 14 Aug 2019 13:51:30 -0400 Subject: [PATCH] actually check if something's been downloaded --- dist/bundle.es.js | 9 +++------ src/redux/selectors/file_info.js | 12 ++++-------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index aeb5956..baa40ce 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -2625,15 +2625,12 @@ const makeSelectDownloadPathForUri = uri => reselect.createSelector(makeSelectFi return fileInfo && fileInfo.download_path; }); -const makeSelectFilePartlyDownloaded = uri => reselect.createSelector(selectFileInfosByOutpoint, makeSelectClaimForUri(uri), (downloadsByOutpoint, claim) => { - if (!claim) { +const makeSelectFilePartlyDownloaded = uri => reselect.createSelector(makeSelectFileInfoForUri(uri), fileInfo => { + if (!fileInfo) { return false; } - const { txid, nout } = claim; - const outpoint = `${txid}:${nout}`; - const isDownloaded = downloadsByOutpoint[outpoint]; - return isDownloaded; + return fileInfo.written_bytes > 0 || fileInfo.blobs_completed > 0; }); const makeSelectFileNameForUri = uri => reselect.createSelector(makeSelectFileInfoForUri(uri), fileInfo => { diff --git a/src/redux/selectors/file_info.js b/src/redux/selectors/file_info.js index 25af571..c36bd76 100644 --- a/src/redux/selectors/file_info.js +++ b/src/redux/selectors/file_info.js @@ -285,17 +285,13 @@ export const makeSelectDownloadPathForUri = uri => export const makeSelectFilePartlyDownloaded = uri => createSelector( - selectFileInfosByOutpoint, - makeSelectClaimForUri(uri), - (downloadsByOutpoint, claim) => { - if (!claim) { + makeSelectFileInfoForUri(uri), + fileInfo => { + if (!fileInfo) { return false; } - const { txid, nout } = claim; - const outpoint = `${txid}:${nout}`; - const isDownloaded = downloadsByOutpoint[outpoint]; - return isDownloaded; + return fileInfo.written_bytes > 0 || fileInfo.blobs_completed > 0; } );