Use new matrixRTC calling (#11792)

* initial

Signed-off-by: Timo K <toger5@hotmail.de>

* cleanup1

Signed-off-by: Timo K <toger5@hotmail.de>

* bring back call timer

Signed-off-by: Timo K <toger5@hotmail.de>

* more cleanup and test removals

Signed-off-by: Timo K <toger5@hotmail.de>

* remove event

Signed-off-by: Timo K <toger5@hotmail.de>

* cleanups and minor fixes

Signed-off-by: Timo K <toger5@hotmail.de>

* add matrixRTC to stubClient

Signed-off-by: Timo K <toger5@hotmail.de>

* update tests (some got removed)
The removal is a consequence of EW now doing less call logic.
More logic is done by the js sdk (MatrixRTCSession)
And therefore in EC itself.

Signed-off-by: Timo K <toger5@hotmail.de>

* cleanups

Signed-off-by: Timo K <toger5@hotmail.de>

* mock the session

Signed-off-by: Timo K <toger5@hotmail.de>

* lint

Signed-off-by: Timo K <toger5@hotmail.de>

* remove GroupCallDuration

Signed-off-by: Timo K <toger5@hotmail.de>

* review and fixing tests

Signed-off-by: Timo K <toger5@hotmail.de>

---------

Signed-off-by: Timo K <toger5@hotmail.de>
This commit is contained in:
Timo 2023-10-30 16:14:27 +01:00 committed by GitHub
parent c4852dd216
commit 860764c057
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 176 additions and 255 deletions

View file

@ -16,6 +16,10 @@ limitations under the License.
import { logger } from "matrix-js-sdk/src/logger";
import { GroupCallEventHandlerEvent } from "matrix-js-sdk/src/webrtc/groupCallEventHandler";
// eslint-disable-next-line no-restricted-imports
import { MatrixRTCSessionManagerEvents } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSessionManager";
// eslint-disable-next-line no-restricted-imports
import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession";
import type { GroupCall, Room } from "matrix-js-sdk/src/matrix";
import defaultDispatcher from "../dispatcher/dispatcher";
@ -61,6 +65,8 @@ export class CallStore extends AsyncStoreWithClient<{}> {
}
this.matrixClient.on(GroupCallEventHandlerEvent.Incoming, this.onGroupCall);
this.matrixClient.on(GroupCallEventHandlerEvent.Outgoing, this.onGroupCall);
this.matrixClient.matrixRTC.on(MatrixRTCSessionManagerEvents.SessionStarted, this.onRTCSession);
this.matrixClient.matrixRTC.on(MatrixRTCSessionManagerEvents.SessionEnded, this.onRTCSession);
WidgetStore.instance.on(UPDATE_EVENT, this.onWidgets);
// If the room ID of a previously connected call is still in settings at
@ -94,6 +100,8 @@ export class CallStore extends AsyncStoreWithClient<{}> {
this.matrixClient.off(GroupCallEventHandlerEvent.Incoming, this.onGroupCall);
this.matrixClient.off(GroupCallEventHandlerEvent.Outgoing, this.onGroupCall);
this.matrixClient.off(GroupCallEventHandlerEvent.Ended, this.onGroupCall);
this.matrixClient.matrixRTC.off(MatrixRTCSessionManagerEvents.SessionStarted, this.onRTCSession);
this.matrixClient.matrixRTC.off(MatrixRTCSessionManagerEvents.SessionEnded, this.onRTCSession);
}
WidgetStore.instance.off(UPDATE_EVENT, this.onWidgets);
}
@ -191,4 +199,7 @@ export class CallStore extends AsyncStoreWithClient<{}> {
};
private onGroupCall = (groupCall: GroupCall): void => this.updateRoom(groupCall.room);
private onRTCSession = (roomId: string, session: MatrixRTCSession): void => {
this.updateRoom(session.room);
};
}