Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
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,7 @@
{
"type": "prerelease",
"comment": "Added onFetchProfile to CommonCallAdapterOptions to allow displayName changes when using AzureCommunicationCallAdapter",
"packageName": "@azure/communication-react",
"email": "miguelgamis@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Added onFetchProfile to CommonCallAdapterOptions.",
"packageName": "@azure/communication-react",
"email": "miguelgamis@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Added onFetchProfile to CommonCallAdapterOptions to allow displayName changes when using AzureCommunicationCallAdapter",
"packageName": "@azure/communication-react",
"email": "miguelgamis@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "Added onFetchProfile to CommonCallAdapterOptions.",
"packageName": "@azure/communication-react",
"email": "miguelgamis@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -1600,6 +1600,7 @@ export interface CommonCallAdapter extends AdapterState<CallAdapterState>, Dispo
// @beta
export type CommonCallAdapterOptions = {
videoBackgroundImages?: VideoBackgroundImage[];
onFetchProfile?: OnFetchProfileCallback;
};

// @public
Expand Down Expand Up @@ -1960,7 +1961,7 @@ export const createStatefulChatClient: (args: StatefulChatClientArgs, options?:
export const createTeamsCallAdapter: ({ userId, credential, locator, options }: TeamsCallAdapterArgs) => Promise<TeamsCallAdapter>;

// @beta
export const createTeamsCallAdapterFromClient: (callClient: StatefulCallClient, callAgent: TeamsCallAgent, locator: CallAdapterLocator, options?: TeamsAdapterOptions | undefined) => Promise<TeamsCallAdapter>;
export const createTeamsCallAdapterFromClient: (callClient: StatefulCallClient, callAgent: TeamsCallAgent, locator: CallAdapterLocator, options?: CommonCallAdapterOptions | undefined) => Promise<TeamsCallAdapter>;

// @public
export interface CreateVideoStreamViewResult {
Expand Down Expand Up @@ -3411,9 +3412,7 @@ export interface SystemMessageCommon extends MessageCommon {
}

// @beta
export type TeamsAdapterOptions = {
onFetchProfile?: OnFetchProfileCallback;
} & CommonCallAdapterOptions;
export type TeamsAdapterOptions = CommonCallAdapterOptions;

// @beta
export interface TeamsCallAdapter extends CommonCallAdapter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,7 @@ export interface CommonCallAdapter extends AdapterState<CallAdapterState>, Dispo
// @beta
export type CommonCallAdapterOptions = {
videoBackgroundImages?: VideoBackgroundImage[];
onFetchProfile?: OnFetchProfileCallback;
};

// @public
Expand Down Expand Up @@ -1107,7 +1108,7 @@ export function createAzureCommunicationChatAdapterFromClient(chatClient: Statef
export const createTeamsCallAdapter: ({ userId, credential, locator, options }: TeamsCallAdapterArgs) => Promise<TeamsCallAdapter>;

// @beta
export const createTeamsCallAdapterFromClient: (callClient: StatefulCallClient, callAgent: TeamsCallAgent, locator: CallAdapterLocator, options?: TeamsAdapterOptions | undefined) => Promise<TeamsCallAdapter>;
export const createTeamsCallAdapterFromClient: (callClient: StatefulCallClient, callAgent: TeamsCallAgent, locator: CallAdapterLocator, options?: CommonCallAdapterOptions | undefined) => Promise<TeamsCallAdapter>;

// @beta
type CustomCallControlButtonCallback = (args: CustomCallControlButtonCallbackArgs) => CustomCallWithChatControlButtonProps;
Expand Down Expand Up @@ -1465,9 +1466,7 @@ export interface RemoteVideoTileMenuOptions {
export type SelectedVideoBackgroundEffect = VideoBackgroundNoEffect | VideoBackgroundBlurEffect | VideoBackgroundReplacementEffect;

// @beta
export type TeamsAdapterOptions = {
onFetchProfile?: OnFetchProfileCallback;
} & CommonCallAdapterOptions;
export type TeamsAdapterOptions = CommonCallAdapterOptions;

// @beta
export interface TeamsCallAdapter extends CommonCallAdapter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1051,6 +1051,12 @@ export type CommonCallAdapterOptions = {
* Default set of background images for background image picker.
*/
videoBackgroundImages?: VideoBackgroundImage[];
/**
* Use this to fetch profile information which will override data in {@link CallAdapterState} like display name
* The onFetchProfile is fetch-and-forget one time action for each user, once a user profile is updated, the value will be cached
* and would not be updated again within the lifecycle of adapter.
*/
onFetchProfile?: OnFetchProfileCallback;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something that can be overridden for just normal users as well?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you can override the display name for any user based on the userId.
image

};

/**
Expand Down Expand Up @@ -1098,14 +1104,7 @@ export type AzureCommunicationCallAdapterArgs = {
*
* @beta
*/
export type TeamsAdapterOptions = {
/**
* Use this to fetch profile information which will override data in {@link CallAdapterState} like display name
* The onFetchProfile is fetch-and-forget one time action for each user, once a user profile is updated, the value will be cached
* and would not be updated again within the lifecycle of adapter.
*/
onFetchProfile?: OnFetchProfileCallback;
} & CommonCallAdapterOptions;
export type TeamsAdapterOptions = CommonCallAdapterOptions;

/**
* Arguments for creating the Azure Communication Services implementation of {@link TeamsCallAdapter}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export const createProfileStateModifier = (
const profile = await onFetchProfile(key, { displayName: originalParticipants[key].displayName });
if (profile?.displayName && originalParticipants[key].displayName !== profile?.displayName) {
cachedDisplayName[key] = profile?.displayName;
shouldNotifyUpdates = true;
}
shouldNotifyUpdates = true;
}
// notify update only when there is a change, which most likely will trigger modifier and setState again
shouldNotifyUpdates && notifyUpdate();
Comment thread
mgamis-msft marked this conversation as resolved.
Expand Down