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

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
32 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
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": "[email protected]",
"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": "[email protected]",
"dependentChangeType": "patch"
}
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 @@ -3195,6 +3195,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 @@ -2754,6 +2754,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 @@ -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
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,43 @@ 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) {
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) */
return showDtmfDialer;
dmceachernmsft marked this conversation as resolved.
Show resolved Hide resolved
}
/* @conditional-compile-remove(dtmf-dialer-on-by-default) */
showDtmfDialer = true;
return showDtmfDialer;
};
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export const PreparedMoreDrawer = (props: PreparedMoreDrawerProps): JSX.Element
captionsMenuTitle: strings.moreDrawerCaptionsMenuTitle,
spokenLanguageMenuTitle: strings.moreDrawerSpokenLanguageMenuTitle,
captionLanguageMenuTitle: strings.moreDrawerCaptionLanguageMenuTitle,

galleryOptionsMenuTitle: strings.moreDrawerGalleryOptionsMenuTitle
}),
[strings]
Expand Down
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
Loading