diff --git a/src/CallHandler.js b/src/CallHandler.js
index c61794a940..eba1c9995e 100644
--- a/src/CallHandler.js
+++ b/src/CallHandler.js
@@ -1,5 +1,6 @@
/*
Copyright 2015, 2016 OpenMarket Ltd
+Copyright 2017 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -60,6 +61,7 @@ import Matrix from 'matrix-js-sdk';
import dis from './dispatcher';
import { getUnknownDevicesForRoom } from './cryptodevices';
import SettingsStore from "./settings/SettingsStore";
+import { showUnknownDeviceDialogForCalls } from './cryptodevices';
global.mxCalls = {
//room_id: MatrixCall
@@ -99,6 +101,18 @@ function pause(audioId) {
}
}
+function _reAttemptCall(call) {
+ if (call.direction === 'outbound') {
+ dis.dispatch({
+ action: 'place_call',
+ room_id: call.roomId,
+ type: call.type,
+ });
+ } else {
+ call.answer();
+ }
+}
+
function _setCallListeners(call) {
call.on("error", function(err) {
console.error("Call error: %s", err);
@@ -113,22 +127,30 @@ function _setCallListeners(call) {
description: _t(
"There are unknown devices in this room: "+
"if you proceed without verifying them, it will be "+
- "possible for someone to eavesdrop on your call"
+ "possible for someone to eavesdrop on your call."
),
button: _t('Review Devices'),
onFinished: function(confirmed) {
if (confirmed) {
const room = MatrixClientPeg.get().getRoom(call.roomId);
- getUnknownDevicesForRoom(MatrixClientPeg.get(), room).then((unknownDevices) => {
- const UnknownDeviceDialog = sdk.getComponent('dialogs.UnknownDeviceDialog');
- Modal.createTrackedDialog('Unknown Device Dialog', '', UnknownDeviceDialog, {
- room: room,
- devices: unknownDevices,
- }, 'mx_Dialog_unknownDevice');
- });
+ showUnknownDeviceDialogForCalls(
+ MatrixClientPeg.get(),
+ room,
+ () => {
+ _reAttemptCall(call);
+ },
+ call.direction === 'outbound' ? _t("Call Anyway") : _t("Answer Anyway"),
+ );
}
},
});
+ } else {
+ const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
+
+ Modal.createTrackedDialog('Call Failed', '', ErrorDialog, {
+ title: _t('Call Failed'),
+ description: err.message,
+ });
}
});
call.on("hangup", function() {
diff --git a/src/components/views/dialogs/UnknownDeviceDialog.js b/src/components/views/dialogs/UnknownDeviceDialog.js
index 2e89459164..d3f26d7536 100644
--- a/src/components/views/dialogs/UnknownDeviceDialog.js
+++ b/src/components/views/dialogs/UnknownDeviceDialog.js
@@ -98,13 +98,19 @@ export default React.createClass({
// map from userid -> deviceid -> deviceinfo
devices: PropTypes.object.isRequired,
onFinished: PropTypes.func.isRequired,
- sendAnywayButton: PropTypes.node,
+ sendAnywayLabel: PropTypes.string.isRequired,
+ onSendAnyway: PropTypes.func.isRequired,
},
_onDismissClicked: function() {
this.props.onFinished();
},
+ _onSendAnywayClicked: function() {
+ this.props.onFinished();
+ this.props.onSendAnyway();
+ },
+
render: function() {
if (this.props.devices === null) {
const Spinner = sdk.getComponent("elements.Spinner");
@@ -148,6 +154,9 @@ export default React.createClass({
{this.props.sendAnywayButton}
+