Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/models/Call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -595,19 +595,26 @@ export class ElementCall extends Call {
const isDM = !!DMRoomMap.shared().getUserIdForRoomId(room.roomId);
const oldestCallMember = client.matrixRTC.getRoomSession(room).getOldestMembership();
const hasCallStarted = !!oldestCallMember && oldestCallMember.sender !== client.getSafeUserId();
// XXX: @element-hq/element-call-embedded <= 0.15.0 sets the wrong parameter for
// preload by default so we override here. This can be removed when that package
// is released and upgraded.
if (isDM) {
params.append("sendNotificationType", "ring");
if (hasCallStarted) {
params.append("intent", ElementCallIntent.JoinExistingDM);
params.append("preload", "false");
} else {
params.append("intent", ElementCallIntent.StartCallDM);
params.append("preload", "false");
}
} else {
params.append("sendNotificationType", "notification");
if (hasCallStarted) {
params.append("intent", ElementCallIntent.JoinExisting);
params.append("preload", "false");
} else {
params.append("intent", ElementCallIntent.StartCall);
params.append("preload", "false");
}
Comment on lines 601 to 618
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we touch this again anyways i think can change it to

if(isDM && hasCallStarted)
if(!isDM && hasCallStarted)
if(isDM && !hasCallStarted)
if(!isDM && !hasCallStarted)

I stumbled over the nesting again. I expect it to be more complicated than it is with the nesting. I know that params.append("sendNotificationType", "notification"); would then be duplicated but even that makes it more readable imo.

}
}
Expand Down
Loading