diff --git a/app/src/page/file/index.js b/app/src/page/file/index.js index 8a82abed..18b5bde9 100644 --- a/app/src/page/file/index.js +++ b/app/src/page/file/index.js @@ -9,7 +9,7 @@ import { selectRewardContentClaimIds, makeSelectCostInfoForUri } from 'lbry-redux'; -import { doDeleteFile } from '../../redux/actions/file'; +import { doDeleteFile, doStopDownloadingFile } from '../../redux/actions/file'; import FilePage from './view'; const select = (state, props) => { @@ -29,6 +29,7 @@ const select = (state, props) => { const perform = dispatch => ({ fetchFileInfo: uri => dispatch(doFetchFileInfo(uri)), fetchCostInfo: uri => dispatch(doFetchCostInfoForUri(uri)), + stopDownload: (uri, fileInfo) => dispatch(doStopDownloadingFile(uri, fileInfo)), deleteFile: (fileInfo, deleteFromDevice, abandonClaim) => { dispatch(doDeleteFile(fileInfo, deleteFromDevice, abandonClaim)); }, diff --git a/app/src/page/file/view.js b/app/src/page/file/view.js index 8327b513..3bf6955b 100644 --- a/app/src/page/file/view.js +++ b/app/src/page/file/view.js @@ -76,6 +76,20 @@ class FilePage extends React.PureComponent { ); } + onStopDownloadPressed = () => { + const { deleteFile, stopDownload, fileInfo, navigation } = this.props; + + Alert.alert( + 'Stop download', + 'Are you sure you want to stop downloading this file?', + [ + { text: 'No' }, + { text: 'Yes', onPress: () => { stopDownload(navigation.state.params.uri, fileInfo); } } + ], + { cancelable: true } + ); + } + componentWillUnmount() { StatusBar.setHidden(false); if (NativeModules.ScreenOrientation) { @@ -128,7 +142,7 @@ class FilePage extends React.PureComponent { { showActions && {completed &&