Wire up Unknown Devices popup for outbound calls
This commit is contained in:
parent
aeca83ff2e
commit
b0027525f3
4 changed files with 92 additions and 47 deletions
|
@ -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() {
|
||||
|
|
|
@ -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({
|
|||
</GeminiScrollbar>
|
||||
<div className="mx_Dialog_buttons">
|
||||
{this.props.sendAnywayButton}
|
||||
<button onClick={this._onSendAnywayClicked}>
|
||||
{ this.props.sendAnywayLabel }
|
||||
</button>
|
||||
<button className="mx_Dialog_primary" autoFocus={true}
|
||||
onClick={this._onDismissClicked}
|
||||
>
|
||||
|
|
|
@ -53,11 +53,25 @@ export function showUnknownDeviceDialogForMessages(matrixClient, room) {
|
|||
Modal.createTrackedDialog('Unknown Device Dialog', '', UnknownDeviceDialog, {
|
||||
room: room,
|
||||
devices: unknownDevices,
|
||||
sendAnywayButton:(
|
||||
<button onClick={onSendAnywayClicked}>
|
||||
{ _t("Send anyway") }
|
||||
</button>
|
||||
),
|
||||
sendAnywayLabel: _t("Send anyway"),
|
||||
onSendAnyway: onSendAnywayClicked,
|
||||
}, 'mx_Dialog_unknownDevice');
|
||||
});
|
||||
}
|
||||
|
||||
export function showUnknownDeviceDialogForCalls(matrixClient, room, sendAnyway, sendAnywayLabel) {
|
||||
getUnknownDevicesForRoom(matrixClient, room).then((unknownDevices) => {
|
||||
const onSendAnywayClicked = () => {
|
||||
markAllDevicesKnown(matrixClient, unknownDevices);
|
||||
sendAnyway();
|
||||
};
|
||||
|
||||
const UnknownDeviceDialog = sdk.getComponent('dialogs.UnknownDeviceDialog');
|
||||
Modal.createTrackedDialog('Unknown Device Dialog', '', UnknownDeviceDialog, {
|
||||
room: room,
|
||||
devices: unknownDevices,
|
||||
sendAnywayLabel: sendAnywayLabel,
|
||||
onSendAnyway: onSendAnywayClicked,
|
||||
}, 'mx_Dialog_unknownDevice');
|
||||
});
|
||||
}
|
||||
|
|
|
@ -3,8 +3,10 @@
|
|||
"This phone number is already in use": "This phone number is already in use",
|
||||
"Failed to verify email address: make sure you clicked the link in the email": "Failed to verify email address: make sure you clicked the link in the email",
|
||||
"Call Failed": "Call Failed",
|
||||
"There are unknown devices in this room: if you proceed without verifying them, it will be possible for someone to eavesdrop on your call": "There are unknown devices in this room: if you proceed without verifying them, it will be possible for someone to eavesdrop on your call",
|
||||
"There are unknown devices in this room: if you proceed without verifying them, it will be possible for someone to eavesdrop on your call.": "There are unknown devices in this room: if you proceed without verifying them, it will be possible for someone to eavesdrop on your call.",
|
||||
"Review Devices": "Review Devices",
|
||||
"Call Anyway": "Call Anyway",
|
||||
"Answer Anyway": "Answer Anyway",
|
||||
"Call Timeout": "Call Timeout",
|
||||
"The remote side failed to pick up": "The remote side failed to pick up",
|
||||
"Unable to capture screen": "Unable to capture screen",
|
||||
|
@ -153,24 +155,44 @@
|
|||
"%(widgetName)s widget modified by %(senderName)s": "%(widgetName)s widget modified by %(senderName)s",
|
||||
"%(widgetName)s widget added by %(senderName)s": "%(widgetName)s widget added by %(senderName)s",
|
||||
"%(widgetName)s widget removed by %(senderName)s": "%(widgetName)s widget removed by %(senderName)s",
|
||||
"Message Pinning": "Message Pinning",
|
||||
"Presence Management": "Presence Management",
|
||||
"%(displayName)s is typing": "%(displayName)s is typing",
|
||||
"%(names)s and %(count)s others are typing|other": "%(names)s and %(count)s others are typing",
|
||||
"%(names)s and %(count)s others are typing|one": "%(names)s and one other is typing",
|
||||
"%(names)s and %(lastPerson)s are typing": "%(names)s and %(lastPerson)s are typing",
|
||||
"Failure to create room": "Failure to create room",
|
||||
"Server may be unavailable, overloaded, or you hit a bug.": "Server may be unavailable, overloaded, or you hit a bug.",
|
||||
"Send anyway": "Send anyway",
|
||||
"Unnamed Room": "Unnamed Room",
|
||||
"Your browser does not support the required cryptography extensions": "Your browser does not support the required cryptography extensions",
|
||||
"Not a valid Riot keyfile": "Not a valid Riot keyfile",
|
||||
"Authentication check failed: incorrect password?": "Authentication check failed: incorrect password?",
|
||||
"Failed to join room": "Failed to join room",
|
||||
"Message Pinning": "Message Pinning",
|
||||
"Presence Management": "Presence Management",
|
||||
"Disable Emoji suggestions while typing": "Disable Emoji suggestions while typing",
|
||||
"Use compact timeline layout": "Use compact timeline layout",
|
||||
"Hide removed messages": "Hide removed messages",
|
||||
"Hide join/leave messages (invites/kicks/bans unaffected)": "Hide join/leave messages (invites/kicks/bans unaffected)",
|
||||
"Hide avatar changes": "Hide avatar changes",
|
||||
"Hide display name changes": "Hide display name changes",
|
||||
"Hide read receipts": "Hide read receipts",
|
||||
"Show timestamps in 12 hour format (e.g. 2:30pm)": "Show timestamps in 12 hour format (e.g. 2:30pm)",
|
||||
"Always show message timestamps": "Always show message timestamps",
|
||||
"Autoplay GIFs and videos": "Autoplay GIFs and videos",
|
||||
"Enable automatic language detection for syntax highlighting": "Enable automatic language detection for syntax highlighting",
|
||||
"Hide avatars in user and room mentions": "Hide avatars in user and room mentions",
|
||||
"Disable big emoji in chat": "Disable big emoji in chat",
|
||||
"Don't send typing notifications": "Don't send typing notifications",
|
||||
"Automatically replace plain text Emoji": "Automatically replace plain text Emoji",
|
||||
"Mirror local video feed": "Mirror local video feed",
|
||||
"Disable Peer-to-Peer for 1:1 calls": "Disable Peer-to-Peer for 1:1 calls",
|
||||
"Opt out of analytics": "Opt out of analytics",
|
||||
"Never send encrypted messages to unverified devices from this device": "Never send encrypted messages to unverified devices from this device",
|
||||
"Never send encrypted messages to unverified devices in this room from this device": "Never send encrypted messages to unverified devices in this room from this device",
|
||||
"Enable inline URL previews by default": "Enable inline URL previews by default",
|
||||
"Enable URL previews for this room (only affects you)": "Enable URL previews for this room (only affects you)",
|
||||
"Enable URL previews by default for participants in this room": "Enable URL previews by default for participants in this room",
|
||||
"Room Colour": "Room Colour",
|
||||
"Active call (%(roomName)s)": "Active call (%(roomName)s)",
|
||||
"unknown caller": "unknown caller",
|
||||
"Incoming voice call from %(name)s": "Incoming voice call from %(name)s",
|
||||
|
@ -211,9 +233,6 @@
|
|||
"Delete": "Delete",
|
||||
"Disable Notifications": "Disable Notifications",
|
||||
"Enable Notifications": "Enable Notifications",
|
||||
"You have <a>enabled</a> URL previews by default.": "You have <a>enabled</a> URL previews by default.",
|
||||
"You have <a>disabled</a> URL previews by default.": "You have <a>disabled</a> URL previews by default.",
|
||||
"URL Previews": "URL Previews",
|
||||
"Cannot add any more widgets": "Cannot add any more widgets",
|
||||
"The maximum permitted number of widgets have already been added to this room.": "The maximum permitted number of widgets have already been added to this room.",
|
||||
"Add a widget": "Add a widget",
|
||||
|
@ -381,7 +400,6 @@
|
|||
"Devices will not yet be able to decrypt history from before they joined the room": "Devices will not yet be able to decrypt history from before they joined the room",
|
||||
"Once encryption is enabled for a room it cannot be turned off again (for now)": "Once encryption is enabled for a room it cannot be turned off again (for now)",
|
||||
"Encrypted messages will not be visible on clients that do not yet implement encryption": "Encrypted messages will not be visible on clients that do not yet implement encryption",
|
||||
"Never send encrypted messages to unverified devices in this room from this device": "Never send encrypted messages to unverified devices in this room from this device",
|
||||
"Enable encryption": "Enable encryption",
|
||||
"(warning: cannot be disabled again!)": "(warning: cannot be disabled again!)",
|
||||
"Encryption is enabled in this room": "Encryption is enabled in this room",
|
||||
|
@ -407,7 +425,6 @@
|
|||
"Members only (since the point in time of selecting this option)": "Members only (since the point in time of selecting this option)",
|
||||
"Members only (since they were invited)": "Members only (since they were invited)",
|
||||
"Members only (since they joined)": "Members only (since they joined)",
|
||||
"Room Colour": "Room Colour",
|
||||
"Permissions": "Permissions",
|
||||
"The default role for new room members is": "The default role for new room members is",
|
||||
"To send messages, you must be a": "To send messages, you must be a",
|
||||
|
@ -441,6 +458,9 @@
|
|||
"Related communities for this room:": "Related communities for this room:",
|
||||
"This room has no related communities": "This room has no related communities",
|
||||
"New community ID (e.g. +foo:%(localDomain)s)": "New community ID (e.g. +foo:%(localDomain)s)",
|
||||
"You have <a>enabled</a> URL previews by default.": "You have <a>enabled</a> URL previews by default.",
|
||||
"You have <a>disabled</a> URL previews by default.": "You have <a>disabled</a> URL previews by default.",
|
||||
"URL Previews": "URL Previews",
|
||||
"Error decrypting audio": "Error decrypting audio",
|
||||
"Error decrypting attachment": "Error decrypting attachment",
|
||||
"Decrypt %(text)s": "Decrypt %(text)s",
|
||||
|
@ -477,6 +497,7 @@
|
|||
"Please enter the code it contains:": "Please enter the code it contains:",
|
||||
"Start authentication": "Start authentication",
|
||||
"powered by Matrix": "powered by Matrix",
|
||||
"Username on %(hs)s": "Username on %(hs)s",
|
||||
"User name": "User name",
|
||||
"Mobile phone number": "Mobile phone number",
|
||||
"Forgot your password?": "Forgot your password?",
|
||||
|
@ -484,7 +505,6 @@
|
|||
"Sign in with": "Sign in with",
|
||||
"Email address": "Email address",
|
||||
"Sign in": "Sign in",
|
||||
"Sign in to get started": "Sign in to get started",
|
||||
"If you don't specify an email address, you won't be able to reset your password. Are you sure?": "If you don't specify an email address, you won't be able to reset your password. Are you sure?",
|
||||
"Email address (optional)": "Email address (optional)",
|
||||
"You are registering with %(SelectedTeamName)s": "You are registering with %(SelectedTeamName)s",
|
||||
|
@ -664,7 +684,6 @@
|
|||
"Room contains unknown devices": "Room contains unknown devices",
|
||||
"\"%(RoomName)s\" contains devices that you haven't seen before.": "\"%(RoomName)s\" contains devices that you haven't seen before.",
|
||||
"Unknown devices": "Unknown devices",
|
||||
"Send anyway": "Send anyway",
|
||||
"Private Chat": "Private Chat",
|
||||
"Public Chat": "Public Chat",
|
||||
"Custom": "Custom",
|
||||
|
@ -765,25 +784,9 @@
|
|||
"Uploading %(filename)s and %(count)s others|other": "Uploading %(filename)s and %(count)s others",
|
||||
"Uploading %(filename)s and %(count)s others|zero": "Uploading %(filename)s",
|
||||
"Uploading %(filename)s and %(count)s others|one": "Uploading %(filename)s and %(count)s other",
|
||||
"Autoplay GIFs and videos": "Autoplay GIFs and videos",
|
||||
"Hide read receipts": "Hide read receipts",
|
||||
"Don't send typing notifications": "Don't send typing notifications",
|
||||
"Always show message timestamps": "Always show message timestamps",
|
||||
"Show timestamps in 12 hour format (e.g. 2:30pm)": "Show timestamps in 12 hour format (e.g. 2:30pm)",
|
||||
"Hide join/leave messages (invites/kicks/bans unaffected)": "Hide join/leave messages (invites/kicks/bans unaffected)",
|
||||
"Use compact timeline layout": "Use compact timeline layout",
|
||||
"Hide removed messages": "Hide removed messages",
|
||||
"Enable automatic language detection for syntax highlighting": "Enable automatic language detection for syntax highlighting",
|
||||
"Automatically replace plain text Emoji": "Automatically replace plain text Emoji",
|
||||
"Disable Emoji suggestions while typing": "Disable Emoji suggestions while typing",
|
||||
"Hide avatars in user and room mentions": "Hide avatars in user and room mentions",
|
||||
"Disable big emoji in chat": "Disable big emoji in chat",
|
||||
"Mirror local video feed": "Mirror local video feed",
|
||||
"Opt out of analytics": "Opt out of analytics",
|
||||
"Disable Peer-to-Peer for 1:1 calls": "Disable Peer-to-Peer for 1:1 calls",
|
||||
"Never send encrypted messages to unverified devices from this device": "Never send encrypted messages to unverified devices from this device",
|
||||
"Light theme": "Light theme",
|
||||
"Dark theme": "Dark theme",
|
||||
"Status.im theme": "Status.im theme",
|
||||
"Can't load user settings": "Can't load user settings",
|
||||
"Server may be unavailable or overloaded": "Server may be unavailable or overloaded",
|
||||
"Sign out": "Sign out",
|
||||
|
@ -798,7 +801,6 @@
|
|||
"Interface Language": "Interface Language",
|
||||
"User Interface": "User Interface",
|
||||
"Autocomplete Delay (ms):": "Autocomplete Delay (ms):",
|
||||
"Disable inline URL previews by default": "Disable inline URL previews by default",
|
||||
"<not supported>": "<not supported>",
|
||||
"Import E2E room keys": "Import E2E room keys",
|
||||
"Cryptography": "Cryptography",
|
||||
|
@ -863,6 +865,7 @@
|
|||
"Create an account": "Create an account",
|
||||
"This Home Server does not support login using email address.": "This Home Server does not support login using email address.",
|
||||
"Incorrect username and/or password.": "Incorrect username and/or password.",
|
||||
"Please note you are logging into the %(hs)s server, not matrix.org.": "Please note you are logging into the %(hs)s server, not matrix.org.",
|
||||
"Guest access is disabled on this Home Server.": "Guest access is disabled on this Home Server.",
|
||||
"The phone number entered looks invalid": "The phone number entered looks invalid",
|
||||
"Error: Problem communicating with the given homeserver.": "Error: Problem communicating with the given homeserver.",
|
||||
|
@ -870,7 +873,7 @@
|
|||
"Can't connect to homeserver - please check your connectivity, ensure your <a>homeserver's SSL certificate</a> is trusted, and that a browser extension is not blocking requests.": "Can't connect to homeserver - please check your connectivity, ensure your <a>homeserver's SSL certificate</a> is trusted, and that a browser extension is not blocking requests.",
|
||||
"Sorry, this homeserver is using a login which is not recognised ": "Sorry, this homeserver is using a login which is not recognised ",
|
||||
"Login as guest": "Login as guest",
|
||||
"Return to app": "Return to app",
|
||||
"Sign in to get started": "Sign in to get started",
|
||||
"Failed to fetch avatar URL": "Failed to fetch avatar URL",
|
||||
"Set a display name:": "Set a display name:",
|
||||
"Upload an avatar:": "Upload an avatar:",
|
||||
|
@ -932,8 +935,5 @@
|
|||
"This process allows you to import encryption keys that you had previously exported from another Matrix client. You will then be able to decrypt any messages that the other client could decrypt.": "This process allows you to import encryption keys that you had previously exported from another Matrix client. You will then be able to decrypt any messages that the other client could decrypt.",
|
||||
"The export file will be protected with a passphrase. You should enter the passphrase here, to decrypt the file.": "The export file will be protected with a passphrase. You should enter the passphrase here, to decrypt the file.",
|
||||
"File to import": "File to import",
|
||||
"Import": "Import",
|
||||
"Status.im theme": "Status.im theme",
|
||||
"Please note you are logging into the %(hs)s server, not matrix.org.": "Please note you are logging into the %(hs)s server, not matrix.org.",
|
||||
"Username on %(hs)s": "Username on %(hs)s"
|
||||
"Import": "Import"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue