Skip to content

Commit

Permalink
Remove breakoutRoomOriginCallId from BreakoutRoomsState api (#5629)
Browse files Browse the repository at this point in the history
* Remove breakoutRoomOriginCallId from BreakoutRoomsState in stateful layer

* Change files

* Update code comments
  • Loading branch information
mgamis-msft authored Feb 6, 2025
1 parent 0c652c4 commit 47034b4
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "prerelease",
"area": "feature",
"workstream": "Breakout rooms",
"comment": "Remove breakoutRoomOriginCallId from BreakoutRoomsState api",
"packageName": "@azure/communication-react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ export class BreakoutRoomsSubscriber {
};

private onBreakoutRoomsJoined = (call: Call | TeamsCall): void => {
this._context.setBreakoutRoomOriginCallId(this._callIdRef.callId, call.id);
this._context.deleteLatestNotification('assignedBreakoutRoomOpened', this._callIdRef.callId);
this._context.deleteLatestNotification('assignedBreakoutRoomOpenedPromptJoin', this._callIdRef.callId);
this._context.deleteLatestNotification('assignedBreakoutRoomChanged', this._callIdRef.callId);
Expand Down
2 changes: 0 additions & 2 deletions packages/calling-stateful-client/src/CallClientState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,6 @@ export interface BreakoutRoomsState {
assignedBreakoutRoom?: BreakoutRoom;
/** Breakout room settings of call. This is defined when call is a breakout room. */
breakoutRoomSettings?: BreakoutRoomsSettings;
/** Origin call id of breakout room. This is defined when call is a breakout room. */
breakoutRoomOriginCallId?: string;
/** Display name of breakout room. This is defined when call is a breakout room. */
breakoutRoomDisplayName?: string;
}
Expand Down
17 changes: 0 additions & 17 deletions packages/calling-stateful-client/src/CallContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,6 @@ export class CallContext {
delete draft.calls[oldCallId];
draft.calls[newCallId] = call;
}
/* @conditional-compile-remove(breakout-rooms) */
// Update the old origin call id of breakout room calls to the new call id
Object.values(draft.calls).forEach((call) => {
if (call.breakoutRooms?.breakoutRoomOriginCallId === oldCallId) {
call.breakoutRooms?.breakoutRoomOriginCallId === newCallId;
}
});

/* @conditional-compile-remove(breakout-rooms) */
// Update call ids in latestCallIdsThatPushedNotifications
Expand Down Expand Up @@ -762,16 +755,6 @@ export class CallContext {
});
}

/* @conditional-compile-remove(breakout-rooms) */
public setBreakoutRoomOriginCallId(callId: string, breakoutRoomCallId: string): void {
this.modifyState((draft: CallClientState) => {
const call = draft.calls[this._callIdHistory.latestCallId(breakoutRoomCallId)];
if (call) {
call.breakoutRooms = { ...call.breakoutRooms, breakoutRoomOriginCallId: callId };
}
});
}

/* @conditional-compile-remove(breakout-rooms) */
public setBreakoutRoomSettings(callId: string, breakoutRoomSettings: BreakoutRoomsSettings): void {
this.modifyState((draft: CallClientState) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ export interface BlockedMessage extends MessageCommon {
export interface BreakoutRoomsState {
assignedBreakoutRoom?: BreakoutRoom;
breakoutRoomDisplayName?: string;
breakoutRoomOriginCallId?: string;
breakoutRoomSettings?: BreakoutRoomsSettings;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ export interface BaseCustomStyles {
export interface BreakoutRoomsState {
assignedBreakoutRoom?: BreakoutRoom;
breakoutRoomDisplayName?: string;
breakoutRoomOriginCallId?: string;
breakoutRoomSettings?: BreakoutRoomsSettings;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,9 @@ const CallWithChatScreen = (props: CallWithChatScreenProps): JSX.Element => {

let chatPaneTitle = callWithChatStrings.chatPaneTitle;
/* @conditional-compile-remove(breakout-rooms) */
if (callAdapter.getState().call?.breakoutRooms?.breakoutRoomOriginCallId) {
// If breakout room settings are defined then we know we are in a breakout room so we should
// use the breakout room chat pane title.
if (callAdapter.getState().call?.breakoutRooms?.breakoutRoomSettings) {
chatPaneTitle = callWithChatStrings.breakoutRoomChatPaneTitle;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -732,8 +732,10 @@ export class AzureCommunicationCallWithChatAdapter implements CallWithChatAdapte
this.updateChatAdapter(this.originCallChatAdapter);
}

const originCallId = this.callAdapter.getState().call?.breakoutRooms?.breakoutRoomOriginCallId;
if (originCallId) {
// Check if breakout room settings are defined to verify the user is in a breakout room before
// returning to the origin call.
const breakoutRoomSettings = this.context.getState().call?.breakoutRooms?.breakoutRoomSettings;
if (breakoutRoomSettings) {
await this.callAdapter.returnFromBreakoutRoom();
}
}
Expand Down

0 comments on commit 47034b4

Please sign in to comment.