From c6262d62a63fee8aad8546141e5898c400f73284 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 28 Apr 2017 18:21:22 +0100 Subject: [PATCH 01/26] webrtc config electron init on LoggedInView mounting configurable via UserSettings new class: CallMediaHandler Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/CallMediaHandler.js | 63 ++++++++++++++++++ src/components/structures/LoggedInView.js | 5 ++ src/components/structures/UserSettings.js | 78 ++++++++++++++++++++++- 3 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 src/CallMediaHandler.js diff --git a/src/CallMediaHandler.js b/src/CallMediaHandler.js new file mode 100644 index 0000000000..9133a6548d --- /dev/null +++ b/src/CallMediaHandler.js @@ -0,0 +1,63 @@ +/* + Copyright 2017 Michael Telatynski <7t3chguy@gmail.com> + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +import UserSettingsStore from './UserSettingsStore'; +import * as Matrix from 'matrix-js-sdk'; +import q from 'q'; + +export default { + getDevices: function() { + // Only needed for Electron atm, though should work in modern browsers + // once permission has been granted to the webapp + return navigator.mediaDevices.enumerateDevices().then(function(devices) { + const audioIn = {}; + const videoIn = {}; + + devices.forEach((device) => { + switch (device.kind) { + case 'audioinput': audioIn[device.deviceId] = device.label; break; + case 'videoinput': videoIn[device.deviceId] = device.label; break; + } + }); + + // console.log("Loaded WebRTC Devices", mediaDevices); + return { + audioinput: audioIn, + videoinput: videoIn, + }; + }, (error) => { console.log('Unable to refresh WebRTC Devices: ', error); }); + }, + + loadDevices: function() { + // this.getDevices().then((devices) => { + const localSettings = UserSettingsStore.getLocalSettings(); + // // if deviceId is not found, automatic fallback is in spec + // // recall previously stored inputs if any + Matrix.setMatrixCallAudioInput(localSettings['webrtc_audioinput']); + Matrix.setMatrixCallVideoInput(localSettings['webrtc_videoinput']); + // }); + }, + + setAudioInput: function(deviceId) { + UserSettingsStore.setLocalSetting('webrtc_audioinput', deviceId); + Matrix.setMatrixCallAudioInput(deviceId); + }, + + setVideoInput: function(deviceId) { + UserSettingsStore.setLocalSetting('webrtc_videoinput', deviceId); + Matrix.setMatrixCallVideoInput(deviceId); + }, +}; diff --git a/src/components/structures/LoggedInView.js b/src/components/structures/LoggedInView.js index 9f01b0082b..8d18e92a0d 100644 --- a/src/components/structures/LoggedInView.js +++ b/src/components/structures/LoggedInView.js @@ -21,6 +21,7 @@ import React from 'react'; import KeyCode from '../../KeyCode'; import Notifier from '../../Notifier'; import PageTypes from '../../PageTypes'; +import CallMediaHandler from '../../CallMediaHandler'; import sdk from '../../index'; import dis from '../../dispatcher'; @@ -71,6 +72,10 @@ export default React.createClass({ // RoomView.getScrollState() this._scrollStateMap = {}; + // Only run these in electron, at least until a better mechanism for perms exists + // https://w3c.github.io/permissions/#dom-permissionname-device-info + if (window && window.process && window.process.type) CallMediaHandler.loadDevices(); + document.addEventListener('keydown', this._onKeyDown); }, diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index ba5d5780b4..05410e866f 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -24,6 +24,7 @@ var dis = require("../../dispatcher"); var q = require('q'); var package_json = require('../../../package.json'); var UserSettingsStore = require('../../UserSettingsStore'); +var CallMediaHandler = require('../../CallMediaHandler'); var GeminiScrollbar = require('react-gemini-scrollbar'); var Email = require('../../email'); var AddThreepid = require('../../AddThreepid'); @@ -109,7 +110,6 @@ const THEMES = [ } ]; - module.exports = React.createClass({ displayName: 'UserSettings', @@ -147,6 +147,7 @@ module.exports = React.createClass({ email_add_pending: false, vectorVersion: null, rejectingInvites: false, + mediaDevices: null, }; }, @@ -167,6 +168,18 @@ module.exports = React.createClass({ }); } + q().then(() => { + return CallMediaHandler.getDevices(); + }).then((mediaDevices) => { + console.log("got mediaDevices", mediaDevices, this._unmounted); + if (this._unmounted) return; + this.setState({ + mediaDevices, + activeAudioInput: this._localSettings['webrtc_audioinput'] || 'default', + activeVideoInput: this._localSettings['webrtc_videoinput'] || 'default', + }); + }); + // Bulk rejecting invites: // /sync won't have had time to return when UserSettings re-renders from state changes, so getRooms() // will still return rooms with invites. To get around this, add a listener for @@ -187,6 +200,8 @@ module.exports = React.createClass({ this._syncedSettings = syncedSettings; this._localSettings = UserSettingsStore.getLocalSettings(); + this._setAudioInput = this._setAudioInput.bind(this); + this._setVideoInput = this._setVideoInput.bind(this); }, componentDidMount: function() { @@ -775,6 +790,66 @@ module.exports = React.createClass({ ; }, + _mapWebRtcDevicesToSpans: function(devices) { + return Object.keys(devices).map( + (deviceId) => {devices[deviceId]} + ); + }, + + _setAudioInput: function(deviceId) { + this.setState({activeAudioInput: deviceId}); + CallMediaHandler.setAudioInput(deviceId); + }, + + _setVideoInput: function(deviceId) { + this.setState({activeVideoInput: deviceId}); + CallMediaHandler.setVideoInput(deviceId); + }, + + _renderWebRtcSettings: function() { + if (!(window && window.process && window.process.type) + || !this.state.mediaDevices) return; + + const Dropdown = sdk.getComponent('elements.Dropdown'); + + let microphoneDropdown =
No Microphones detected
; + let webcamDropdown =
No Webcams detected
; + + const audioInputs = this.state.mediaDevices.audioinput; + if ('default' in audioInputs) { + microphoneDropdown =
+

Microphone

+ + {this._mapWebRtcDevicesToSpans(audioInputs)} + +
; + } + + const videoInputs = this.state.mediaDevices.videoinput; + if ('default' in videoInputs) { + webcamDropdown =
+

Cameras

+ + {this._mapWebRtcDevicesToSpans(videoInputs)} + +
; + } + + return
+

WebRTC

+
+ {microphoneDropdown} + {webcamDropdown} +
+
; + }, + _showSpoiler: function(event) { const target = event.target; const hidden = target.getAttribute('data-spoiler'); @@ -973,6 +1048,7 @@ module.exports = React.createClass({ {this._renderUserInterfaceSettings()} {this._renderLabs()} + {this._renderWebRtcSettings()} {this._renderDevicesPanel()} {this._renderCryptoInfo()} {this._renderBulkOptions()} From b944fff5c5f97193c55dc1255545179be820fcef Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@googlemail.com> Date: Fri, 5 May 2017 20:57:18 +0100 Subject: [PATCH 02/26] unscrew merge --- src/components/structures/UserSettings.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index 06103eae55..9d53bfda31 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -24,6 +24,7 @@ const dis = require("../../dispatcher"); const q = require('q'); const packageJson = require('../../../package.json'); const UserSettingsStore = require('../../UserSettingsStore'); +const CallMediaHandler = require('../../CallMediaHandler'); const GeminiScrollbar = require('react-gemini-scrollbar'); const Email = require('../../email'); const AddThreepid = require('../../AddThreepid'); From 09d0ab7df5f9e6602ca2e8e705e4d59a1304f94e Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 25 May 2017 01:01:40 +0100 Subject: [PATCH 03/26] attempt to make media selector work everywhere (TM) loadDevices not only in electron Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/CallMediaHandler.js | 2 + src/components/structures/LoggedInView.js | 4 +- src/components/structures/UserSettings.js | 52 ++++++++++++++++------- 3 files changed, 40 insertions(+), 18 deletions(-) diff --git a/src/CallMediaHandler.js b/src/CallMediaHandler.js index 9133a6548d..4f82e003b9 100644 --- a/src/CallMediaHandler.js +++ b/src/CallMediaHandler.js @@ -26,6 +26,8 @@ export default { const audioIn = {}; const videoIn = {}; + if (devices.some((device) => !device.label)) return false; + devices.forEach((device) => { switch (device.kind) { case 'audioinput': audioIn[device.deviceId] = device.label; break; diff --git a/src/components/structures/LoggedInView.js b/src/components/structures/LoggedInView.js index a84661bcd2..1a7b7e06e4 100644 --- a/src/components/structures/LoggedInView.js +++ b/src/components/structures/LoggedInView.js @@ -72,9 +72,7 @@ export default React.createClass({ // RoomView.getScrollState() this._scrollStateMap = {}; - // Only run these in electron, at least until a better mechanism for perms exists - // https://w3c.github.io/permissions/#dom-permissionname-device-info - if (window && window.process && window.process.type) CallMediaHandler.loadDevices(); + CallMediaHandler.loadDevices(); document.addEventListener('keydown', this._onKeyDown); }, diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index de88566300..58c6bb7c20 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -178,17 +178,7 @@ module.exports = React.createClass({ }); } - q().then(() => { - return CallMediaHandler.getDevices(); - }).then((mediaDevices) => { - console.log("got mediaDevices", mediaDevices, this._unmounted); - if (this._unmounted) return; - this.setState({ - mediaDevices, - activeAudioInput: this._localSettings['webrtc_audioinput'] || 'default', - activeVideoInput: this._localSettings['webrtc_videoinput'] || 'default', - }); - }); + this._refreshMediaDevices(); // Bulk rejecting invites: // /sync won't have had time to return when UserSettings re-renders from state changes, so getRooms() @@ -210,8 +200,6 @@ module.exports = React.createClass({ this._syncedSettings = syncedSettings; this._localSettings = UserSettingsStore.getLocalSettings(); - this._setAudioInput = this._setAudioInput.bind(this); - this._setVideoInput = this._setVideoInput.bind(this); }, componentDidMount: function() { @@ -233,6 +221,20 @@ module.exports = React.createClass({ } }, + _refreshMediaDevices: function() { + q().then(() => { + return CallMediaHandler.getDevices(); + }).then((mediaDevices) => { + // console.log("got mediaDevices", mediaDevices, this._unmounted); + if (this._unmounted) return; + this.setState({ + mediaDevices, + activeAudioInput: this._localSettings['webrtc_audioinput'] || 'default', + activeVideoInput: this._localSettings['webrtc_videoinput'] || 'default', + }); + }); + }, + _refreshFromServer: function() { const self = this; q.all([ @@ -818,9 +820,29 @@ module.exports = React.createClass({ CallMediaHandler.setVideoInput(deviceId); }, + _requestMediaPermissions: function() { + console.log("Request media perms"); + const getUserMedia = ( + window.navigator.getUserMedia || window.navigator.webkitGetUserMedia || window.navigator.mozGetUserMedia + ); + if (getUserMedia) { + return getUserMedia.apply(window.navigator, [ + { video: true, audio: true }, + this._refreshMediaDevices, + function() {}, + ]); + } + }, + _renderWebRtcSettings: function() { - if (!(window && window.process && window.process.type) - || !this.state.mediaDevices) return; + if (this.state.mediaDevices === false) { + return
+

WebRTC

+
+
Missing Media Permissions, click to request.
+
+
; + } else if (!this.state.mediaDevices) return; const Dropdown = sdk.getComponent('elements.Dropdown'); From 8158ec6d54c062c6a3c49b92ee5c1fe1e64e969b Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 25 May 2017 01:25:17 +0100 Subject: [PATCH 04/26] touchups Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/UserSettings.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index 58c6bb7c20..0d182b27ab 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -820,8 +820,7 @@ module.exports = React.createClass({ CallMediaHandler.setVideoInput(deviceId); }, - _requestMediaPermissions: function() { - console.log("Request media perms"); + _requestMediaPermissions: function(event) { const getUserMedia = ( window.navigator.getUserMedia || window.navigator.webkitGetUserMedia || window.navigator.mozGetUserMedia ); @@ -829,7 +828,13 @@ module.exports = React.createClass({ return getUserMedia.apply(window.navigator, [ { video: true, audio: true }, this._refreshMediaDevices, - function() {}, + function() { + const ErrorDialog = sdk.getComponent('dialogs.ErrorDialog'); + Modal.createDialog(ErrorDialog, { + title: "No media permissions", + description: "You may need to manually permit Riot to access your microphone/webcam", + }); + }, ]); } }, @@ -839,15 +844,17 @@ module.exports = React.createClass({ return

WebRTC

-
Missing Media Permissions, click to request.
+

+ Missing Media Permissions, click here to request. +

; } else if (!this.state.mediaDevices) return; const Dropdown = sdk.getComponent('elements.Dropdown'); - let microphoneDropdown =
No Microphones detected
; - let webcamDropdown =
No Webcams detected
; + let microphoneDropdown =

No Microphones detected

; + let webcamDropdown =

No Webcams detected

; const audioInputs = this.state.mediaDevices.audioinput; if ('default' in audioInputs) { From b63adc9b105605d87a37ddfeaccbf0bae123cc36 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Thu, 1 Jun 2017 02:15:48 +0100 Subject: [PATCH 05/26] Prepare changelog for v0.9.0-rc.1 --- CHANGELOG.md | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b9ecdb325..23098c4749 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,115 @@ +Changes in [0.9.0-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v0.9.0-rc.1) (2017-06-01) +============================================================================================================= +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v0.8.9...v0.9.0-rc.1) + + * Fix rare case where presence duration is undefined + [\#982](https://github.com/matrix-org/matrix-react-sdk/pull/982) + * add concept of platform handling loudNotifications (bings/pings/whatHaveYou) + [\#985](https://github.com/matrix-org/matrix-react-sdk/pull/985) + * Fixes to i18n code + [\#984](https://github.com/matrix-org/matrix-react-sdk/pull/984) + * Update from Weblate. + [\#978](https://github.com/matrix-org/matrix-react-sdk/pull/978) + * Add partial support for RTL languages + [\#955](https://github.com/matrix-org/matrix-react-sdk/pull/955) + * Added two strings to translate + [\#975](https://github.com/matrix-org/matrix-react-sdk/pull/975) + * Update from Weblate. + [\#976](https://github.com/matrix-org/matrix-react-sdk/pull/976) + * Update from Weblate. + [\#974](https://github.com/matrix-org/matrix-react-sdk/pull/974) + * Initial Electron Settings - for Auto Launch + [\#920](https://github.com/matrix-org/matrix-react-sdk/pull/920) + * Fix missing string in the room settings + [\#973](https://github.com/matrix-org/matrix-react-sdk/pull/973) + * fix error in i18n string + [\#972](https://github.com/matrix-org/matrix-react-sdk/pull/972) + * Update from Weblate. + [\#970](https://github.com/matrix-org/matrix-react-sdk/pull/970) + * Support 12hr time in full date + [\#971](https://github.com/matrix-org/matrix-react-sdk/pull/971) + * Add _tJsx() + [\#968](https://github.com/matrix-org/matrix-react-sdk/pull/968) + * Update from Weblate. + [\#966](https://github.com/matrix-org/matrix-react-sdk/pull/966) + * Remove space between time and AM/PM + [\#969](https://github.com/matrix-org/matrix-react-sdk/pull/969) + * Piwik Analytics + [\#948](https://github.com/matrix-org/matrix-react-sdk/pull/948) + * Update from Weblate. + [\#965](https://github.com/matrix-org/matrix-react-sdk/pull/965) + * Improve ChatInviteDialog perf by ditching fuse, using indexOf and + lastActiveTs() + [\#960](https://github.com/matrix-org/matrix-react-sdk/pull/960) + * Say "X removed the room name" instead of showing nothing + [\#958](https://github.com/matrix-org/matrix-react-sdk/pull/958) + * roomview/roomheader fixes + [\#959](https://github.com/matrix-org/matrix-react-sdk/pull/959) + * Update from Weblate. + [\#953](https://github.com/matrix-org/matrix-react-sdk/pull/953) + * fix i18n in a situation where navigator.languages=[] + [\#956](https://github.com/matrix-org/matrix-react-sdk/pull/956) + * `t_` -> `_t` fix typo + [\#957](https://github.com/matrix-org/matrix-react-sdk/pull/957) + * Change redact -> remove for clarity + [\#831](https://github.com/matrix-org/matrix-react-sdk/pull/831) + * Update from Weblate. + [\#950](https://github.com/matrix-org/matrix-react-sdk/pull/950) + * fix mis-linting - missed it in code review :( + [\#952](https://github.com/matrix-org/matrix-react-sdk/pull/952) + * i18n fixes + [\#951](https://github.com/matrix-org/matrix-react-sdk/pull/951) + * Message Forwarding + [\#812](https://github.com/matrix-org/matrix-react-sdk/pull/812) + * don't focus_composer on window focus + [\#944](https://github.com/matrix-org/matrix-react-sdk/pull/944) + * Fix vector-im/riot-web#4042 + [\#947](https://github.com/matrix-org/matrix-react-sdk/pull/947) + * import _t, drop two unused imports + [\#946](https://github.com/matrix-org/matrix-react-sdk/pull/946) + * Fix punctuation in TextForEvent to be i18n'd consistently + [\#945](https://github.com/matrix-org/matrix-react-sdk/pull/945) + * actually wire up alwaysShowTimestamps + [\#940](https://github.com/matrix-org/matrix-react-sdk/pull/940) + * Update from Weblate. + [\#943](https://github.com/matrix-org/matrix-react-sdk/pull/943) + * Update from Weblate. + [\#942](https://github.com/matrix-org/matrix-react-sdk/pull/942) + * Update from Weblate. + [\#941](https://github.com/matrix-org/matrix-react-sdk/pull/941) + * Update from Weblate. + [\#938](https://github.com/matrix-org/matrix-react-sdk/pull/938) + * Fix PM being AM + [\#939](https://github.com/matrix-org/matrix-react-sdk/pull/939) + * pass call state through dispatcher, for poor electron + [\#918](https://github.com/matrix-org/matrix-react-sdk/pull/918) + * Translations! + [\#934](https://github.com/matrix-org/matrix-react-sdk/pull/934) + * Remove suffix and prefix from login input username + [\#906](https://github.com/matrix-org/matrix-react-sdk/pull/906) + * Kierangould/12hourtimestamp + [\#903](https://github.com/matrix-org/matrix-react-sdk/pull/903) + * Don't include src in the test resolve root + [\#931](https://github.com/matrix-org/matrix-react-sdk/pull/931) + * Make the linked versions open a new tab, turt2live complained :P + [\#910](https://github.com/matrix-org/matrix-react-sdk/pull/910) + * Fix lint errors in SlashCommands + [\#919](https://github.com/matrix-org/matrix-react-sdk/pull/919) + * autoFocus input box + [\#911](https://github.com/matrix-org/matrix-react-sdk/pull/911) + * Make travis test against riot-web new-guest-access + [\#917](https://github.com/matrix-org/matrix-react-sdk/pull/917) + * Add right-branch logic to travis test script + [\#916](https://github.com/matrix-org/matrix-react-sdk/pull/916) + * Group e2e keys into blocks of 4 characters + [\#914](https://github.com/matrix-org/matrix-react-sdk/pull/914) + * Factor out DeviceVerifyDialog + [\#913](https://github.com/matrix-org/matrix-react-sdk/pull/913) + * Fix 'missing page_type' error + [\#909](https://github.com/matrix-org/matrix-react-sdk/pull/909) + * code style update + [\#904](https://github.com/matrix-org/matrix-react-sdk/pull/904) + Changes in [0.8.9](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v0.8.9) (2017-05-22) =================================================================================================== [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v0.8.9-rc.1...v0.8.9) From bceef2db916c519d637923b2dd8f504cbd0c0cea Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Thu, 1 Jun 2017 02:15:49 +0100 Subject: [PATCH 06/26] v0.9.0-rc.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a6076a56d2..c17c8e83a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "0.8.9", + "version": "0.9.0-rc.1", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": { From dbba1dedb6a529ce1198f2b2d85ec8e7b046c981 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 1 Jun 2017 22:58:17 +0100 Subject: [PATCH 07/26] i18nize all the things and change show logic Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/UserSettings.js | 22 ++++++++++------------ src/i18n/strings/en_EN.json | 6 ++++++ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index 4cb49d8c1e..b33bdd271d 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -902,9 +902,7 @@ module.exports = React.createClass({ }, _mapWebRtcDevicesToSpans: function(devices) { - return Object.keys(devices).map( - (deviceId) => {devices[deviceId]} - ); + return Object.keys(devices).map((deviceId) => {devices[deviceId]}); }, _setAudioInput: function(deviceId) { @@ -928,8 +926,8 @@ module.exports = React.createClass({ function() { const ErrorDialog = sdk.getComponent('dialogs.ErrorDialog'); Modal.createDialog(ErrorDialog, { - title: "No media permissions", - description: "You may need to manually permit Riot to access your microphone/webcam", + title: _t('No media permissions'), + description: _t('You may need to manually permit Riot to access your microphone/webcam'), }); }, ]); @@ -939,10 +937,10 @@ module.exports = React.createClass({ _renderWebRtcSettings: function() { if (this.state.mediaDevices === false) { return
-

WebRTC

+

{_t('VoIP')}

- Missing Media Permissions, click here to request. + {_t('Missing Media Permissions, click here to request.')}

; @@ -950,11 +948,11 @@ module.exports = React.createClass({ const Dropdown = sdk.getComponent('elements.Dropdown'); - let microphoneDropdown =

No Microphones detected

; - let webcamDropdown =

No Webcams detected

; + let microphoneDropdown =

{_t('No Microphones detected')}

; + let webcamDropdown =

{_t('No Webcams detected')}

; const audioInputs = this.state.mediaDevices.audioinput; - if ('default' in audioInputs) { + if (Object.keys(videoInputs).length > 0) { microphoneDropdown =

Microphone

0) { webcamDropdown =

Cameras

-

WebRTC

+

{_t('VoIP')}

{microphoneDropdown} {webcamDropdown} diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 211d164c2a..44a1af57fa 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -129,6 +129,12 @@ "Add email address": "Add email address", "Add phone number": "Add phone number", "Admin": "Admin", + "VoIP": "VoIP", + "Missing Media Permissions, click here to request.": "Missing Media Permissions, click here to request.", + "No Microphones detected": "No Microphones detected", + "No Webcams detected": "No Webcams detected", + "No media permissions": "No media permissions", + "You may need to manually permit Riot to access your microphone/webcam": "You may need to manually permit Riot to access your microphone/webcam", "Advanced": "Advanced", "Algorithm": "Algorithm", "Always show message timestamps": "Always show message timestamps", From 0c367783691629c551cea9ec02e1cd4fa6f5ccbe Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 1 Jun 2017 22:59:37 +0100 Subject: [PATCH 08/26] fix bad indentation Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/i18n/strings/en_EN.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 44a1af57fa..dcf3670dd9 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -134,7 +134,7 @@ "No Microphones detected": "No Microphones detected", "No Webcams detected": "No Webcams detected", "No media permissions": "No media permissions", - "You may need to manually permit Riot to access your microphone/webcam": "You may need to manually permit Riot to access your microphone/webcam", + "You may need to manually permit Riot to access your microphone/webcam": "You may need to manually permit Riot to access your microphone/webcam", "Advanced": "Advanced", "Algorithm": "Algorithm", "Always show message timestamps": "Always show message timestamps", From aa90d6b097d4b541b1d260f4655482d4c2d117fb Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 1 Jun 2017 23:00:25 +0100 Subject: [PATCH 09/26] fix **AMAZING** C&P derp Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/UserSettings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index b33bdd271d..f660cf71e1 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -952,7 +952,7 @@ module.exports = React.createClass({ let webcamDropdown =

{_t('No Webcams detected')}

; const audioInputs = this.state.mediaDevices.audioinput; - if (Object.keys(videoInputs).length > 0) { + if (Object.keys(audioInputs).length > 0) { microphoneDropdown =

Microphone

Date: Thu, 1 Jun 2017 23:25:44 +0100 Subject: [PATCH 10/26] change device data structure to array of objects so that we can set falsey values, for unsetting device most dolphinately needs testing Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/CallMediaHandler.js | 8 ++++---- src/components/structures/UserSettings.js | 17 ++++++++++++----- src/i18n/strings/en_EN.json | 1 + 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/CallMediaHandler.js b/src/CallMediaHandler.js index 4f82e003b9..45ca5dc30d 100644 --- a/src/CallMediaHandler.js +++ b/src/CallMediaHandler.js @@ -23,15 +23,15 @@ export default { // Only needed for Electron atm, though should work in modern browsers // once permission has been granted to the webapp return navigator.mediaDevices.enumerateDevices().then(function(devices) { - const audioIn = {}; - const videoIn = {}; + const audioIn = []; + const videoIn = []; if (devices.some((device) => !device.label)) return false; devices.forEach((device) => { switch (device.kind) { - case 'audioinput': audioIn[device.deviceId] = device.label; break; - case 'videoinput': videoIn[device.deviceId] = device.label; break; + case 'audioinput': audioIn.push(device); break; + case 'videoinput': videoIn.push(device); break; } }); diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index f660cf71e1..fcb7a70559 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -269,8 +269,8 @@ module.exports = React.createClass({ if (this._unmounted) return; this.setState({ mediaDevices, - activeAudioInput: this._localSettings['webrtc_audioinput'] || 'default', - activeVideoInput: this._localSettings['webrtc_videoinput'] || 'default', + activeAudioInput: this._localSettings['webrtc_audioinput'], + activeVideoInput: this._localSettings['webrtc_videoinput'], }); }); }, @@ -902,7 +902,7 @@ module.exports = React.createClass({ }, _mapWebRtcDevicesToSpans: function(devices) { - return Object.keys(devices).map((deviceId) => {devices[deviceId]}); + return devices.map((device) => {devices[device.deviceId]}); }, _setAudioInput: function(deviceId) { @@ -951,8 +951,14 @@ module.exports = React.createClass({ let microphoneDropdown =

{_t('No Microphones detected')}

; let webcamDropdown =

{_t('No Webcams detected')}

; + const defaultOption = { + deviceId: undefined, + label: _t('Default Device'), + }; + const audioInputs = this.state.mediaDevices.audioinput; - if (Object.keys(audioInputs).length > 0) { + if (audioInputs.length > 0) { + audioInputs.unshift(defaultOption); microphoneDropdown =

Microphone

0) { + if (videoInputs.length > 0) { + videoInputs.unshift(defaultOption); webcamDropdown =

Cameras

Date: Thu, 1 Jun 2017 23:33:36 +0100 Subject: [PATCH 11/26] only unshift default if there is no deviceId===default Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/UserSettings.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index fcb7a70559..5dd6a7fec2 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -958,7 +958,9 @@ module.exports = React.createClass({ const audioInputs = this.state.mediaDevices.audioinput; if (audioInputs.length > 0) { - audioInputs.unshift(defaultOption); + if (!audioInputs.some((input) => input.deviceId === 'default')) { + audioInputs.unshift(defaultOption); + } microphoneDropdown =

Microphone

0) { - videoInputs.unshift(defaultOption); + if (!videoInputs.some((input) => input.deviceId === 'default')) { + videoInputs.unshift(defaultOption); + } webcamDropdown =

Cameras

Date: Thu, 1 Jun 2017 23:39:54 +0100 Subject: [PATCH 12/26] lets actually make things work, eh? Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/UserSettings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index 5dd6a7fec2..9a55094edf 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -902,7 +902,7 @@ module.exports = React.createClass({ }, _mapWebRtcDevicesToSpans: function(devices) { - return devices.map((device) => {devices[device.deviceId]}); + return devices.map((device) => {device.label}); }, _setAudioInput: function(deviceId) { From beedeec1636e0d43938b0edeaf688a98b78117ff Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 1 Jun 2017 23:50:14 +0100 Subject: [PATCH 13/26] copy the arrays so we're not making a mess Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/UserSettings.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index 9a55094edf..b5d5c23296 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -956,7 +956,7 @@ module.exports = React.createClass({ label: _t('Default Device'), }; - const audioInputs = this.state.mediaDevices.audioinput; + const audioInputs = this.state.mediaDevices.audioinput.slice(0); if (audioInputs.length > 0) { if (!audioInputs.some((input) => input.deviceId === 'default')) { audioInputs.unshift(defaultOption); @@ -972,7 +972,7 @@ module.exports = React.createClass({
; } - const videoInputs = this.state.mediaDevices.videoinput; + const videoInputs = this.state.mediaDevices.videoinput.slice(0); if (videoInputs.length > 0) { if (!videoInputs.some((input) => input.deviceId === 'default')) { videoInputs.unshift(defaultOption); From 3eb519b2275de34461edb67c99ab1af493b96c33 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 1 Jun 2017 23:54:17 +0100 Subject: [PATCH 14/26] this is just endless Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/UserSettings.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index b5d5c23296..b8567fc180 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -958,14 +958,18 @@ module.exports = React.createClass({ const audioInputs = this.state.mediaDevices.audioinput.slice(0); if (audioInputs.length > 0) { + let defaultInput; if (!audioInputs.some((input) => input.deviceId === 'default')) { audioInputs.unshift(defaultOption); + } else { + defaultInput = 'default'; } + microphoneDropdown =

Microphone

{this._mapWebRtcDevicesToSpans(audioInputs)} @@ -974,14 +978,18 @@ module.exports = React.createClass({ const videoInputs = this.state.mediaDevices.videoinput.slice(0); if (videoInputs.length > 0) { + let defaultInput; if (!videoInputs.some((input) => input.deviceId === 'default')) { videoInputs.unshift(defaultOption); + } else { + defaultInput = 'default'; } + webcamDropdown =

Cameras

{this._mapWebRtcDevicesToSpans(videoInputs)} From b411c8f97e88f79e37e52adc9700db216cb8642f Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Fri, 2 Jun 2017 00:10:54 +0100 Subject: [PATCH 15/26] shorten signin label to aid fr i18n --- src/i18n/strings/de_DE.json | 2 +- src/i18n/strings/en_EN.json | 2 +- src/i18n/strings/es.json | 2 +- src/i18n/strings/fr.json | 2 +- src/i18n/strings/pt.json | 2 +- src/i18n/strings/pt_BR.json | 2 +- src/i18n/strings/ru.json | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/i18n/strings/de_DE.json b/src/i18n/strings/de_DE.json index baf2b317cf..cd3d82b112 100644 --- a/src/i18n/strings/de_DE.json +++ b/src/i18n/strings/de_DE.json @@ -139,7 +139,7 @@ "Invite new room members": "Lade neue Raum-Mitglieder ein", "is a": "ist ein", "is trusted": "wird vertraut", - "I want to sign in with": "Ich möchte mich anmelden mit", + "Sign in with": "Ich möchte mich anmelden mit", "joined and left": "trat bei und ging", "joined": "trat bei", "joined the room": "trat dem Raum bei", diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 211d164c2a..5d6a010638 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -318,7 +318,7 @@ "'%(alias)s' is not a valid format for an address": "'%(alias)s' is not a valid format for an address", "'%(alias)s' is not a valid format for an alias": "'%(alias)s' is not a valid format for an alias", "%(displayName)s is typing": "%(displayName)s is typing", - "I want to sign in with": "I want to sign in with", + "Sign in with": "Sign in with", "Join Room": "Join Room", "joined and left": "joined and left", "joined": "joined", diff --git a/src/i18n/strings/es.json b/src/i18n/strings/es.json index e071e63a3a..df6f0dd011 100644 --- a/src/i18n/strings/es.json +++ b/src/i18n/strings/es.json @@ -308,7 +308,7 @@ "'%(alias)s' is not a valid format for an address": "'%(alias)s' no es un formato válido para una dirección", "'%(alias)s' is not a valid format for an alias": "'%(alias)s' no es un formato válido para un alias", "%(displayName)s is typing": "%(displayName)s esta escribiendo", - "I want to sign in with": "Quiero iniciar sesión con", + "Sign in with": "Quiero iniciar sesión con", "Join Room": "Unirte a la sala", "joined and left": "unido y dejado", "joined": "unido", diff --git a/src/i18n/strings/fr.json b/src/i18n/strings/fr.json index fbcc04e881..a2c008c00d 100644 --- a/src/i18n/strings/fr.json +++ b/src/i18n/strings/fr.json @@ -318,7 +318,7 @@ "'%(alias)s' is not a valid format for an address": "'%(alias)s' n'est pas un format valide pour une adresse", "'%(alias)s' is not a valid format for an alias": "'%(alias)s' n'est pas un format valide pour un alias", "%(displayName)s is typing": "%(displayName)s est en train de taper", - "I want to sign in with": "Je veux m'identifier avec", + "Sign in with": "Je veux m'identifier avec", "Join Room": "Rejoindre le salon", "joined and left": "a joint et quitté", "joined": "a joint", diff --git a/src/i18n/strings/pt.json b/src/i18n/strings/pt.json index ad4a9774d6..830952bd57 100644 --- a/src/i18n/strings/pt.json +++ b/src/i18n/strings/pt.json @@ -112,7 +112,7 @@ "Invites": "Convidar", "Invites user with given id to current room": "Convidar usuários com um dado identificador para esta sala", "is a": "é um(a)", - "I want to sign in with": "Quero entrar", + "Sign in with": "Quero entrar", "joined and left": "entrou e saiu", "joined": "entrou", "joined the room": "entrou na sala", diff --git a/src/i18n/strings/pt_BR.json b/src/i18n/strings/pt_BR.json index f987a0cd68..a44bf0c955 100644 --- a/src/i18n/strings/pt_BR.json +++ b/src/i18n/strings/pt_BR.json @@ -115,7 +115,7 @@ "Invites": "Convidar", "Invites user with given id to current room": "Convidar usuários com um dado identificador para esta sala", "is a": "é um(a)", - "I want to sign in with": "Quero entrar", + "Sign in with": "Quero entrar", "joined and left": "entrou e saiu", "joined": "entrou", "joined the room": "entrou na sala", diff --git a/src/i18n/strings/ru.json b/src/i18n/strings/ru.json index 30672aeab1..743aade542 100644 --- a/src/i18n/strings/ru.json +++ b/src/i18n/strings/ru.json @@ -103,7 +103,7 @@ "Invites": "Приглашать", "Invites user with given id to current room": "Пригласить пользователя с данным id в текущую комнату", "is a": "является", - "I want to sign in with": "Я хочу регистрироваться с", + "Sign in with": "Я хочу регистрироваться с", "joined and left": "присоединенный и оставленный", "joined": "присоединенный", "joined the room": "joined the room", From 6a225d1ac20bcf00275bcc252835632a090516c8 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Fri, 2 Jun 2017 00:16:17 +0100 Subject: [PATCH 16/26] use new sign-in string --- src/components/views/login/PasswordLogin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/login/PasswordLogin.js b/src/components/views/login/PasswordLogin.js index 11d8f2cc7c..dff6fb0b58 100644 --- a/src/components/views/login/PasswordLogin.js +++ b/src/components/views/login/PasswordLogin.js @@ -182,7 +182,7 @@ class PasswordLogin extends React.Component {
- + Date: Fri, 2 Jun 2017 00:20:34 +0100 Subject: [PATCH 17/26] special case default - CallMediaHandler can figure it out Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/CallMediaHandler.js | 24 +++++++++++++++++++++++ src/components/structures/UserSettings.js | 16 +++++---------- src/i18n/strings/en_EN.json | 2 ++ 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/CallMediaHandler.js b/src/CallMediaHandler.js index 45ca5dc30d..780df60846 100644 --- a/src/CallMediaHandler.js +++ b/src/CallMediaHandler.js @@ -53,12 +53,36 @@ export default { // }); }, + _findDefault: function(devices) { + return devices.some((device) => device.deviceId === 'default') ? 'default' : undefined; + }, + + setAudioInputDefault: async function() { + const devices = await this.getDevices(); + const audioDefault = this._findDefault(devices.audioinput); + this._setAudioInput(audioDefault); + }, + setAudioInput: function(deviceId) { + this[deviceId === 'default' ? 'setAudioInputDefault' : '_setAudioInput'](deviceId); + }, + + _setAudioInput: function(deviceId) { UserSettingsStore.setLocalSetting('webrtc_audioinput', deviceId); Matrix.setMatrixCallAudioInput(deviceId); }, + setVideoInputDefault: async function() { + const devices = await this.getDevices(); + const videoDefault = this._findDefault(devices.videoinput); + this._setVideoInput(videoDefault); + }, + setVideoInput: function(deviceId) { + this[deviceId === 'default' ? 'setVideoInputDefault' : '_setVideoInput'](); + }, + + _setVideoInput: function(deviceId) { UserSettingsStore.setLocalSetting('webrtc_videoinput', deviceId); Matrix.setMatrixCallVideoInput(deviceId); }, diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index b8567fc180..99b02b59f9 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -952,24 +952,21 @@ module.exports = React.createClass({ let webcamDropdown =

{_t('No Webcams detected')}

; const defaultOption = { - deviceId: undefined, + deviceId: 'default', label: _t('Default Device'), }; const audioInputs = this.state.mediaDevices.audioinput.slice(0); if (audioInputs.length > 0) { - let defaultInput; if (!audioInputs.some((input) => input.deviceId === 'default')) { audioInputs.unshift(defaultOption); - } else { - defaultInput = 'default'; } microphoneDropdown =
-

Microphone

+

{_t('Microphone')}

{this._mapWebRtcDevicesToSpans(audioInputs)} @@ -978,18 +975,15 @@ module.exports = React.createClass({ const videoInputs = this.state.mediaDevices.videoinput.slice(0); if (videoInputs.length > 0) { - let defaultInput; if (!videoInputs.some((input) => input.deviceId === 'default')) { videoInputs.unshift(defaultOption); - } else { - defaultInput = 'default'; } webcamDropdown =
-

Cameras

+

{_t('Camera')}

{this._mapWebRtcDevicesToSpans(videoInputs)} diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 3a8752fd5d..b9ac79d362 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -136,6 +136,8 @@ "No media permissions": "No media permissions", "You may need to manually permit Riot to access your microphone/webcam": "You may need to manually permit Riot to access your microphone/webcam", "Default Device": "Default Device", + "Microphone": "Microphone", + "Cameras": "Cameras", "Advanced": "Advanced", "Algorithm": "Algorithm", "Always show message timestamps": "Always show message timestamps", From c7285b905321a12d760a316c49012144a2ef6f2d Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Fri, 2 Jun 2017 00:21:00 +0100 Subject: [PATCH 18/26] fix fr layout --- src/components/views/login/ServerConfig.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/views/login/ServerConfig.js b/src/components/views/login/ServerConfig.js index 3abe64cd2f..a63d02416c 100644 --- a/src/components/views/login/ServerConfig.js +++ b/src/components/views/login/ServerConfig.js @@ -132,7 +132,7 @@ module.exports = React.createClass({ var toggleButton; if (this.props.withToggleButton) { toggleButton = ( -
+
From 4976cbb4240acc32bc2cc88c36c48d2d06a847ec Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 2 Jun 2017 00:21:34 +0100 Subject: [PATCH 19/26] missed a thing Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/CallMediaHandler.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CallMediaHandler.js b/src/CallMediaHandler.js index 780df60846..d5813c1d5c 100644 --- a/src/CallMediaHandler.js +++ b/src/CallMediaHandler.js @@ -79,7 +79,7 @@ export default { }, setVideoInput: function(deviceId) { - this[deviceId === 'default' ? 'setVideoInputDefault' : '_setVideoInput'](); + this[deviceId === 'default' ? 'setVideoInputDefault' : '_setVideoInput'](deviceId); }, _setVideoInput: function(deviceId) { From 0bafd6458a0a6a06b8d9f14dff097cffc75e297e Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 2 Jun 2017 00:26:31 +0100 Subject: [PATCH 20/26] Revert voodoo --- src/CallMediaHandler.js | 24 ----------------------- src/components/structures/UserSettings.js | 16 ++++++++++----- src/i18n/strings/en_EN.json | 2 -- 3 files changed, 11 insertions(+), 31 deletions(-) diff --git a/src/CallMediaHandler.js b/src/CallMediaHandler.js index d5813c1d5c..45ca5dc30d 100644 --- a/src/CallMediaHandler.js +++ b/src/CallMediaHandler.js @@ -53,36 +53,12 @@ export default { // }); }, - _findDefault: function(devices) { - return devices.some((device) => device.deviceId === 'default') ? 'default' : undefined; - }, - - setAudioInputDefault: async function() { - const devices = await this.getDevices(); - const audioDefault = this._findDefault(devices.audioinput); - this._setAudioInput(audioDefault); - }, - setAudioInput: function(deviceId) { - this[deviceId === 'default' ? 'setAudioInputDefault' : '_setAudioInput'](deviceId); - }, - - _setAudioInput: function(deviceId) { UserSettingsStore.setLocalSetting('webrtc_audioinput', deviceId); Matrix.setMatrixCallAudioInput(deviceId); }, - setVideoInputDefault: async function() { - const devices = await this.getDevices(); - const videoDefault = this._findDefault(devices.videoinput); - this._setVideoInput(videoDefault); - }, - setVideoInput: function(deviceId) { - this[deviceId === 'default' ? 'setVideoInputDefault' : '_setVideoInput'](deviceId); - }, - - _setVideoInput: function(deviceId) { UserSettingsStore.setLocalSetting('webrtc_videoinput', deviceId); Matrix.setMatrixCallVideoInput(deviceId); }, diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index 99b02b59f9..b8567fc180 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -952,21 +952,24 @@ module.exports = React.createClass({ let webcamDropdown =

{_t('No Webcams detected')}

; const defaultOption = { - deviceId: 'default', + deviceId: undefined, label: _t('Default Device'), }; const audioInputs = this.state.mediaDevices.audioinput.slice(0); if (audioInputs.length > 0) { + let defaultInput; if (!audioInputs.some((input) => input.deviceId === 'default')) { audioInputs.unshift(defaultOption); + } else { + defaultInput = 'default'; } microphoneDropdown =
-

{_t('Microphone')}

+

Microphone

{this._mapWebRtcDevicesToSpans(audioInputs)} @@ -975,15 +978,18 @@ module.exports = React.createClass({ const videoInputs = this.state.mediaDevices.videoinput.slice(0); if (videoInputs.length > 0) { + let defaultInput; if (!videoInputs.some((input) => input.deviceId === 'default')) { videoInputs.unshift(defaultOption); + } else { + defaultInput = 'default'; } webcamDropdown =
-

{_t('Camera')}

+

Cameras

{this._mapWebRtcDevicesToSpans(videoInputs)} diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index b9ac79d362..3a8752fd5d 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -136,8 +136,6 @@ "No media permissions": "No media permissions", "You may need to manually permit Riot to access your microphone/webcam": "You may need to manually permit Riot to access your microphone/webcam", "Default Device": "Default Device", - "Microphone": "Microphone", - "Cameras": "Cameras", "Advanced": "Advanced", "Algorithm": "Algorithm", "Always show message timestamps": "Always show message timestamps", From 6b4daf02a9d6522d695b9b8be440f46be7685df8 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 2 Jun 2017 00:27:20 +0100 Subject: [PATCH 21/26] i18 missed things Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/UserSettings.js | 4 ++-- src/i18n/strings/en_EN.json | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index b8567fc180..837cf99f1a 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -966,7 +966,7 @@ module.exports = React.createClass({ } microphoneDropdown =
-

Microphone

+

{_t('Microphone')}

-

Cameras

+

{_t('Camera')}

Date: Fri, 2 Jun 2017 00:31:43 +0100 Subject: [PATCH 22/26] try empty string as falsey key Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/UserSettings.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index 837cf99f1a..389f08fd3b 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -952,7 +952,7 @@ module.exports = React.createClass({ let webcamDropdown =

{_t('No Webcams detected')}

; const defaultOption = { - deviceId: undefined, + deviceId: '', label: _t('Default Device'), }; From b1973d799860535577ee1234277540f2ed3a71b5 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 2 Jun 2017 00:42:19 +0100 Subject: [PATCH 23/26] undefined =/= '' Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/structures/UserSettings.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/structures/UserSettings.js b/src/components/structures/UserSettings.js index 389f08fd3b..7300d82541 100644 --- a/src/components/structures/UserSettings.js +++ b/src/components/structures/UserSettings.js @@ -958,7 +958,7 @@ module.exports = React.createClass({ const audioInputs = this.state.mediaDevices.audioinput.slice(0); if (audioInputs.length > 0) { - let defaultInput; + let defaultInput = ''; if (!audioInputs.some((input) => input.deviceId === 'default')) { audioInputs.unshift(defaultOption); } else { @@ -978,7 +978,7 @@ module.exports = React.createClass({ const videoInputs = this.state.mediaDevices.videoinput.slice(0); if (videoInputs.length > 0) { - let defaultInput; + let defaultInput = ''; if (!videoInputs.some((input) => input.deviceId === 'default')) { videoInputs.unshift(defaultOption); } else { From 73f97b46614261e19e92f178b9336c48b99465d4 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Fri, 2 Jun 2017 01:05:09 +0100 Subject: [PATCH 24/26] bump js-sdk for webrtc --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a6076a56d2..33f7314fc6 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "isomorphic-fetch": "^2.2.1", "linkifyjs": "^2.1.3", "lodash": "^4.13.1", - "matrix-js-sdk": "0.7.9", + "matrix-js-sdk": "0.7.10", "optimist": "^0.6.1", "q": "^1.4.1", "react": "^15.4.0", From 3c5d0f82c901db5f01a9267cc6b60a9de2c37d11 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Fri, 2 Jun 2017 01:14:13 +0100 Subject: [PATCH 25/26] Prepare changelog for v0.9.0-rc.2 --- CHANGELOG.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 23098c4749..7102c43f24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,40 @@ +Changes in [0.9.0-rc.2](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v0.9.0-rc.2) (2017-06-02) +============================================================================================================= +[Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v0.9.0-rc.1...v0.9.0-rc.2) + + * Update from Weblate. + [\#1002](https://github.com/matrix-org/matrix-react-sdk/pull/1002) + * webrtc config electron + [\#850](https://github.com/matrix-org/matrix-react-sdk/pull/850) + * enable useCompactLayout user setting an add a class when it's enabled + [\#986](https://github.com/matrix-org/matrix-react-sdk/pull/986) + * Update from Weblate. + [\#987](https://github.com/matrix-org/matrix-react-sdk/pull/987) + * Translation fixes for everything but src/components + [\#990](https://github.com/matrix-org/matrix-react-sdk/pull/990) + * Fix tests + [\#1001](https://github.com/matrix-org/matrix-react-sdk/pull/1001) + * Fix tests for PR #989 + [\#999](https://github.com/matrix-org/matrix-react-sdk/pull/999) + * Revert "Revert "add labels to language picker"" + [\#1000](https://github.com/matrix-org/matrix-react-sdk/pull/1000) + * maybe fixxy [Electron] external thing? + [\#997](https://github.com/matrix-org/matrix-react-sdk/pull/997) + * travisci: Don't run the riot-web tests if the react-sdk tests fail + [\#992](https://github.com/matrix-org/matrix-react-sdk/pull/992) + * Support 12hr time on DateSeparator + [\#991](https://github.com/matrix-org/matrix-react-sdk/pull/991) + * Revert "add labels to language picker" + [\#994](https://github.com/matrix-org/matrix-react-sdk/pull/994) + * Call MatrixClient.clearStores on logout + [\#983](https://github.com/matrix-org/matrix-react-sdk/pull/983) + * Matthew/room avatar event + [\#988](https://github.com/matrix-org/matrix-react-sdk/pull/988) + * add labels to language picker + [\#989](https://github.com/matrix-org/matrix-react-sdk/pull/989) + * Update from Weblate. + [\#981](https://github.com/matrix-org/matrix-react-sdk/pull/981) + Changes in [0.9.0-rc.1](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v0.9.0-rc.1) (2017-06-01) ============================================================================================================= [Full Changelog](https://github.com/matrix-org/matrix-react-sdk/compare/v0.8.9...v0.9.0-rc.1) From 8add074dbfaa54d02e8bef3fcc9d02c327633cc2 Mon Sep 17 00:00:00 2001 From: Matthew Hodgson Date: Fri, 2 Jun 2017 01:14:13 +0100 Subject: [PATCH 26/26] v0.9.0-rc.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3cb87ce716..1b00a57d52 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "matrix-react-sdk", - "version": "0.9.0-rc.1", + "version": "0.9.0-rc.2", "description": "SDK for matrix.org using React", "author": "matrix.org", "repository": {