diff --git a/src/page/file/index.js b/src/page/file/index.js index ec40d19..c82536f 100644 --- a/src/page/file/index.js +++ b/src/page/file/index.js @@ -1,5 +1,6 @@ import { connect } from 'react-redux'; import { + doAbandonClaim, doFetchFileInfo, doFetchChannelListMine, doFetchClaimListMine, @@ -73,6 +74,7 @@ const select = (state, props) => { }; const perform = dispatch => ({ + abandonClaim: (txid, nout) => dispatch(doAbandonClaim(txid, nout)), 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 36a0d63..8ab5f85 100644 --- a/src/page/file/view.js +++ b/src/page/file/view.js @@ -240,7 +240,7 @@ class FilePage extends React.PureComponent { }; onDeletePressed = () => { - const { claim, deleteFile, deletePurchasedUri, fileInfo, navigation } = this.props; + const { abandonClaim, claim, deleteFile, deletePurchasedUri, myClaimUris, fileInfo, navigation } = this.props; Alert.alert( 'Delete file', @@ -262,6 +262,16 @@ class FilePage extends React.PureComponent { mediaLoaded: false, stopDownloadConfirmed: false, }); + + if (claim) { + const fullUri = normalizeURI(`${claim.name}#${claim.claim_id}`); + const ownedClaim = myClaimUris.includes(fullUri); + if (ownedClaim) { + const { txid, nout } = claim; + abandonClaim(txid, nout); + navigation.navigate({ routeName: Constants.DRAWER_ROUTE_PUBLISHES }); + } + } }, }, ], @@ -874,11 +884,11 @@ class FilePage extends React.PureComponent { /> )} - {completed && ( + {(completed || canEdit) && (