Skip to content

Commit 0981652

Browse files
dbkrSimonBrandner
andauthored
Add GroupCallEventHandlerEvent.Room (#2631)
* Add GroupCalEventHandlerEvent.Room Emit an event when the group call event handler has processed all pending group calls. * Remove unused return value * Add void return type Co-authored-by: Šimon Brandner <[email protected]> Co-authored-by: Šimon Brandner <[email protected]>
1 parent db32420 commit 0981652

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,7 @@ type EmittedEvents = ClientEvent
869869
| GroupCallEventHandlerEvent.Incoming
870870
| GroupCallEventHandlerEvent.Ended
871871
| GroupCallEventHandlerEvent.Participants
872+
| GroupCallEventHandlerEvent.Room
872873
| HttpApiEvent.SessionLoggedOut
873874
| HttpApiEvent.NoConsent
874875
| BeaconEvent;

src/webrtc/groupCallEventHandler.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ export enum GroupCallEventHandlerEvent {
3333
Incoming = "GroupCall.incoming",
3434
Ended = "GroupCall.ended",
3535
Participants = "GroupCall.participants",
36+
Room = "GroupCall.Room",
3637
}
3738

3839
export type GroupCallEventHandlerEventHandlerMap = {
3940
[GroupCallEventHandlerEvent.Incoming]: (call: GroupCall) => void;
4041
[GroupCallEventHandlerEvent.Ended]: (call: GroupCall) => void;
4142
[GroupCallEventHandlerEvent.Participants]: (participants: RoomMember[], call: GroupCall) => void;
43+
[GroupCallEventHandlerEvent.Room]: (room: Room) => void;
4244
};
4345

4446
export class GroupCallEventHandler {
@@ -65,7 +67,7 @@ export class GroupCallEventHandler {
6567
return [...this.groupCalls.values()].find((groupCall) => groupCall.groupCallId === groupCallId);
6668
}
6769

68-
private createGroupCallForRoom(room: Room): GroupCall | undefined {
70+
private createGroupCallForRoom(room: Room): void {
6971
const callEvents = room.currentState.getStateEvents(EventType.GroupCallPrefix);
7072
const sortedCallEvents = callEvents.sort((a, b) => b.getTs() - a.getTs());
7173

@@ -76,7 +78,9 @@ export class GroupCallEventHandler {
7678
continue;
7779
}
7880

79-
return this.createGroupCallFromRoomStateEvent(callEvent);
81+
this.createGroupCallFromRoomStateEvent(callEvent);
82+
this.client.emit(GroupCallEventHandlerEvent.Room, room);
83+
break;
8084
}
8185
}
8286

0 commit comments

Comments
 (0)