From 3ad9aafd7b63c976a0db5097e5c834bd1ca679e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Victor=20Nunes?= <62393923+JoVictorNunes@users.noreply.github.com> Date: Tue, 20 Aug 2024 13:29:04 -0300 Subject: [PATCH] fix: userdata-force_restore_presentation_on_new_events (#20974) --- .../ui/components/whiteboard/container.jsx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bigbluebutton-html5/imports/ui/components/whiteboard/container.jsx b/bigbluebutton-html5/imports/ui/components/whiteboard/container.jsx index 703aacc403..66d418cf3d 100644 --- a/bigbluebutton-html5/imports/ui/components/whiteboard/container.jsx +++ b/bigbluebutton-html5/imports/ui/components/whiteboard/container.jsx @@ -45,6 +45,10 @@ import { } from '../presentation/mutations'; import { useMergedCursorData } from './hooks.ts'; import useDeduplicatedSubscription from '../../core/hooks/useDeduplicatedSubscription'; +import MediaService from '/imports/ui/components/media/service'; +import getFromUserSettings from '/imports/ui/services/users-settings'; + +const FORCE_RESTORE_PRESENTATION_ON_NEW_EVENTS = 'bbb_force_restore_presentation_on_new_events'; const WhiteboardContainer = (props) => { const { @@ -53,6 +57,7 @@ const WhiteboardContainer = (props) => { } = props; const WHITEBOARD_CONFIG = window.meetingClientSettings.public.whiteboard; + const layoutContextDispatch = layoutDispatch(); const [annotations, setAnnotations] = useState([]); const [shapes, setShapes] = useState({}); @@ -223,6 +228,17 @@ const WhiteboardContainer = (props) => { ); setAnnotations([...currentAnnotations, ...newAnnotations]); + + if (newAnnotations.length) { + const restoreOnUpdate = getFromUserSettings( + FORCE_RESTORE_PRESENTATION_ON_NEW_EVENTS, + window.meetingClientSettings.public.presentation.restoreOnUpdate, + ); + + if (restoreOnUpdate) { + MediaService.setPresentationIsOpen(layoutContextDispatch, true); + } + } }; React.useEffect(() => { @@ -281,7 +297,6 @@ const WhiteboardContainer = (props) => { colorStyle, dashStyle, fillStyle, fontStyle, sizeStyle, } = WHITEBOARD_CONFIG.styles; const handleToggleFullScreen = (ref) => FullscreenService.toggleFullScreen(ref); - const layoutContextDispatch = layoutDispatch(); bgShape.push({ x: 1,