This commit is contained in:
David Baker 2017-05-23 15:16:31 +01:00
parent 46bb29a3af
commit d419c42a4f
73 changed files with 4660 additions and 639 deletions

View file

@ -55,6 +55,7 @@ var MatrixClientPeg = require('./MatrixClientPeg');
var PlatformPeg = require("./PlatformPeg");
var Modal = require('./Modal');
var sdk = require('./index');
import _t from 'counterpart-riot';
var Matrix = require("matrix-js-sdk");
var dis = require("./dispatcher");
@ -142,8 +143,9 @@ function _setCallListeners(call) {
play("busyAudio");
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, {
title: "Call Timeout",
description: "The remote side failed to pick up."
title: _t('Call Timeout'),
description: _t('The remote side failed to pick up') + '.',
button: _t("OK"),
});
}
else if (oldState === "invite_sent") {
@ -203,8 +205,9 @@ function _onAction(payload) {
console.log("Can't capture screen: " + screenCapErrorString);
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, {
title: "Unable to capture screen",
description: screenCapErrorString
title: _t('Unable to capture screen'),
description: screenCapErrorString,
button: _t("OK"),
});
return;
}
@ -223,8 +226,9 @@ function _onAction(payload) {
if (module.exports.getAnyActiveCall()) {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, {
title: "Existing Call",
description: "You are already in a call."
title: _t('Existing Call'),
description: _t('You are already in a call') + '.',
button: _t("OK"),
});
return; // don't allow >1 call to be placed.
}
@ -233,8 +237,9 @@ function _onAction(payload) {
if (!MatrixClientPeg.get().supportsVoip()) {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, {
title: "VoIP is unsupported",
description: "You cannot place VoIP calls in this browser."
title: _t('VoIP is unsupported'),
description: _t('You cannot place VoIP calls in this browser') + '.',
button: _t("OK"),
});
return;
}
@ -249,7 +254,9 @@ function _onAction(payload) {
if (members.length <= 1) {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, {
description: "You cannot place a call with yourself."
description: _t('You cannot place a call with yourself') + '.',
title: _t("Error"),
button: _t("OK"),
});
return;
}
@ -275,14 +282,17 @@ function _onAction(payload) {
if (!ConferenceHandler) {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, {
description: "Conference calls are not supported in this client"
description: _t('Conference calls are not supported in this client'),
title: _t("Error"),
button: _t("OK"),
});
}
else if (!MatrixClientPeg.get().supportsVoip()) {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, {
title: "VoIP is unsupported",
description: "You cannot place VoIP calls in this browser."
title: _t('VoIP is unsupported'),
description: _t('You cannot place VoIP calls in this browser') + '.',
button: _t("OK"),
});
}
else if (MatrixClientPeg.get().isRoomEncrypted(payload.room_id)) {
@ -294,14 +304,17 @@ function _onAction(payload) {
// Therefore we disable conference calling in E2E rooms.
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createDialog(ErrorDialog, {
description: "Conference calls are not supported in encrypted rooms",
title: _t("Error"),
button: _t("OK"),
description: _t('Conference calls are not supported in encrypted rooms'),
});
}
else {
var QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
Modal.createDialog(QuestionDialog, {
title: "Warning!",
description: "Conference calling is in development and may not be reliable.",
title: _t('Warning') + '!',
description: _t('Conference calling is in development and may not be reliable') + '.',
button: _t("OK"),
onFinished: confirm=>{
if (confirm) {
ConferenceHandler.createNewMatrixCall(
@ -312,8 +325,9 @@ function _onAction(payload) {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Conference call failed: " + err);
Modal.createDialog(ErrorDialog, {
title: "Failed to set up conference call",
description: "Conference call failed. " + ((err && err.message) ? err.message : ""),
title: _t('Failed to set up conference call'),
description: _t('Conference call failed') + '. ' + ((err && err.message) ? err.message : ''),
button: _t("OK"),
});
});
}