Skip to content

Commit f763192

Browse files
authored
Remove deprecated DeviceInfo in webrtc/call.ts (#4654)
* chore(legacy call): Remove `DeviceInfo` usage * refactor(legacy call): throw `GroupCallUnknownDeviceError` at the end of `initOpponentCrypto`
1 parent 8537aee commit f763192

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

src/webrtc/call.ts

+5-9
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ import {
4848
import { CallFeed } from "./callFeed.ts";
4949
import { MatrixClient } from "../client.ts";
5050
import { EventEmitterEvents, TypedEventEmitter } from "../models/typed-event-emitter.ts";
51-
import { DeviceInfo } from "../crypto/deviceinfo.ts";
5251
import { GroupCallUnknownDeviceError } from "./groupCall.ts";
5352
import { IScreensharingOpts } from "./mediaHandler.ts";
5453
import { MatrixError } from "../http-api/index.ts";
@@ -426,7 +425,7 @@ export class MatrixCall extends TypedEventEmitter<CallEvent, CallEventHandlerMap
426425
private callStartTime?: number;
427426

428427
private opponentDeviceId?: string;
429-
private opponentDeviceInfo?: DeviceInfo;
428+
private hasOpponentDeviceInfo?: boolean;
430429
private opponentSessionId?: string;
431430
public groupCallId?: string;
432431

@@ -633,19 +632,16 @@ export class MatrixCall extends TypedEventEmitter<CallEvent, CallEventHandlerMap
633632
// ourselves (for example if the client is a RoomWidgetClient)
634633
if (!this.client.getCrypto()) {
635634
// All we know is the device ID
636-
this.opponentDeviceInfo = new DeviceInfo(this.opponentDeviceId);
635+
this.hasOpponentDeviceInfo = true;
637636
return;
638637
}
639638
const userId = this.invitee || this.getOpponentMember()?.userId;
640639

641640
if (!userId) throw new Error("Couldn't find opponent user ID to init crypto");
642641

643642
// Here we were calling `MatrixClient.crypto.deviceList.downloadKeys` which is not supported by the rust cryptography.
644-
const deviceInfoMap = new Map();
645-
this.opponentDeviceInfo = deviceInfoMap.get(userId)?.get(this.opponentDeviceId);
646-
if (this.opponentDeviceInfo === undefined) {
647-
throw new GroupCallUnknownDeviceError(userId);
648-
}
643+
this.hasOpponentDeviceInfo = false;
644+
throw new GroupCallUnknownDeviceError(userId);
649645
}
650646

651647
/**
@@ -2509,7 +2505,7 @@ export class MatrixCall extends TypedEventEmitter<CallEvent, CallEventHandlerMap
25092505

25102506
const userId = this.invitee || this.getOpponentMember()!.userId;
25112507
if (this.client.getUseE2eForGroupCall()) {
2512-
if (!this.opponentDeviceInfo) {
2508+
if (!this.hasOpponentDeviceInfo) {
25132509
logger.warn(`Call ${this.callId} sendVoipEvent() failed: we do not have opponentDeviceInfo`);
25142510
return;
25152511
}

0 commit comments

Comments
 (0)