Skip to content

Commit

Permalink
Merge branch 'v3.0.x-release' into show-poll-result-in-bbb-playback
Browse files Browse the repository at this point in the history
  • Loading branch information
antobinary authored Sep 23, 2024
2 parents 0fcdf70 + 0847134 commit 919ae4c
Show file tree
Hide file tree
Showing 21 changed files with 777 additions and 866 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,28 +50,18 @@ class WhiteboardModel extends SystemConfiguration {
val wb = getWhiteboard(wbId)

var annotationsAdded = Array[AnnotationVO]()
var annotationsDiffAdded = Array[AnnotationVO]()
var newAnnotationsMap = wb.annotationsMap

for (annotation <- annotations) {
val oldAnnotation = wb.annotationsMap.get(annotation.id)
if (oldAnnotation.isDefined) {
val hasPermission = isPresenter || isModerator || oldAnnotation.get.userId == userId
if (hasPermission) {
// Determine if the annotation is a line shape
val isLineShape = annotation.annotationInfo.get("type").contains("line")

// Merge old and new annotation properties with special handling for line shape
val mergedAnnotationInfo = if (isLineShape) {
val newProps = annotation.annotationInfo.get("props").asInstanceOf[Option[Map[String, Any]]].getOrElse(Map.empty)
val oldProps = oldAnnotation.get.annotationInfo.get("props").asInstanceOf[Option[Map[String, Any]]].getOrElse(Map.empty)
val updatedProps = overwriteLineShapeHandles(oldProps, newProps)
annotation.annotationInfo + ("props" -> updatedProps)
} else {
deepMerge(oldAnnotation.get.annotationInfo, annotation.annotationInfo)
}
val mergedAnnotationInfo = deepMerge(oldAnnotation.get.annotationInfo, annotation.annotationInfo)

// Apply cleaning if it's an arrow annotation
val finalAnnotationInfo = if (annotation.annotationInfo.get("type").contains("arrow")) {
val finalAnnotationInfo = if (oldAnnotation.get.annotationInfo.get("type").contains("arrow")) {
cleanArrowAnnotationProps(mergedAnnotationInfo)
} else {
mergedAnnotationInfo
Expand All @@ -80,13 +70,15 @@ class WhiteboardModel extends SystemConfiguration {
val newAnnotation = oldAnnotation.get.copy(annotationInfo = finalAnnotationInfo)
newAnnotationsMap += (annotation.id -> newAnnotation)
annotationsAdded :+= newAnnotation
annotationsDiffAdded :+= annotation
println(s"Updated annotation on page [${wb.id}]. After numAnnotations=[${newAnnotationsMap.size}].")
} else {
println(s"User $userId doesn't have permission to edit annotation ${annotation.id}, ignoring...")
}
} else if (annotation.annotationInfo.contains("type")) {
newAnnotationsMap += (annotation.id -> annotation)
annotationsAdded :+= annotation
annotationsDiffAdded :+= annotation
println(s"Adding annotation to page [${wb.id}]. After numAnnotations=[${newAnnotationsMap.size}].")
} else {
println(s"New annotation [${annotation.id}] with no type, ignoring...")
Expand All @@ -97,7 +89,7 @@ class WhiteboardModel extends SystemConfiguration {

val newWb = wb.copy(annotationsMap = newAnnotationsMap)
saveWhiteboard(newWb)
annotationsAdded
annotationsDiffAdded
}

private def overwriteLineShapeHandles(oldProps: Map[String, Any], newProps: Map[String, Any]): Map[String, Any] = {
Expand Down Expand Up @@ -188,4 +180,4 @@ class WhiteboardModel extends SystemConfiguration {
}

def getChangedModeOn(wbId: String): Long = getWhiteboard(wbId).changedModeOn
}
}
2 changes: 1 addition & 1 deletion bbb-playback.placeholder.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
git clone --branch v5.1.1 --depth 1 https://github.com/bigbluebutton/bbb-playback bbb-playback
git clone --branch v5.1.2 --depth 1 https://github.com/bigbluebutton/bbb-playback bbb-playback
5 changes: 5 additions & 0 deletions bigbluebutton-html5/imports/ui/Types/meetingClientSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ export interface Cookie {

export interface Media {
audio: Audio2
screenshare: Screenshare2,
stunTurnServersFetchAddress: string
cacheStunTurnServers: boolean
fallbackStunServer: string
Expand Down Expand Up @@ -622,6 +623,10 @@ export interface Audio2 {
retryThroughRelay: boolean
}

export interface Screenshare2 {
showButtonForNonPresenters: boolean
}

export interface Bridge {
name: string
path: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
shareScreen,
screenshareHasEnded,
useIsCameraAsContentBroadcasting,
useShowButtonForNonPresenters,
} from '/imports/ui/components/screenshare/service';
import { SCREENSHARING_ERRORS } from '/imports/api/screenshare/client/bridge/errors';
import Button from '/imports/ui/components/common/button/component';
Expand Down Expand Up @@ -46,6 +47,18 @@ const intlMessages = defineMessages({
id: 'app.actionsBar.actionsDropdown.stopDesktopShareDesc',
description: 'adds context to stop desktop share option',
},
lockedDesktopShareDesc: {
id: 'app.actionsBar.actionsDropdown.lockedDesktopShareDesc',
description: 'Desktop locked Share option desc',
},
notPresenterDesktopShareLabel: {
id: 'app.actionsBar.actionsDropdown.notPresenterDesktopShareLabel',
description: 'You are not the presenter label',
},
notPresenterDesktopShareDesc: {
id: 'app.actionsBar.actionsDropdown.notPresenterDesktopShareDesc',
description: 'You are not the presenter desc',
},
screenShareNotSupported: {
id: 'app.media.screenshare.notSupported',
descriptions: 'error message when trying share screen on unsupported browsers',
Expand Down Expand Up @@ -129,6 +142,7 @@ const ScreenshareButton = ({
isScreenGloballyBroadcasting,
amIPresenter = false,
isMeteorConnected,
screenshareDataSavingSetting,
}) => {
const TROUBLESHOOTING_URLS = window.meetingClientSettings.public.media.screenshareTroubleshootingLinks;
const [stopExternalVideoShare] = useMutation(EXTERNAL_VIDEO_STOP);
Expand Down Expand Up @@ -182,17 +196,23 @@ const ScreenshareButton = ({
</Styled.ScreenShareModal>
);

const screenshareLabel = intlMessages.desktopShareLabel;
const vLabel = isScreenBroadcasting
? intlMessages.stopDesktopShareLabel : screenshareLabel;

const vDescr = isScreenBroadcasting
? intlMessages.stopDesktopShareDesc : intlMessages.desktopShareDesc;
const amIBroadcasting = isScreenBroadcasting && amIPresenter;

// this part handles the label/desc intl for the screenshare button
// basically: if you are not a presenter, the label/desc will be 'the screen cannot be shared'.
// if you are: the label/desc intl will be 'stop/start screenshare'.
let info = screenshareDataSavingSetting ? 'desktopShare' : 'lockedDesktopShare';
if (!amIPresenter) {
info = 'notPresenterDesktopShare';
} else if (isScreenBroadcasting) {
info = 'stopDesktopShare';
}

const showButtonForNonPresenters = useShowButtonForNonPresenters();

const shouldAllowScreensharing = enabled
&& (!isMobile || isTabletApp)
&& amIPresenter;
&& (amIPresenter || showButtonForNonPresenters);

const dataTest = isScreenBroadcasting ? 'stopScreenShare' : 'startScreenShare';
const loading = isScreenBroadcasting && !isScreenGloballyBroadcasting;
Expand All @@ -204,11 +224,11 @@ const ScreenshareButton = ({
? (
<Styled.Container>
<Button
disabled={(!isMeteorConnected && !isScreenBroadcasting)}
disabled={(!isMeteorConnected && !isScreenBroadcasting) || !screenshareDataSavingSetting || !amIPresenter}
icon={amIBroadcasting ? 'desktop' : 'desktop_off'}
data-test={dataTest}
label={intl.formatMessage(vLabel)}
description={intl.formatMessage(vDescr)}
label={intl.formatMessage(intlMessages[`${info}Label`])}
description={intl.formatMessage(intlMessages[`${info}Desc`])}
color={amIBroadcasting ? 'primary' : 'default'}
ghost={!amIBroadcasting}
hideLabel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ export const MuteToggle: React.FC<MuteToggleProps> = ({
cooldownActive.current = false;
}, COOLDOWN_TIME);
}
setTimeout(() => {
muteLoadingState(false);
}, 1000);
}, []);

useEffect(() => {
Expand All @@ -115,7 +118,7 @@ export const MuteToggle: React.FC<MuteToggleProps> = ({
};
}, []);

React.useEffect(() => {
useEffect(() => {
muteLoadingState(false);
}, [muted]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ export default class Button extends BaseButton {
} = this.props;

if (svgIcon) {
return (<Styled.ButtonSvgIcon iconName={svgIcon} />);
return (<Styled.ButtonSvgIcon iconName={svgIcon} wrapped />);
}

if (iconName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Styled from './styles';
interface IconProps {
iconName: string;
rotate?: boolean;
wrapped?: boolean;
}

const iconsMap: { [key: string]: JSX.Element } = {
Expand Down Expand Up @@ -68,11 +69,16 @@ const iconsMap: { [key: string]: JSX.Element } = {
const Icon: React.FC<IconProps> = ({
iconName = '',
rotate = false,
wrapped = false,
}) => {
if (!iconsMap[iconName]) {
return null;
}

if (!wrapped) {
return iconsMap[iconName];
}

return (
<Styled.Icon $rotate={rotate}>
{iconsMap[iconName]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ export const useShouldEnableVolumeControl = () => {
return VOLUME_CONTROL_ENABLED && hasAudio;
};

export const useShowButtonForNonPresenters = () => {
const MEDIA_CONFIG = window.meetingClientSettings.public.kurento;

return MEDIA_CONFIG.screenshare.showButtonForNonPresenters;
}

export const attachLocalPreviewStream = (mediaElement) => {
const { isTabletApp } = browserInfo;
if (isTabletApp) {
Expand Down Expand Up @@ -378,6 +384,7 @@ export default {
useIsScreenGloballyBroadcasting,
useIsCameraAsContentGloballyBroadcasting,
useShouldEnableVolumeControl,
useShowButtonForNonPresenters,
useIsScreenBroadcasting,
useIsCameraAsContentBroadcasting,
useScreenshareHasAudio,
Expand Down
Loading

0 comments on commit 919ae4c

Please sign in to comment.