Skip to content

Commit

Permalink
Use disptacher so that matrix-org#6691 has effect
Browse files Browse the repository at this point in the history
Signed-off-by: Šimon Brandner <[email protected]>
  • Loading branch information
SimonBrandner committed Aug 28, 2021
1 parent 470bc0f commit 072fdf1
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/components/structures/CallEventGrouper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,24 +108,34 @@ export default class CallEventGrouper extends EventEmitter {
return [...this.events][0].getContent().call_id;
}

private get roomId(): string {
return [...this.events][0]?.getRoomId();
}

private onSilencedCallsChanged = () => {
const newState = CallHandler.sharedInstance().isCallSilenced(this.callId);
this.emit(CallEventGrouperEvent.SilencedChanged, newState);
};

public answerCall = () => {
this.call?.answer();
defaultDispatcher.dispatch({
action: 'answer',
room_id: this.roomId,
});
};

public rejectCall = () => {
this.call?.reject();
defaultDispatcher.dispatch({
action: 'reject',
room_id: this.roomId,
});
};

public callBack = () => {
defaultDispatcher.dispatch({
action: 'place_call',
type: this.isVoice ? CallType.Voice : CallType.Video,
room_id: [...this.events][0]?.getRoomId(),
room_id: this.roomId,
});
};

Expand Down

0 comments on commit 072fdf1

Please sign in to comment.