2017-12-21 18:08:54 -03:00
|
|
|
import { connect } from 'react-redux';
|
2017-09-07 23:15:05 -04:00
|
|
|
import {
|
|
|
|
makeSelectFileInfoForUri,
|
|
|
|
makeSelectDownloadingForUri,
|
|
|
|
makeSelectLoadingForUri,
|
2019-07-04 12:23:22 +01:00
|
|
|
makeSelectClaimIsMine,
|
2020-01-07 13:17:43 -05:00
|
|
|
makeSelectClaimForUri,
|
2020-05-21 11:38:28 -04:00
|
|
|
makeSelectClaimWasPurchased,
|
|
|
|
makeSelectStreamingUrlForUri,
|
2018-04-18 00:03:01 -04:00
|
|
|
} from 'lbry-redux';
|
2020-01-07 14:02:26 -05:00
|
|
|
import { makeSelectCostInfoForUri } from 'lbryinc';
|
2019-11-04 12:09:11 -05:00
|
|
|
import { doOpenModal, doAnalyticsView } from 'redux/actions/app';
|
2019-08-05 23:25:33 -04:00
|
|
|
import { doSetPlayingUri, doPlayUri } from 'redux/actions/content';
|
2017-12-21 18:08:54 -03:00
|
|
|
import FileDownloadLink from './view';
|
2017-09-07 23:15:05 -04:00
|
|
|
|
|
|
|
const select = (state, props) => ({
|
|
|
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
|
|
|
downloading: makeSelectDownloadingForUri(props.uri)(state),
|
|
|
|
loading: makeSelectLoadingForUri(props.uri)(state),
|
2019-07-04 12:23:22 +01:00
|
|
|
claimIsMine: makeSelectClaimIsMine(props.uri)(state),
|
2020-01-07 13:17:43 -05:00
|
|
|
claim: makeSelectClaimForUri(props.uri)(state),
|
2020-01-07 14:02:26 -05:00
|
|
|
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
2020-05-21 11:38:28 -04:00
|
|
|
claimWasPurchased: makeSelectClaimWasPurchased(props.uri)(state),
|
|
|
|
streamingUrl: makeSelectStreamingUrlForUri(props.uri)(state),
|
2017-09-07 23:15:05 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
const perform = dispatch => ({
|
2019-05-12 15:46:14 +01:00
|
|
|
openModal: (modal, props) => dispatch(doOpenModal(modal, props)),
|
2018-07-31 09:29:28 -04:00
|
|
|
pause: () => dispatch(doSetPlayingUri(null)),
|
2019-11-13 10:20:54 -05:00
|
|
|
download: uri => dispatch(doPlayUri(uri, false, true, () => dispatch(doAnalyticsView(uri)))),
|
2017-09-07 23:15:05 -04:00
|
|
|
});
|
|
|
|
|
2020-05-21 11:38:28 -04:00
|
|
|
export default connect(select, perform)(FileDownloadLink);
|