Add Element call related functionality to new room header (#12091)
* New room header - add chat button during call - close lobby button in lobby - join button if session exists - allow to toggle call <-> timeline during call with call button Compound style for join button in call notify toast. Signed-off-by: Timo K <toger5@hotmail.de> * dont show start call, join button in video rooms. Signed-off-by: Timo K <toger5@hotmail.de> * Make active call check based on participant count Not based on available call object Signed-off-by: Timo K <toger5@hotmail.de> * fix room header tests Signed-off-by: Timo K <toger5@hotmail.de> * fix room header tests Signed-off-by: Timo K <toger5@hotmail.de> * remove chat button test for displaying. Chat button display logic is now part of the RoomHeader. Signed-off-by: Timo K <toger5@hotmail.de> * remove duplicate notification Tread icon Signed-off-by: Timo K <toger5@hotmail.de> * remove obsolete jest snapshot Signed-off-by: Timo K <toger5@hotmail.de> * Update src/components/views/rooms/RoomHeader.tsx Co-authored-by: Robin <robin@robin.town> * update isECWidget logic Signed-off-by: Timo K <toger5@hotmail.de> * remove dead code Signed-off-by: Timo K <toger5@hotmail.de> * refactor call options Add menu to choose if there are multiple options Signed-off-by: Timo K <toger5@hotmail.de> * join ec when clicking join button (dont start jitsi) Use icon buttons don't show call icon when join button is visible Signed-off-by: Timo K <toger5@hotmail.de> * refactor isViewingCall Signed-off-by: Timo K <toger5@hotmail.de> * fix room header tests Signed-off-by: Timo K <toger5@hotmail.de> * fix header snapshot Signed-off-by: Timo K <toger5@hotmail.de> * sonar proposals Signed-off-by: Timo K <toger5@hotmail.de> * fix event shiftKey may be undefined Signed-off-by: Timo K <toger5@hotmail.de> * more lobby time before timeout only await sticky promise on becoming sticky. Signed-off-by: Timo K <toger5@hotmail.de> * don't allow starting new calls if there is an ongoing other call. Signed-off-by: Timo K <toger5@hotmail.de> * review Signed-off-by: Timo K <toger5@hotmail.de> * fix translation typo Signed-off-by: Timo K <toger5@hotmail.de> --------- Signed-off-by: Timo K <toger5@hotmail.de> Co-authored-by: Robin <robin@robin.town>
This commit is contained in:
parent
31449d6f80
commit
73b16239a5
14 changed files with 286 additions and 164 deletions
|
@ -65,18 +65,26 @@ const waitForEvent = async (
|
|||
emitter: EventEmitter,
|
||||
event: string,
|
||||
pred: (...args: any[]) => boolean = () => true,
|
||||
customTimeout?: number | false,
|
||||
): Promise<void> => {
|
||||
let listener: (...args: any[]) => void;
|
||||
const wait = new Promise<void>((resolve) => {
|
||||
listener = (...args) => {
|
||||
if (pred(...args)) resolve();
|
||||
if (pred(...args)) {
|
||||
resolve();
|
||||
if (customTimeout === false) {
|
||||
emitter.off(event, listener!);
|
||||
}
|
||||
}
|
||||
};
|
||||
emitter.on(event, listener);
|
||||
});
|
||||
|
||||
const timedOut = (await timeout(wait, false, TIMEOUT_MS)) === false;
|
||||
emitter.off(event, listener!);
|
||||
if (timedOut) throw new Error("Timed out");
|
||||
if (customTimeout !== false) {
|
||||
const timedOut = (await timeout(wait, false, customTimeout ?? TIMEOUT_MS)) === false;
|
||||
emitter.off(event, listener!);
|
||||
if (timedOut) throw new Error("Timed out");
|
||||
}
|
||||
};
|
||||
|
||||
export enum ConnectionState {
|
||||
|
@ -899,6 +907,7 @@ export class ElementCall extends Call {
|
|||
MatrixRTCSessionEvent.MembershipsChanged,
|
||||
(_, newMemberships: CallMembership[]) =>
|
||||
newMemberships.some((m) => m.sender === this.client.getUserId()),
|
||||
false, // allow user to wait as long as they want (no timeout)
|
||||
);
|
||||
} else {
|
||||
await waitForEvent(
|
||||
|
@ -906,6 +915,7 @@ export class ElementCall extends Call {
|
|||
MatrixRTCSessionManagerEvents.SessionStarted,
|
||||
(roomId: string, session: MatrixRTCSession) =>
|
||||
this.session.callId === session.callId && roomId === this.roomId,
|
||||
false, // allow user to wait as long as they want (no timeout)
|
||||
);
|
||||
}
|
||||
this.sendCallNotify();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue