Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bugfix] dialpad logic updates #5454

Merged
merged 36 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
8832b12
Change files
dmceachernmsft Nov 29, 2024
06f5ad5
add dialer page API
dmceachernmsft Nov 29, 2024
5f8cf92
remove type casting
dmceachernmsft Nov 29, 2024
2faa929
remove cc for dialer auto on
dmceachernmsft Nov 29, 2024
2eb3336
fix comments
dmceachernmsft Dec 2, 2024
1cad5a3
Merge branch 'main' into dmceachernmsft/dialpad-logic
dmceachernmsft Dec 2, 2024
17f2c98
add so API also allows controls to render properly
dmceachernmsft Dec 2, 2024
128fc42
Merge branch 'dmceachernmsft/dialpad-logic' of https://github.com/Azu…
dmceachernmsft Dec 2, 2024
c357d04
Update packages/react-composites CallWithChatComposite browser test s…
github-actions[bot] Dec 2, 2024
36e4d9e
Update packages/react-components browser test snapshots
github-actions[bot] Dec 2, 2024
052faeb
fix false case
dmceachernmsft Dec 3, 2024
1ff487a
Merge branch 'main' into dmceachernmsft/dialpad-logic
dmceachernmsft Dec 3, 2024
f587c2b
Update packages/react-components browser test snapshots
github-actions[bot] Dec 4, 2024
357c2db
Update packages/react-composites CallComposite browser test snapshots
github-actions[bot] Dec 4, 2024
21911ea
Merge branch 'dmceachernmsft/dialpad-logic' of https://github.com/Azu…
github-actions[bot] Dec 4, 2024
85b3cb4
Update packages/react-composites CallComposite browser test snapshots
github-actions[bot] Dec 4, 2024
35d6460
Merge branch 'dmceachernmsft/dialpad-logic' of https://github.com/Azu…
github-actions[bot] Dec 4, 2024
97499bc
Merge branch 'main' into dmceachernmsft/dialpad-logic
dmceachernmsft Dec 5, 2024
a0d8c49
Merge branch 'main' into dmceachernmsft/dialpad-logic
dmceachernmsft Dec 5, 2024
fc0ffb0
Merge branch 'main' into dmceachernmsft/dialpad-logic
dmceachernmsft Dec 6, 2024
0e06ef6
Merge branch 'main' into dmceachernmsft/dialpad-logic
dmceachernmsft Dec 6, 2024
35fc10d
Merge branch 'main' into dmceachernmsft/dialpad-logic
dmceachernmsft Dec 6, 2024
dcba53f
Merge branch 'main' of https://github.com/Azure/communication-ui-libr…
dmceachernmsft Dec 9, 2024
873c913
Merge branch 'dmceachernmsft/dialpad-logic' of https://github.com/Azu…
dmceachernmsft Dec 9, 2024
7148453
Merge branch 'main' into dmceachernmsft/dialpad-logic
dmceachernmsft Dec 9, 2024
8e162f3
Merge branch 'main' into dmceachernmsft/dialpad-logic
dmceachernmsft Dec 10, 2024
c6d3601
Merge branch 'main' into dmceachernmsft/dialpad-logic
dmceachernmsft Dec 10, 2024
6642565
Update packages/react-components browser test snapshots
github-actions[bot] Dec 10, 2024
ee47d3b
Update packages/react-composites CallComposite browser test snapshots
github-actions[bot] Dec 10, 2024
4f32212
Merge branch 'dmceachernmsft/dialpad-logic' of https://github.com/Azu…
github-actions[bot] Dec 10, 2024
ba78835
Merge branch 'main' into dmceachernmsft/dialpad-logic
dmceachernmsft Dec 11, 2024
5eb0454
Update packages/react-components browser test snapshots
github-actions[bot] Dec 12, 2024
268536e
Merge branch 'main' into dmceachernmsft/dialpad-logic
dmceachernmsft Dec 12, 2024
3177434
Update packages/react-components browser test snapshots
github-actions[bot] Dec 13, 2024
5dd272c
Merge branch 'main' into dmceachernmsft/dialpad-logic
dmceachernmsft Dec 13, 2024
302683b
Update packages/react-components browser test snapshots
github-actions[bot] Dec 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "minor",
"area": "fix",
"workstream": "Allow for contoso to hard set the dialer page, on, off, or follow our auto behaviors",
"comment": "Allow for contoso to hard set the dialer page, on, off, or follow our behaviors",
"packageName": "@azure/communication-react",
"email": "dmceachern@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "minor",
"area": "fix",
"workstream": "Allow for contoso to hard set the dialer page, on, off, or follow our auto behaviors",
"comment": "Allow for contoso to hard set the dialer page, on, off, or follow our behaviors",
"packageName": "@azure/communication-react",
"email": "dmceachern@microsoft.com",
"dependentChangeType": "patch"
}
2 changes: 0 additions & 2 deletions common/config/babel/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ module.exports = {
"in-progress-beta-feature-demo",
// Feature for remote UFD
"remote-ufd",
// Feature for showing dtmp dialer by default
"dtmf-dialer-on-by-default",
// Feature for together mode
"together-mode",
// Feature for forbid/permit remote participants audio/video access
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ export type CallCompositeOptions = {
remoteVideoTileMenuOptions?: RemoteVideoTileMenuOptions;
localVideoTile?: boolean | LocalVideoTileOptions;
videoTilesOptions?: VideoTilesOptions;
disableAutoShowDtmfDialer?: boolean;
disableAutoShowDtmfDialer?: boolean | DtmfDialPadOptions;
galleryOptions?: {
layout?: VideoGalleryLayout;
};
Expand Down Expand Up @@ -3278,6 +3278,12 @@ interface Disposable_2 {
}
export { Disposable_2 as Disposable }

// @public
export interface DtmfDialPadOptions {
// (undocumented)
dialerBehavior?: 'autoShow' | 'alwaysShow' | 'alwaysHide';
dmceachernmsft marked this conversation as resolved.
Show resolved Hide resolved
}

// @public
export type DtmfTone = 'A' | 'B' | 'C' | 'D' | 'Flash' | 'Num0' | 'Num1' | 'Num2' | 'Num3' | 'Num4' | 'Num5' | 'Num6' | 'Num7' | 'Num8' | 'Num9' | 'Pound' | 'Star';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ export type CallCompositeOptions = {
remoteVideoTileMenuOptions?: RemoteVideoTileMenuOptions;
localVideoTile?: boolean | LocalVideoTileOptions;
videoTilesOptions?: VideoTilesOptions;
disableAutoShowDtmfDialer?: boolean;
disableAutoShowDtmfDialer?: boolean | DtmfDialPadOptions;
galleryOptions?: {
layout?: VideoGalleryLayout;
};
Expand Down Expand Up @@ -2836,6 +2836,12 @@ interface Disposable_2 {
}
export { Disposable_2 as Disposable }

// @public
export interface DtmfDialPadOptions {
// (undocumented)
dialerBehavior?: 'autoShow' | 'alwaysShow' | 'alwaysHide';
}

// @public
export type DtmfTone = 'A' | 'B' | 'C' | 'D' | 'Flash' | 'Num0' | 'Num1' | 'Num2' | 'Num3' | 'Num4' | 'Num5' | 'Num6' | 'Num7' | 'Num8' | 'Num9' | 'Pound' | 'Star';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,15 @@ export interface LocalVideoTileOptions {
*/
position?: 'grid' | 'floating';
}

/**
* Options to determine the rendering behavior of the dtmfDialer in the CallComposite
* @public
*/
export interface DtmfDialPadOptions {
dialerBehavior?: 'autoShow' | 'alwaysShow' | 'alwaysHide';
}

/**
* Optional features of the {@link CallComposite}.
*
Expand Down Expand Up @@ -244,7 +253,7 @@ export type CallCompositeOptions = {
* - PSTN Calls
* @defaultValue false
*/
disableAutoShowDtmfDialer?: boolean;
disableAutoShowDtmfDialer?: boolean | DtmfDialPadOptions;
/**
* Options for controlling the starting layout of the composite's video gallery
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ import { useCompositeStringsForNotificationStackStrings } from '../hooks/useComp
/* @conditional-compile-remove(breakout-rooms) */
import { BreakoutRoomsBanner } from './BreakoutRoomsBanner';
import { FocusableElement } from '../../common/types/FocusableElement';
import { DtmfDialPadOptions } from '../CallComposite';

/**
* @private
Expand All @@ -116,21 +117,17 @@ export interface CallArrangementProps {
latestErrors: ActiveErrorMessage[] | ActiveNotification[];
latestNotifications?: ActiveNotification[];
onDismissError: (error: ActiveErrorMessage | ActiveNotification) => void;

onDismissNotification?: (notification: ActiveNotification) => void;
onUserSetOverflowGalleryPositionChange?: (position: 'Responsive' | 'horizontalTop') => void;
onUserSetGalleryLayoutChange?: (layout: VideoGalleryLayout) => void;
userSetGalleryLayout?: VideoGalleryLayout;

capabilitiesChangedNotificationBarProps?: CapabilitiesChangeNotificationBarProps;
onCloseChatPane?: () => void;
onSetDialpadPage?: () => void;
dtmfDialerPresent?: boolean;

dtmfDialerOptions?: boolean | DtmfDialPadOptions;
setIsPromptOpen?: (isOpen: boolean) => void;

setPromptProps?: (props: PromptProps) => void;

hideSpotlightButtons?: boolean;
pinnedParticipants?: string[];
setPinnedParticipants?: (pinnedParticipants: string[]) => void;
Expand Down Expand Up @@ -565,6 +562,7 @@ export const CallArrangement = (props: CallArrangementProps): JSX.Element => {
userSetGalleryLayout={props.userSetGalleryLayout}
onSetDialpadPage={props.onSetDialpadPage}
dtmfDialerPresent={props.dtmfDialerPresent}
dtmfDialerOptions={props.dtmfDialerOptions}
reactionResources={reactionResources}
onClickMeetingPhoneInfo={onMeetingPhoneInfoClicked}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export type { CallCompositeOptions, CallCompositeProps, RemoteVideoTileMenuOptio
export type { DeviceCheckOptions } from './CallComposite';
export type { LocalVideoTileOptions } from './CallComposite';
export type { CallControlOptions } from './types/CallControlOptions';
export type { DtmfDialPadOptions } from './CallComposite';

export * from './Strings';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import React, { useMemo } from 'react';
import { useState } from 'react';
import { AvatarPersonaDataCallback } from '../../common/AvatarPersona';
import { useLocale } from '../../localization';
import { CallCompositeOptions } from '../CallComposite';
import { CallCompositeOptions, DtmfDialPadOptions } from '../CallComposite';
import { CallArrangement } from '../components/CallArrangement';
import { MediaGallery } from '../components/MediaGallery';
import { NetworkReconnectTile } from '../components/NetworkReconnectTile';
Expand Down Expand Up @@ -61,7 +61,7 @@ export interface CallPageProps {
pinnedParticipants?: string[];
setPinnedParticipants?: (pinnedParticipants: string[]) => void;
compositeAudioContext?: AudioContext;
disableAutoShowDtmfDialer?: boolean;
disableAutoShowDtmfDialer?: boolean | DtmfDialPadOptions;
}

/**
Expand All @@ -82,7 +82,7 @@ export const CallPage = (props: CallPageProps): JSX.Element => {
pinnedParticipants = [],
setPinnedParticipants,
compositeAudioContext,
disableAutoShowDtmfDialer = false,
disableAutoShowDtmfDialer = { dialerBehavior: 'autoShow' },
latestNotifications,
onDismissNotification
} = props;
Expand All @@ -98,10 +98,8 @@ export const CallPage = (props: CallPageProps): JSX.Element => {
const networkReconnectTileProps = useSelector(networkReconnectTileSelector);
const remoteParticipantsConnected = useSelector(getRemoteParticipantsConnectedSelector);
const callees = useSelector(getTargetCallees);
const renderDtmfDialerFromStart = showDtmfDialer(callees, remoteParticipantsConnected);
const [dtmfDialerPresent, setDtmfDialerPresent] = useState<boolean>(
renderDtmfDialerFromStart && disableAutoShowDtmfDialer
);
const renderDtmfDialerFromStart = showDtmfDialer(callees, remoteParticipantsConnected, disableAutoShowDtmfDialer);
const [dtmfDialerPresent, setDtmfDialerPresent] = useState<boolean>(renderDtmfDialerFromStart);

const strings = useLocale().strings.call;

Expand Down Expand Up @@ -213,6 +211,7 @@ export const CallPage = (props: CallPageProps): JSX.Element => {
/* @conditional-compile-remove(call-readiness) */
doNotShowCameraAccessNotifications={props.options?.deviceChecks?.camera === 'doNotPrompt'}
captionsOptions={options?.captionsBanner}
dtmfDialerOptions={disableAutoShowDtmfDialer}
/>
{<Prompt isOpen={isPromptOpen} onDismiss={() => setIsPromptOpen(false)} {...promptProps} />}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
isMicrosoftTeamsAppIdentifier,
isPhoneNumberIdentifier
} from '@azure/communication-common';
import { DtmfDialPadOptions } from '../CallComposite';

type ParticipantChangedAnnouncmentStrings = {
participantJoinedNoticeString: string;
Expand Down Expand Up @@ -174,22 +175,41 @@ export const createAnnouncementString = (
*/
export const showDtmfDialer = (
callees?: CommunicationIdentifier[],
remoteParticipants?: RemoteParticipantState[]
remoteParticipants?: RemoteParticipantState[],
dialerOptions?: boolean | DtmfDialPadOptions
): boolean => {
let showDtmfDialer = false;
callees?.forEach((callee) => {
if (isMicrosoftTeamsAppIdentifier(callee) || isPhoneNumberIdentifier(callee)) {
showDtmfDialer = true;
let showDtmfDialerAuto = false;
if (typeof dialerOptions === 'object' && 'dialerBehavior' in dialerOptions) {
const hideDtmfDialerAlways = dialerOptions.dialerBehavior && dialerOptions.dialerBehavior === 'alwaysHide';
const showDtmfDialerAlways = dialerOptions.dialerBehavior === 'alwaysShow';
showDtmfDialerAuto = dialerOptions.dialerBehavior === 'autoShow' ? true : false;
if (showDtmfDialerAlways) {
return true;
}
});
if (remoteParticipants) {
remoteParticipants.forEach((participant) => {
if (!('phoneNumber' in participant.identifier || 'teamsAppId' in participant.identifier)) {
showDtmfDialer = false;
if (hideDtmfDialerAlways) {
return false;
}
}
let showDtmfDialer = false;

/**
* We also want to check to see if the option is undefined. If this is the case we want this function
* to fallback on the original logic so that it will also render the callControls to show and hide the dialpad
* for the user.
*/
if (showDtmfDialerAuto || dialerOptions === undefined || dialerOptions === false) {
callees?.forEach((callee) => {
if (isMicrosoftTeamsAppIdentifier(callee) || isPhoneNumberIdentifier(callee)) {
showDtmfDialer = true;
}
});
if (remoteParticipants) {
remoteParticipants.forEach((participant) => {
if (!('phoneNumber' in participant.identifier || 'teamsAppId' in participant.identifier)) {
showDtmfDialer = false;
}
});
}
}
/* @conditional-compile-remove(dtmf-dialer-on-by-default) */
showDtmfDialer = true;
return showDtmfDialer;
};
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ import { getTargetCallees } from '../../CallComposite/selectors/baseSelectors';
import { getTeamsMeetingCoordinates, getIsTeamsMeeting } from '../../CallComposite/selectors/baseSelectors';
import { showDtmfDialer } from '../../CallComposite/utils/MediaGalleryUtils';
import { SpokenLanguageSettingsDrawer } from './SpokenLanguageSettingsDrawer';
import { DtmfDialPadOptions } from '../../CallComposite';
import { getRemoteParticipantsConnectedSelector } from '../../CallComposite/selectors/mediaGallerySelector';

/** @private */
export interface MoreDrawerStrings {
Expand Down Expand Up @@ -136,6 +138,10 @@ export interface MoreDrawerDevicesMenuProps {
* Whether the dialpad is present in the call
*/
dtmfDialerPresent?: boolean;
/**
* options for the controls of the DTMF dialer
*/
dtmfDialerOptions?: boolean | DtmfDialPadOptions;
}

/** @private */
Expand Down Expand Up @@ -176,7 +182,8 @@ export const MoreDrawer = (props: MoreDrawerProps): JSX.Element => {
const holdButtonProps = usePropsFor(HoldButton);

const callees = useSelector(getTargetCallees);
const allowDtmfDialer = showDtmfDialer(callees);
const participants = useSelector(getRemoteParticipantsConnectedSelector);
const allowDtmfDialer = showDtmfDialer(callees, participants, props.dtmfDialerOptions);
const [dtmfDialerChecked, setDtmfDialerChecked] = useState<boolean>(props.dtmfDialerPresent ?? false);

const raiseHandButtonProps = usePropsFor(RaiseHandButton) as RaiseHandButtonProps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { CommonCallControlOptions } from '../types/CommonCallControlOptions';
/* @condtional-compile-remove(gallery-options) */
import { VideoGalleryLayout } from '@internal/react-components';
import { ReactionResources } from '@internal/react-components';
import { DtmfDialPadOptions } from '../../CallComposite';

/** @private */
export interface PreparedMoreDrawerProps {
Expand All @@ -24,6 +25,7 @@ export interface PreparedMoreDrawerProps {
userSetGalleryLayout?: VideoGalleryLayout;
onSetDialpadPage?: () => void;
dtmfDialerPresent?: boolean;
dtmfDialerOptions?: boolean | DtmfDialPadOptions;
useTeamsCaptions?: boolean;
reactionResources?: ReactionResources;
onClickMeetingPhoneInfo?: () => void;
Expand All @@ -41,7 +43,6 @@ export const PreparedMoreDrawer = (props: PreparedMoreDrawerProps): JSX.Element
captionsMenuTitle: strings.moreDrawerCaptionsMenuTitle,
spokenLanguageMenuTitle: strings.moreDrawerSpokenLanguageMenuTitle,
captionLanguageMenuTitle: strings.moreDrawerCaptionLanguageMenuTitle,

galleryOptionsMenuTitle: strings.moreDrawerGalleryOptionsMenuTitle
}),
[strings]
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion samples/Calling/src/app/views/CallCompositeContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const CallCompositeContainer = (props: CallCompositeContainerProps): JSX.
hangUpForEveryone: 'endCallOptions'
}
},
autoShowDtmfDialer: true
disableAutoShowDtmfDialer: { dialerBehavior: 'autoShow' }
}),
[shouldHideScreenShare]
);
Expand Down