mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 13:14:58 +08:00
Move ICE fallback prompt to time of placing / answering calls
This moves the ICE fallback prompt out of session startup and instead it will now appear contextually when your either place a call with no ICE server from the homeserver or a call fails (in either direction). Fixes https://github.com/vector-im/riot-web/issues/10546
This commit is contained in:
parent
1c6312d999
commit
d31f556c1f
@ -1,6 +1,7 @@
|
||||
/*
|
||||
Copyright 2015, 2016 OpenMarket Ltd
|
||||
Copyright 2017, 2018 New Vector Ltd
|
||||
Copyright 2019 The Matrix.org Foundation C.I.C.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
@ -64,6 +65,7 @@ import { showUnknownDeviceDialogForCalls } from './cryptodevices';
|
||||
import WidgetUtils from './utils/WidgetUtils';
|
||||
import WidgetEchoStore from './stores/WidgetEchoStore';
|
||||
import {IntegrationManagers} from "./integrations/IntegrationManagers";
|
||||
import SettingsStore, { SettingLevel } from './settings/SettingsStore';
|
||||
|
||||
global.mxCalls = {
|
||||
//room_id: MatrixCall
|
||||
@ -117,8 +119,7 @@ function _reAttemptCall(call) {
|
||||
|
||||
function _setCallListeners(call) {
|
||||
call.on("error", function(err) {
|
||||
console.error("Call error: %s", err);
|
||||
console.error(err.stack);
|
||||
console.error("Call error:", err);
|
||||
if (err.code === 'unknown_devices') {
|
||||
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
||||
|
||||
@ -146,8 +147,15 @@ function _setCallListeners(call) {
|
||||
},
|
||||
});
|
||||
} else {
|
||||
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
||||
if (
|
||||
MatrixClientPeg.get().getTurnServers().length === 0 &&
|
||||
SettingsStore.getValue("fallbackICEServerAllowed") === null
|
||||
) {
|
||||
_showICEFallbackPrompt(_t("Call Failed"));
|
||||
return;
|
||||
}
|
||||
|
||||
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
||||
Modal.createTrackedDialog('Call Failed', '', ErrorDialog, {
|
||||
title: _t('Call Failed'),
|
||||
description: err.message,
|
||||
@ -217,6 +225,39 @@ function _setCallState(call, roomId, status) {
|
||||
});
|
||||
}
|
||||
|
||||
function _showICEFallbackPrompt(title) {
|
||||
const cli = MatrixClientPeg.get();
|
||||
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
||||
const code = sub => <code>{sub}</code>;
|
||||
Modal.createTrackedDialog('No TURN servers', '', QuestionDialog, {
|
||||
title,
|
||||
description: <div>
|
||||
<p>{ _t(
|
||||
"Your homeserver <code>%(homeserverDomain)s</code> is " +
|
||||
"currently not configured to assist with calls by offering a " +
|
||||
"TURN server, which means it is likely that voice and video " +
|
||||
"calls will fail. Please notify your homeserver administrator " +
|
||||
"so that they can address this.",
|
||||
{ homeserverDomain: cli.getDomain() }, { code },
|
||||
) }</p>
|
||||
<p>{ _t(
|
||||
"Riot can use a fallback server <code>turn.matrix.org</code> " +
|
||||
"if you urgently need to make a call. Your IP address would be " +
|
||||
"shared with this fallback server only if you agree and later " +
|
||||
"place or receive a call. You can change this permission later " +
|
||||
"in the Voice & Video section of Settings.",
|
||||
null, { code },
|
||||
)}</p>
|
||||
</div>,
|
||||
button: _t('Allow Fallback'),
|
||||
cancelButton: _t('Dismiss'),
|
||||
onFinished: (allow) => {
|
||||
SettingsStore.setValue("fallbackICEServerAllowed", null, SettingLevel.DEVICE, allow);
|
||||
cli.setFallbackICEServerAllowed(allow);
|
||||
},
|
||||
}, null, true);
|
||||
}
|
||||
|
||||
function _onAction(payload) {
|
||||
function placeCall(newCall) {
|
||||
_setCallListeners(newCall);
|
||||
@ -270,6 +311,14 @@ function _onAction(payload) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
MatrixClientPeg.get().getTurnServers().length === 0 &&
|
||||
SettingsStore.getValue("fallbackICEServerAllowed") === null
|
||||
) {
|
||||
_showICEFallbackPrompt(_t("Homeserver not configured to support calls"));
|
||||
return;
|
||||
}
|
||||
|
||||
const room = MatrixClientPeg.get().getRoom(payload.room_id);
|
||||
if (!room) {
|
||||
console.error("Room %s does not exist.", payload.room_id);
|
||||
|
@ -1370,37 +1370,6 @@ export default React.createClass({
|
||||
call: call,
|
||||
}, true);
|
||||
});
|
||||
cli.on('Call.noTURNServers', () => {
|
||||
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
||||
const code = sub => <code>{sub}</code>;
|
||||
Modal.createTrackedDialog('No TURN servers', '', QuestionDialog, {
|
||||
title: _t('Homeserver not configured to support calls'),
|
||||
description: <div>
|
||||
<p>{ _t(
|
||||
"Your homeserver <code>%(homeserverDomain)s</code> is " +
|
||||
"currently not configured to assist with calls by offering a " +
|
||||
"TURN server, which means it is likely that voice and video " +
|
||||
"calls will fail. Please notify your homeserver administrator " +
|
||||
"so that they can address this.",
|
||||
{ homeserverDomain: cli.getDomain() }, { code },
|
||||
) }</p>
|
||||
<p>{ _t(
|
||||
"Riot can use a fallback server <code>turn.matrix.org</code> " +
|
||||
"if you urgently need to make a call. Your IP address would be " +
|
||||
"shared with this fallback server only if you agree and later " +
|
||||
"place or receive a call. You can change this permission later " +
|
||||
"in the Voice & Video section of Settings.",
|
||||
null, { code },
|
||||
)}</p>
|
||||
</div>,
|
||||
button: _t('Allow Fallback'),
|
||||
cancelButton: _t('Dismiss'),
|
||||
onFinished: (allow) => {
|
||||
SettingsStore.setValue("fallbackICEServerAllowed", null, SettingLevel.DEVICE, allow);
|
||||
cli.setFallbackICEServerAllowed(allow);
|
||||
},
|
||||
}, null, true);
|
||||
});
|
||||
cli.on('Session.logged_out', function(errObj) {
|
||||
if (Lifecycle.isLoggingOut()) return;
|
||||
|
||||
|
@ -28,11 +28,16 @@
|
||||
"Answer": "Answer",
|
||||
"Call Timeout": "Call Timeout",
|
||||
"The remote side failed to pick up": "The remote side failed to pick up",
|
||||
"Your homeserver <code>%(homeserverDomain)s</code> is currently not configured to assist with calls by offering a TURN server, which means it is likely that voice and video calls will fail. Please notify your homeserver administrator so that they can address this.": "Your homeserver <code>%(homeserverDomain)s</code> is currently not configured to assist with calls by offering a TURN server, which means it is likely that voice and video calls will fail. Please notify your homeserver administrator so that they can address this.",
|
||||
"Riot can use a fallback server <code>turn.matrix.org</code> if you urgently need to make a call. Your IP address would be shared with this fallback server only if you agree and later place or receive a call. You can change this permission later in the Voice & Video section of Settings.": "Riot can use a fallback server <code>turn.matrix.org</code> if you urgently need to make a call. Your IP address would be shared with this fallback server only if you agree and later place or receive a call. You can change this permission later in the Voice & Video section of Settings.",
|
||||
"Allow Fallback": "Allow Fallback",
|
||||
"Dismiss": "Dismiss",
|
||||
"Unable to capture screen": "Unable to capture screen",
|
||||
"Existing Call": "Existing Call",
|
||||
"You are already in a call.": "You are already in a call.",
|
||||
"VoIP is unsupported": "VoIP is unsupported",
|
||||
"You cannot place VoIP calls in this browser.": "You cannot place VoIP calls in this browser.",
|
||||
"Homeserver not configured to support calls": "Homeserver not configured to support calls",
|
||||
"You cannot place a call with yourself.": "You cannot place a call with yourself.",
|
||||
"Could not connect to the integration server": "Could not connect to the integration server",
|
||||
"A conference call could not be started because the integrations server is not available": "A conference call could not be started because the integrations server is not available",
|
||||
@ -94,7 +99,6 @@
|
||||
"Unnamed Room": "Unnamed Room",
|
||||
"Error": "Error",
|
||||
"Unable to load! Check your network connectivity and try again.": "Unable to load! Check your network connectivity and try again.",
|
||||
"Dismiss": "Dismiss",
|
||||
"Riot does not have permission to send you notifications - please check your browser settings": "Riot does not have permission to send you notifications - please check your browser settings",
|
||||
"Riot was not given permission to send notifications - please try again": "Riot was not given permission to send notifications - please try again",
|
||||
"Unable to enable Notifications": "Unable to enable Notifications",
|
||||
@ -1508,10 +1512,6 @@
|
||||
"Failed to leave room": "Failed to leave room",
|
||||
"Can't leave Server Notices room": "Can't leave Server Notices room",
|
||||
"This room is used for important messages from the Homeserver, so you cannot leave it.": "This room is used for important messages from the Homeserver, so you cannot leave it.",
|
||||
"Homeserver not configured to support calls": "Homeserver not configured to support calls",
|
||||
"Your homeserver <code>%(homeserverDomain)s</code> is currently not configured to assist with calls by offering a TURN server, which means it is likely that voice and video calls will fail. Please notify your homeserver administrator so that they can address this.": "Your homeserver <code>%(homeserverDomain)s</code> is currently not configured to assist with calls by offering a TURN server, which means it is likely that voice and video calls will fail. Please notify your homeserver administrator so that they can address this.",
|
||||
"Riot can use a fallback server <code>turn.matrix.org</code> if you urgently need to make a call. Your IP address would be shared with this fallback server only if you agree and later place or receive a call. You can change this permission later in the Voice & Video section of Settings.": "Riot can use a fallback server <code>turn.matrix.org</code> if you urgently need to make a call. Your IP address would be shared with this fallback server only if you agree and later place or receive a call. You can change this permission later in the Voice & Video section of Settings.",
|
||||
"Allow Fallback": "Allow Fallback",
|
||||
"Signed Out": "Signed Out",
|
||||
"For security, this session has been signed out. Please sign in again.": "For security, this session has been signed out. Please sign in again.",
|
||||
"Terms and Conditions": "Terms and Conditions",
|
||||
|
Loading…
Reference in New Issue
Block a user