2017-12-21 22:08:54 +01:00
|
|
|
import { connect } from 'react-redux';
|
2017-09-08 05:15:05 +02:00
|
|
|
import {
|
|
|
|
makeSelectFileInfoForUri,
|
|
|
|
makeSelectDownloadingForUri,
|
|
|
|
makeSelectLoadingForUri,
|
2018-08-22 19:17:11 +02:00
|
|
|
makeSelectClaimForUri,
|
2018-04-18 06:03:01 +02:00
|
|
|
} from 'lbry-redux';
|
2019-03-12 20:53:55 +01:00
|
|
|
import { makeSelectCostInfoForUri } from 'lbryinc';
|
2018-04-18 06:03:01 +02:00
|
|
|
import { doOpenFileInShell } from 'redux/actions/file';
|
2018-07-31 15:29:28 +02:00
|
|
|
import { doPurchaseUri, doStartDownload, doSetPlayingUri } from 'redux/actions/content';
|
2017-12-21 22:08:54 +01:00
|
|
|
import FileDownloadLink from './view';
|
2017-09-08 05:15:05 +02:00
|
|
|
|
|
|
|
const select = (state, props) => ({
|
|
|
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
2017-12-13 22:36:30 +01:00
|
|
|
/* availability check is disabled due to poor performance, TBD if it dies forever or requires daemon fix */
|
2017-09-08 05:15:05 +02:00
|
|
|
downloading: makeSelectDownloadingForUri(props.uri)(state),
|
|
|
|
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
|
|
|
loading: makeSelectLoadingForUri(props.uri)(state),
|
2018-08-22 19:17:11 +02:00
|
|
|
claim: makeSelectClaimForUri(props.uri)(state),
|
2017-09-08 05:15:05 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
const perform = dispatch => ({
|
2017-09-20 14:47:08 +02:00
|
|
|
openInShell: path => dispatch(doOpenFileInShell(path)),
|
2017-09-18 04:08:43 +02:00
|
|
|
purchaseUri: uri => dispatch(doPurchaseUri(uri)),
|
2017-09-08 05:15:05 +02:00
|
|
|
restartDownload: (uri, outpoint) => dispatch(doStartDownload(uri, outpoint)),
|
2018-07-31 15:29:28 +02:00
|
|
|
pause: () => dispatch(doSetPlayingUri(null)),
|
2017-09-08 05:15:05 +02:00
|
|
|
});
|
|
|
|
|
2018-08-22 19:17:11 +02:00
|
|
|
export default connect(
|
|
|
|
select,
|
|
|
|
perform
|
|
|
|
)(FileDownloadLink);
|