Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Weblate 2018-06-22 10:45:23 +00:00
commit f887369a54
6 changed files with 202 additions and 151 deletions

View file

@ -4,7 +4,6 @@ src/autocomplete/AutocompleteProvider.js
src/autocomplete/Autocompleter.js src/autocomplete/Autocompleter.js
src/autocomplete/EmojiProvider.js src/autocomplete/EmojiProvider.js
src/autocomplete/UserProvider.js src/autocomplete/UserProvider.js
src/CallHandler.js
src/component-index.js src/component-index.js
src/components/structures/BottomLeftMenu.js src/components/structures/BottomLeftMenu.js
src/components/structures/CompatibilityPage.js src/components/structures/CompatibilityPage.js

View file

@ -1,6 +1,6 @@
/* /*
Copyright 2015, 2016 OpenMarket Ltd Copyright 2015, 2016 OpenMarket Ltd
Copyright 2017 New Vector Ltd Copyright 2017, 2018 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -60,6 +60,7 @@ import { _t } from './languageHandler';
import Matrix from 'matrix-js-sdk'; import Matrix from 'matrix-js-sdk';
import dis from './dispatcher'; import dis from './dispatcher';
import { showUnknownDeviceDialogForCalls } from './cryptodevices'; import { showUnknownDeviceDialogForCalls } from './cryptodevices';
import SettingsStore from "./settings/SettingsStore";
global.mxCalls = { global.mxCalls = {
//room_id: MatrixCall //room_id: MatrixCall
@ -123,7 +124,7 @@ function _setCallListeners(call) {
description: _t( description: _t(
"There are unknown devices in this room: "+ "There are unknown devices in this room: "+
"if you proceed without verifying them, it will be "+ "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'), button: _t('Review Devices'),
onFinished: function(confirmed) { onFinished: function(confirmed) {
@ -246,6 +247,7 @@ function _onAction(payload) {
switch (payload.action) { switch (payload.action) {
case 'place_call': case 'place_call':
{
if (module.exports.getAnyActiveCall()) { if (module.exports.getAnyActiveCall()) {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createTrackedDialog('Call Handler', 'Existing Call', ErrorDialog, { Modal.createTrackedDialog('Call Handler', 'Existing Call', ErrorDialog, {
@ -265,13 +267,13 @@ function _onAction(payload) {
return; return;
} }
var room = MatrixClientPeg.get().getRoom(payload.room_id); const room = MatrixClientPeg.get().getRoom(payload.room_id);
if (!room) { if (!room) {
console.error("Room %s does not exist.", payload.room_id); console.error("Room %s does not exist.", payload.room_id);
return; return;
} }
var members = room.getJoinedMembers(); const members = room.getJoinedMembers();
if (members.length <= 1) { if (members.length <= 1) {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createTrackedDialog('Call Handler', 'Cannot place call with self', ErrorDialog, { Modal.createTrackedDialog('Call Handler', 'Cannot place call with self', ErrorDialog, {
@ -291,9 +293,28 @@ function _onAction(payload) {
local_element: payload.local_element, local_element: payload.local_element,
}); });
} }
}
break; break;
case 'place_conference_call': case 'place_conference_call':
console.log("Place conference call in %s", payload.room_id); console.log("Place conference call in %s", payload.room_id);
if (MatrixClientPeg.get().isRoomEncrypted(payload.room_id)) {
// Conference calls are implemented by sending the media to central
// server which combines the audio from all the participants together
// into a single stream. This is incompatible with end-to-end encryption
// because a central server would be decrypting the audio for each
// participant.
// Therefore we disable conference calling in E2E rooms.
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createTrackedDialog('Call Handler', 'Conference calls unsupported e2e', ErrorDialog, {
description: _t('Conference calls are not supported in encrypted rooms'),
});
return;
}
if (SettingsStore.isFeatureEnabled('feature_jitsi')) {
_startCallApp(payload.room_id, payload.type);
} else {
if (!ConferenceHandler) { if (!ConferenceHandler) {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createTrackedDialog('Call Handler', 'Conference call unsupported client', ErrorDialog, { Modal.createTrackedDialog('Call Handler', 'Conference call unsupported client', ErrorDialog, {
@ -305,17 +326,6 @@ function _onAction(payload) {
title: _t('VoIP is unsupported'), title: _t('VoIP is unsupported'),
description: _t('You cannot place VoIP calls in this browser.'), description: _t('You cannot place VoIP calls in this browser.'),
}); });
} else if (MatrixClientPeg.get().isRoomEncrypted(payload.room_id)) {
// Conference calls are implemented by sending the media to central
// server which combines the audio from all the participants together
// into a single stream. This is incompatible with end-to-end encryption
// because a central server would be decrypting the audio for each
// participant.
// Therefore we disable conference calling in E2E rooms.
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createTrackedDialog('Call Handler', 'Conference calls unsupported e2e', ErrorDialog, {
description: _t('Conference calls are not supported in encrypted rooms'),
});
} else { } else {
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog"); const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
Modal.createTrackedDialog('Call Handler', 'Conference calling in development', QuestionDialog, { Modal.createTrackedDialog('Call Handler', 'Conference calling in development', QuestionDialog, {
@ -330,17 +340,27 @@ function _onAction(payload) {
}, function(err) { }, function(err) {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
console.error("Conference call failed: " + err); console.error("Conference call failed: " + err);
Modal.createTrackedDialog('Call Handler', 'Failed to set up conference call', ErrorDialog, { Modal.createTrackedDialog(
'Call Handler',
'Failed to set up conference call',
ErrorDialog,
{
title: _t('Failed to set up conference call'), title: _t('Failed to set up conference call'),
description: _t('Conference call failed.') + ' ' + ((err && err.message) ? err.message : ''), description: (
}); _t('Conference call failed.') +
' ' + ((err && err.message) ? err.message : '')
),
},
);
}); });
} }
}, },
}); });
} }
}
break; break;
case 'incoming_call': case 'incoming_call':
{
if (module.exports.getAnyActiveCall()) { if (module.exports.getAnyActiveCall()) {
// ignore multiple incoming calls. in future, we may want a line-1/line-2 setup. // ignore multiple incoming calls. in future, we may want a line-1/line-2 setup.
// we avoid rejecting with "busy" in case the user wants to answer it on a different device. // we avoid rejecting with "busy" in case the user wants to answer it on a different device.
@ -354,9 +374,10 @@ function _onAction(payload) {
return; return;
} }
var call = payload.call; const call = payload.call;
_setCallListeners(call); _setCallListeners(call);
_setCallState(call, call.roomId, "ringing"); _setCallState(call, call.roomId, "ringing");
}
break; break;
case 'hangup': case 'hangup':
if (!calls[payload.room_id]) { if (!calls[payload.room_id]) {
@ -378,6 +399,71 @@ function _onAction(payload) {
break; break;
} }
} }
function _startCallApp(roomId, type) {
dis.dispatch({
action: 'appsDrawer',
show: true,
});
const room = MatrixClientPeg.get().getRoom(roomId);
if (!room) {
console.error("Attempted to start conference call widget in unknown room: " + roomId);
return;
}
const appsStateEvents = room.currentState.getStateEvents('im.vector.modular.widgets');
const currentJitsiWidgets = appsStateEvents.filter((ev) => {
ev.getContent().type == 'jitsi';
});
if (currentJitsiWidgets.length > 0) {
console.warn(
"Refusing to start conference call widget in " + roomId +
" a conference call widget is already present",
);
return;
}
// This inherits its poor naming from the field of the same name that goes into
// the event. It's just a random string to make the Jitsi URLs unique.
const widgetSessionId = Math.random().toString(36).substring(2);
const confId = room.roomId.replace(/[^A-Za-z0-9]/g, '') + widgetSessionId;
// NB. we can't just encodeURICompoent all of these because the $ signs need to be there
// (but currently the only thing that needs encoding is the confId)
const queryString = [
'confId='+encodeURIComponent(confId),
'isAudioConf='+(type === 'voice' ? 'true' : 'false'),
'displayName=$matrix_display_name',
'avatarUrl=$matrix_avatar_url',
'email=$matrix_user_id',
].join('&');
const widgetUrl = (
'https://scalar.vector.im/api/widgets' +
'/jitsi.html?' +
queryString
);
const jitsiEvent = {
type: 'jitsi',
url: widgetUrl,
data: {
widgetSessionId: widgetSessionId,
},
};
const widgetId = (
'jitsi_' +
MatrixClientPeg.get().credentials.userId +
'_' +
Date.now()
);
MatrixClientPeg.get().sendStateEvent(
roomId,
'im.vector.modular.widgets',
jitsiEvent,
widgetId,
).then(() => console.log('Sent jitsi widget state event'), (e) => console.error(e));
}
// FIXME: Nasty way of making sure we only register // FIXME: Nasty way of making sure we only register
// with the dispatcher once // with the dispatcher once
if (!global.mxCallHandler) { if (!global.mxCallHandler) {

View file

@ -94,15 +94,7 @@ module.exports = React.createClass({
const hideWidgetKey = this.props.room.roomId + '_hide_widget_drawer'; const hideWidgetKey = this.props.room.roomId + '_hide_widget_drawer';
switch (action.action) { switch (action.action) {
case 'appsDrawer': case 'appsDrawer':
// When opening the app drawer when there aren't any apps,
// auto-launch the integrations manager to skip the awkward
// click on "Add widget"
if (action.show) { if (action.show) {
const apps = this._getApps();
if (apps.length === 0) {
this._launchManageIntegrations();
}
localStorage.removeItem(hideWidgetKey); localStorage.removeItem(hideWidgetKey);
} else { } else {
// Store hidden state of widget // Store hidden state of widget

View file

@ -159,54 +159,20 @@ export default class MessageComposer extends React.Component {
}); });
} }
// _startCallApp(isAudioConf) {
// dis.dispatch({
// action: 'appsDrawer',
// show: true,
// });
// const appsStateEvents = this.props.room.currentState.getStateEvents('im.vector.modular.widgets', '');
// let appsStateEvent = {};
// if (appsStateEvents) {
// appsStateEvent = appsStateEvents.getContent();
// }
// if (!appsStateEvent.videoConf) {
// appsStateEvent.videoConf = {
// type: 'jitsi',
// // FIXME -- This should not be localhost
// url: 'http://localhost:8000/jitsi.html',
// data: {
// confId: this.props.room.roomId.replace(/[^A-Za-z0-9]/g, '_') + Date.now(),
// isAudioConf: isAudioConf,
// },
// };
// MatrixClientPeg.get().sendStateEvent(
// this.props.room.roomId,
// 'im.vector.modular.widgets',
// appsStateEvent,
// '',
// ).then(() => console.log('Sent state'), (e) => console.error(e));
// }
// }
onCallClick(ev) { onCallClick(ev) {
// NOTE -- Will be replaced by Jitsi code (currently commented)
dis.dispatch({ dis.dispatch({
action: 'place_call', action: 'place_call',
type: ev.shiftKey ? "screensharing" : "video", type: ev.shiftKey ? "screensharing" : "video",
room_id: this.props.room.roomId, room_id: this.props.room.roomId,
}); });
// this._startCallApp(false);
} }
onVoiceCallClick(ev) { onVoiceCallClick(ev) {
// NOTE -- Will be replaced by Jitsi code (currently commented)
dis.dispatch({ dis.dispatch({
action: 'place_call', action: 'place_call',
type: "voice", type: "voice",
room_id: this.props.room.roomId, room_id: this.props.room.roomId,
}); });
// this._startCallApp(true);
} }
onInputContentChanged(content: string, selection: {start: number, end: number}) { onInputContentChanged(content: string, selection: {start: number, end: number}) {

View file

@ -33,8 +33,8 @@
"VoIP is unsupported": "VoIP is unsupported", "VoIP is unsupported": "VoIP is unsupported",
"You cannot place VoIP calls in this browser.": "You cannot place VoIP calls in this browser.", "You cannot place VoIP calls in this browser.": "You cannot place VoIP calls in this browser.",
"You cannot place a call with yourself.": "You cannot place a call with yourself.", "You cannot place a call with yourself.": "You cannot place a call with yourself.",
"Conference calls are not supported in this client": "Conference calls are not supported in this client",
"Conference calls are not supported in encrypted rooms": "Conference calls are not supported in encrypted rooms", "Conference calls are not supported in encrypted rooms": "Conference calls are not supported in encrypted rooms",
"Conference calls are not supported in this client": "Conference calls are not supported in this client",
"Warning!": "Warning!", "Warning!": "Warning!",
"Conference calling is in development and may not be reliable.": "Conference calling is in development and may not be reliable.", "Conference calling is in development and may not be reliable.": "Conference calling is in development and may not be reliable.",
"Failed to set up conference call": "Failed to set up conference call", "Failed to set up conference call": "Failed to set up conference call",
@ -114,19 +114,36 @@
"Room %(roomId)s not visible": "Room %(roomId)s not visible", "Room %(roomId)s not visible": "Room %(roomId)s not visible",
"Missing user_id in request": "Missing user_id in request", "Missing user_id in request": "Missing user_id in request",
"Usage": "Usage", "Usage": "Usage",
"Searches DuckDuckGo for results": "Searches DuckDuckGo for results",
"/ddg is not a command": "/ddg is not a command", "/ddg is not a command": "/ddg is not a command",
"To use it, just wait for autocomplete results to load and tab through them.": "To use it, just wait for autocomplete results to load and tab through them.", "To use it, just wait for autocomplete results to load and tab through them.": "To use it, just wait for autocomplete results to load and tab through them.",
"Changes your display nickname": "Changes your display nickname",
"Changes colour scheme of current room": "Changes colour scheme of current room",
"Sets the room topic": "Sets the room topic",
"Invites user with given id to current room": "Invites user with given id to current room",
"Joins room with given alias": "Joins room with given alias",
"Leave room": "Leave room",
"Unrecognised room alias:": "Unrecognised room alias:", "Unrecognised room alias:": "Unrecognised room alias:",
"Kicks user with given id": "Kicks user with given id",
"Bans user with given id": "Bans user with given id",
"Unbans user with given id": "Unbans user with given id",
"Ignores a user, hiding their messages from you": "Ignores a user, hiding their messages from you",
"Ignored user": "Ignored user", "Ignored user": "Ignored user",
"You are now ignoring %(userId)s": "You are now ignoring %(userId)s", "You are now ignoring %(userId)s": "You are now ignoring %(userId)s",
"Stops ignoring a user, showing their messages going forward": "Stops ignoring a user, showing their messages going forward",
"Unignored user": "Unignored user", "Unignored user": "Unignored user",
"You are no longer ignoring %(userId)s": "You are no longer ignoring %(userId)s", "You are no longer ignoring %(userId)s": "You are no longer ignoring %(userId)s",
"Define the power level of a user": "Define the power level of a user",
"Deops user with given id": "Deops user with given id",
"Opens the Developer Tools dialog": "Opens the Developer Tools dialog",
"Verifies a user, device, and pubkey tuple": "Verifies a user, device, and pubkey tuple",
"Unknown (user, device) pair:": "Unknown (user, device) pair:", "Unknown (user, device) pair:": "Unknown (user, device) pair:",
"Device already verified!": "Device already verified!", "Device already verified!": "Device already verified!",
"WARNING: Device already verified, but keys do NOT MATCH!": "WARNING: Device already verified, but keys do NOT MATCH!", "WARNING: Device already verified, but keys do NOT MATCH!": "WARNING: Device already verified, but keys do NOT MATCH!",
"WARNING: KEY VERIFICATION FAILED! The signing key for %(userId)s and device %(deviceId)s is \"%(fprint)s\" which does not match the provided key \"%(fingerprint)s\". This could mean your communications are being intercepted!": "WARNING: KEY VERIFICATION FAILED! The signing key for %(userId)s and device %(deviceId)s is \"%(fprint)s\" which does not match the provided key \"%(fingerprint)s\". This could mean your communications are being intercepted!", "WARNING: KEY VERIFICATION FAILED! The signing key for %(userId)s and device %(deviceId)s is \"%(fprint)s\" which does not match the provided key \"%(fingerprint)s\". This could mean your communications are being intercepted!": "WARNING: KEY VERIFICATION FAILED! The signing key for %(userId)s and device %(deviceId)s is \"%(fprint)s\" which does not match the provided key \"%(fingerprint)s\". This could mean your communications are being intercepted!",
"Verified key": "Verified key", "Verified key": "Verified key",
"The signing key you provided matches the signing key you received from %(userId)s's device %(deviceId)s. Device marked as verified.": "The signing key you provided matches the signing key you received from %(userId)s's device %(deviceId)s. Device marked as verified.", "The signing key you provided matches the signing key you received from %(userId)s's device %(deviceId)s. Device marked as verified.": "The signing key you provided matches the signing key you received from %(userId)s's device %(deviceId)s. Device marked as verified.",
"Displays action": "Displays action",
"Unrecognised command:": "Unrecognised command:", "Unrecognised command:": "Unrecognised command:",
"Reason": "Reason", "Reason": "Reason",
"%(targetName)s accepted the invitation for %(displayName)s.": "%(targetName)s accepted the invitation for %(displayName)s.", "%(targetName)s accepted the invitation for %(displayName)s.": "%(targetName)s accepted the invitation for %(displayName)s.",
@ -187,6 +204,7 @@
"Authentication check failed: incorrect password?": "Authentication check failed: incorrect password?", "Authentication check failed: incorrect password?": "Authentication check failed: incorrect password?",
"Failed to join room": "Failed to join room", "Failed to join room": "Failed to join room",
"Message Pinning": "Message Pinning", "Message Pinning": "Message Pinning",
"Jitsi Conference Calling": "Jitsi Conference Calling",
"Disable Emoji suggestions while typing": "Disable Emoji suggestions while typing", "Disable Emoji suggestions while typing": "Disable Emoji suggestions while typing",
"Use compact timeline layout": "Use compact timeline layout", "Use compact timeline layout": "Use compact timeline layout",
"Hide removed messages": "Hide removed messages", "Hide removed messages": "Hide removed messages",
@ -497,7 +515,6 @@
"Muted Users": "Muted Users", "Muted Users": "Muted Users",
"Banned users": "Banned users", "Banned users": "Banned users",
"This room is not accessible by remote Matrix servers": "This room is not accessible by remote Matrix servers", "This room is not accessible by remote Matrix servers": "This room is not accessible by remote Matrix servers",
"Leave room": "Leave room",
"Favourite": "Favourite", "Favourite": "Favourite",
"Tagged as: ": "Tagged as: ", "Tagged as: ": "Tagged as: ",
"To link to a room it must have <a>an address</a>.": "To link to a room it must have <a>an address</a>.", "To link to a room it must have <a>an address</a>.": "To link to a room it must have <a>an address</a>.",
@ -748,8 +765,8 @@
"Matrix ID": "Matrix ID", "Matrix ID": "Matrix ID",
"Matrix Room ID": "Matrix Room ID", "Matrix Room ID": "Matrix Room ID",
"email address": "email address", "email address": "email address",
"Try using one of the following valid address types: %(validTypesList)s.": "Try using one of the following valid address types: %(validTypesList)s.",
"You have entered an invalid address.": "You have entered an invalid address.", "You have entered an invalid address.": "You have entered an invalid address.",
"Try using one of the following valid address types: %(validTypesList)s.": "Try using one of the following valid address types: %(validTypesList)s.",
"Preparing to send logs": "Preparing to send logs", "Preparing to send logs": "Preparing to send logs",
"Logs sent": "Logs sent", "Logs sent": "Logs sent",
"Thank you!": "Thank you!", "Thank you!": "Thank you!",
@ -1142,22 +1159,6 @@
"You need to enter a user name.": "You need to enter a user name.", "You need to enter a user name.": "You need to enter a user name.",
"An unknown error occurred.": "An unknown error occurred.", "An unknown error occurred.": "An unknown error occurred.",
"I already have an account": "I already have an account", "I already have an account": "I already have an account",
"Displays action": "Displays action",
"Bans user with given id": "Bans user with given id",
"Unbans user with given id": "Unbans user with given id",
"Define the power level of a user": "Define the power level of a user",
"Deops user with given id": "Deops user with given id",
"Invites user with given id to current room": "Invites user with given id to current room",
"Joins room with given alias": "Joins room with given alias",
"Sets the room topic": "Sets the room topic",
"Kicks user with given id": "Kicks user with given id",
"Changes your display nickname": "Changes your display nickname",
"Searches DuckDuckGo for results": "Searches DuckDuckGo for results",
"Changes colour scheme of current room": "Changes colour scheme of current room",
"Verifies a user, device, and pubkey tuple": "Verifies a user, device, and pubkey tuple",
"Ignores a user, hiding their messages from you": "Ignores a user, hiding their messages from you",
"Stops ignoring a user, showing their messages going forward": "Stops ignoring a user, showing their messages going forward",
"Opens the Developer Tools dialog": "Opens the Developer Tools dialog",
"Commands": "Commands", "Commands": "Commands",
"Results from DuckDuckGo": "Results from DuckDuckGo", "Results from DuckDuckGo": "Results from DuckDuckGo",
"Emoji": "Emoji", "Emoji": "Emoji",

View file

@ -1,5 +1,6 @@
/* /*
Copyright 2017 Travis Ralston Copyright 2017 Travis Ralston
Copyright 2018 New Vector Ltd
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -82,6 +83,12 @@ export const SETTINGS = {
supportedLevels: LEVELS_FEATURE, supportedLevels: LEVELS_FEATURE,
default: false, default: false,
}, },
"feature_jitsi": {
isFeature: true,
displayName: _td("Jitsi Conference Calling"),
supportedLevels: LEVELS_FEATURE,
default: false,
},
"MessageComposerInput.dontSuggestEmoji": { "MessageComposerInput.dontSuggestEmoji": {
supportedLevels: LEVELS_ACCOUNT_SETTINGS, supportedLevels: LEVELS_ACCOUNT_SETTINGS,
displayName: _td('Disable Emoji suggestions while typing'), displayName: _td('Disable Emoji suggestions while typing'),