Use native js-sdk group call support (#9625)
* Use native js-sdk group call support Now that the js-sdk supports group calls natively, our group call implementation can be simplified a bit. Switching to the js-sdk implementation also brings the react-sdk up to date with recent MSC3401 changes, and adds support for joining calls from multiple devices. (So, the previous logic which sent to-device messages to prevent multi-device sessions is no longer necessary.) * Fix strings * Fix strict type errors
This commit is contained in:
parent
3c7781a561
commit
2c612d5aa1
20 changed files with 383 additions and 567 deletions
|
@ -16,11 +16,13 @@ limitations under the License.
|
|||
|
||||
import { MatrixWidgetType } from "matrix-widget-api";
|
||||
|
||||
import type { GroupCall } from "matrix-js-sdk/src/webrtc/groupCall";
|
||||
import type { Room } from "matrix-js-sdk/src/models/room";
|
||||
import type { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
||||
import type { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
||||
import { mkEvent } from "./test-utils";
|
||||
import { Call, ConnectionState, ElementCall, JitsiCall } from "../../src/models/Call";
|
||||
import { CallStore } from "../../src/stores/CallStore";
|
||||
|
||||
export class MockedCall extends Call {
|
||||
public static readonly EVENT_TYPE = "org.example.mocked_call";
|
||||
|
@ -49,7 +51,6 @@ export class MockedCall extends Call {
|
|||
}
|
||||
|
||||
public static create(room: Room, id: string) {
|
||||
// Update room state to let CallStore know that a call might now exist
|
||||
room.addLiveEvents([mkEvent({
|
||||
event: true,
|
||||
type: this.EVENT_TYPE,
|
||||
|
@ -59,16 +60,17 @@ export class MockedCall extends Call {
|
|||
skey: id,
|
||||
ts: Date.now(),
|
||||
})]);
|
||||
// @ts-ignore deliberately calling a private method
|
||||
// Let CallStore know that a call might now exist
|
||||
CallStore.instance.updateRoom(room);
|
||||
}
|
||||
|
||||
public get groupCall(): MatrixEvent {
|
||||
return this.event;
|
||||
}
|
||||
public readonly groupCall = { creationTs: this.event.getTs() } as unknown as GroupCall;
|
||||
|
||||
public get participants(): Set<RoomMember> {
|
||||
public get participants(): Map<RoomMember, Set<string>> {
|
||||
return super.participants;
|
||||
}
|
||||
public set participants(value: Set<RoomMember>) {
|
||||
public set participants(value: Map<RoomMember, Set<string>>) {
|
||||
super.participants = value;
|
||||
}
|
||||
|
||||
|
@ -77,8 +79,7 @@ export class MockedCall extends Call {
|
|||
}
|
||||
|
||||
// No action needed for any of the following methods since this is just a mock
|
||||
protected getDevices(): string[] { return []; }
|
||||
protected async setDevices(): Promise<void> { }
|
||||
public async clean(): Promise<void> {}
|
||||
// Public to allow spying
|
||||
public async performConnection(): Promise<void> {}
|
||||
public async performDisconnection(): Promise<void> {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue