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,10 +218,13 @@ class AudioModal extends Component {
|
||||
const {
|
||||
intl,
|
||||
listenOnlyMode,
|
||||
forceListenOnlyAttendee,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<span className={styles.audioOptions}>
|
||||
{forceListenOnlyAttendee ?
|
||||
null :
|
||||
<Button
|
||||
className={styles.audioBtn}
|
||||
label={intl.formatMessage(intlMessages.microphoneLabel)}
|
||||
@ -207,6 +233,7 @@ class AudioModal extends Component {
|
||||
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,7 +345,10 @@ class AudioModal extends Component {
|
||||
className={styles.modal}
|
||||
onRequestClose={this.closeModal}
|
||||
>
|
||||
{ isConnecting ? null :
|
||||
{ isConnecting ||
|
||||
forceListenOnlyAttendee ||
|
||||
joinFullAudioImmediately ||
|
||||
joinFullAudioEchoTest ? null :
|
||||
<header
|
||||
data-test="audioModalHeader"
|
||||
className={styles.header}
|
||||
|
@ -8,13 +8,16 @@ 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) => {
|
||||
joinMicrophone: () => {
|
||||
if (APP_CONFIG.skipCheck) {
|
||||
return new Promise((resolve, reject) => {
|
||||
Service.joinMicrophone().then(() => {
|
||||
mountModal(null);
|
||||
resolve();
|
||||
@ -22,7 +25,18 @@ export default withModalMounter(withTracker(({ mountModal }) =>
|
||||
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