From d63253cc30372015378bae987c9d3b1b83261d91 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Wed, 11 Sep 2019 12:44:44 +0100 Subject: [PATCH] auto claim eligible rewards after viewing a file --- src/page/file/index.js | 2 ++ src/page/file/view.js | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/page/file/index.js b/src/page/file/index.js index 79c5e97..f6916ee 100644 --- a/src/page/file/index.js +++ b/src/page/file/index.js @@ -25,6 +25,7 @@ import { selectPurchaseUriErrorMessage, } from 'lbry-redux'; import { + doClaimEligiblePurchaseRewards, doFetchCostInfoForUri, makeSelectCostInfoForUri, selectRewardContentClaimIds, @@ -69,6 +70,7 @@ const select = (state, props) => { }; const perform = dispatch => ({ + claimEligibleRewards: () => dispatch(doClaimEligiblePurchaseRewards()), deleteFile: (fileInfo, deleteFromDevice, abandonClaim) => { dispatch(doDeleteFile(fileInfo, deleteFromDevice, abandonClaim)); }, diff --git a/src/page/file/view.js b/src/page/file/view.js index 8ff225d..45e2233 100644 --- a/src/page/file/view.js +++ b/src/page/file/view.js @@ -477,6 +477,7 @@ class FilePage extends React.PureComponent { return; } + const { claimEligibleRewards } = this.props; const { nout, claim_id: claimId, txid } = claim; const outpoint = `${txid}:${nout}`; const params = { @@ -488,7 +489,9 @@ class FilePage extends React.PureComponent { params.time_to_start = timeToStart; } - Lbryio.call('file', 'view', params).catch(() => {}); + Lbryio.call('file', 'view', params) + .then(() => claimEligibleRewards()) + .catch(() => {}); this.setState({ fileViewLogged: true }); };