2017-06-06 23:19:12 +02:00
|
|
|
import React from "react";
|
|
|
|
import { connect } from "react-redux";
|
|
|
|
import { doCloseModal } from "actions/app";
|
2017-08-25 21:05:00 +02:00
|
|
|
import { doNavigate, doChangeVolume } from "actions/app";
|
|
|
|
import { selectCurrentModal, selectVolume } from "selectors/app";
|
2017-06-06 23:19:12 +02:00
|
|
|
import { doPurchaseUri, doLoadVideo } from "actions/content";
|
2017-04-23 11:56:50 +02:00
|
|
|
import {
|
2017-05-31 19:36:38 +02:00
|
|
|
makeSelectMetadataForUri,
|
|
|
|
makeSelectContentTypeForUri,
|
2017-06-06 23:19:12 +02:00
|
|
|
} from "selectors/claims";
|
2017-05-15 05:50:59 +02:00
|
|
|
import {
|
|
|
|
makeSelectFileInfoForUri,
|
|
|
|
makeSelectLoadingForUri,
|
|
|
|
makeSelectDownloadingForUri,
|
2017-06-06 23:19:12 +02:00
|
|
|
} from "selectors/file_info";
|
|
|
|
import { makeSelectCostInfoForUri } from "selectors/cost_info";
|
2017-06-28 09:12:01 +02:00
|
|
|
import { selectShowNsfw } from "selectors/settings";
|
2017-06-06 23:19:12 +02:00
|
|
|
import Video from "./view";
|
2017-05-15 05:50:59 +02:00
|
|
|
|
|
|
|
const makeSelect = () => {
|
2017-06-06 23:19:12 +02:00
|
|
|
const selectCostInfo = makeSelectCostInfoForUri();
|
|
|
|
const selectFileInfo = makeSelectFileInfoForUri();
|
|
|
|
const selectIsLoading = makeSelectLoadingForUri();
|
|
|
|
const selectIsDownloading = makeSelectDownloadingForUri();
|
|
|
|
const selectMetadata = makeSelectMetadataForUri();
|
|
|
|
const selectContentType = makeSelectContentTypeForUri();
|
2017-05-15 05:50:59 +02:00
|
|
|
|
|
|
|
const select = (state, props) => ({
|
|
|
|
costInfo: selectCostInfo(state, props),
|
|
|
|
fileInfo: selectFileInfo(state, props),
|
|
|
|
metadata: selectMetadata(state, props),
|
2017-06-28 09:12:01 +02:00
|
|
|
obscureNsfw: !selectShowNsfw(state),
|
2017-05-15 05:50:59 +02:00
|
|
|
modal: selectCurrentModal(state),
|
|
|
|
isLoading: selectIsLoading(state, props),
|
|
|
|
isDownloading: selectIsDownloading(state, props),
|
2017-05-31 19:36:38 +02:00
|
|
|
contentType: selectContentType(state, props),
|
2017-08-25 21:05:00 +02:00
|
|
|
volume: selectVolume(state, props),
|
2017-06-06 23:19:12 +02:00
|
|
|
});
|
2017-05-15 05:50:59 +02:00
|
|
|
|
2017-06-06 23:19:12 +02:00
|
|
|
return select;
|
2017-06-06 06:21:55 +02:00
|
|
|
};
|
2017-04-23 11:56:50 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
const perform = dispatch => ({
|
2017-06-06 23:19:12 +02:00
|
|
|
loadVideo: uri => dispatch(doLoadVideo(uri)),
|
|
|
|
purchaseUri: uri => dispatch(doPurchaseUri(uri, "affirmPurchaseAndPlay")),
|
2017-04-23 11:56:50 +02:00
|
|
|
closeModal: () => dispatch(doCloseModal()),
|
2017-08-25 21:05:00 +02:00
|
|
|
changeVolume: volume => dispatch(doChangeVolume(volume)),
|
2017-06-06 06:21:55 +02:00
|
|
|
});
|
2017-04-23 11:56:50 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
export default connect(makeSelect, perform)(Video);
|