Put call on hold when transfer dialog is opened (#7669)

And take it off hold if the dialog is cancelled.

Also changes the onFinished signature of invitedialog which claimed
to return an array of strings but never did, so now it just returns
a boolean.
This commit is contained in:
David Baker
2022-01-28 17:05:57 +00:00
committed by GitHub
parent b04d2de313
commit 7c20eb9b74
3 changed files with 30 additions and 15 deletions
+18
View File
@@ -39,6 +39,7 @@ import { WidgetType } from "./widgets/WidgetType";
import { SettingLevel } from "./settings/SettingLevel";
import QuestionDialog from "./components/views/dialogs/QuestionDialog";
import ErrorDialog from "./components/views/dialogs/ErrorDialog";
import InviteDialog, { KIND_CALL_TRANSFER } from "./components/views/dialogs/InviteDialog";
import WidgetStore from "./stores/WidgetStore";
import { WidgetMessagingStore } from "./stores/widgets/WidgetMessagingStore";
import { ElementWidgetActions } from "./stores/widgets/ElementWidgetActions";
@@ -1100,6 +1101,23 @@ export default class CallHandler extends EventEmitter {
});
}
/*
* Shows the transfer dialog for a call, signalling to the other end that
* a transfer is about to happen
*/
public showTransferDialog(call: MatrixCall): void {
call.setRemoteOnHold(true);
const { finished } = Modal.createTrackedDialog(
'Transfer Call', '', InviteDialog, { kind: KIND_CALL_TRANSFER, call },
/*className=*/"mx_InviteDialog_transferWrapper", /*isPriority=*/false, /*isStatic=*/true,
);
finished.then((results: boolean[]) => {
if (results.length === 0 || results[0] === false) {
call.setRemoteOnHold(false);
}
});
}
private addCallForRoom(roomId: string, call: MatrixCall, changedRooms = false): void {
if (this.calls.has(roomId)) {
logger.log(`Couldn't add call to room ${roomId}: already have a call for this room`);