2017-09-08 05:15:05 +02:00
|
|
|
import React from "react";
|
|
|
|
import { connect } from "react-redux";
|
|
|
|
import {
|
|
|
|
makeSelectFileInfoForUri,
|
|
|
|
makeSelectDownloadingForUri,
|
|
|
|
makeSelectLoadingForUri,
|
2017-11-13 22:02:23 +01:00
|
|
|
} from "redux/selectors/file_info";
|
|
|
|
import { makeSelectCostInfoForUri } from "redux/selectors/cost_info";
|
|
|
|
import { doFetchAvailability } from "redux/actions/availability";
|
|
|
|
import { doOpenFileInShell } from "redux/actions/file_info";
|
|
|
|
import { doPurchaseUri, doStartDownload } from "redux/actions/content";
|
2017-12-21 00:38:11 +01:00
|
|
|
import { doPause } from "redux/actions/media";
|
2017-09-08 05:15:05 +02:00
|
|
|
import FileDownloadLink from "./view";
|
|
|
|
|
|
|
|
const select = (state, props) => ({
|
|
|
|
fileInfo: makeSelectFileInfoForUri(props.uri)(state),
|
|
|
|
/*availability check is disabled due to poor performance, TBD if it dies forever or requires daemon fix*/
|
|
|
|
downloading: makeSelectDownloadingForUri(props.uri)(state),
|
|
|
|
costInfo: makeSelectCostInfoForUri(props.uri)(state),
|
|
|
|
loading: makeSelectLoadingForUri(props.uri)(state),
|
|
|
|
});
|
|
|
|
|
|
|
|
const perform = dispatch => ({
|
|
|
|
checkAvailability: uri => dispatch(doFetchAvailability(uri)),
|
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)),
|
2017-12-21 00:38:11 +01:00
|
|
|
doPause: () => dispatch(doPause()),
|
2017-09-08 05:15:05 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(select, perform)(FileDownloadLink);
|