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.pull/21833/head
parent
b04d2de313
commit
7c20eb9b74
|
@ -39,6 +39,7 @@ import { WidgetType } from "./widgets/WidgetType";
|
||||||
import { SettingLevel } from "./settings/SettingLevel";
|
import { SettingLevel } from "./settings/SettingLevel";
|
||||||
import QuestionDialog from "./components/views/dialogs/QuestionDialog";
|
import QuestionDialog from "./components/views/dialogs/QuestionDialog";
|
||||||
import ErrorDialog from "./components/views/dialogs/ErrorDialog";
|
import ErrorDialog from "./components/views/dialogs/ErrorDialog";
|
||||||
|
import InviteDialog, { KIND_CALL_TRANSFER } from "./components/views/dialogs/InviteDialog";
|
||||||
import WidgetStore from "./stores/WidgetStore";
|
import WidgetStore from "./stores/WidgetStore";
|
||||||
import { WidgetMessagingStore } from "./stores/widgets/WidgetMessagingStore";
|
import { WidgetMessagingStore } from "./stores/widgets/WidgetMessagingStore";
|
||||||
import { ElementWidgetActions } from "./stores/widgets/ElementWidgetActions";
|
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 {
|
private addCallForRoom(roomId: string, call: MatrixCall, changedRooms = false): void {
|
||||||
if (this.calls.has(roomId)) {
|
if (this.calls.has(roomId)) {
|
||||||
logger.log(`Couldn't add call to room ${roomId}: already have a call for this room`);
|
logger.log(`Couldn't add call to room ${roomId}: already have a call for this room`);
|
||||||
|
|
|
@ -21,8 +21,6 @@ import { MatrixCall } from 'matrix-js-sdk/src/webrtc/call';
|
||||||
import { _t } from '../../../languageHandler';
|
import { _t } from '../../../languageHandler';
|
||||||
import ContextMenu, { IProps as IContextMenuProps, MenuItem } from '../../structures/ContextMenu';
|
import ContextMenu, { IProps as IContextMenuProps, MenuItem } from '../../structures/ContextMenu';
|
||||||
import CallHandler from '../../../CallHandler';
|
import CallHandler from '../../../CallHandler';
|
||||||
import InviteDialog, { KIND_CALL_TRANSFER } from '../dialogs/InviteDialog';
|
|
||||||
import Modal from '../../../Modal';
|
|
||||||
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||||
|
|
||||||
interface IProps extends IContextMenuProps {
|
interface IProps extends IContextMenuProps {
|
||||||
|
@ -52,10 +50,7 @@ export default class CallContextMenu extends React.Component<IProps> {
|
||||||
};
|
};
|
||||||
|
|
||||||
onTransferClick = () => {
|
onTransferClick = () => {
|
||||||
Modal.createTrackedDialog(
|
CallHandler.instance.showTransferDialog(this.props.call);
|
||||||
'Transfer Call', '', InviteDialog, { kind: KIND_CALL_TRANSFER, call: this.props.call },
|
|
||||||
/*className=*/"mx_InviteDialog_transferWrapper", /*isPriority=*/false, /*isStatic=*/true,
|
|
||||||
);
|
|
||||||
this.props.onFinished();
|
this.props.onFinished();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -352,8 +352,10 @@ class DMRoomTile extends React.PureComponent<IDMRoomTileProps> {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IInviteDialogProps {
|
interface IInviteDialogProps {
|
||||||
// Takes an array of user IDs/emails to invite.
|
// Takes a boolean which is true if a user / users were invited /
|
||||||
onFinished: (toInvite?: string[]) => void;
|
// a call transfer was initiated or false if the dialog was cancelled
|
||||||
|
// with no action taken.
|
||||||
|
onFinished: (success: boolean) => void;
|
||||||
|
|
||||||
// The kind of invite being performed. Assumed to be KIND_DM if
|
// The kind of invite being performed. Assumed to be KIND_DM if
|
||||||
// not provided.
|
// not provided.
|
||||||
|
@ -685,7 +687,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
should_peek: false,
|
should_peek: false,
|
||||||
joining: false,
|
joining: false,
|
||||||
});
|
});
|
||||||
this.props.onFinished();
|
this.props.onFinished(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -732,7 +734,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
}
|
}
|
||||||
|
|
||||||
await createRoom(createRoomOptions);
|
await createRoom(createRoomOptions);
|
||||||
this.props.onFinished();
|
this.props.onFinished(true);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error(err);
|
logger.error(err);
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -764,7 +766,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
const result = await inviteMultipleToRoom(this.props.roomId, targetIds, true);
|
const result = await inviteMultipleToRoom(this.props.roomId, targetIds, true);
|
||||||
CountlyAnalytics.instance.trackSendInvite(startTime, this.props.roomId, targetIds.length);
|
CountlyAnalytics.instance.trackSendInvite(startTime, this.props.roomId, targetIds.length);
|
||||||
if (!this.shouldAbortAfterInviteError(result, room)) { // handles setting error message too
|
if (!this.shouldAbortAfterInviteError(result, room)) { // handles setting error message too
|
||||||
this.props.onFinished();
|
this.props.onFinished(true);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error(err);
|
logger.error(err);
|
||||||
|
@ -801,7 +803,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
this.state.consultFirst,
|
this.state.consultFirst,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
this.props.onFinished();
|
this.props.onFinished(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
private onKeyDown = (e) => {
|
private onKeyDown = (e) => {
|
||||||
|
@ -824,7 +826,7 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
};
|
};
|
||||||
|
|
||||||
private onCancel = () => {
|
private onCancel = () => {
|
||||||
this.props.onFinished([]);
|
this.props.onFinished(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
private updateSuggestions = async (term) => {
|
private updateSuggestions = async (term) => {
|
||||||
|
@ -1086,11 +1088,11 @@ export default class InviteDialog extends React.PureComponent<IInviteDialogProps
|
||||||
private onManageSettingsClick = (e) => {
|
private onManageSettingsClick = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
dis.fire(Action.ViewUserSettings);
|
dis.fire(Action.ViewUserSettings);
|
||||||
this.props.onFinished();
|
this.props.onFinished(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
private onCommunityInviteClick = (e) => {
|
private onCommunityInviteClick = (e) => {
|
||||||
this.props.onFinished();
|
this.props.onFinished(false);
|
||||||
showCommunityInviteDialog(CommunityPrototypeStore.instance.getSelectedCommunityId());
|
showCommunityInviteDialog(CommunityPrototypeStore.instance.getSelectedCommunityId());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue