2021-09-13 19:34:03 +08:00
|
|
|
import React, { Component } from 'react';
|
2017-03-11 02:33:46 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
|
|
|
import AppContainer from '/imports/ui/components/app/container';
|
2024-05-29 21:26:11 +08:00
|
|
|
import { getSettingsSingletonInstance } from '/imports/ui/services/settings';
|
2024-06-06 21:50:03 +08:00
|
|
|
import Session from '/imports/ui/services/storage/in-memory';
|
2020-01-30 05:40:00 +08:00
|
|
|
import deviceInfo from '/imports/utils/deviceInfo';
|
|
|
|
import getFromUserSettings from '/imports/ui/services/users-settings';
|
2021-09-11 04:48:52 +08:00
|
|
|
import { layoutSelectInput, layoutDispatch } from '../../ui/components/layout/context';
|
2024-06-17 19:54:03 +08:00
|
|
|
import { useVideoStreams } from '/imports/ui/components/video-provider/hooks';
|
2021-04-27 07:04:34 +08:00
|
|
|
import DebugWindow from '/imports/ui/components/debug-window/component';
|
2021-05-18 04:25:07 +08:00
|
|
|
import { ACTIONS, PANELS } from '../../ui/components/layout/enums';
|
2024-06-14 21:30:48 +08:00
|
|
|
import { useIsChatEnabled } from '/imports/ui/services/features';
|
2024-01-30 21:03:11 +08:00
|
|
|
import useUserChangedLocalSettings from '/imports/ui/services/settings/hooks/useUserChangedLocalSettings';
|
2024-05-18 04:33:52 +08:00
|
|
|
import useSettings from '/imports/ui/services/settings/hooks/useSettings';
|
|
|
|
import { SETTINGS } from '/imports/ui/services/settings/enums';
|
2024-06-06 21:50:03 +08:00
|
|
|
import { useStorageKey } from '/imports/ui/services/storage/hooks';
|
2020-01-30 05:40:00 +08:00
|
|
|
|
2019-04-11 23:04:10 +08:00
|
|
|
const HTML = document.getElementsByTagName('html')[0];
|
2018-08-06 20:05:07 +08:00
|
|
|
|
2021-03-18 02:01:08 +08:00
|
|
|
let checkedUserSettings = false;
|
2018-08-06 20:05:07 +08:00
|
|
|
|
2019-03-12 21:56:05 +08:00
|
|
|
const fullscreenChangedEvents = [
|
|
|
|
'fullscreenchange',
|
|
|
|
'webkitfullscreenchange',
|
|
|
|
'mozfullscreenchange',
|
|
|
|
'MSFullscreenChange',
|
|
|
|
];
|
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
class Base extends Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2017-03-11 02:33:46 +08:00
|
|
|
|
2021-11-20 03:26:04 +08:00
|
|
|
this.handleFullscreenChange = this.handleFullscreenChange.bind(this);
|
|
|
|
}
|
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
componentDidMount() {
|
2021-09-16 20:25:51 +08:00
|
|
|
const { animations, usersVideo, layoutContextDispatch } = this.props;
|
2024-08-28 20:59:22 +08:00
|
|
|
const APP_CONFIG = window.meetingClientSettings.public.app;
|
|
|
|
const CAPTIONS_ALWAYS_VISIBLE = APP_CONFIG.audioCaptions.alwaysVisible;
|
2021-09-16 20:25:51 +08:00
|
|
|
|
|
|
|
layoutContextDispatch({
|
|
|
|
type: ACTIONS.SET_NUM_CAMERAS,
|
|
|
|
value: usersVideo.length,
|
|
|
|
});
|
2019-04-11 23:04:10 +08:00
|
|
|
|
|
|
|
if (animations) HTML.classList.add('animationsEnabled');
|
|
|
|
if (!animations) HTML.classList.add('animationsDisabled');
|
|
|
|
|
2019-03-12 00:21:12 +08:00
|
|
|
fullscreenChangedEvents.forEach((event) => {
|
2021-11-20 03:26:04 +08:00
|
|
|
document.addEventListener(event, this.handleFullscreenChange);
|
2019-03-12 00:21:12 +08:00
|
|
|
});
|
2024-06-06 21:50:03 +08:00
|
|
|
Session.setItem('isFullscreen', false);
|
2024-06-13 00:06:07 +08:00
|
|
|
Session.setItem('audioCaptions', CAPTIONS_ALWAYS_VISIBLE);
|
2021-09-13 19:34:03 +08:00
|
|
|
}
|
2019-03-12 00:21:12 +08:00
|
|
|
|
2024-03-13 22:11:58 +08:00
|
|
|
componentDidUpdate(prevProps) {
|
2021-09-13 19:34:03 +08:00
|
|
|
const {
|
|
|
|
animations,
|
|
|
|
layoutContextDispatch,
|
|
|
|
sidebarContentPanel,
|
|
|
|
usersVideo,
|
2024-01-30 21:03:11 +08:00
|
|
|
setLocalSettings,
|
2024-06-14 21:30:48 +08:00
|
|
|
isChatEnabled,
|
2021-09-13 19:34:03 +08:00
|
|
|
} = this.props;
|
2021-07-20 21:19:48 +08:00
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
if (usersVideo !== prevProps.usersVideo) {
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-05-18 04:25:07 +08:00
|
|
|
type: ACTIONS.SET_NUM_CAMERAS,
|
|
|
|
value: usersVideo.length,
|
|
|
|
});
|
2020-06-09 11:09:46 +08:00
|
|
|
}
|
|
|
|
|
2019-04-11 23:04:10 +08:00
|
|
|
const enabled = HTML.classList.contains('animationsEnabled');
|
|
|
|
const disabled = HTML.classList.contains('animationsDisabled');
|
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
if (animations && animations !== prevProps.animations) {
|
2019-04-11 23:04:10 +08:00
|
|
|
if (disabled) HTML.classList.remove('animationsDisabled');
|
|
|
|
HTML.classList.add('animationsEnabled');
|
2021-09-13 19:34:03 +08:00
|
|
|
} else if (!animations && animations !== prevProps.animations) {
|
2019-04-11 23:04:10 +08:00
|
|
|
if (enabled) HTML.classList.remove('animationsEnabled');
|
|
|
|
HTML.classList.add('animationsDisabled');
|
2019-01-25 00:16:23 +08:00
|
|
|
}
|
2021-07-20 21:19:48 +08:00
|
|
|
|
2024-04-26 21:33:20 +08:00
|
|
|
if (Session.equals('layoutReady', true) && (sidebarContentPanel === PANELS.NONE)) {
|
2021-07-20 21:19:48 +08:00
|
|
|
if (!checkedUserSettings) {
|
2024-01-23 05:33:58 +08:00
|
|
|
const showAnimationsDefault = getFromUserSettings(
|
|
|
|
'bbb_show_animations_default',
|
2024-08-28 20:59:22 +08:00
|
|
|
window.meetingClientSettings.public.app.defaultSettings.application.animations,
|
2024-01-23 05:33:58 +08:00
|
|
|
);
|
|
|
|
|
2024-05-29 21:26:11 +08:00
|
|
|
const Settings = getSettingsSingletonInstance();
|
2024-01-23 05:33:58 +08:00
|
|
|
Settings.application.animations = showAnimationsDefault;
|
2024-01-30 21:03:11 +08:00
|
|
|
Settings.save(setLocalSettings);
|
2024-01-23 05:33:58 +08:00
|
|
|
|
2024-03-22 03:41:32 +08:00
|
|
|
if (getFromUserSettings('bbb_show_participants_on_login', window.meetingClientSettings.public.layout.showParticipantsOnLogin) && !deviceInfo.isPhone) {
|
2024-06-14 21:30:48 +08:00
|
|
|
if (isChatEnabled && getFromUserSettings('bbb_show_public_chat_on_login', !window.meetingClientSettings.public.chat.startClosed)) {
|
2024-05-29 21:26:11 +08:00
|
|
|
const PUBLIC_CHAT_ID = window.meetingClientSettings.public.chat.public_group_id;
|
|
|
|
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-20 21:19:48 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_NAVIGATION_IS_OPEN,
|
|
|
|
value: true,
|
|
|
|
});
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-20 21:19:48 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_IS_OPEN,
|
|
|
|
value: true,
|
|
|
|
});
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-20 21:19:48 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_PANEL,
|
|
|
|
value: PANELS.CHAT,
|
|
|
|
});
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-20 21:19:48 +08:00
|
|
|
type: ACTIONS.SET_ID_CHAT_OPEN,
|
|
|
|
value: PUBLIC_CHAT_ID,
|
|
|
|
});
|
|
|
|
} else {
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-20 21:19:48 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_NAVIGATION_IS_OPEN,
|
|
|
|
value: true,
|
|
|
|
});
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-20 21:19:48 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_IS_OPEN,
|
|
|
|
value: false,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} else {
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-20 21:19:48 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_NAVIGATION_IS_OPEN,
|
|
|
|
value: false,
|
|
|
|
});
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-07-20 21:19:48 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_IS_OPEN,
|
|
|
|
value: false,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2024-04-26 21:33:20 +08:00
|
|
|
checkedUserSettings = true;
|
2021-07-20 21:19:48 +08:00
|
|
|
}
|
|
|
|
}
|
2021-09-13 19:34:03 +08:00
|
|
|
}
|
2019-01-22 03:28:37 +08:00
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
componentWillUnmount() {
|
|
|
|
fullscreenChangedEvents.forEach((event) => {
|
2021-11-20 03:26:04 +08:00
|
|
|
document.removeEventListener(event, this.handleFullscreenChange);
|
2021-09-13 19:34:03 +08:00
|
|
|
});
|
|
|
|
}
|
2017-03-11 02:33:46 +08:00
|
|
|
|
2024-08-28 20:59:22 +08:00
|
|
|
handleFullscreenChange() {
|
|
|
|
const { layoutContextDispatch } = this.props;
|
|
|
|
|
|
|
|
if (document.fullscreenElement
|
|
|
|
|| document.webkitFullscreenElement
|
|
|
|
|| document.mozFullScreenElement
|
|
|
|
|| document.msFullscreenElement) {
|
|
|
|
Session.setItem('isFullscreen', true);
|
|
|
|
} else {
|
|
|
|
layoutContextDispatch({
|
|
|
|
type: ACTIONS.SET_FULLSCREEN_ELEMENT,
|
|
|
|
value: {
|
|
|
|
element: '',
|
|
|
|
group: '',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
Session.setItem('isFullscreen', false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-03-13 22:11:58 +08:00
|
|
|
render() {
|
2021-09-13 19:34:03 +08:00
|
|
|
return (
|
|
|
|
<>
|
2024-03-13 22:11:58 +08:00
|
|
|
<DebugWindow />
|
|
|
|
<AppContainer {...this.props} />
|
2021-09-13 19:34:03 +08:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2017-03-11 02:33:46 +08:00
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
const BaseContainer = (props) => {
|
2024-06-06 21:50:03 +08:00
|
|
|
const codeError = useStorageKey('codeError');
|
2021-09-13 19:34:03 +08:00
|
|
|
const sidebarContent = layoutSelectInput((i) => i.sidebarContent);
|
|
|
|
const { sidebarContentPanel } = sidebarContent;
|
|
|
|
const layoutContextDispatch = layoutDispatch();
|
2024-01-30 21:03:11 +08:00
|
|
|
const setLocalSettings = useUserChangedLocalSettings();
|
2024-05-29 21:26:11 +08:00
|
|
|
|
|
|
|
const applicationSettings = useSettings(SETTINGS.APPLICATION);
|
|
|
|
const animations = applicationSettings?.animations;
|
|
|
|
|
2024-07-19 20:52:55 +08:00
|
|
|
const { viewScreenshare } = useSettings(SETTINGS.DATA_SAVING);
|
|
|
|
const { streams: usersVideo } = useVideoStreams();
|
2024-06-05 01:09:48 +08:00
|
|
|
const loggedIn = Auth.useLoggedIn();
|
2024-06-14 21:30:48 +08:00
|
|
|
const isChatEnabled = useIsChatEnabled();
|
2024-01-30 21:03:11 +08:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Base
|
|
|
|
{...{
|
|
|
|
sidebarContentPanel,
|
|
|
|
layoutContextDispatch,
|
|
|
|
setLocalSettings,
|
2024-04-20 04:34:43 +08:00
|
|
|
usersVideo,
|
2024-05-18 04:33:52 +08:00
|
|
|
animations,
|
|
|
|
viewScreenshare,
|
2024-06-06 21:50:03 +08:00
|
|
|
codeError,
|
2024-06-05 01:09:48 +08:00
|
|
|
loggedIn,
|
2024-06-14 21:30:48 +08:00
|
|
|
isChatEnabled,
|
2024-01-30 21:03:11 +08:00
|
|
|
...props,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
2021-09-13 19:34:03 +08:00
|
|
|
};
|
|
|
|
|
2024-06-12 01:18:28 +08:00
|
|
|
export default BaseContainer;
|