2019-08-13 01:35:13 -04:00
|
|
|
import * as SETTINGS from 'constants/settings';
|
2017-12-21 18:08:54 -03:00
|
|
|
import { connect } from 'react-redux';
|
2017-05-14 23:50:59 -04:00
|
|
|
import {
|
|
|
|
makeSelectFileInfoForUri,
|
2019-04-24 10:02:08 -04:00
|
|
|
makeSelectThumbnailForUri,
|
2019-08-02 02:28:14 -04:00
|
|
|
makeSelectStreamingUrlForUri,
|
|
|
|
makeSelectMediaTypeForUri,
|
2019-11-26 14:08:34 -05:00
|
|
|
makeSelectContentTypeForUri,
|
2019-08-02 02:28:14 -04:00
|
|
|
makeSelectUriIsStreamable,
|
2019-08-13 01:35:13 -04:00
|
|
|
makeSelectTitleForUri,
|
2018-04-18 00:03:01 -04:00
|
|
|
} from 'lbry-redux';
|
2019-08-15 10:26:20 -04:00
|
|
|
import { doClaimEligiblePurchaseRewards } from 'lbryinc';
|
2019-08-13 01:35:13 -04:00
|
|
|
import { makeSelectIsPlaying, makeSelectShouldObscurePreview, selectPlayingUri } from 'redux/selectors/content';
|
|
|
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
|
|
|
import { doSetPlayingUri } from 'redux/actions/content';
|
|
|
|
import { withRouter } from 'react-router';
|
2019-08-13 23:04:08 -04:00
|
|
|
import { doAnalyticsView } from 'redux/actions/app';
|
2018-07-09 21:32:59 -06:00
|
|
|
import FileViewer from './view';
|
2017-05-14 23:50:59 -04:00
|
|
|
|
2019-08-13 01:35:13 -04:00
|
|
|
const select = (state, props) => {
|
|
|
|
const uri = selectPlayingUri(state);
|
|
|
|
return {
|
|
|
|
uri,
|
|
|
|
title: makeSelectTitleForUri(uri)(state),
|
|
|
|
thumbnail: makeSelectThumbnailForUri(uri)(state),
|
|
|
|
mediaType: makeSelectMediaTypeForUri(uri)(state),
|
2019-11-26 14:08:34 -05:00
|
|
|
contentType: makeSelectContentTypeForUri(uri)(state),
|
2019-08-13 01:35:13 -04:00
|
|
|
fileInfo: makeSelectFileInfoForUri(uri)(state),
|
|
|
|
obscurePreview: makeSelectShouldObscurePreview(uri)(state),
|
|
|
|
isPlaying: makeSelectIsPlaying(uri)(state),
|
|
|
|
streamingUrl: makeSelectStreamingUrlForUri(uri)(state),
|
|
|
|
isStreamable: makeSelectUriIsStreamable(uri)(state),
|
|
|
|
floatingPlayerEnabled: makeSelectClientSetting(SETTINGS.FLOATING_PLAYER)(state),
|
|
|
|
};
|
|
|
|
};
|
2017-04-23 16:56:50 +07:00
|
|
|
|
2017-06-05 21:21:55 -07:00
|
|
|
const perform = dispatch => ({
|
2019-08-13 01:35:13 -04:00
|
|
|
clearPlayingUri: () => dispatch(doSetPlayingUri(null)),
|
2019-08-13 23:04:08 -04:00
|
|
|
triggerAnalyticsView: (uri, timeToStart) => dispatch(doAnalyticsView(uri, timeToStart)),
|
2019-08-15 10:26:20 -04:00
|
|
|
claimRewards: () => dispatch(doClaimEligiblePurchaseRewards()),
|
2017-06-05 21:21:55 -07:00
|
|
|
});
|
2017-04-23 16:56:50 +07:00
|
|
|
|
2019-08-13 01:35:13 -04:00
|
|
|
export default withRouter(
|
|
|
|
connect(
|
|
|
|
select,
|
|
|
|
perform
|
|
|
|
)(FileViewer)
|
|
|
|
);
|