2021-05-28 02:12:49 +08:00
|
|
|
import React, { Component } from 'react';
|
2017-06-04 10:40:14 +08:00
|
|
|
import PropTypes from 'prop-types';
|
2023-03-02 21:25:08 +08:00
|
|
|
import { throttle } from '/imports/utils/throttle';
|
2020-05-26 04:00:13 +08:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2023-03-20 21:08:35 +08:00
|
|
|
import ReactModal from 'react-modal';
|
2021-04-01 19:14:24 +08:00
|
|
|
import browserInfo from '/imports/utils/browserInfo';
|
2021-04-01 01:13:36 +08:00
|
|
|
import deviceInfo from '/imports/utils/deviceInfo';
|
2018-10-12 23:05:53 +08:00
|
|
|
import PollingContainer from '/imports/ui/components/polling/container';
|
2018-12-07 01:26:08 +08:00
|
|
|
import logger from '/imports/startup/client/logger';
|
2019-02-27 01:40:01 +08:00
|
|
|
import ActivityCheckContainer from '/imports/ui/components/activity-check/container';
|
2019-04-06 06:32:21 +08:00
|
|
|
import UserInfoContainer from '/imports/ui/components/user-info/container';
|
2019-06-07 21:49:50 +08:00
|
|
|
import BreakoutRoomInvitation from '/imports/ui/components/breakout-room/invitation/container';
|
2021-05-18 04:25:07 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
2022-02-16 01:57:50 +08:00
|
|
|
import ToastContainer from '/imports/ui/components/common/toast/container';
|
2021-10-16 03:07:13 +08:00
|
|
|
import PadsSessionsContainer from '/imports/ui/components/pads/sessions/container';
|
2023-06-14 00:26:43 +08:00
|
|
|
import WakeLockContainer from '../wake-lock/container';
|
2016-08-10 00:28:16 +08:00
|
|
|
import NotificationsBarContainer from '../notifications-bar/container';
|
2017-03-28 04:40:44 +08:00
|
|
|
import AudioContainer from '../audio/container';
|
2018-08-10 01:02:18 +08:00
|
|
|
import ChatAlertContainer from '../chat/alert/container';
|
2019-03-16 04:07:14 +08:00
|
|
|
import BannerBarContainer from '/imports/ui/components/banner-bar/container';
|
2023-06-08 09:10:07 +08:00
|
|
|
import RaiseHandNotifier from '/imports/ui/components/raisehand-notifier/container';
|
2019-06-13 02:03:23 +08:00
|
|
|
import ManyWebcamsNotifier from '/imports/ui/components/video-provider/many-users-notify/container';
|
2022-03-25 03:05:20 +08:00
|
|
|
import AudioCaptionsSpeechContainer from '/imports/ui/components/audio/captions/speech/container';
|
2020-02-26 03:29:14 +08:00
|
|
|
import UploaderContainer from '/imports/ui/components/presentation/presentation-uploader/container';
|
2021-10-16 03:07:13 +08:00
|
|
|
import CaptionsSpeechContainer from '/imports/ui/components/captions/speech/container';
|
2022-02-15 23:54:55 +08:00
|
|
|
import RandomUserSelectContainer from '/imports/ui/components/common/modal/random-user/container';
|
2022-05-24 01:09:50 +08:00
|
|
|
import ScreenReaderAlertContainer from '../screenreader-alert/container';
|
2023-05-12 04:20:26 +08:00
|
|
|
import WebcamContainer from '../webcam/container';
|
2021-06-09 21:49:59 +08:00
|
|
|
import PresentationAreaContainer from '../presentation/presentation-area/container';
|
2021-06-15 04:25:05 +08:00
|
|
|
import ScreenshareContainer from '../screenshare/container';
|
2021-06-16 20:53:27 +08:00
|
|
|
import ExternalVideoContainer from '../external-video-player/container';
|
2023-09-19 06:02:21 +08:00
|
|
|
import EmojiRainContainer from '../emoji-rain/container';
|
2021-10-28 00:43:51 +08:00
|
|
|
import Styled from './styles';
|
2022-11-16 00:30:22 +08:00
|
|
|
import { DEVICE_TYPE, ACTIONS, SMALL_VIEWPORT_BREAKPOINT, PANELS } from '../layout/enums';
|
2021-05-18 04:25:07 +08:00
|
|
|
import {
|
|
|
|
isMobile, isTablet, isTabletPortrait, isTabletLandscape, isDesktop,
|
|
|
|
} from '../layout/utils';
|
2021-09-24 04:46:50 +08:00
|
|
|
import LayoutEngine from '../layout/layout-manager/layoutEngine';
|
2021-05-18 04:25:07 +08:00
|
|
|
import NavBarContainer from '../nav-bar/container';
|
|
|
|
import SidebarNavigationContainer from '../sidebar-navigation/container';
|
|
|
|
import SidebarContentContainer from '../sidebar-content/container';
|
2019-11-20 01:49:18 +08:00
|
|
|
import { makeCall } from '/imports/ui/services/api';
|
2021-03-26 05:22:50 +08:00
|
|
|
import ConnectionStatusService from '/imports/ui/components/connection-status/service';
|
2021-06-22 04:28:51 +08:00
|
|
|
import Settings from '/imports/ui/services/settings';
|
2021-09-05 06:36:48 +08:00
|
|
|
import { registerTitleView } from '/imports/utils/dom-utils';
|
2022-03-11 03:33:25 +08:00
|
|
|
import Notifications from '../notifications/container';
|
2021-11-06 03:59:01 +08:00
|
|
|
import GlobalStyles from '/imports/ui/stylesheets/styled-components/globalStyles';
|
2022-02-10 03:45:43 +08:00
|
|
|
import ActionsBarContainer from '../actions-bar/container';
|
2022-09-03 02:18:17 +08:00
|
|
|
import PushLayoutEngine from '../layout/push-layout/pushLayoutEngine';
|
2022-10-14 03:23:54 +08:00
|
|
|
import AudioService from '/imports/ui/components/audio/service';
|
2022-10-24 21:11:28 +08:00
|
|
|
import NotesContainer from '/imports/ui/components/notes/container';
|
2022-11-16 00:30:22 +08:00
|
|
|
import DEFAULT_VALUES from '../layout/defaultValues';
|
2023-03-21 03:28:57 +08:00
|
|
|
import AppService from '/imports/ui/components/app/service';
|
2020-04-27 04:18:43 +08:00
|
|
|
import TimerService from '/imports/ui/components/timer/service';
|
2023-11-30 23:10:36 +08:00
|
|
|
import SpeechService from '/imports/ui/components/audio/captions/speech/service';
|
2022-02-10 03:45:43 +08:00
|
|
|
|
2018-06-05 02:44:23 +08:00
|
|
|
const MOBILE_MEDIA = 'only screen and (max-width: 40em)';
|
2019-01-04 01:14:45 +08:00
|
|
|
const APP_CONFIG = Meteor.settings.public.app;
|
2019-01-04 01:55:10 +08:00
|
|
|
const DESKTOP_FONT_SIZE = APP_CONFIG.desktopFontSize;
|
|
|
|
const MOBILE_FONT_SIZE = APP_CONFIG.mobileFontSize;
|
2022-04-26 03:57:11 +08:00
|
|
|
const LAYOUT_CONFIG = Meteor.settings.public.layout;
|
2022-10-14 03:23:54 +08:00
|
|
|
const CONFIRMATION_ON_LEAVE = Meteor.settings.public.app.askForConfirmationOnLeave;
|
2018-06-05 02:44:23 +08:00
|
|
|
|
2017-03-28 03:49:46 +08:00
|
|
|
const intlMessages = defineMessages({
|
|
|
|
userListLabel: {
|
2017-09-23 01:51:47 +08:00
|
|
|
id: 'app.userList.label',
|
2017-04-10 23:50:03 +08:00
|
|
|
description: 'Aria-label for Userlist Nav',
|
2017-03-28 03:49:46 +08:00
|
|
|
},
|
|
|
|
chatLabel: {
|
2017-09-23 01:23:25 +08:00
|
|
|
id: 'app.chat.label',
|
2017-04-19 03:42:55 +08:00
|
|
|
description: 'Aria-label for Chat Section',
|
2017-03-28 03:49:46 +08:00
|
|
|
},
|
2017-08-11 00:05:51 +08:00
|
|
|
actionsBarLabel: {
|
|
|
|
id: 'app.actionsBar.label',
|
2017-04-19 03:42:55 +08:00
|
|
|
description: 'Aria-label for ActionsBar Section',
|
2017-03-28 03:49:46 +08:00
|
|
|
},
|
2019-05-30 22:42:38 +08:00
|
|
|
clearedEmoji: {
|
|
|
|
id: 'app.toast.clearedEmoji.label',
|
2019-06-01 02:48:41 +08:00
|
|
|
description: 'message for cleared emoji status',
|
2019-05-30 22:42:38 +08:00
|
|
|
},
|
2023-07-21 22:10:10 +08:00
|
|
|
clearedReaction: {
|
|
|
|
id: 'app.toast.clearedReactions.label',
|
|
|
|
description: 'message for cleared reactions',
|
|
|
|
},
|
2019-05-30 22:42:38 +08:00
|
|
|
setEmoji: {
|
|
|
|
id: 'app.toast.setEmoji.label',
|
2019-06-01 02:48:41 +08:00
|
|
|
description: 'message when a user emoji has been set',
|
2019-05-30 22:42:38 +08:00
|
|
|
},
|
2021-03-22 01:06:16 +08:00
|
|
|
raisedHand: {
|
|
|
|
id: 'app.toast.setEmoji.raiseHand',
|
|
|
|
description: 'toast message for raised hand notification',
|
|
|
|
},
|
|
|
|
loweredHand: {
|
|
|
|
id: 'app.toast.setEmoji.lowerHand',
|
|
|
|
description: 'toast message for lowered hand notification',
|
|
|
|
},
|
2023-06-08 09:57:49 +08:00
|
|
|
away: {
|
|
|
|
id: 'app.toast.setEmoji.away',
|
|
|
|
description: 'toast message for set away notification',
|
|
|
|
},
|
|
|
|
notAway: {
|
|
|
|
id: 'app.toast.setEmoji.notAway',
|
|
|
|
description: 'toast message for remove away notification',
|
|
|
|
},
|
2019-05-30 22:42:38 +08:00
|
|
|
meetingMuteOn: {
|
|
|
|
id: 'app.toast.meetingMuteOn.label',
|
2019-06-01 02:48:41 +08:00
|
|
|
description: 'message used when meeting has been muted',
|
2019-05-30 22:42:38 +08:00
|
|
|
},
|
|
|
|
meetingMuteOff: {
|
|
|
|
id: 'app.toast.meetingMuteOff.label',
|
2019-06-01 02:48:41 +08:00
|
|
|
description: 'message used when meeting has been unmuted',
|
2019-05-30 22:42:38 +08:00
|
|
|
},
|
2019-05-22 22:44:17 +08:00
|
|
|
pollPublishedLabel: {
|
|
|
|
id: 'app.whiteboard.annotations.poll',
|
|
|
|
description: 'message displayed when a poll is published',
|
|
|
|
},
|
2021-09-05 06:36:48 +08:00
|
|
|
defaultViewLabel: {
|
|
|
|
id: 'app.title.defaultViewLabel',
|
|
|
|
description: 'view name apended to document title',
|
|
|
|
},
|
2022-01-11 13:02:24 +08:00
|
|
|
promotedLabel: {
|
|
|
|
id: 'app.toast.promotedLabel',
|
|
|
|
description: 'notification message when promoted',
|
|
|
|
},
|
|
|
|
demotedLabel: {
|
|
|
|
id: 'app.toast.demotedLabel',
|
|
|
|
description: 'notification message when demoted',
|
|
|
|
},
|
2017-03-28 03:49:46 +08:00
|
|
|
});
|
|
|
|
|
2016-04-29 03:02:51 +08:00
|
|
|
const propTypes = {
|
|
|
|
actionsbar: PropTypes.element,
|
2019-05-17 04:11:10 +08:00
|
|
|
captions: PropTypes.element,
|
2022-04-09 03:05:29 +08:00
|
|
|
darkTheme: PropTypes.bool.isRequired,
|
2017-03-17 03:57:45 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
const defaultProps = {
|
2017-09-22 22:24:24 +08:00
|
|
|
actionsbar: null,
|
2019-05-17 04:11:10 +08:00
|
|
|
captions: null,
|
2016-04-29 03:02:51 +08:00
|
|
|
};
|
|
|
|
|
2022-03-04 04:48:56 +08:00
|
|
|
const isLayeredView = window.matchMedia(`(max-width: ${SMALL_VIEWPORT_BREAKPOINT}px)`);
|
2019-05-09 01:52:12 +08:00
|
|
|
|
2017-03-28 03:49:46 +08:00
|
|
|
class App extends Component {
|
2021-05-18 04:25:07 +08:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2016-09-15 01:48:50 +08:00
|
|
|
this.state = {
|
2018-06-05 02:44:23 +08:00
|
|
|
enableResize: !window.matchMedia(MOBILE_MEDIA).matches,
|
2023-03-25 04:48:00 +08:00
|
|
|
isAudioModalOpen: false,
|
|
|
|
isRandomUserSelectModalOpen: false,
|
2023-03-27 23:36:25 +08:00
|
|
|
isVideoPreviewModalOpen: false,
|
2023-08-05 00:41:42 +08:00
|
|
|
presentationFitToWidth: false,
|
2016-09-15 01:48:50 +08:00
|
|
|
};
|
2018-06-05 02:44:23 +08:00
|
|
|
|
2020-06-13 02:50:42 +08:00
|
|
|
this.isTimerEnabled = TimerService.isEnabled();
|
|
|
|
this.timeOffsetInterval = null;
|
2020-04-27 04:18:43 +08:00
|
|
|
|
2023-08-05 00:41:42 +08:00
|
|
|
this.setPresentationFitToWidth = this.setPresentationFitToWidth.bind(this);
|
2018-06-05 02:44:23 +08:00
|
|
|
this.handleWindowResize = throttle(this.handleWindowResize).bind(this);
|
2019-05-16 06:51:43 +08:00
|
|
|
this.shouldAriaHide = this.shouldAriaHide.bind(this);
|
2023-03-24 23:29:09 +08:00
|
|
|
this.setAudioModalIsOpen = this.setAudioModalIsOpen.bind(this);
|
2023-03-25 04:48:00 +08:00
|
|
|
this.setRandomUserSelectModalIsOpen = this.setRandomUserSelectModalIsOpen.bind(this);
|
2023-03-27 23:36:25 +08:00
|
|
|
this.setVideoPreviewModalIsOpen = this.setVideoPreviewModalIsOpen.bind(this);
|
2021-05-18 04:25:07 +08:00
|
|
|
|
|
|
|
this.throttledDeviceType = throttle(() => this.setDeviceType(),
|
|
|
|
50, { trailing: true, leading: true }).bind(this);
|
2017-02-25 04:19:53 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
2019-04-19 01:14:34 +08:00
|
|
|
const {
|
2021-05-18 04:25:07 +08:00
|
|
|
notify,
|
|
|
|
intl,
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch,
|
2021-07-26 22:03:31 +08:00
|
|
|
isRTL,
|
2023-11-30 23:10:36 +08:00
|
|
|
transcriptionSettings,
|
2019-04-19 01:14:34 +08:00
|
|
|
} = this.props;
|
2021-04-01 19:14:24 +08:00
|
|
|
const { browserName } = browserInfo;
|
2021-05-18 04:25:07 +08:00
|
|
|
const { osName } = deviceInfo;
|
2017-07-04 22:32:22 +08:00
|
|
|
|
2021-09-05 06:36:48 +08:00
|
|
|
registerTitleView(intl.formatMessage(intlMessages.defaultViewLabel));
|
|
|
|
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-26 22:03:31 +08:00
|
|
|
type: ACTIONS.SET_IS_RTL,
|
|
|
|
value: isRTL,
|
|
|
|
});
|
|
|
|
|
2023-03-20 21:08:35 +08:00
|
|
|
ReactModal.setAppElement('#app');
|
2021-05-05 09:13:00 +08:00
|
|
|
|
2021-06-19 02:32:46 +08:00
|
|
|
const fontSize = isMobile() ? MOBILE_FONT_SIZE : DESKTOP_FONT_SIZE;
|
|
|
|
document.getElementsByTagName('html')[0].style.fontSize = fontSize;
|
|
|
|
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-06-19 02:32:46 +08:00
|
|
|
type: ACTIONS.SET_FONT_SIZE,
|
2021-08-05 12:22:07 +08:00
|
|
|
value: parseInt(fontSize.slice(0, -2), 10),
|
2021-06-19 02:32:46 +08:00
|
|
|
});
|
2018-06-05 02:44:23 +08:00
|
|
|
|
2018-06-08 01:51:00 +08:00
|
|
|
const body = document.getElementsByTagName('body')[0];
|
2021-04-01 19:14:24 +08:00
|
|
|
|
2021-04-03 01:23:31 +08:00
|
|
|
if (browserName) {
|
|
|
|
body.classList.add(`browser-${browserName.split(' ').pop()
|
|
|
|
.toLowerCase()}`);
|
|
|
|
}
|
|
|
|
|
2021-04-01 01:13:36 +08:00
|
|
|
body.classList.add(`os-${osName.split(' ').shift().toLowerCase()}`);
|
2018-06-08 01:51:00 +08:00
|
|
|
|
2018-06-05 02:44:23 +08:00
|
|
|
this.handleWindowResize();
|
|
|
|
window.addEventListener('resize', this.handleWindowResize, false);
|
2021-08-09 22:06:33 +08:00
|
|
|
window.addEventListener('localeChanged', () => {
|
2021-08-09 21:09:00 +08:00
|
|
|
layoutContextDispatch({
|
|
|
|
type: ACTIONS.SET_IS_RTL,
|
2021-08-09 22:06:33 +08:00
|
|
|
value: Settings.application.isRTL,
|
2021-08-09 21:09:00 +08:00
|
|
|
});
|
|
|
|
});
|
2021-05-18 04:25:07 +08:00
|
|
|
window.ondragover = (e) => { e.preventDefault(); };
|
|
|
|
window.ondrop = (e) => { e.preventDefault(); };
|
2018-12-07 01:26:08 +08:00
|
|
|
|
2022-10-14 03:23:54 +08:00
|
|
|
if (CONFIRMATION_ON_LEAVE) {
|
|
|
|
window.onbeforeunload = (event) => {
|
|
|
|
AudioService.muteMicrophone();
|
|
|
|
event.stopImmediatePropagation();
|
|
|
|
event.preventDefault();
|
|
|
|
// eslint-disable-next-line no-param-reassign
|
|
|
|
event.returnValue = '';
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2021-12-17 05:44:17 +08:00
|
|
|
if (deviceInfo.isMobile) makeCall('setMobileUser');
|
2019-11-20 01:49:18 +08:00
|
|
|
|
2021-03-26 05:22:50 +08:00
|
|
|
ConnectionStatusService.startRoundTripTime();
|
|
|
|
|
2020-06-13 02:50:42 +08:00
|
|
|
if (this.isTimerEnabled) {
|
|
|
|
TimerService.fetchTimeOffset();
|
2023-06-09 03:24:25 +08:00
|
|
|
this.timeOffsetInterval = setInterval(TimerService.fetchTimeOffset,
|
|
|
|
TimerService.OFFSET_INTERVAL);
|
2020-06-13 02:50:42 +08:00
|
|
|
}
|
|
|
|
|
2023-11-30 23:10:36 +08:00
|
|
|
if (transcriptionSettings) {
|
|
|
|
const { partialUtterances, minUtteranceLength } = transcriptionSettings;
|
|
|
|
if (partialUtterances !== undefined || minUtteranceLength !== undefined) {
|
|
|
|
logger.info({ logCode: 'app_component_set_speech_options' }, 'Setting initial speech options');
|
|
|
|
|
|
|
|
Settings.transcription.partialUtterances = partialUtterances ? true : false;
|
|
|
|
Settings.transcription.minUtteranceLength = parseInt(minUtteranceLength, 10);
|
|
|
|
|
|
|
|
SpeechService.setSpeechOptions(Settings.transcription.partialUtterances, Settings.transcription.minUtteranceLength);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-02 03:12:06 +08:00
|
|
|
logger.info({ logCode: 'app_component_componentdidmount' }, 'Client loaded successfully');
|
2018-06-05 02:44:23 +08:00
|
|
|
}
|
|
|
|
|
2019-05-30 22:42:38 +08:00
|
|
|
componentDidUpdate(prevProps) {
|
|
|
|
const {
|
2020-09-26 03:41:30 +08:00
|
|
|
notify,
|
|
|
|
currentUserEmoji,
|
2023-06-08 09:57:49 +08:00
|
|
|
currentUserAway,
|
|
|
|
currentUserRaiseHand,
|
2020-09-26 03:41:30 +08:00
|
|
|
intl,
|
2021-05-18 04:25:07 +08:00
|
|
|
deviceType,
|
2021-12-02 01:58:36 +08:00
|
|
|
mountRandomUserModal,
|
2022-11-16 00:30:22 +08:00
|
|
|
selectedLayout,
|
|
|
|
sidebarContentIsOpen,
|
|
|
|
layoutContextDispatch,
|
2022-11-23 01:15:15 +08:00
|
|
|
numCameras,
|
|
|
|
presentationIsOpen,
|
2019-05-30 22:42:38 +08:00
|
|
|
} = this.props;
|
|
|
|
|
2022-04-09 03:05:29 +08:00
|
|
|
this.renderDarkMode();
|
|
|
|
|
2023-03-25 04:48:00 +08:00
|
|
|
if (mountRandomUserModal) this.setRandomUserSelectModalIsOpen(true);
|
2020-08-29 01:23:27 +08:00
|
|
|
|
2023-06-08 09:57:49 +08:00
|
|
|
if (prevProps.currentUserEmoji.status !== currentUserEmoji.status
|
|
|
|
&& currentUserEmoji.status !== 'raiseHand'
|
|
|
|
&& currentUserEmoji.status !== 'away'
|
|
|
|
) {
|
2019-06-01 02:36:52 +08:00
|
|
|
const formattedEmojiStatus = intl.formatMessage({ id: `app.actionsBar.emojiMenu.${currentUserEmoji.status}Label` })
|
2021-05-18 04:25:07 +08:00
|
|
|
|| currentUserEmoji.status;
|
2019-05-30 22:42:38 +08:00
|
|
|
|
2021-03-22 01:06:16 +08:00
|
|
|
if (currentUserEmoji.status === 'none') {
|
2023-06-08 09:57:49 +08:00
|
|
|
notify(
|
|
|
|
intl.formatMessage(intlMessages.clearedEmoji),
|
|
|
|
'info',
|
|
|
|
'clear_status',
|
|
|
|
);
|
2021-03-22 01:06:16 +08:00
|
|
|
} else {
|
2023-06-08 09:57:49 +08:00
|
|
|
notify(
|
|
|
|
intl.formatMessage(intlMessages.setEmoji, ({ 0: formattedEmojiStatus })),
|
|
|
|
'info',
|
|
|
|
'user',
|
|
|
|
);
|
2021-03-22 01:06:16 +08:00
|
|
|
}
|
2023-06-08 09:57:49 +08:00
|
|
|
}
|
2021-03-22 01:06:16 +08:00
|
|
|
|
2023-06-08 09:57:49 +08:00
|
|
|
if (prevProps.currentUserAway !== currentUserAway) {
|
|
|
|
if (currentUserAway === true) {
|
|
|
|
notify(intl.formatMessage(intlMessages.away), 'info', 'user');
|
|
|
|
} else {
|
|
|
|
notify(intl.formatMessage(intlMessages.notAway), 'info', 'clear_status');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (prevProps.currentUserRaiseHand !== currentUserRaiseHand) {
|
|
|
|
if (currentUserRaiseHand === true) {
|
|
|
|
notify(intl.formatMessage(intlMessages.raisedHand), 'info', 'user');
|
|
|
|
} else {
|
|
|
|
notify(intl.formatMessage(intlMessages.loweredHand), 'info', 'clear_status');
|
|
|
|
}
|
2019-05-30 22:42:38 +08:00
|
|
|
}
|
2021-05-18 04:25:07 +08:00
|
|
|
|
|
|
|
if (deviceType === null || prevProps.deviceType !== deviceType) this.throttledDeviceType();
|
2022-11-16 00:30:22 +08:00
|
|
|
|
|
|
|
if (
|
|
|
|
selectedLayout !== prevProps.selectedLayout
|
|
|
|
&& selectedLayout?.toLowerCase?.()?.includes?.('focus')
|
|
|
|
&& !sidebarContentIsOpen
|
2022-11-23 01:15:15 +08:00
|
|
|
&& deviceType !== DEVICE_TYPE.MOBILE
|
|
|
|
&& numCameras > 0
|
|
|
|
&& presentationIsOpen
|
2022-11-16 00:30:22 +08:00
|
|
|
) {
|
|
|
|
setTimeout(() => {
|
|
|
|
layoutContextDispatch({
|
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_IS_OPEN,
|
|
|
|
value: true,
|
|
|
|
});
|
|
|
|
layoutContextDispatch({
|
|
|
|
type: ACTIONS.SET_ID_CHAT_OPEN,
|
|
|
|
value: DEFAULT_VALUES.idChatOpen,
|
|
|
|
});
|
|
|
|
layoutContextDispatch({
|
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_PANEL,
|
|
|
|
value: PANELS.CHAT,
|
|
|
|
});
|
|
|
|
}, 0);
|
|
|
|
}
|
2019-05-30 22:42:38 +08:00
|
|
|
}
|
|
|
|
|
2018-06-05 02:44:23 +08:00
|
|
|
componentWillUnmount() {
|
|
|
|
window.removeEventListener('resize', this.handleWindowResize, false);
|
2022-10-14 03:23:54 +08:00
|
|
|
window.onbeforeunload = null;
|
2021-03-26 05:22:50 +08:00
|
|
|
ConnectionStatusService.stopRoundTripTime();
|
2020-06-13 02:50:42 +08:00
|
|
|
|
|
|
|
if (this.timeOffsetInterval) {
|
|
|
|
clearInterval(this.timeOffsetInterval);
|
|
|
|
}
|
2018-06-05 02:44:23 +08:00
|
|
|
}
|
|
|
|
|
2023-08-05 00:41:42 +08:00
|
|
|
setPresentationFitToWidth(presentationFitToWidth) {
|
|
|
|
this.setState({ presentationFitToWidth });
|
|
|
|
}
|
|
|
|
|
2018-06-05 02:44:23 +08:00
|
|
|
handleWindowResize() {
|
|
|
|
const { enableResize } = this.state;
|
|
|
|
const shouldEnableResize = !window.matchMedia(MOBILE_MEDIA).matches;
|
2018-06-08 01:51:00 +08:00
|
|
|
if (enableResize === shouldEnableResize) return;
|
2018-06-05 02:44:23 +08:00
|
|
|
|
|
|
|
this.setState({ enableResize: shouldEnableResize });
|
2021-05-18 04:25:07 +08:00
|
|
|
this.throttledDeviceType();
|
|
|
|
}
|
|
|
|
|
|
|
|
setDeviceType() {
|
2021-08-05 19:03:24 +08:00
|
|
|
const { deviceType, layoutContextDispatch } = this.props;
|
2021-05-18 04:25:07 +08:00
|
|
|
let newDeviceType = null;
|
|
|
|
if (isMobile()) newDeviceType = DEVICE_TYPE.MOBILE;
|
|
|
|
if (isTablet()) newDeviceType = DEVICE_TYPE.TABLET;
|
|
|
|
if (isTabletPortrait()) newDeviceType = DEVICE_TYPE.TABLET_PORTRAIT;
|
|
|
|
if (isTabletLandscape()) newDeviceType = DEVICE_TYPE.TABLET_LANDSCAPE;
|
|
|
|
if (isDesktop()) newDeviceType = DEVICE_TYPE.DESKTOP;
|
|
|
|
|
|
|
|
if (newDeviceType !== deviceType) {
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-05-18 04:25:07 +08:00
|
|
|
type: ACTIONS.SET_DEVICE_TYPE,
|
|
|
|
value: newDeviceType,
|
|
|
|
});
|
|
|
|
}
|
2016-09-15 01:48:50 +08:00
|
|
|
}
|
|
|
|
|
2019-05-16 06:51:43 +08:00
|
|
|
shouldAriaHide() {
|
2021-05-18 04:25:07 +08:00
|
|
|
const { sidebarNavigationIsOpen, sidebarContentIsOpen, isPhone } = this.props;
|
|
|
|
return sidebarNavigationIsOpen
|
|
|
|
&& sidebarContentIsOpen
|
|
|
|
&& (isPhone || isLayeredView.matches);
|
2019-03-12 08:34:34 +08:00
|
|
|
}
|
|
|
|
|
2019-05-17 04:11:10 +08:00
|
|
|
renderCaptions() {
|
2021-08-16 21:38:39 +08:00
|
|
|
const {
|
|
|
|
captions,
|
|
|
|
captionsStyle,
|
|
|
|
} = this.props;
|
2017-05-16 05:45:44 +08:00
|
|
|
|
2019-05-17 04:11:10 +08:00
|
|
|
if (!captions) return null;
|
2017-05-16 05:45:44 +08:00
|
|
|
|
|
|
|
return (
|
2021-10-28 00:43:51 +08:00
|
|
|
<Styled.CaptionsWrapper
|
2021-12-13 11:49:49 +08:00
|
|
|
role="region"
|
2021-08-16 21:38:39 +08:00
|
|
|
style={
|
|
|
|
{
|
|
|
|
position: 'absolute',
|
|
|
|
left: captionsStyle.left,
|
|
|
|
right: captionsStyle.right,
|
2021-08-17 22:20:26 +08:00
|
|
|
maxWidth: captionsStyle.maxWidth,
|
2021-08-16 21:38:39 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
>
|
2019-05-17 04:11:10 +08:00
|
|
|
{captions}
|
2021-10-28 00:43:51 +08:00
|
|
|
</Styled.CaptionsWrapper>
|
2017-03-17 00:52:43 +08:00
|
|
|
);
|
2016-04-29 03:02:51 +08:00
|
|
|
}
|
|
|
|
|
2022-03-25 03:05:20 +08:00
|
|
|
renderAudioCaptions() {
|
|
|
|
const {
|
|
|
|
audioCaptions,
|
|
|
|
captionsStyle,
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
if (!audioCaptions) return null;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Styled.CaptionsWrapper
|
|
|
|
role="region"
|
|
|
|
style={
|
|
|
|
{
|
|
|
|
position: 'absolute',
|
|
|
|
left: captionsStyle.left,
|
|
|
|
right: captionsStyle.right,
|
|
|
|
maxWidth: captionsStyle.maxWidth,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
>
|
|
|
|
{audioCaptions}
|
|
|
|
</Styled.CaptionsWrapper>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2016-05-04 22:48:53 +08:00
|
|
|
renderActionsBar() {
|
2018-04-29 09:59:45 +08:00
|
|
|
const {
|
2019-05-09 01:52:12 +08:00
|
|
|
intl,
|
2021-06-01 04:28:57 +08:00
|
|
|
actionsBarStyle,
|
2021-10-20 03:20:31 +08:00
|
|
|
hideActionsBar,
|
2022-05-12 05:48:12 +08:00
|
|
|
setPushLayout,
|
2022-02-10 03:45:43 +08:00
|
|
|
setMeetingLayout,
|
2022-02-11 22:30:35 +08:00
|
|
|
presentationIsOpen,
|
2022-04-26 03:57:11 +08:00
|
|
|
selectedLayout,
|
2018-04-29 09:59:45 +08:00
|
|
|
} = this.props;
|
2016-04-29 03:02:51 +08:00
|
|
|
|
2022-04-26 03:57:11 +08:00
|
|
|
const { showPushLayoutButton } = LAYOUT_CONFIG;
|
|
|
|
|
2022-02-10 03:45:43 +08:00
|
|
|
if (hideActionsBar) return null;
|
2016-04-29 03:02:51 +08:00
|
|
|
|
2016-05-12 04:43:07 +08:00
|
|
|
return (
|
2021-10-28 00:43:51 +08:00
|
|
|
<Styled.ActionsBar
|
2022-04-09 03:05:29 +08:00
|
|
|
id="ActionsBar"
|
2021-12-13 11:49:49 +08:00
|
|
|
role="region"
|
2017-08-11 00:05:51 +08:00
|
|
|
aria-label={intl.formatMessage(intlMessages.actionsBarLabel)}
|
2019-05-16 06:51:43 +08:00
|
|
|
aria-hidden={this.shouldAriaHide()}
|
2021-06-01 04:28:57 +08:00
|
|
|
style={
|
2021-08-05 12:22:07 +08:00
|
|
|
{
|
|
|
|
position: 'absolute',
|
|
|
|
top: actionsBarStyle.top,
|
|
|
|
left: actionsBarStyle.left,
|
|
|
|
height: actionsBarStyle.height,
|
|
|
|
width: actionsBarStyle.width,
|
|
|
|
padding: actionsBarStyle.padding,
|
|
|
|
}
|
2021-06-01 04:28:57 +08:00
|
|
|
}
|
2017-06-03 03:25:02 +08:00
|
|
|
>
|
2022-02-10 03:45:43 +08:00
|
|
|
<ActionsBarContainer
|
2022-05-12 05:48:12 +08:00
|
|
|
setPushLayout={setPushLayout}
|
2022-02-10 03:45:43 +08:00
|
|
|
setMeetingLayout={setMeetingLayout}
|
2022-04-26 03:57:11 +08:00
|
|
|
showPushLayout={showPushLayoutButton && selectedLayout === 'custom'}
|
2022-02-11 22:30:35 +08:00
|
|
|
presentationIsOpen={presentationIsOpen}
|
2023-08-05 00:41:42 +08:00
|
|
|
setPresentationFitToWidth={this.setPresentationFitToWidth}
|
2022-04-15 03:22:21 +08:00
|
|
|
/>
|
2021-10-28 00:43:51 +08:00
|
|
|
</Styled.ActionsBar>
|
2016-05-12 04:43:07 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-02-27 01:40:01 +08:00
|
|
|
renderActivityCheck() {
|
|
|
|
const { User } = this.props;
|
|
|
|
|
|
|
|
const { inactivityCheck, responseDelay } = User;
|
|
|
|
|
|
|
|
return (inactivityCheck ? (
|
|
|
|
<ActivityCheckContainer
|
|
|
|
inactivityCheck={inactivityCheck}
|
|
|
|
responseDelay={responseDelay}
|
2021-05-03 02:20:49 +08:00
|
|
|
/>
|
|
|
|
) : null);
|
2019-02-27 01:40:01 +08:00
|
|
|
}
|
|
|
|
|
2019-04-06 06:32:21 +08:00
|
|
|
renderUserInformation() {
|
|
|
|
const { UserInfo, User } = this.props;
|
|
|
|
|
|
|
|
return (UserInfo.length > 0 ? (
|
|
|
|
<UserInfoContainer
|
|
|
|
UserInfo={UserInfo}
|
|
|
|
requesterUserId={User.userId}
|
|
|
|
meetingId={User.meetingId}
|
2021-05-03 02:20:49 +08:00
|
|
|
/>
|
|
|
|
) : null);
|
2019-04-06 06:32:21 +08:00
|
|
|
}
|
|
|
|
|
2022-04-09 03:05:29 +08:00
|
|
|
renderDarkMode() {
|
|
|
|
const { darkTheme } = this.props;
|
|
|
|
|
2023-03-21 03:28:57 +08:00
|
|
|
AppService.setDarkTheme(darkTheme);
|
2022-04-09 03:05:29 +08:00
|
|
|
}
|
|
|
|
|
2022-09-03 02:18:17 +08:00
|
|
|
mountPushLayoutEngine() {
|
|
|
|
const {
|
|
|
|
cameraWidth,
|
|
|
|
cameraHeight,
|
|
|
|
cameraIsResizing,
|
|
|
|
cameraPosition,
|
|
|
|
focusedCamera,
|
|
|
|
horizontalPosition,
|
2022-10-10 21:32:19 +08:00
|
|
|
isMeetingLayoutResizing,
|
2022-09-03 02:18:17 +08:00
|
|
|
isPresenter,
|
|
|
|
isModerator,
|
|
|
|
layoutContextDispatch,
|
|
|
|
meetingLayout,
|
|
|
|
meetingLayoutCameraPosition,
|
|
|
|
meetingLayoutFocusedCamera,
|
|
|
|
meetingLayoutVideoRate,
|
|
|
|
meetingPresentationIsOpen,
|
|
|
|
meetingLayoutUpdatedAt,
|
|
|
|
presentationIsOpen,
|
|
|
|
presentationVideoRate,
|
|
|
|
pushLayout,
|
|
|
|
pushLayoutMeeting,
|
|
|
|
selectedLayout,
|
|
|
|
setMeetingLayout,
|
2023-03-04 05:59:47 +08:00
|
|
|
setPushLayout,
|
2022-09-03 02:18:17 +08:00
|
|
|
shouldShowScreenshare,
|
|
|
|
shouldShowExternalVideo,
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<PushLayoutEngine
|
|
|
|
{...{
|
|
|
|
cameraWidth,
|
|
|
|
cameraHeight,
|
|
|
|
cameraIsResizing,
|
|
|
|
cameraPosition,
|
|
|
|
focusedCamera,
|
|
|
|
horizontalPosition,
|
2022-10-10 21:32:19 +08:00
|
|
|
isMeetingLayoutResizing,
|
2022-09-03 02:18:17 +08:00
|
|
|
isPresenter,
|
|
|
|
isModerator,
|
|
|
|
layoutContextDispatch,
|
|
|
|
meetingLayout,
|
|
|
|
meetingLayoutCameraPosition,
|
|
|
|
meetingLayoutFocusedCamera,
|
|
|
|
meetingLayoutVideoRate,
|
|
|
|
meetingPresentationIsOpen,
|
|
|
|
meetingLayoutUpdatedAt,
|
|
|
|
presentationIsOpen,
|
|
|
|
presentationVideoRate,
|
|
|
|
pushLayout,
|
|
|
|
pushLayoutMeeting,
|
|
|
|
selectedLayout,
|
|
|
|
setMeetingLayout,
|
2023-03-04 05:59:47 +08:00
|
|
|
setPushLayout,
|
2022-09-03 02:18:17 +08:00
|
|
|
shouldShowScreenshare,
|
2023-03-29 22:02:14 +08:00
|
|
|
shouldShowExternalVideo: !!shouldShowExternalVideo,
|
2022-09-03 02:18:17 +08:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-03-24 23:29:09 +08:00
|
|
|
setAudioModalIsOpen(value) {
|
|
|
|
this.setState({isAudioModalOpen: value});
|
|
|
|
}
|
2023-06-08 09:10:07 +08:00
|
|
|
|
2023-03-27 23:36:25 +08:00
|
|
|
setVideoPreviewModalIsOpen(value) {
|
|
|
|
this.setState({isVideoPreviewModalOpen: value});
|
|
|
|
}
|
2023-03-24 23:29:09 +08:00
|
|
|
|
2023-03-25 04:48:00 +08:00
|
|
|
setRandomUserSelectModalIsOpen(value) {
|
2023-04-12 23:51:23 +08:00
|
|
|
const {setMountRandomUserModal} = this.props;
|
2023-03-25 04:48:00 +08:00
|
|
|
this.setState({isRandomUserSelectModalOpen: value});
|
2023-04-12 23:51:23 +08:00
|
|
|
setMountRandomUserModal(false);
|
2023-03-25 04:48:00 +08:00
|
|
|
}
|
|
|
|
|
2017-01-14 07:57:29 +08:00
|
|
|
render() {
|
2018-10-19 04:37:14 +08:00
|
|
|
const {
|
2021-05-18 04:25:07 +08:00
|
|
|
customStyle,
|
|
|
|
customStyleUrl,
|
2021-05-28 01:46:27 +08:00
|
|
|
audioAlertEnabled,
|
2021-05-28 02:12:49 +08:00
|
|
|
pushAlertEnabled,
|
2021-06-15 04:25:05 +08:00
|
|
|
shouldShowPresentation,
|
|
|
|
shouldShowScreenshare,
|
2021-06-16 20:53:27 +08:00
|
|
|
shouldShowExternalVideo,
|
2022-10-24 21:11:28 +08:00
|
|
|
shouldShowSharedNotes,
|
2021-06-16 20:53:27 +08:00
|
|
|
isPresenter,
|
2022-04-14 06:15:21 +08:00
|
|
|
selectedLayout,
|
2022-02-11 22:30:35 +08:00
|
|
|
presentationIsOpen,
|
2023-02-14 11:28:36 +08:00
|
|
|
darkTheme,
|
2018-10-19 04:37:14 +08:00
|
|
|
} = this.props;
|
2021-02-24 01:04:00 +08:00
|
|
|
|
2023-08-10 22:49:01 +08:00
|
|
|
const { isAudioModalOpen, isRandomUserSelectModalOpen, isVideoPreviewModalOpen, presentationFitToWidth } = this.state;
|
2023-08-05 00:41:42 +08:00
|
|
|
|
2016-04-29 03:02:51 +08:00
|
|
|
return (
|
2021-05-18 04:25:07 +08:00
|
|
|
<>
|
2022-03-11 03:33:25 +08:00
|
|
|
<Notifications />
|
2022-09-03 02:18:17 +08:00
|
|
|
{this.mountPushLayoutEngine()}
|
2022-09-09 20:58:44 +08:00
|
|
|
{selectedLayout ? <LayoutEngine layoutType={selectedLayout} /> : null}
|
2021-11-06 03:59:01 +08:00
|
|
|
<GlobalStyles />
|
2021-10-28 00:43:51 +08:00
|
|
|
<Styled.Layout
|
2021-08-05 19:03:24 +08:00
|
|
|
id="layout"
|
2021-08-05 12:22:07 +08:00
|
|
|
style={{
|
|
|
|
width: '100%',
|
|
|
|
height: '100%',
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{this.renderActivityCheck()}
|
|
|
|
{this.renderUserInformation()}
|
2022-05-24 01:09:50 +08:00
|
|
|
<ScreenReaderAlertContainer />
|
2021-08-05 12:22:07 +08:00
|
|
|
<BannerBarContainer />
|
|
|
|
<NotificationsBarContainer />
|
|
|
|
<SidebarNavigationContainer />
|
2023-02-01 01:52:17 +08:00
|
|
|
<SidebarContentContainer isSharedNotesPinned={shouldShowSharedNotes} />
|
2021-08-05 12:22:07 +08:00
|
|
|
<NavBarContainer main="new" />
|
2023-05-12 04:20:26 +08:00
|
|
|
<WebcamContainer isLayoutSwapped={!presentationIsOpen} layoutType={selectedLayout} />
|
2023-03-18 01:51:39 +08:00
|
|
|
<Styled.TextMeasure id="text-measure" />
|
2023-08-10 22:49:01 +08:00
|
|
|
{shouldShowPresentation ? <PresentationAreaContainer setPresentationFitToWidth={this.setPresentationFitToWidth} fitToWidth={presentationFitToWidth} darkTheme={darkTheme} presentationIsOpen={presentationIsOpen} layoutType={selectedLayout} /> : null}
|
2022-02-11 22:30:35 +08:00
|
|
|
{shouldShowScreenshare ? <ScreenshareContainer isLayoutSwapped={!presentationIsOpen} /> : null}
|
2021-08-05 12:22:07 +08:00
|
|
|
{
|
|
|
|
shouldShowExternalVideo
|
2022-02-11 22:30:35 +08:00
|
|
|
? <ExternalVideoContainer isLayoutSwapped={!presentationIsOpen} isPresenter={isPresenter} />
|
2021-08-05 12:22:07 +08:00
|
|
|
: null
|
|
|
|
}
|
2023-05-15 22:58:30 +08:00
|
|
|
{shouldShowSharedNotes
|
2023-01-19 04:10:22 +08:00
|
|
|
? (
|
|
|
|
<NotesContainer
|
|
|
|
area="media"
|
|
|
|
layoutType={selectedLayout}
|
|
|
|
/>
|
|
|
|
) : null}
|
2021-08-16 21:38:39 +08:00
|
|
|
{this.renderCaptions()}
|
2022-03-25 03:05:20 +08:00
|
|
|
<AudioCaptionsSpeechContainer />
|
|
|
|
{this.renderAudioCaptions()}
|
2021-08-05 12:22:07 +08:00
|
|
|
<UploaderContainer />
|
2021-10-16 03:07:13 +08:00
|
|
|
<CaptionsSpeechContainer />
|
2021-08-05 12:22:07 +08:00
|
|
|
<BreakoutRoomInvitation />
|
2023-03-24 23:29:09 +08:00
|
|
|
<AudioContainer {...{
|
|
|
|
isAudioModalOpen,
|
|
|
|
setAudioModalIsOpen: this.setAudioModalIsOpen,
|
2023-03-27 23:36:25 +08:00
|
|
|
isVideoPreviewModalOpen,
|
|
|
|
setVideoPreviewModalIsOpen: this.setVideoPreviewModalIsOpen,
|
2023-03-24 23:29:09 +08:00
|
|
|
}} />
|
2021-08-05 12:22:07 +08:00
|
|
|
<ToastContainer rtl />
|
|
|
|
{(audioAlertEnabled || pushAlertEnabled)
|
|
|
|
&& (
|
|
|
|
<ChatAlertContainer
|
|
|
|
audioAlertEnabled={audioAlertEnabled}
|
|
|
|
pushAlertEnabled={pushAlertEnabled}
|
|
|
|
/>
|
|
|
|
)}
|
2023-06-08 09:10:07 +08:00
|
|
|
<RaiseHandNotifier />
|
2021-08-05 12:22:07 +08:00
|
|
|
<ManyWebcamsNotifier />
|
|
|
|
<PollingContainer />
|
2021-10-16 03:07:13 +08:00
|
|
|
<PadsSessionsContainer />
|
2023-06-14 00:26:43 +08:00
|
|
|
<WakeLockContainer />
|
2021-08-05 12:22:07 +08:00
|
|
|
{this.renderActionsBar()}
|
2023-09-19 06:02:21 +08:00
|
|
|
<EmojiRainContainer />
|
2021-08-05 12:22:07 +08:00
|
|
|
{customStyleUrl ? <link rel="stylesheet" type="text/css" href={customStyleUrl} /> : null}
|
|
|
|
{customStyle ? <link rel="stylesheet" type="text/css" href={`data:text/css;charset=UTF-8,${encodeURIComponent(customStyle)}`} /> : null}
|
2023-06-08 09:10:07 +08:00
|
|
|
{isRandomUserSelectModalOpen ? <RandomUserSelectContainer
|
2023-03-25 04:48:00 +08:00
|
|
|
{...{
|
|
|
|
onRequestClose: () => this.setRandomUserSelectModalIsOpen(false),
|
|
|
|
priority: "low",
|
|
|
|
setIsOpen: this.setRandomUserSelectModalIsOpen,
|
2023-04-13 03:05:54 +08:00
|
|
|
isOpen: isRandomUserSelectModalOpen,
|
2023-03-25 04:48:00 +08:00
|
|
|
}}
|
|
|
|
/> : null}
|
2021-10-28 00:43:51 +08:00
|
|
|
</Styled.Layout>
|
2021-05-18 04:25:07 +08:00
|
|
|
</>
|
2016-04-29 03:02:51 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
App.propTypes = propTypes;
|
2017-03-17 03:57:45 +08:00
|
|
|
App.defaultProps = defaultProps;
|
2018-06-05 03:11:11 +08:00
|
|
|
|
2022-04-09 03:05:29 +08:00
|
|
|
export default injectIntl(App);
|