2017-09-20 01:47:57 +08:00
|
|
|
import React from 'react';
|
|
|
|
import { createContainer } from 'meteor/react-meteor-data';
|
|
|
|
import PropTypes from 'prop-types';
|
2017-09-26 04:28:36 +08:00
|
|
|
import { withModalMounter } from '/imports/ui/components/modal/service';
|
2017-09-20 01:47:57 +08:00
|
|
|
import AudioControls from './component';
|
2017-09-26 04:28:36 +08:00
|
|
|
import AudioModal from '../audio-modal/component';
|
2017-09-20 01:47:57 +08:00
|
|
|
import Service from '../service';
|
|
|
|
|
|
|
|
// const propTypes = {
|
|
|
|
// children: PropTypes.element,
|
|
|
|
// };
|
|
|
|
//
|
|
|
|
// const defaultProps = {
|
|
|
|
// children: null,
|
|
|
|
// };
|
|
|
|
|
2017-09-26 04:28:36 +08:00
|
|
|
const AudioControlsContainer = props => <AudioControls {...props} />;
|
2017-09-20 01:47:57 +08:00
|
|
|
|
|
|
|
let didMountAutoJoin = false;
|
|
|
|
|
2017-09-26 04:28:36 +08:00
|
|
|
export default withModalMounter(createContainer(({ mountModal }) => {
|
2017-09-20 01:47:57 +08:00
|
|
|
// const APP_CONFIG = Meteor.settings.public.app;
|
|
|
|
//
|
|
|
|
// const { autoJoinAudio } = APP_CONFIG;
|
|
|
|
// const { isConnected, isConnecting, isListenOnly } = Service.getStats();
|
|
|
|
// let shouldShowMute = isConnected && !isListenOnly;
|
|
|
|
// let shouldShowUnmute = isConnected && !isListenOnly && isMuted;
|
|
|
|
// let shouldShowJoin = !isConnected;
|
|
|
|
|
|
|
|
return {
|
|
|
|
mute: Service.isConnected() && !Service.isListenOnly(),
|
|
|
|
unmute: Service.isConnected() && !Service.isListenOnly() && Service.isMuted(),
|
|
|
|
join: Service.isConnected(),
|
|
|
|
|
|
|
|
handleToggleMuteMicrophone: () => Service.toggleMuteMicrophone(),
|
2017-09-26 04:28:36 +08:00
|
|
|
handleJoinAudio: () => mountModal(<AudioModal handleJoinListenOnly={() => {}} />),
|
|
|
|
handleLeaveAudio: () => Service.exitAudio(),
|
2017-09-20 01:47:57 +08:00
|
|
|
};
|
2017-09-26 04:28:36 +08:00
|
|
|
}, AudioControlsContainer));
|
2017-09-20 01:47:57 +08:00
|
|
|
|
|
|
|
// AudioControlsContainer.propTypes = propTypes;
|
|
|
|
// AudioControlsContainer.defaultProps = defaultProps;
|