From c9cb2344a1bf266e85d43069b14d6e05ae5b757e Mon Sep 17 00:00:00 2001 From: fuyan Date: Tue, 4 Feb 2025 13:17:49 -0800 Subject: [PATCH 1/2] Edited display name test --- .../calling-stateful-client/src/ParticipantSubscriber.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/calling-stateful-client/src/ParticipantSubscriber.ts b/packages/calling-stateful-client/src/ParticipantSubscriber.ts index 8c98964e62b..f3265b49bd8 100644 --- a/packages/calling-stateful-client/src/ParticipantSubscriber.ts +++ b/packages/calling-stateful-client/src/ParticipantSubscriber.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import { RemoteParticipant, RemoteVideoStream } from '@azure/communication-calling'; +import { DisplayNameChangedReason, RemoteParticipant, RemoteVideoStream } from '@azure/communication-calling'; import { toFlatCommunicationIdentifier } from '@internal/acs-ui-common'; import { CallContext } from './CallContext'; import { CallIdRef } from './CallIdRef'; @@ -111,7 +111,12 @@ export class ParticipantSubscriber { this._context.setParticipantRole(this._callIdRef.callId, this._participantKey, this._participant.role); }; - private displayNameChanged = (): void => { + private displayNameChanged = (args: { + newValue?: string; + oldValue?: string; + reason?: DisplayNameChangedReason; + }): void => { + console.log(`display name changed from ${args.oldValue} to ${args.newValue} due to ${args.reason}`); this._context.setParticipantDisplayName( this._callIdRef.callId, this._participantKey, From 0ac10ba64f815ed1eaa7d27a08b4134d1184486f Mon Sep 17 00:00:00 2001 From: fuyan Date: Tue, 4 Feb 2025 16:30:14 -0800 Subject: [PATCH 2/2] update --- .../calling-stateful-client/src/ParticipantSubscriber.ts | 2 +- samples/CallWithChat/src/app/views/CallScreen.tsx | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/calling-stateful-client/src/ParticipantSubscriber.ts b/packages/calling-stateful-client/src/ParticipantSubscriber.ts index f3265b49bd8..30c9a51e666 100644 --- a/packages/calling-stateful-client/src/ParticipantSubscriber.ts +++ b/packages/calling-stateful-client/src/ParticipantSubscriber.ts @@ -116,7 +116,7 @@ export class ParticipantSubscriber { oldValue?: string; reason?: DisplayNameChangedReason; }): void => { - console.log(`display name changed from ${args.oldValue} to ${args.newValue} due to ${args.reason}`); + console.log(`hi there display name changed from ${args.oldValue} to ${args.newValue} due to ${args.reason}`); this._context.setParticipantDisplayName( this._callIdRef.callId, this._participantKey, diff --git a/samples/CallWithChat/src/app/views/CallScreen.tsx b/samples/CallWithChat/src/app/views/CallScreen.tsx index 16fc7f247aa..8cf5b9e6df4 100644 --- a/samples/CallWithChat/src/app/views/CallScreen.tsx +++ b/samples/CallWithChat/src/app/views/CallScreen.tsx @@ -12,6 +12,7 @@ import { CallWithChatCompositeOptions, onResolveDeepNoiseSuppressionDependencyLazy, onResolveVideoEffectDependencyLazy, + Profile, toFlatCommunicationIdentifier, useAzureCommunicationCallWithChatAdapter } from '@azure/communication-react'; @@ -99,6 +100,13 @@ export const CallScreen = (props: CallScreenProps): JSX.Element => { laughReaction: { url: 'assets/reactions/laughEmoji.png', frameCount: 102 }, applauseReaction: { url: 'assets/reactions/clapEmoji.png', frameCount: 102 }, surprisedReaction: { url: 'assets/reactions/surprisedEmoji.png', frameCount: 102 } + }, + onFetchProfile: async (userId: string, defaultProfile?: Profile): Promise => { + console.log('hi there onFetchProfile', userId, defaultProfile); + if (userId !== null) { + return { displayName: '[Renamed Remote Participant] bob' }; + } + return defaultProfile; } }; }, []);