Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "none",
"area": "fix",
"workstream": "Screenshare button",
"comment": "Prevent showing screenShareButton when formFactor is set to mobile",
"packageName": "@azure/communication-react",
"email": "79475487+mgamis-msft@users.noreply.github.com",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "none",
"area": "fix",
"workstream": "Screenshare button",
"comment": "Prevent showing screenShareButton when formFactor is set to mobile",
"packageName": "@azure/communication-react",
"email": "79475487+mgamis-msft@users.noreply.github.com",
"dependentChangeType": "none"
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,31 @@ export type CallControlsProps = {
// Enforce a background color on control bar to ensure it matches the composite background color.
const controlBarStyles = memoizeFunction((background: string) => ({ root: { background: background } }));

const inferCallControlOptions = (
mobileView: boolean,
callControlOptions?: boolean | CallControlOptions
): CallControlOptions => {
if (callControlOptions === false) {
return {};
}

const options = callControlOptions === true || callControlOptions === undefined ? {} : callControlOptions;
if (mobileView) {
// Set options to always not show screen share button for mobile
options.screenShareButton = false;
}
return options;
};

/**
* @private
*/
export const CallControls = (props: CallControlsProps & ContainerRectProps): JSX.Element => {
const options = useMemo(() => (typeof props.options === 'boolean' ? {} : props.options), [props.options]);
const options: CallControlOptions = useMemo(
() => inferCallControlOptions(!!props.isMobile, props.options),
[props.isMobile, props.options]
);

/* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(rooms) */
const adapter = useAdapter();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,8 @@ const inferCommonCallControlOptions = (
if (mobileView) {
// Set to compressed mode when composite is optimized for mobile
options.displayType = 'compact';
// Do not show screen share button when composite is optimized for mobile unless the developer
// has explicitly opted in.
if (options.screenShareButton !== true) {
options.screenShareButton = false;
}
// Set options to always not show screen share button for mobile
options.screenShareButton = false;
}
return options;
};
Expand Down
6 changes: 3 additions & 3 deletions samples/CallWithChat/src/app/views/CallScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,15 @@ export const CallScreen = (props: CallScreenProps): JSX.Element => {
afterAdapterCreate
);

const shouldDisableScreenShare = isIOS();
const shouldHideScreenShare = isMobileSession || isIOS();

const options: CallWithChatCompositeOptions = useMemo(
() => ({
callControls: {
screenShareButton: !shouldDisableScreenShare
Comment thread
JamesBurnside marked this conversation as resolved.
screenShareButton: shouldHideScreenShare ? false : undefined
}
}),
[shouldDisableScreenShare]
[shouldHideScreenShare]
);

// Dispose of the adapter in the window's before unload event.
Expand Down
4 changes: 2 additions & 2 deletions samples/Calling/src/app/views/CallCompositeContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ export const CallCompositeContainer = (props: CallCompositeContainerProps): JSX.
const { adapter } = props;
const { currentTheme, currentRtl } = useSwitchableFluentTheme();
const isMobileSession = useIsMobile();
const shouldDisableScreenShare = isIOS();
const shouldDisableScreenShare = isMobileSession || isIOS();

const options: CallCompositeOptions = useMemo(
() => ({
/* @conditional-compile-remove(call-readiness) */ onPermissionsTroubleshootingClick,
/* @conditional-compile-remove(call-readiness) */ onNetworkingTroubleShootingClick,
callControls: {
screenShareButton: !shouldDisableScreenShare
screenShareButton: shouldDisableScreenShare ? false : undefined
}
}),
[shouldDisableScreenShare]
Expand Down