2021-09-10 21:16:44 +08:00
|
|
|
import React from 'react';
|
2018-01-08 12:44:42 +08:00
|
|
|
import Settings from './component';
|
2021-09-11 04:48:52 +08:00
|
|
|
import { layoutDispatch } from '../layout/context';
|
2024-06-14 21:30:48 +08:00
|
|
|
import { useIsChatEnabled, useIsScreenSharingEnabled } from '/imports/ui/services/features';
|
2023-08-11 21:14:16 +08:00
|
|
|
import UserReactionService from '/imports/ui/components/user-reaction/service';
|
2024-06-13 00:06:07 +08:00
|
|
|
import AudioCaptionsService from '/imports/ui/components/audio/audio-graphql/audio-captions/service';
|
2017-03-29 02:41:48 +08:00
|
|
|
|
2017-02-25 04:19:53 +08:00
|
|
|
import {
|
2018-01-08 12:44:42 +08:00
|
|
|
updateSettings,
|
|
|
|
getAvailableLocales,
|
2024-07-03 01:58:58 +08:00
|
|
|
FALLBACK_LOCALES,
|
2018-01-08 12:44:42 +08:00
|
|
|
} from './service';
|
2024-01-30 21:03:11 +08:00
|
|
|
import useUserChangedLocalSettings from '../../services/settings/hooks/useUserChangedLocalSettings';
|
2024-06-17 19:54:03 +08:00
|
|
|
import { useShouldRenderPaginationToggle } from '/imports/ui/components/video-provider/hooks';
|
2024-05-17 21:37:32 +08:00
|
|
|
import useSettings from '/imports/ui/services/settings/hooks/useSettings';
|
|
|
|
import { SETTINGS } from '/imports/ui/services/settings/enums';
|
|
|
|
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
|
|
|
|
import useMeeting from '/imports/ui/core/hooks/useMeeting';
|
|
|
|
|
|
|
|
const ASK_MODERATOR = 'ASK_MODERATOR';
|
2016-12-21 02:06:01 +08:00
|
|
|
|
2021-08-09 22:24:02 +08:00
|
|
|
const SettingsContainer = (props) => {
|
2021-09-11 04:48:52 +08:00
|
|
|
const layoutContextDispatch = layoutDispatch();
|
2024-01-30 21:03:11 +08:00
|
|
|
const setLocalSettings = useUserChangedLocalSettings();
|
2024-05-06 22:24:45 +08:00
|
|
|
const paginationToggleEnabled = useShouldRenderPaginationToggle();
|
2024-05-17 21:37:32 +08:00
|
|
|
const { data: currentUser } = useCurrentUser((u) => ({
|
|
|
|
presenter: u.presenter,
|
|
|
|
isModerator: u.isModerator,
|
|
|
|
}));
|
|
|
|
const { data: meeting } = useMeeting((m) => ({
|
|
|
|
usersPolicies: {
|
|
|
|
guestPolicy: m.usersPolicies.guestPolicy,
|
|
|
|
},
|
|
|
|
}));
|
|
|
|
const application = useSettings(SETTINGS.APPLICATION);
|
|
|
|
const audio = useSettings(SETTINGS.AUDIO);
|
|
|
|
const dataSaving = useSettings(SETTINGS.DATA_SAVING);
|
2024-06-13 00:06:07 +08:00
|
|
|
const transcription = useSettings(SETTINGS.TRANSCRIPTION);
|
2024-05-17 21:37:32 +08:00
|
|
|
const availableLocales = getAvailableLocales();
|
|
|
|
const isPresenter = currentUser?.presenter ?? false;
|
|
|
|
const isModerator = currentUser?.isModerator ?? false;
|
|
|
|
const isScreenSharingEnabled = useIsScreenSharingEnabled();
|
|
|
|
const showGuestNotification = meeting?.usersPolicies?.guestPolicy === ASK_MODERATOR;
|
|
|
|
const isReactionsEnabled = UserReactionService.useIsEnabled();
|
2024-06-13 00:06:07 +08:00
|
|
|
const isGladiaEnabled = AudioCaptionsService.isGladia();
|
2024-06-14 21:30:48 +08:00
|
|
|
const isChatEnabled = useIsChatEnabled();
|
2021-06-19 02:32:46 +08:00
|
|
|
|
2024-01-30 21:03:11 +08:00
|
|
|
return (
|
|
|
|
<Settings
|
2024-05-17 21:37:32 +08:00
|
|
|
{...{
|
|
|
|
...props,
|
|
|
|
updateSettings,
|
|
|
|
application,
|
|
|
|
audio,
|
|
|
|
dataSaving,
|
2024-06-13 00:06:07 +08:00
|
|
|
transcription,
|
2024-05-17 21:37:32 +08:00
|
|
|
availableLocales,
|
|
|
|
isPresenter,
|
|
|
|
isModerator,
|
|
|
|
isScreenSharingEnabled,
|
|
|
|
showGuestNotification,
|
|
|
|
isReactionsEnabled,
|
|
|
|
showToggleLabel: false,
|
|
|
|
isVideoEnabled: window.meetingClientSettings.public.kurento.enableVideo,
|
2024-06-13 00:06:07 +08:00
|
|
|
isGladiaEnabled,
|
2024-06-14 21:30:48 +08:00
|
|
|
isChatEnabled,
|
2024-05-17 21:37:32 +08:00
|
|
|
}}
|
2024-01-30 21:03:11 +08:00
|
|
|
layoutContextDispatch={layoutContextDispatch}
|
|
|
|
setLocalSettings={setLocalSettings}
|
2024-05-06 22:24:45 +08:00
|
|
|
paginationToggleEnabled={paginationToggleEnabled}
|
2024-07-03 01:58:58 +08:00
|
|
|
fallbackLocales={FALLBACK_LOCALES}
|
2024-01-30 21:03:11 +08:00
|
|
|
/>
|
|
|
|
);
|
2021-06-19 02:32:46 +08:00
|
|
|
};
|
2016-12-23 09:48:19 +08:00
|
|
|
|
2024-05-17 21:37:32 +08:00
|
|
|
export default SettingsContainer;
|