2024-08-29 23:12:09 +08:00
|
|
|
import React, { useEffect } from 'react';
|
2024-01-30 00:27:30 +08:00
|
|
|
import AudioCaptionsLiveContainer from '/imports/ui/components/audio/audio-graphql/audio-captions/live/component';
|
2018-10-19 04:37:14 +08:00
|
|
|
import getFromUserSettings from '/imports/ui/services/users-settings';
|
2024-08-29 23:12:09 +08:00
|
|
|
import { useIsPresentationEnabled, useIsExternalVideoEnabled } from '/imports/ui/services/features';
|
2024-03-13 22:11:58 +08:00
|
|
|
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
|
|
|
|
import useMeeting from '/imports/ui/core/hooks/useMeeting';
|
2021-10-20 04:35:39 +08:00
|
|
|
import {
|
|
|
|
layoutSelectInput,
|
|
|
|
layoutSelectOutput,
|
2021-09-11 04:48:52 +08:00
|
|
|
} from '../layout/context';
|
2024-06-13 00:06:07 +08:00
|
|
|
import useSetSpeechOptions from '../audio/audio-graphql/hooks/useSetSpeechOptions';
|
2019-04-11 03:40:40 +08:00
|
|
|
|
2017-03-17 03:57:45 +08:00
|
|
|
import App from './component';
|
2024-05-01 20:39:03 +08:00
|
|
|
import { PINNED_PAD_SUBSCRIPTION } from '../notes/queries';
|
2024-06-04 21:40:54 +08:00
|
|
|
import useDeduplicatedSubscription from '../../core/hooks/useDeduplicatedSubscription';
|
2024-05-18 04:33:52 +08:00
|
|
|
import useSettings from '../../services/settings/hooks/useSettings';
|
|
|
|
import { SETTINGS } from '../../services/settings/enums';
|
2016-12-23 07:34:20 +08:00
|
|
|
|
2017-07-14 22:18:07 +08:00
|
|
|
const AppContainer = (props) => {
|
2024-06-12 05:55:38 +08:00
|
|
|
const {
|
|
|
|
viewScreenshare,
|
|
|
|
} = useSettings(SETTINGS.DATA_SAVING);
|
|
|
|
|
|
|
|
const {
|
|
|
|
data: currentUser,
|
|
|
|
} = useCurrentUser((u) => ({
|
|
|
|
away: u.away,
|
|
|
|
raiseHand: u.raiseHand,
|
|
|
|
userId: u.userId,
|
|
|
|
presenter: u.presenter,
|
|
|
|
}));
|
|
|
|
|
|
|
|
const {
|
|
|
|
data: currentMeeting,
|
|
|
|
} = useMeeting((m) => ({
|
|
|
|
layout: m.layout,
|
|
|
|
componentsFlags: m.componentsFlags,
|
|
|
|
}));
|
|
|
|
|
2024-06-13 22:48:15 +08:00
|
|
|
const presentationRestoreOnUpdate = getFromUserSettings(
|
|
|
|
'bbb_force_restore_presentation_on_new_events',
|
|
|
|
window.meetingClientSettings.public.presentation.restoreOnUpdate,
|
|
|
|
);
|
2024-06-12 05:55:38 +08:00
|
|
|
|
2024-05-29 21:26:11 +08:00
|
|
|
const NOTES_CONFIG = window.meetingClientSettings.public.notes;
|
|
|
|
|
2024-05-18 04:33:52 +08:00
|
|
|
const {
|
|
|
|
darkTheme,
|
|
|
|
} = useSettings(SETTINGS.APPLICATION);
|
|
|
|
|
2024-06-13 00:06:07 +08:00
|
|
|
const { partialUtterances, minUtteranceLength } = useSettings(SETTINGS.TRANSCRIPTION);
|
2024-05-18 04:33:52 +08:00
|
|
|
|
2024-06-11 03:31:30 +08:00
|
|
|
const genericMainContent = layoutSelectInput((i) => i.genericMainContent);
|
2021-09-11 04:48:52 +08:00
|
|
|
const captionsStyle = layoutSelectOutput((i) => i.captions);
|
2021-09-14 02:41:52 +08:00
|
|
|
const presentation = layoutSelectInput((i) => i.presentation);
|
2024-04-19 22:08:13 +08:00
|
|
|
const sharedNotesInput = layoutSelectInput((i) => i.sharedNotes);
|
2021-09-10 21:16:44 +08:00
|
|
|
|
2024-06-13 00:06:07 +08:00
|
|
|
const setSpeechOptions = useSetSpeechOptions();
|
2024-06-04 21:40:54 +08:00
|
|
|
const { data: pinnedPadData } = useDeduplicatedSubscription(PINNED_PAD_SUBSCRIPTION);
|
2024-04-19 22:08:13 +08:00
|
|
|
const isSharedNotesPinnedFromGraphql = !!pinnedPadData
|
2024-01-16 03:49:09 +08:00
|
|
|
&& pinnedPadData.sharedNotes[0]?.sharedNotesExtId === NOTES_CONFIG.id;
|
2024-04-19 22:08:13 +08:00
|
|
|
const isSharedNotesPinned = sharedNotesInput?.isPinned && isSharedNotesPinnedFromGraphql;
|
2024-06-14 21:30:48 +08:00
|
|
|
const isExternalVideoEnabled = useIsExternalVideoEnabled();
|
|
|
|
const isPresentationEnabled = useIsPresentationEnabled();
|
2024-08-29 23:12:09 +08:00
|
|
|
const isPresenter = currentUser?.presenter;
|
2023-11-30 21:24:25 +08:00
|
|
|
|
2023-02-17 23:44:36 +08:00
|
|
|
const { isOpen } = presentation;
|
2023-02-21 23:44:12 +08:00
|
|
|
const presentationIsOpen = isOpen;
|
|
|
|
|
2024-06-04 21:40:54 +08:00
|
|
|
const isSharingVideo = currentMeeting?.componentsFlags.hasExternalVideo;
|
2023-11-29 21:22:59 +08:00
|
|
|
|
2024-06-14 21:30:48 +08:00
|
|
|
const shouldShowExternalVideo = isExternalVideoEnabled && isSharingVideo;
|
2023-11-29 21:22:59 +08:00
|
|
|
|
2024-06-11 03:31:30 +08:00
|
|
|
const shouldShowGenericMainContent = !!genericMainContent.genericContentId;
|
2024-02-19 18:59:45 +08:00
|
|
|
|
2024-06-13 22:48:15 +08:00
|
|
|
const shouldShowScreenshare = (viewScreenshare || isPresenter)
|
2024-06-25 00:02:10 +08:00
|
|
|
&& (currentMeeting?.componentsFlags?.hasScreenshare
|
|
|
|
|| currentMeeting?.componentsFlags?.hasCameraAsContent);
|
2024-04-19 22:08:13 +08:00
|
|
|
const shouldShowPresentation = (!shouldShowScreenshare && !isSharedNotesPinned
|
2024-06-11 03:31:30 +08:00
|
|
|
&& !shouldShowExternalVideo && !shouldShowGenericMainContent
|
2024-06-14 21:30:48 +08:00
|
|
|
&& (presentationIsOpen || presentationRestoreOnUpdate)) && isPresentationEnabled;
|
2024-04-17 06:39:29 +08:00
|
|
|
|
2024-06-13 00:06:07 +08:00
|
|
|
// Update after editing app savings
|
|
|
|
useEffect(() => {
|
|
|
|
setSpeechOptions(
|
|
|
|
partialUtterances,
|
|
|
|
minUtteranceLength,
|
|
|
|
);
|
|
|
|
}, [partialUtterances, minUtteranceLength]);
|
2024-06-12 05:55:38 +08:00
|
|
|
|
2024-08-29 23:12:09 +08:00
|
|
|
if (!currentUser) return null;
|
2024-06-14 22:12:44 +08:00
|
|
|
|
2024-06-12 05:55:38 +08:00
|
|
|
return currentUser?.userId
|
2021-07-21 21:19:47 +08:00
|
|
|
? (
|
|
|
|
<App
|
|
|
|
{...{
|
2024-06-12 05:55:38 +08:00
|
|
|
hideActionsBar: getFromUserSettings('bbb_hide_actions_bar', false),
|
|
|
|
currentUserAway: currentUser.away,
|
|
|
|
currentUserRaiseHand: currentUser.raiseHand,
|
2021-08-16 21:38:39 +08:00
|
|
|
captionsStyle,
|
2022-02-11 22:32:08 +08:00
|
|
|
presentationIsOpen,
|
2023-11-29 21:22:59 +08:00
|
|
|
shouldShowExternalVideo,
|
2023-11-30 21:24:25 +08:00
|
|
|
shouldShowScreenshare,
|
2024-04-19 22:08:13 +08:00
|
|
|
isSharedNotesPinned,
|
2023-11-30 21:24:25 +08:00
|
|
|
shouldShowPresentation,
|
2024-06-11 03:31:30 +08:00
|
|
|
genericMainContentId: genericMainContent.genericContentId,
|
2024-06-04 04:14:32 +08:00
|
|
|
audioCaptions: <AudioCaptionsLiveContainer />,
|
2024-05-18 04:33:52 +08:00
|
|
|
darkTheme,
|
2021-07-21 21:19:47 +08:00
|
|
|
}}
|
2024-08-30 02:08:24 +08:00
|
|
|
{...props}
|
2021-07-21 21:19:47 +08:00
|
|
|
/>
|
|
|
|
)
|
|
|
|
: null;
|
2017-07-14 22:18:07 +08:00
|
|
|
};
|
2016-07-07 22:01:40 +08:00
|
|
|
|
2024-06-12 05:55:38 +08:00
|
|
|
export default AppContainer;
|