bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/audio/audio-modal/container.jsx

63 lines
2.1 KiB
React
Raw Normal View History

2017-09-29 21:38:10 +08:00
import React from 'react';
import { withTracker } from 'meteor/react-meteor-data';
2017-09-29 21:38:10 +08:00
import { withModalMounter } from '/imports/ui/components/modal/service';
import AudioModal from './component';
import Service from '../service';
const AudioModalContainer = props => <AudioModal {...props} />;
const APP_CONFIG = Meteor.settings.public.app;
2018-03-06 04:00:52 +08:00
const { listenOnlyMode, forceListenOnly, skipCheck } = APP_CONFIG;
export default withModalMounter(withTracker(({ mountModal }) =>
({
closeModal: () => {
if (!Service.isConnecting()) mountModal(null);
},
2018-03-06 04:00:52 +08:00
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();
});
2018-03-06 04:00:52 +08:00
});
},
joinListenOnly: () => Service.joinListenOnly().then(() => mountModal(null)),
leaveEchoTest: () => {
if (!Service.isEchoTest()) {
return Promise.resolve();
}
return Service.exitAudio();
},
changeInputDevice: inputDeviceId => Service.changeInputDevice(inputDeviceId),
changeOutputDevice: outputDeviceId => Service.changeOutputDevice(outputDeviceId),
joinEchoTest: () => Service.joinEchoTest(),
exitAudio: () => Service.exitAudio(),
isConnecting: Service.isConnecting(),
isConnected: Service.isConnected(),
isEchoTest: Service.isEchoTest(),
inputDeviceId: Service.inputDeviceId(),
outputDeviceId: Service.outputDeviceId(),
showPermissionsOvelay: Service.isWaitingPermissions(),
2018-03-06 04:00:52 +08:00
listenOnlyMode,
skipCheck,
joinFullAudioImmediately: !listenOnlyMode && skipCheck,
joinFullAudioEchoTest: !listenOnlyMode && !skipCheck && !forceListenOnly,
forceListenOnlyAttendee: listenOnlyMode && forceListenOnly && !Service.isUserModerator(),
}))(AudioModalContainer));