Handle audio on refactored modal (#2)

* handle audio on refactored modal

* wrap component with withModalMounter
This commit is contained in:
Anton Georgiev 2017-05-02 13:18:01 -04:00 committed by Oswaldo Acauan
parent d434ba6893
commit 5087e5b24b
6 changed files with 21 additions and 16 deletions

View File

@ -25,9 +25,9 @@ class ActionsBarContainer extends Component {
export default withModalMounter(createContainer(({ mountModal }) => {
const isPresenter = Service.isUserPresenter();
const handleExitAudio = () => AudioService.handleExitAudio();
const handleExitAudio = () => AudioService.exitAudio();
const handleOpenJoinAudio = () =>
mountModal(<AudioModal handleJoinListenOnly={AudioService.handleJoinAudio} />);
mountModal(<AudioModal handleJoinListenOnly={AudioService.joinListenOnly} />);
return {
isUserPresenter: isPresenter,

View File

@ -1,7 +1,7 @@
import React from 'react';
import { defineMessages, injectIntl } from 'react-intl';
import Button from '/imports/ui/components/button/component';
import { clearModal } from '/imports/ui/components/app/service';
import { withModalMounter } from '/imports/ui/components/modal/service';
import styles from '../audio-modal/styles.scss';
import DeviceSelector from '/imports/ui/components/audio/device-selector/component';
@ -41,7 +41,7 @@ class AudioSettings extends React.Component {
handleClose() {
this.setState({ isOpen: false });
clearModal();
this.props.mountModal(null);
}
render() {
@ -153,4 +153,4 @@ const intlMessages = defineMessages({
},
});
export default injectIntl(AudioSettings);
export default withModalMounter(injectIntl(AudioSettings));

View File

@ -1,10 +1,10 @@
import React, { Component } from 'react';
import { createContainer } from 'meteor/react-meteor-data';
import { joinListenOnly, joinMicrophone } from '../service';
import { clearModal } from '/imports/ui/components/app/service';
import AudioService from '../service';
import { withModalMounter } from '/imports/ui/components/modal/service';
import EnterAudio from './component';
export default class EnterAudioContainer extends Component {
class EnterAudioContainer extends Component {
constructor(props) {
super(props);
}
@ -12,11 +12,12 @@ export default class EnterAudioContainer extends Component {
render() {
const {
isFullAudio,
mountModal,
} = this.props;
let handleJoin = () => {
clearModal();
return isFullAudio ? joinMicrophone() : joinListenOnly();
mountModal(null);
return isFullAudio ? AudioService.joinMicrophone() : AudioService.joinListenOnly();
};
return (
@ -24,3 +25,5 @@ export default class EnterAudioContainer extends Component {
);
}
}
export default withModalMounter(EnterAudioContainer);

View File

@ -32,7 +32,7 @@ let exitAudio = () => audioManager.exitAudio();
let joinListenOnly = () => audioManager.joinAudio(true);
let joinMicrophone = () => audioManager.joinAudio(false);
export {
export default {
init,
exitAudio,
joinListenOnly,

View File

@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { defineMessages, injectIntl } from 'react-intl';
import { clearModal } from '/imports/ui/components/app/service';
import { withModalMounter } from '/imports/ui/components/modal/service';
import { exitAudio } from '../audio/service';
import Modal from '/imports/ui/components/modal/fullscreen/component';
@ -39,13 +39,16 @@ class BreakoutJoinConfirmation extends Component {
}
handleJoinBreakoutConfirmation() {
const { breakoutURL } = this.props;
const {
breakoutURL,
mountModal,
} = this.props;
// leave main room's audio when joining a breakout room
exitAudio();
window.open(breakoutURL);
clearModal();
mountModal(null);
}
render() {
@ -68,4 +71,4 @@ class BreakoutJoinConfirmation extends Component {
}
};
export default injectIntl(BreakoutJoinConfirmation);
export default withModalMounter(injectIntl(BreakoutJoinConfirmation));

View File

@ -41,7 +41,6 @@ class ChatContainer extends Component {
}
export default injectIntl(createContainer(({ params, intl }) => {
console.log('james');
const chatID = params.chatID || PUBLIC_CHAT_KEY;
let messages = [];