auto claim eligible rewards after viewing a file

This commit is contained in:
Akinwale Ariwodola 2019-09-11 12:44:44 +01:00
parent 6ce143b145
commit d63253cc30
2 changed files with 6 additions and 1 deletions

View file

@ -25,6 +25,7 @@ import {
selectPurchaseUriErrorMessage, selectPurchaseUriErrorMessage,
} from 'lbry-redux'; } from 'lbry-redux';
import { import {
doClaimEligiblePurchaseRewards,
doFetchCostInfoForUri, doFetchCostInfoForUri,
makeSelectCostInfoForUri, makeSelectCostInfoForUri,
selectRewardContentClaimIds, selectRewardContentClaimIds,
@ -69,6 +70,7 @@ const select = (state, props) => {
}; };
const perform = dispatch => ({ const perform = dispatch => ({
claimEligibleRewards: () => dispatch(doClaimEligiblePurchaseRewards()),
deleteFile: (fileInfo, deleteFromDevice, abandonClaim) => { deleteFile: (fileInfo, deleteFromDevice, abandonClaim) => {
dispatch(doDeleteFile(fileInfo, deleteFromDevice, abandonClaim)); dispatch(doDeleteFile(fileInfo, deleteFromDevice, abandonClaim));
}, },

View file

@ -477,6 +477,7 @@ class FilePage extends React.PureComponent {
return; return;
} }
const { claimEligibleRewards } = this.props;
const { nout, claim_id: claimId, txid } = claim; const { nout, claim_id: claimId, txid } = claim;
const outpoint = `${txid}:${nout}`; const outpoint = `${txid}:${nout}`;
const params = { const params = {
@ -488,7 +489,9 @@ class FilePage extends React.PureComponent {
params.time_to_start = timeToStart; params.time_to_start = timeToStart;
} }
Lbryio.call('file', 'view', params).catch(() => {}); Lbryio.call('file', 'view', params)
.then(() => claimEligibleRewards())
.catch(() => {});
this.setState({ fileViewLogged: true }); this.setState({ fileViewLogged: true });
}; };