From 7df84b97277b39a7b0d41b0816a16060007c6f5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Sun, 5 Dec 2021 13:12:44 +0100 Subject: [PATCH 1/4] Don't allow calls when the connection the server has been lost MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/CallHandler.tsx | 9 +++++++++ src/i18n/strings/en_EN.json | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/CallHandler.tsx b/src/CallHandler.tsx index eaff6ee186a..d804fb820b0 100644 --- a/src/CallHandler.tsx +++ b/src/CallHandler.tsx @@ -54,6 +54,7 @@ import { WidgetLayoutStore, Container } from './stores/widgets/WidgetLayoutStore import { getIncomingCallToastKey } from './toasts/IncomingCallToast'; import ToastStore from './stores/ToastStore'; import IncomingCallToast from "./toasts/IncomingCallToast"; +import { SyncState } from "matrix-js-sdk/src/sync.api"; export const PROTOCOL_PSTN = 'm.protocol.pstn'; export const PROTOCOL_PSTN_PREFIXED = 'im.vector.protocol.pstn'; @@ -783,6 +784,14 @@ export default class CallHandler extends EventEmitter { return; } + if (MatrixClientPeg.get().getSyncState() === SyncState.Error) { + Modal.createTrackedDialog('Call Handler', 'Sync error', ErrorDialog, { + title: _t('Connectivity to the server has been lost'), + description: _t('You cannot place VoIP calls without a connection to the server.'), + }); + return; + } + // don't allow > 2 calls to be placed. if (this.getAllActiveCalls().length > 1) { Modal.createTrackedDialog('Call Handler', 'Existing Call', ErrorDialog, { diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 02123310158..9d8a5547d5f 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -56,6 +56,8 @@ "You're already in a call with this person.": "You're already in a call with this person.", "VoIP is unsupported": "VoIP is unsupported", "You cannot place VoIP calls in this browser.": "You cannot place VoIP calls in this browser.", + "Connectivity to the server has been lost": "Connectivity to the server has been lost", + "You cannot place VoIP calls without a connection to the server.": "You cannot place VoIP calls without a connection to the server.", "Too Many Calls": "Too Many Calls", "You've reached the maximum number of simultaneous calls.": "You've reached the maximum number of simultaneous calls.", "You cannot place a call with yourself.": "You cannot place a call with yourself.", From d367c6ffd4e748fb70ece73adf39fda3d2be8b26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Mon, 6 Dec 2021 08:00:59 +0100 Subject: [PATCH 2/4] Remove `VoIP` jargon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/CallHandler.tsx | 6 +++--- src/i18n/strings/en_EN.json | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/CallHandler.tsx b/src/CallHandler.tsx index d804fb820b0..299cf64b86d 100644 --- a/src/CallHandler.tsx +++ b/src/CallHandler.tsx @@ -778,8 +778,8 @@ export default class CallHandler extends EventEmitter { // if the runtime env doesn't do VoIP, whine. if (!MatrixClientPeg.get().supportsVoip()) { Modal.createTrackedDialog('Call Handler', 'VoIP is unsupported', ErrorDialog, { - title: _t('VoIP is unsupported'), - description: _t('You cannot place VoIP calls in this browser.'), + title: _t('Voice/video are unsupported'), + description: _t('You cannot place voice/video calls in this browser.'), }); return; } @@ -787,7 +787,7 @@ export default class CallHandler extends EventEmitter { if (MatrixClientPeg.get().getSyncState() === SyncState.Error) { Modal.createTrackedDialog('Call Handler', 'Sync error', ErrorDialog, { title: _t('Connectivity to the server has been lost'), - description: _t('You cannot place VoIP calls without a connection to the server.'), + description: _t('You cannot place voice/video calls without a connection to the server.'), }); return; } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 9d8a5547d5f..1700e1c387e 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -54,10 +54,10 @@ "No other application is using the webcam": "No other application is using the webcam", "Already in call": "Already in call", "You're already in a call with this person.": "You're already in a call with this person.", - "VoIP is unsupported": "VoIP is unsupported", - "You cannot place VoIP calls in this browser.": "You cannot place VoIP calls in this browser.", + "Voice/video are unsupported": "Voice/video are unsupported", + "You cannot place voice/video calls in this browser.": "You cannot place voice/video calls in this browser.", "Connectivity to the server has been lost": "Connectivity to the server has been lost", - "You cannot place VoIP calls without a connection to the server.": "You cannot place VoIP calls without a connection to the server.", + "You cannot place voice/video calls without a connection to the server.": "You cannot place voice/video calls without a connection to the server.", "Too Many Calls": "Too Many Calls", "You've reached the maximum number of simultaneous calls.": "You've reached the maximum number of simultaneous calls.", "You cannot place a call with yourself.": "You cannot place a call with yourself.", From eb18c1ebfc0dd02a543a4afcbe9feff5f8846e2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Mon, 6 Dec 2021 09:00:36 +0100 Subject: [PATCH 3/4] Use just `calls` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/CallHandler.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CallHandler.tsx b/src/CallHandler.tsx index 299cf64b86d..f6cd54e474c 100644 --- a/src/CallHandler.tsx +++ b/src/CallHandler.tsx @@ -778,8 +778,8 @@ export default class CallHandler extends EventEmitter { // if the runtime env doesn't do VoIP, whine. if (!MatrixClientPeg.get().supportsVoip()) { Modal.createTrackedDialog('Call Handler', 'VoIP is unsupported', ErrorDialog, { - title: _t('Voice/video are unsupported'), - description: _t('You cannot place voice/video calls in this browser.'), + title: _t('Calls are unsupported'), + description: _t('You cannot place calls in this browser.'), }); return; } @@ -787,7 +787,7 @@ export default class CallHandler extends EventEmitter { if (MatrixClientPeg.get().getSyncState() === SyncState.Error) { Modal.createTrackedDialog('Call Handler', 'Sync error', ErrorDialog, { title: _t('Connectivity to the server has been lost'), - description: _t('You cannot place voice/video calls without a connection to the server.'), + description: _t('You cannot place calls without a connection to the server.'), }); return; } From 6e551a2b0bc8ed81f39954822d1ff857b098dd19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Mon, 6 Dec 2021 09:01:00 +0100 Subject: [PATCH 4/4] i18n MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/i18n/strings/en_EN.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 1700e1c387e..12a85288956 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -54,10 +54,10 @@ "No other application is using the webcam": "No other application is using the webcam", "Already in call": "Already in call", "You're already in a call with this person.": "You're already in a call with this person.", - "Voice/video are unsupported": "Voice/video are unsupported", - "You cannot place voice/video calls in this browser.": "You cannot place voice/video calls in this browser.", + "Calls are unsupported": "Calls are unsupported", + "You cannot place calls in this browser.": "You cannot place calls in this browser.", "Connectivity to the server has been lost": "Connectivity to the server has been lost", - "You cannot place voice/video calls without a connection to the server.": "You cannot place voice/video calls without a connection to the server.", + "You cannot place calls without a connection to the server.": "You cannot place calls without a connection to the server.", "Too Many Calls": "Too Many Calls", "You've reached the maximum number of simultaneous calls.": "You've reached the maximum number of simultaneous calls.", "You cannot place a call with yourself.": "You cannot place a call with yourself.",