2024-06-06 21:50:03 +08:00
|
|
|
import React, { useContext } from 'react';
|
2021-04-01 19:14:24 +08:00
|
|
|
import deviceInfo from '/imports/utils/deviceInfo';
|
|
|
|
import browserInfo from '/imports/utils/browserInfo';
|
2023-09-22 04:47:51 +08:00
|
|
|
import OptionsDropdown from './component';
|
2022-02-15 22:42:02 +08:00
|
|
|
import FullscreenService from '/imports/ui/components/common/fullscreen-button/service';
|
2024-06-12 03:04:11 +08:00
|
|
|
import { layoutSelect } from '../../layout/context';
|
2023-09-22 04:47:51 +08:00
|
|
|
import { PluginsContext } from '/imports/ui/components/components-data/plugin-context/context';
|
2023-12-08 03:40:32 +08:00
|
|
|
import { USER_LEAVE_MEETING } from '/imports/ui/core/graphql/mutations/userMutations';
|
|
|
|
import { useMutation } from '@apollo/client';
|
2024-01-30 00:27:30 +08:00
|
|
|
import useMeeting from '/imports/ui/core/hooks/useMeeting';
|
2024-04-25 04:18:21 +08:00
|
|
|
import { useShortcut } from '/imports/ui/core/hooks/useShortcut';
|
2024-06-06 21:50:03 +08:00
|
|
|
import { useStorageKey } from '/imports/ui/services/storage/hooks';
|
|
|
|
import Session from '/imports/ui/services/storage/in-memory';
|
2017-05-16 23:37:17 +08:00
|
|
|
|
2021-04-01 19:14:24 +08:00
|
|
|
const { isIphone } = deviceInfo;
|
|
|
|
const { isSafari, isValidSafariVersion } = browserInfo;
|
|
|
|
|
|
|
|
const noIOSFullscreen = !!(((isSafari && !isValidSafariVersion) || isIphone));
|
2024-04-17 06:39:29 +08:00
|
|
|
|
2024-06-06 21:50:03 +08:00
|
|
|
const setAudioCaptions = (value) => Session.setItem('audioCaptions', value);
|
2019-09-05 02:32:58 +08:00
|
|
|
|
2023-09-22 04:47:51 +08:00
|
|
|
const OptionsDropdownContainer = (props) => {
|
2022-05-13 21:42:19 +08:00
|
|
|
const isRTL = layoutSelect((i) => i.isRTL);
|
2023-11-29 02:31:28 +08:00
|
|
|
const { pluginsExtensibleAreasAggregatedState } = useContext(PluginsContext);
|
2023-09-22 04:47:51 +08:00
|
|
|
let optionsDropdownItems = [];
|
2023-11-29 02:31:28 +08:00
|
|
|
if (pluginsExtensibleAreasAggregatedState.optionsDropdownItems) {
|
2023-09-22 04:47:51 +08:00
|
|
|
optionsDropdownItems = [
|
2023-11-29 02:31:28 +08:00
|
|
|
...pluginsExtensibleAreasAggregatedState.optionsDropdownItems,
|
2023-09-22 04:47:51 +08:00
|
|
|
];
|
|
|
|
}
|
2022-03-04 02:03:05 +08:00
|
|
|
|
2024-01-30 00:27:30 +08:00
|
|
|
const {
|
|
|
|
data: currentMeeting,
|
2024-06-06 21:50:03 +08:00
|
|
|
} = useMeeting((m) => ({
|
|
|
|
componentsFlags: m.componentsFlags,
|
2024-06-12 03:04:11 +08:00
|
|
|
isBreakout: m.isBreakout,
|
2024-06-06 21:50:03 +08:00
|
|
|
}));
|
2024-01-30 00:27:30 +08:00
|
|
|
|
|
|
|
const componentsFlags = currentMeeting?.componentsFlags;
|
|
|
|
const audioCaptionsEnabled = componentsFlags?.hasCaption;
|
|
|
|
|
2023-12-08 03:40:32 +08:00
|
|
|
const [userLeaveMeeting] = useMutation(USER_LEAVE_MEETING);
|
2024-04-25 04:18:21 +08:00
|
|
|
const openOptions = useShortcut('openOptions');
|
2024-06-06 21:50:03 +08:00
|
|
|
const audioCaptionsActive = useStorageKey('audioCaptions') || false;
|
|
|
|
const isDropdownOpen = useStorageKey('dropdownOpen');
|
2023-12-08 03:40:32 +08:00
|
|
|
|
2022-03-04 02:03:05 +08:00
|
|
|
return (
|
2023-09-22 04:47:51 +08:00
|
|
|
<OptionsDropdown {...{
|
2024-04-25 04:18:21 +08:00
|
|
|
isRTL,
|
|
|
|
optionsDropdownItems,
|
|
|
|
userLeaveMeeting,
|
|
|
|
audioCaptionsEnabled,
|
|
|
|
shortcuts: openOptions,
|
2024-06-06 21:50:03 +08:00
|
|
|
audioCaptionsActive,
|
|
|
|
isDropdownOpen,
|
2024-06-12 03:04:11 +08:00
|
|
|
handleToggleFullscreen: FullscreenService.toggleFullScreen,
|
|
|
|
audioCaptionsSet: (value) => setAudioCaptions(value),
|
|
|
|
isMobile: deviceInfo.isMobile,
|
|
|
|
noIOSFullscreen,
|
|
|
|
isBreakoutRoom: currentMeeting?.isBreakout,
|
|
|
|
// TODO: Replace/Remove
|
|
|
|
isMeteorConnected: true,
|
2024-04-25 04:18:21 +08:00
|
|
|
...props,
|
2023-09-22 04:47:51 +08:00
|
|
|
}}
|
|
|
|
/>
|
2022-03-04 02:03:05 +08:00
|
|
|
);
|
|
|
|
};
|
2019-03-12 00:21:12 +08:00
|
|
|
|
2024-06-12 03:04:11 +08:00
|
|
|
export default OptionsDropdownContainer;
|