2021-09-13 19:34:03 +08:00
|
|
|
import React, { Component } from 'react';
|
2018-01-08 12:44:42 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
2017-06-06 20:33:53 +08:00
|
|
|
import PropTypes from 'prop-types';
|
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';
|
2021-04-27 07:04:34 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
2019-03-20 04:06:13 +08:00
|
|
|
import AppService from '/imports/ui/components/app/service';
|
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-04-20 04:34:43 +08:00
|
|
|
import { useVideoStreams } from '/imports/ui/components/video-provider/video-provider-graphql/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';
|
2022-03-09 22:19:25 +08:00
|
|
|
import { isChatEnabled } 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
|
|
|
|
2017-06-06 20:33:53 +08:00
|
|
|
const propTypes = {
|
2018-08-11 01:51:12 +08:00
|
|
|
approved: PropTypes.bool,
|
2017-06-06 20:33:53 +08:00
|
|
|
};
|
2017-03-11 02:33:46 +08:00
|
|
|
|
2017-06-06 20:33:53 +08:00
|
|
|
const defaultProps = {
|
2019-06-05 03:23:44 +08:00
|
|
|
approved: false,
|
2017-06-06 20:33:53 +08:00
|
|
|
};
|
2017-03-11 02:33:46 +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);
|
|
|
|
}
|
|
|
|
|
|
|
|
handleFullscreenChange() {
|
|
|
|
const { layoutContextDispatch } = this.props;
|
|
|
|
|
|
|
|
if (document.fullscreenElement
|
|
|
|
|| document.webkitFullscreenElement
|
|
|
|
|| document.mozFullScreenElement
|
|
|
|
|| document.msFullscreenElement) {
|
2024-06-06 21:50:03 +08:00
|
|
|
Session.setItem('isFullscreen', true);
|
2021-11-20 03:26:04 +08:00
|
|
|
} else {
|
|
|
|
layoutContextDispatch({
|
|
|
|
type: ACTIONS.SET_FULLSCREEN_ELEMENT,
|
|
|
|
value: {
|
|
|
|
element: '',
|
|
|
|
group: '',
|
|
|
|
},
|
|
|
|
});
|
2024-06-06 21:50:03 +08:00
|
|
|
Session.setItem('isFullscreen', false);
|
2021-11-20 03:26:04 +08:00
|
|
|
}
|
2021-09-13 19:34:03 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
componentDidMount() {
|
2021-09-16 20:25:51 +08:00
|
|
|
const { animations, usersVideo, layoutContextDispatch } = this.props;
|
|
|
|
|
|
|
|
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);
|
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,
|
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-03-22 03:41:32 +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) {
|
|
|
|
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-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
|
|
|
|
2017-06-06 20:33:53 +08:00
|
|
|
Base.propTypes = propTypes;
|
|
|
|
Base.defaultProps = defaultProps;
|
|
|
|
|
2021-09-13 19:34:03 +08:00
|
|
|
const BaseContainer = (props) => {
|
2024-06-06 21:50:03 +08:00
|
|
|
const codeError = useStorageKey('codeError');
|
|
|
|
const isGridLayout = useStorageKey('isGridEnabled');
|
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 paginationEnabled = applicationSettings?.paginationEnabled;
|
|
|
|
const animations = applicationSettings?.animations;
|
|
|
|
|
2024-05-18 04:33:52 +08:00
|
|
|
const { viewParticipantsWebcams, viewScreenshare } = useSettings(SETTINGS.DATA_SAVING);
|
2024-04-20 04:34:43 +08:00
|
|
|
const { streams: usersVideo } = useVideoStreams(
|
2024-05-18 04:33:52 +08:00
|
|
|
isGridLayout,
|
|
|
|
paginationEnabled,
|
|
|
|
viewParticipantsWebcams,
|
2024-04-20 04:34:43 +08:00
|
|
|
);
|
2024-06-05 01:09:48 +08:00
|
|
|
const loggedIn = Auth.useLoggedIn();
|
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-01-30 21:03:11 +08:00
|
|
|
...props,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
2021-09-13 19:34:03 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
export default withTracker(() => {
|
2019-02-08 03:40:27 +08:00
|
|
|
let userSubscriptionHandler;
|
2018-01-11 19:19:56 +08:00
|
|
|
|
2017-03-11 02:33:46 +08:00
|
|
|
return {
|
2019-02-08 03:40:27 +08:00
|
|
|
userSubscriptionHandler,
|
2019-06-27 00:29:34 +08:00
|
|
|
isMeteorConnected: Meteor.status().connected,
|
2019-04-06 02:10:05 +08:00
|
|
|
meetingIsBreakout: AppService.meetingIsBreakout(),
|
2017-03-11 02:33:46 +08:00
|
|
|
};
|
2021-09-13 19:34:03 +08:00
|
|
|
})(BaseContainer);
|