Catch call failures due to unknown devices
And show a specific dialog that you can then launch the UDD from (although currently with a 'Send Anyway' button which makes little sense for VoIP)
This commit is contained in:
parent
0659ac1ccb
commit
63919befd0
4 changed files with 73 additions and 28 deletions
|
@ -24,6 +24,7 @@ import MatrixClientPeg from '../../MatrixClientPeg';
|
|||
import MemberAvatar from '../views/avatars/MemberAvatar';
|
||||
import Resend from '../../Resend';
|
||||
import Modal from '../../Modal';
|
||||
import { getUnknownDevicesForRoom } from '../../cryptodevices';
|
||||
|
||||
const HIDE_DEBOUNCE_MS = 10000;
|
||||
const STATUS_BAR_HIDDEN = 0;
|
||||
|
@ -157,7 +158,9 @@ module.exports = React.createClass({
|
|||
},
|
||||
|
||||
_onShowDevicesClick: function() {
|
||||
this._getUnknownDevices().then((unknownDevices) => {
|
||||
getUnknownDevicesForRoom(MatrixClientPeg.get(), this.props.room).then((unknownDevices) => {
|
||||
if (this._unmounted) return;
|
||||
|
||||
const UnknownDeviceDialog = sdk.getComponent('dialogs.UnknownDeviceDialog');
|
||||
Modal.createTrackedDialog('Unknown Device Dialog', '', UnknownDeviceDialog, {
|
||||
room: this.props.room,
|
||||
|
@ -166,31 +169,6 @@ module.exports = React.createClass({
|
|||
});
|
||||
},
|
||||
|
||||
_getUnknownDevices: function() {
|
||||
const roomMembers = this.props.room.getJoinedMembers().map((m) => {
|
||||
return m.userId;
|
||||
});
|
||||
return MatrixClientPeg.get().downloadKeys(roomMembers, false).then((devices) => {
|
||||
if (this._unmounted) return;
|
||||
|
||||
const unknownDevices = {};
|
||||
// This is all devices in this room, so find the unknown ones.
|
||||
Object.keys(devices).forEach((userId) => {
|
||||
Object.keys(devices[userId]).map((deviceId) => {
|
||||
const device = devices[userId][deviceId];
|
||||
|
||||
if (device.isUnverified() && !device.isKnown()) {
|
||||
if (unknownDevices[userId] === undefined) {
|
||||
unknownDevices[userId] = {};
|
||||
}
|
||||
unknownDevices[userId][deviceId] = device;
|
||||
}
|
||||
});
|
||||
});
|
||||
return unknownDevices;
|
||||
});
|
||||
},
|
||||
|
||||
onRoomLocalEchoUpdated: function(event, room, oldEventId, oldStatus) {
|
||||
if (room.roomId !== this.props.room.roomId) return;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue