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