Skip to content

Commit

Permalink
Ensure together mode only works in TeamsCall or Teams Meeting
Browse files Browse the repository at this point in the history
  • Loading branch information
cn0151 committed Jan 31, 2025
1 parent 488835f commit 1ddb1a4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ import { showDtmfDialer } from '../../CallComposite/utils/MediaGalleryUtils';
import { useSelector } from '../../CallComposite/hooks/useSelector';
import { getTargetCallees } from '../../CallComposite/selectors/baseSelectors';
/* @conditional-compile-remove(together-mode) */
import { getIsTogetherModeActive, getCapabilites, getLocalUserId } from '../../CallComposite/selectors/baseSelectors';
import {
getIsTogetherModeActive,
getCapabilites,
getLocalUserId,
getIsTeamsCall
} from '../../CallComposite/selectors/baseSelectors';
import { getTeamsMeetingCoordinates, getIsTeamsMeeting } from '../../CallComposite/selectors/baseSelectors';
import { CallControlOptions } from '../../CallComposite';

Expand Down Expand Up @@ -86,6 +91,8 @@ export const DesktopMoreButton = (props: DesktopMoreButtonProps): JSX.Element =>
const participantCapability = useSelector(getCapabilites);
/* @conditional-compile-remove(together-mode) */
const participantId = useSelector(getLocalUserId);
/* @conditional-compile-remove(together-mode) */
const isTeamsCall = useSelector(getIsTeamsCall);

const [dtmfDialerChecked, setDtmfDialerChecked] = useState<boolean>(props.dtmfDialerPresent ?? false);

Expand Down Expand Up @@ -456,7 +463,9 @@ export const DesktopMoreButton = (props: DesktopMoreButtonProps): JSX.Element =>
/* @conditional-compile-remove(overflow-top-composite) */
galleryOptions.subMenuProps?.items?.push(overflowGalleryOption);
/* @conditional-compile-remove(together-mode) */
galleryOptions.subMenuProps?.items?.push(togetherModeOption);
if (isTeamsCall || isTeamsMeeting) {
galleryOptions.subMenuProps?.items?.push(togetherModeOption);
}
if (props.callControls === true || (props.callControls as CallControlOptions)?.galleryControlsButton !== false) {
moreButtonContextualMenuItems.push(galleryOptions);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,12 @@ import { SpokenLanguageSettingsDrawer } from './SpokenLanguageSettingsDrawer';
import { DtmfDialPadOptions } from '../../CallComposite';
import { getRemoteParticipantsConnectedSelector } from '../../CallComposite/selectors/mediaGallerySelector';
/* @conditional-compile-remove(together-mode) */
import { getCapabilites, getIsTogetherModeActive, getLocalUserId } from '../../CallComposite/selectors/baseSelectors';
import {
getCapabilites,
getIsTogetherModeActive,
getLocalUserId,
getIsTeamsCall
} from '../../CallComposite/selectors/baseSelectors';

/** @private */
export interface MoreDrawerStrings {
Expand Down Expand Up @@ -211,7 +216,10 @@ export const MoreDrawer = (props: MoreDrawerProps): JSX.Element => {
const participantId = useSelector(getLocalUserId);
/* @conditional-compile-remove(together-mode) */
const isTogetherModeActive = useSelector(getIsTogetherModeActive);
/* @conditional-compile-remove(together-mode) */
const isTeamsCall = useSelector(getIsTeamsCall);

const isTeamsMeeting = getIsTeamsMeeting(callAdapter.getState());
const onSpeakerItemClick = useCallback(
(
_ev: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement> | undefined,
Expand Down Expand Up @@ -419,7 +427,9 @@ export const MoreDrawer = (props: MoreDrawerProps): JSX.Element => {
/* @conditional-compile-remove(gallery-layout-composite) */
galleryLayoutOptions.subMenuProps?.push(galleryOption);
/* @conditional-compile-remove(together-mode) */
galleryLayoutOptions.subMenuProps?.push(togetherModeOption);
if (isTeamsCall || isTeamsMeeting) {
galleryLayoutOptions.subMenuProps?.push(togetherModeOption);
}

if (drawerSelectionOptions !== false && isEnabled(drawerSelectionOptions?.galleryControlsButton)) {
drawerMenuItems.push(galleryLayoutOptions);
Expand Down Expand Up @@ -477,8 +487,6 @@ export const MoreDrawer = (props: MoreDrawerProps): JSX.Element => {
});
}

const isTeamsMeeting = getIsTeamsMeeting(callAdapter.getState());

const teamsMeetingCoordinates = getTeamsMeetingCoordinates(callAdapter.getState());

if (
Expand Down

0 comments on commit 1ddb1a4

Please sign in to comment.