Handle better the parameters
This commit is contained in:
parent
85b8769ad5
commit
623db13922
@ -27,6 +27,9 @@ const propTypes = {
|
||||
showPermissionsOvelay: PropTypes.bool.isRequired,
|
||||
listenOnlyMode: PropTypes.bool.isRequired,
|
||||
skipCheck: PropTypes.bool.isRequired,
|
||||
joinFullAudioImmediately: PropTypes.bool.isRequired,
|
||||
joinFullAudioEchoTest: PropTypes.bool.isRequired,
|
||||
forceListenOnlyAttendee: PropTypes.bool.isRequired,
|
||||
};
|
||||
|
||||
const defaultProps = {
|
||||
@ -120,9 +123,23 @@ class AudioModal extends Component {
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
if (this.props.skipCheck) {
|
||||
const {
|
||||
joinFullAudioImmediately,
|
||||
joinFullAudioEchoTest,
|
||||
forceListenOnlyAttendee,
|
||||
} = this.props;
|
||||
|
||||
if (joinFullAudioImmediately) {
|
||||
this.handleJoinMicrophone();
|
||||
}
|
||||
|
||||
if (joinFullAudioEchoTest) {
|
||||
this.handleGoToEchoTest();
|
||||
}
|
||||
|
||||
if (forceListenOnlyAttendee) {
|
||||
this.handleJoinListenOnly();
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
@ -153,8 +170,14 @@ class AudioModal extends Component {
|
||||
const {
|
||||
inputDeviceId,
|
||||
outputDeviceId,
|
||||
skipCheck,
|
||||
} = this.props;
|
||||
|
||||
|
||||
if (skipCheck) {
|
||||
return this.handleJoinMicrophone();
|
||||
}
|
||||
|
||||
return this.joinEchoTest().then(() => {
|
||||
console.log(inputDeviceId, outputDeviceId);
|
||||
this.setState({
|
||||
@ -195,18 +218,22 @@ class AudioModal extends Component {
|
||||
const {
|
||||
intl,
|
||||
listenOnlyMode,
|
||||
forceListenOnlyAttendee,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<span className={styles.audioOptions}>
|
||||
<Button
|
||||
className={styles.audioBtn}
|
||||
label={intl.formatMessage(intlMessages.microphoneLabel)}
|
||||
icon="unmute"
|
||||
circle
|
||||
size="jumbo"
|
||||
onClick={this.handleGoToEchoTest}
|
||||
/>
|
||||
{forceListenOnlyAttendee ?
|
||||
null :
|
||||
<Button
|
||||
className={styles.audioBtn}
|
||||
label={intl.formatMessage(intlMessages.microphoneLabel)}
|
||||
icon="unmute"
|
||||
circle
|
||||
size="jumbo"
|
||||
onClick={this.handleGoToEchoTest}
|
||||
/>
|
||||
}
|
||||
{listenOnlyMode ?
|
||||
<Button
|
||||
className={styles.audioBtn}
|
||||
@ -226,13 +253,21 @@ class AudioModal extends Component {
|
||||
isConnecting,
|
||||
isEchoTest,
|
||||
intl,
|
||||
joinFullAudioImmediately,
|
||||
joinFullAudioEchoTest,
|
||||
forceListenOnlyAttendee,
|
||||
} = this.props;
|
||||
|
||||
const {
|
||||
content,
|
||||
} = this.state;
|
||||
|
||||
if (isConnecting) {
|
||||
if (
|
||||
isConnecting ||
|
||||
forceListenOnlyAttendee ||
|
||||
joinFullAudioImmediately ||
|
||||
joinFullAudioEchoTest
|
||||
) {
|
||||
return (
|
||||
<span className={styles.connecting}>
|
||||
{ !isEchoTest ?
|
||||
@ -293,6 +328,9 @@ class AudioModal extends Component {
|
||||
intl,
|
||||
isConnecting,
|
||||
showPermissionsOvelay,
|
||||
joinFullAudioImmediately,
|
||||
joinFullAudioEchoTest,
|
||||
forceListenOnlyAttendee,
|
||||
} = this.props;
|
||||
|
||||
const {
|
||||
@ -307,26 +345,29 @@ class AudioModal extends Component {
|
||||
className={styles.modal}
|
||||
onRequestClose={this.closeModal}
|
||||
>
|
||||
{ isConnecting ? null :
|
||||
<header
|
||||
data-test="audioModalHeader"
|
||||
className={styles.header}
|
||||
>
|
||||
<h3 className={styles.title}>
|
||||
{ content ?
|
||||
this.contents[content].title :
|
||||
intl.formatMessage(intlMessages.audioChoiceLabel)}
|
||||
</h3>
|
||||
<Button
|
||||
data-test="modalBaseCloseButton"
|
||||
className={styles.closeBtn}
|
||||
label={intl.formatMessage(intlMessages.closeLabel)}
|
||||
icon="close"
|
||||
size="md"
|
||||
hideLabel
|
||||
onClick={this.closeModal}
|
||||
/>
|
||||
</header>
|
||||
{ isConnecting ||
|
||||
forceListenOnlyAttendee ||
|
||||
joinFullAudioImmediately ||
|
||||
joinFullAudioEchoTest ? null :
|
||||
<header
|
||||
data-test="audioModalHeader"
|
||||
className={styles.header}
|
||||
>
|
||||
<h3 className={styles.title}>
|
||||
{ content ?
|
||||
this.contents[content].title :
|
||||
intl.formatMessage(intlMessages.audioChoiceLabel)}
|
||||
</h3>
|
||||
<Button
|
||||
data-test="modalBaseCloseButton"
|
||||
className={styles.closeBtn}
|
||||
label={intl.formatMessage(intlMessages.closeLabel)}
|
||||
icon="close"
|
||||
size="md"
|
||||
hideLabel
|
||||
onClick={this.closeModal}
|
||||
/>
|
||||
</header>
|
||||
}
|
||||
<div className={styles.content}>
|
||||
{ this.renderContent() }
|
||||
|
@ -8,21 +8,35 @@ const AudioModalContainer = props => <AudioModal {...props} />;
|
||||
|
||||
const APP_CONFIG = Meteor.settings.public.app;
|
||||
|
||||
const { listenOnlyMode, forceListenOnly, skipCheck } = APP_CONFIG;
|
||||
|
||||
export default withModalMounter(withTracker(({ mountModal }) =>
|
||||
({
|
||||
closeModal: () => {
|
||||
if (!Service.isConnecting()) mountModal(null);
|
||||
},
|
||||
joinMicrophone: () =>
|
||||
new Promise((resolve, reject) => {
|
||||
Service.joinMicrophone().then(() => {
|
||||
joinMicrophone: () => {
|
||||
if (APP_CONFIG.skipCheck) {
|
||||
return new Promise((resolve, reject) => {
|
||||
Service.joinMicrophone().then(() => {
|
||||
mountModal(null);
|
||||
resolve();
|
||||
}).catch(() => {
|
||||
Service.exitAudio();
|
||||
reject();
|
||||
});
|
||||
});
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
Service.transferCall().then(() => {
|
||||
mountModal(null);
|
||||
resolve();
|
||||
}).catch(() => {
|
||||
Service.exitAudio();
|
||||
reject();
|
||||
});
|
||||
}),
|
||||
});
|
||||
},
|
||||
joinListenOnly: () => Service.joinListenOnly().then(() => mountModal(null)),
|
||||
leaveEchoTest: () => {
|
||||
if (!Service.isEchoTest()) {
|
||||
@ -40,6 +54,9 @@ export default withModalMounter(withTracker(({ mountModal }) =>
|
||||
inputDeviceId: Service.inputDeviceId(),
|
||||
outputDeviceId: Service.outputDeviceId(),
|
||||
showPermissionsOvelay: Service.isWaitingPermissions(),
|
||||
listenOnlyMode: APP_CONFIG.listenOnlyMode,
|
||||
skipCheck: APP_CONFIG.skipCheck,
|
||||
listenOnlyMode,
|
||||
skipCheck,
|
||||
joinFullAudioImmediately: !listenOnlyMode && skipCheck,
|
||||
joinFullAudioEchoTest: !listenOnlyMode && !skipCheck && !forceListenOnly,
|
||||
forceListenOnlyAttendee: listenOnlyMode && forceListenOnly && !Service.isUserModerator(),
|
||||
}))(AudioModalContainer));
|
||||
|
@ -8,7 +8,7 @@ const init = (messages) => {
|
||||
if (AudioManager.initialized) return;
|
||||
const meetingId = Auth.meetingID;
|
||||
const userId = Auth.userID;
|
||||
const sessionToken = Auth.sessionToken;
|
||||
const { sessionToken } = Auth;
|
||||
const User = Users.findOne({ userId });
|
||||
const username = User.name;
|
||||
const Meeting = Meetings.findOne({ meetingId: User.meetingId });
|
||||
@ -53,4 +53,5 @@ export default {
|
||||
outputDeviceId: () => AudioManager.outputDeviceId,
|
||||
isEchoTest: () => AudioManager.isEchoTest,
|
||||
error: () => AudioManager.error,
|
||||
isUserModerator: () => Users.findOne({ userId: Auth.userID }).moderator,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user