Skip to content

Commit

Permalink
udpate api
Browse files Browse the repository at this point in the history
  • Loading branch information
carocao-msft committed Jan 22, 2025
1 parent 0f2ab34 commit afd0c82
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export interface CommonCallingHandlers {
onStartCaptions: (options?: CaptionsOptions) => Promise<void>;
onStopCaptions: () => Promise<void>;
/* @conditional-compile-remove(rtt) */
onSendRealTimeText: (text: string, finalized: boolean) => Promise<void>;
onSendRealTimeText: (text: string, isFinalized: boolean) => Promise<void>;
onSetSpokenLanguage: (language: string) => Promise<void>;
onSetCaptionLanguage: (language: string) => Promise<void>;
onSubmitSurvey(survey: CallSurvey): Promise<CallSurveyResponse | undefined>;
Expand Down Expand Up @@ -738,9 +738,9 @@ export const createDefaultCommonCallingHandlers = memoizeOne(
await captionsFeature.setCaptionLanguage(language);
};
/* @conditional-compile-remove(rtt) */
const onSendRealTimeText = async (text: string, finalized: boolean): Promise<void> => {
const onSendRealTimeText = async (text: string, isFinalized: boolean): Promise<void> => {
const realTimeTextFeature = call?.feature(Features.RealTimeText);
await realTimeTextFeature?.sendRealTimeText(text, finalized);
await realTimeTextFeature?.sendRealTimeText(text, isFinalized);
};
const onSubmitSurvey = async (survey: CallSurvey): Promise<CallSurveyResponse | undefined> =>
await call?.feature(Features.CallSurvey).submitSurvey(survey);
Expand Down
3 changes: 2 additions & 1 deletion packages/calling-stateful-client/src/CallClientState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ export interface RealTimeTextInfo {
updatedTimestamp?: Date;
/**
* If message originated from the local participant
* default is false
*/
isMe: boolean;
isMe?: boolean;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ export interface CallAdapterCallOperations {
resumeCall(): Promise<void>;
returnFromBreakoutRoom(): Promise<void>;
sendDtmfTone(dtmfTone: DtmfTone_2): Promise<void>;
sendRealTimeText: (text: string, finalized: boolean) => Promise<void>;
sendRealTimeText: (text: string, isFinalized: boolean) => Promise<void>;
setCaptionLanguage(language: string): Promise<void>;
setSpokenLanguage(language: string): Promise<void>;
// @beta
Expand Down Expand Up @@ -1318,7 +1318,7 @@ export interface CallWithChatAdapterManagement {
sendDtmfTone: (dtmfTone: DtmfTone_2) => Promise<void>;
sendMessage(content: string, options?: SendMessageOptions | /* @conditional-compile-remove(file-sharing-acs) */ MessageOptions): Promise<void>;
sendReadReceipt(chatMessageId: string): Promise<void>;
sendRealTimeText: (text: string, finalized: boolean) => Promise<void>;
sendRealTimeText: (text: string, isFinalized: boolean) => Promise<void>;
sendTypingIndicator(): Promise<void>;
setCamera(sourceInfo: VideoDeviceInfo, options?: VideoStreamOptions): Promise<void>;
setCaptionLanguage(language: string): Promise<void>;
Expand Down Expand Up @@ -1898,7 +1898,7 @@ export interface CaptionsBannerProps {
isRealTimeTextOn?: boolean;
latestLocalRealTimeText?: RealTimeTextInformation;
onRenderAvatar?: OnRenderAvatarCallback;
onSendRealTimeText?: (text: string, finalized: boolean) => Promise<void>;
onSendRealTimeText?: (text: string, isFinalized: boolean) => Promise<void>;
realTimeTexts?: {
completedMessages?: RealTimeTextInformation[];
currentInProgress?: RealTimeTextInformation[];
Expand Down Expand Up @@ -2427,7 +2427,7 @@ export interface CommonCallingHandlers {
// (undocumented)
onSendDtmfTone: (dtmfTone: DtmfTone_2) => Promise<void>;
// (undocumented)
onSendRealTimeText: (text: string, finalized: boolean) => Promise<void>;
onSendRealTimeText: (text: string, isFinalized: boolean) => Promise<void>;
// (undocumented)
onSetCaptionLanguage: (language: string) => Promise<void>;
// (undocumented)
Expand Down Expand Up @@ -4615,7 +4615,7 @@ export interface RealTimeTextCallFeatureState {
// @beta (undocumented)
export interface RealTimeTextInfo {
id: number;
isMe: boolean;
isMe?: boolean;
message: string;
receivedTimestamp?: Date;
resultType: RealTimeTextResultType;
Expand All @@ -4630,19 +4630,8 @@ export type RealTimeTextInformation = {
userId?: string;
message: string;
isTyping: boolean;
isMe: boolean;
finalizedTimeStamp: Date;
};

// @beta
export type RealTimeTextInformation = {
id: number;
displayName: string;
userId?: string;
message: string;
isTyping: boolean;
isMe: boolean;
finalizedTimeStamp: Date;
isMe?: boolean;
};

// @beta
Expand Down
11 changes: 6 additions & 5 deletions packages/react-components/src/components/CaptionsBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,15 @@ export type RealTimeTextInformation = {
* if the real time text received is partial
*/
isTyping: boolean;
/**
* If message originated from the local participant
*/
isMe: boolean;
/**
* timestamp when the real time text was finalized
*/
finalizedTimeStamp: Date;
/**
* If message originated from the local participant
* default value is false
*/
isMe?: boolean;
};
/**
* @public
Expand Down Expand Up @@ -177,7 +178,7 @@ export interface CaptionsBannerProps {
/**
* Optional callback to send real time text.
*/
onSendRealTimeText?: (text: string, finalized: boolean) => Promise<void>;
onSendRealTimeText?: (text: string, isFinalized: boolean) => Promise<void>;
/* @conditional-compile-remove(rtt) */
/**
* Latest local real time text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export class _MockCallAdapter implements CallAdapter {
throw Error('stopCaptions not implemented');
}
/* @conditional-compile-remove(rtt) */
sendRealTimeText(text: string, finalized: boolean): Promise<void> {
sendRealTimeText(text: string, isFinalized: boolean): Promise<void> {
throw Error('sendRealTimeText not implemented');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1157,8 +1157,8 @@ export class AzureCommunicationCallAdapter<AgentType extends CallAgent | TeamsCa
this.handlers.onSetSpokenLanguage(language);
}
/* @conditional-compile-remove(rtt) */
public async sendRealTimeText(text: string, finalized: boolean): Promise<void> {
this.handlers.onSendRealTimeText(text, finalized);
public async sendRealTimeText(text: string, isFinalized: boolean): Promise<void> {
this.handlers.onSendRealTimeText(text, isFinalized);
}
public async submitSurvey(survey: CallSurvey): Promise<CallSurveyResponse | undefined> {
return this.handlers.onSubmitSurvey(survey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ export interface CallAdapterCallOperations {
* @param text - real time text content
* @param finalized - Boolean to indicate if the real time text is final
*/
sendRealTimeText: (text: string, finalized: boolean) => Promise<void>;
sendRealTimeText: (text: string, isFinalized: boolean) => Promise<void>;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,8 @@ const createCompositeHandlers = memoizeOne(
return await adapter.disposeTogetherModeStreamView();
},
/* @conditional-compile-remove(rtt) */
onSendRealTimeText: async (text: string, finalized: boolean) => {
return await adapter.sendRealTimeText(text, finalized);
onSendRealTimeText: async (text: string, isFinalized: boolean) => {
return await adapter.sendRealTimeText(text, isFinalized);
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -659,8 +659,8 @@ export class AzureCommunicationCallWithChatAdapter implements CallWithChatAdapte
await this.callAdapter.setSpokenLanguage(language);
}
/* @conditional-compile-remove(rtt) */
public async sendRealTimeText(text: string, finalized: boolean): Promise<void> {
await this.callAdapter.sendRealTimeText(text, finalized);
public async sendRealTimeText(text: string, isFinalized: boolean): Promise<void> {
await this.callAdapter.sendRealTimeText(text, isFinalized);
}

public async startVideoBackgroundEffect(videoBackgroundEffect: VideoBackgroundEffect): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ export interface CallWithChatAdapterManagement {
* @param text - real time text content
* @param finalized - Boolean to indicate if the real time text is final
*/
sendRealTimeText: (text: string, finalized: boolean) => Promise<void>;
sendRealTimeText: (text: string, isFinalized: boolean) => Promise<void>;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ export class CallWithChatBackedCallAdapter implements CallAdapter {
await this.callWithChatAdapter.setSpokenLanguage(language);
}
/* @conditional-compile-remove(rtt) */
public async sendRealTimeText(text: string, finalized: boolean): Promise<void> {
await this.callWithChatAdapter.sendRealTimeText(text, finalized);
public async sendRealTimeText(text: string, isFinalized: boolean): Promise<void> {
await this.callWithChatAdapter.sendRealTimeText(text, isFinalized);
}

public async startVideoBackgroundEffect(videoBackgroundEffect: VideoBackgroundEffect): Promise<void> {
Expand Down

0 comments on commit afd0c82

Please sign in to comment.