2017-09-29 21:38:10 +08:00
|
|
|
import React from 'react';
|
2018-01-08 12:44:42 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
2017-09-29 21:38:10 +08:00
|
|
|
import { withModalMounter } from '/imports/ui/components/modal/service';
|
2018-06-12 07:12:43 +08:00
|
|
|
import browser from 'browser-detect';
|
2018-09-14 02:09:30 +08:00
|
|
|
import getFromUserSettings from '/imports/ui/services/users-settings';
|
2017-09-29 21:38:10 +08:00
|
|
|
import AudioModal from './component';
|
|
|
|
import Service from '../service';
|
|
|
|
|
|
|
|
const AudioModalContainer = props => <AudioModal {...props} />;
|
|
|
|
|
2018-03-02 20:01:34 +08:00
|
|
|
const APP_CONFIG = Meteor.settings.public.app;
|
|
|
|
|
2018-03-06 04:00:52 +08:00
|
|
|
|
2018-09-14 02:09:30 +08:00
|
|
|
export default withModalMounter(withTracker(({ mountModal }) => {
|
|
|
|
const listenOnlyMode = getFromUserSettings('listenOnlyMode', APP_CONFIG.listenOnlyMode);
|
|
|
|
const forceListenOnly = getFromUserSettings('forceListenOnly', APP_CONFIG.forceListenOnly);
|
|
|
|
const skipCheck = getFromUserSettings('skipCheck', APP_CONFIG.skipCheck);
|
|
|
|
|
|
|
|
return ({
|
2018-01-08 12:44:42 +08:00
|
|
|
closeModal: () => {
|
|
|
|
if (!Service.isConnecting()) mountModal(null);
|
|
|
|
},
|
2018-03-06 04:00:52 +08:00
|
|
|
joinMicrophone: () => {
|
2018-03-08 21:38:18 +08:00
|
|
|
const call = new Promise((resolve, reject) => {
|
|
|
|
if (skipCheck) {
|
|
|
|
resolve(Service.joinMicrophone());
|
|
|
|
} else {
|
|
|
|
resolve(Service.transferCall());
|
|
|
|
}
|
|
|
|
reject(() => {
|
2018-01-08 12:44:42 +08:00
|
|
|
Service.exitAudio();
|
2018-06-12 07:12:43 +08:00
|
|
|
});
|
2018-03-08 21:38:18 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
return call.then(() => {
|
|
|
|
mountModal(null);
|
|
|
|
}).catch((error) => {
|
|
|
|
throw error;
|
2018-03-06 04:00:52 +08:00
|
|
|
});
|
|
|
|
},
|
2018-01-08 12:44:42 +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,
|
2018-07-10 03:23:16 +08:00
|
|
|
audioLocked: Service.audioLocked(),
|
2018-03-06 04:00:52 +08:00
|
|
|
joinFullAudioImmediately: !listenOnlyMode && skipCheck,
|
2018-03-06 22:36:49 +08:00
|
|
|
joinFullAudioEchoTest: !listenOnlyMode && !skipCheck,
|
2018-03-06 04:00:52 +08:00
|
|
|
forceListenOnlyAttendee: listenOnlyMode && forceListenOnly && !Service.isUserModerator(),
|
2018-06-12 07:12:43 +08:00
|
|
|
isIOSChrome: browser().name === 'crios',
|
2019-02-01 01:17:03 +08:00
|
|
|
isMobileNative: navigator.userAgent.toLowerCase().includes('bbbnative'),
|
2019-03-29 05:53:42 +08:00
|
|
|
isIEOrEdge: browser().name === 'edge' || browser().name === 'ie',
|
2018-09-14 02:09:30 +08:00
|
|
|
});
|
|
|
|
})(AudioModalContainer));
|