Set Element Call "intents" when starting and answering DM calls. (#30730)
* Start to implement intents for DM calls. * Refactor and fix intent bugs * Do not default skipLobby in Element Web * Remove hacks * cleanup * Don't template skipLobby or returnToLobby but inject as required * Revert "Don't template skipLobby or returnToLobby but inject as required" This reverts commit 35569f35bb254462dd86c16438dab38188db6fbc. * lint * Fix test * lint * Use other intents * Ensure we test all intents * lint * cleanup * Fix room check * Update imports * update test * Fix RoomViewStore test
This commit is contained in:
+26
-6
@@ -43,8 +43,7 @@ import { isVideoRoom } from "../utils/video-rooms";
|
||||
import { FontWatcher } from "../settings/watchers/FontWatcher";
|
||||
import { type JitsiCallMemberContent, JitsiCallMemberEventType } from "../call-types";
|
||||
import SdkConfig from "../SdkConfig.ts";
|
||||
import RoomListStore from "../stores/room-list/RoomListStore.ts";
|
||||
import { DefaultTagID } from "../stores/room-list/models.ts";
|
||||
import DMRoomMap from "../utils/DMRoomMap.ts";
|
||||
|
||||
const TIMEOUT_MS = 16000;
|
||||
|
||||
@@ -542,6 +541,13 @@ export class JitsiCall extends Call {
|
||||
};
|
||||
}
|
||||
|
||||
export enum ElementCallIntent {
|
||||
StartCall = "start_call",
|
||||
JoinExisting = "join_existing",
|
||||
StartCallDM = "start_call_dm",
|
||||
JoinExistingDM = "join_existing_dm",
|
||||
}
|
||||
|
||||
/**
|
||||
* A group call using MSC3401 and Element Call as a backend.
|
||||
* (somewhat cheekily named)
|
||||
@@ -586,10 +592,24 @@ export class ElementCall extends Call {
|
||||
|
||||
const room = client.getRoom(roomId);
|
||||
if (room !== null && !isVideoRoom(room)) {
|
||||
params.append(
|
||||
"sendNotificationType",
|
||||
RoomListStore.instance.getTagsForRoom(room).includes(DefaultTagID.DM) ? "ring" : "notification",
|
||||
);
|
||||
const isDM = !!DMRoomMap.shared().getUserIdForRoomId(room.roomId);
|
||||
const oldestCallMember = client.matrixRTC.getRoomSession(room).getOldestMembership();
|
||||
const hasCallStarted = !!oldestCallMember && oldestCallMember.sender !== client.getSafeUserId();
|
||||
if (isDM) {
|
||||
params.append("sendNotificationType", "ring");
|
||||
if (hasCallStarted) {
|
||||
params.append("intent", ElementCallIntent.JoinExistingDM);
|
||||
} else {
|
||||
params.append("intent", ElementCallIntent.StartCallDM);
|
||||
}
|
||||
} else {
|
||||
params.append("sendNotificationType", "notification");
|
||||
if (hasCallStarted) {
|
||||
params.append("intent", ElementCallIntent.JoinExisting);
|
||||
} else {
|
||||
params.append("intent", ElementCallIntent.StartCall);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const rageshakeSubmitUrl = SdkConfig.get("bug_report_endpoint_url");
|
||||
|
||||
Reference in New Issue
Block a user