2019-08-13 07:35:13 +02:00
|
|
|
import * as SETTINGS from 'constants/settings';
|
2017-12-21 22:08:54 +01:00
|
|
|
import { connect } from 'react-redux';
|
2020-04-01 20:43:50 +02:00
|
|
|
import { makeSelectFileInfoForUri, makeSelectTitleForUri } from 'lbry-redux';
|
2019-08-15 16:26:20 +02:00
|
|
|
import { doClaimEligiblePurchaseRewards } from 'lbryinc';
|
2020-01-06 21:57:49 +01:00
|
|
|
import {
|
|
|
|
makeSelectIsPlaying,
|
|
|
|
selectPlayingUri,
|
2020-04-01 20:43:50 +02:00
|
|
|
makeSelectFileRenderModeForUri,
|
|
|
|
makeSelectStreamingUrlForUriWebProxy,
|
2020-01-06 21:57:49 +01:00
|
|
|
} from 'redux/selectors/content';
|
2019-08-13 07:35:13 +02:00
|
|
|
import { makeSelectClientSetting } from 'redux/selectors/settings';
|
|
|
|
import { doSetPlayingUri } from 'redux/actions/content';
|
|
|
|
import { withRouter } from 'react-router';
|
2019-08-14 05:04:08 +02:00
|
|
|
import { doAnalyticsView } from 'redux/actions/app';
|
2020-04-01 20:43:50 +02:00
|
|
|
import FileRenderFloating from './view';
|
2017-05-15 05:50:59 +02:00
|
|
|
|
2019-08-13 07:35:13 +02:00
|
|
|
const select = (state, props) => {
|
|
|
|
const uri = selectPlayingUri(state);
|
|
|
|
return {
|
|
|
|
uri,
|
|
|
|
title: makeSelectTitleForUri(uri)(state),
|
|
|
|
fileInfo: makeSelectFileInfoForUri(uri)(state),
|
|
|
|
isPlaying: makeSelectIsPlaying(uri)(state),
|
2020-04-01 20:43:50 +02:00
|
|
|
streamingUrl: makeSelectStreamingUrlForUriWebProxy(uri)(state),
|
2019-08-13 07:35:13 +02:00
|
|
|
floatingPlayerEnabled: makeSelectClientSetting(SETTINGS.FLOATING_PLAYER)(state),
|
2020-04-01 20:43:50 +02:00
|
|
|
renderMode: makeSelectFileRenderModeForUri(uri)(state),
|
2019-08-13 07:35:13 +02:00
|
|
|
};
|
|
|
|
};
|
2017-04-23 11:56:50 +02:00
|
|
|
|
2017-06-06 06:21:55 +02:00
|
|
|
const perform = dispatch => ({
|
2019-08-13 07:35:13 +02:00
|
|
|
clearPlayingUri: () => dispatch(doSetPlayingUri(null)),
|
2019-08-14 05:04:08 +02:00
|
|
|
triggerAnalyticsView: (uri, timeToStart) => dispatch(doAnalyticsView(uri, timeToStart)),
|
2019-08-15 16:26:20 +02:00
|
|
|
claimRewards: () => dispatch(doClaimEligiblePurchaseRewards()),
|
2017-06-06 06:21:55 +02:00
|
|
|
});
|
2017-04-23 11:56:50 +02:00
|
|
|
|
2020-04-01 20:43:50 +02:00
|
|
|
export default withRouter(connect(select, perform)(FileRenderFloating));
|