de-lint views/voip/*

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2017-07-01 14:58:46 +01:00
parent 661a0f3956
commit 9ef83b8dc0
No known key found for this signature in database
GPG key ID: 0435A1D4BBD34D64
5 changed files with 41 additions and 50 deletions

View file

@ -111,10 +111,6 @@ src/components/views/settings/ChangePassword.js
src/components/views/settings/DevicesPanel.js src/components/views/settings/DevicesPanel.js
src/components/views/settings/DevicesPanelEntry.js src/components/views/settings/DevicesPanelEntry.js
src/components/views/settings/EnableNotificationsButton.js src/components/views/settings/EnableNotificationsButton.js
src/components/views/voip/CallView.js
src/components/views/voip/IncomingCallBox.js
src/components/views/voip/VideoFeed.js
src/components/views/voip/VideoView.js
src/ContentMessages.js src/ContentMessages.js
src/HtmlUtils.js src/HtmlUtils.js
src/ImageUtils.js src/ImageUtils.js

View file

@ -13,11 +13,11 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
var React = require("react"); import React from 'react';
var dis = require("../../../dispatcher"); import dis from '../../../dispatcher';
var CallHandler = require("../../../CallHandler"); import CallHandler from '../../../CallHandler';
var sdk = require('../../../index'); import sdk from '../../../index';
var MatrixClientPeg = require("../../../MatrixClientPeg"); import MatrixClientPeg from '../../../MatrixClientPeg';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
module.exports = React.createClass({ module.exports = React.createClass({
@ -73,10 +73,10 @@ module.exports = React.createClass({
}, },
showCall: function() { showCall: function() {
var call; let call;
if (this.props.room) { if (this.props.room) {
var roomId = this.props.room.roomId; const roomId = this.props.room.roomId;
call = CallHandler.getCallForRoom(roomId) || call = CallHandler.getCallForRoom(roomId) ||
(this.props.ConferenceHandler ? (this.props.ConferenceHandler ?
this.props.ConferenceHandler.getConferenceCallForRoom(roomId) : this.props.ConferenceHandler.getConferenceCallForRoom(roomId) :
@ -86,9 +86,7 @@ module.exports = React.createClass({
if (this.call) { if (this.call) {
this.setState({ call: call }); this.setState({ call: call });
} }
} else {
}
else {
call = CallHandler.getAnyActiveCall(); call = CallHandler.getAnyActiveCall();
this.setState({ call: call }); this.setState({ call: call });
} }
@ -109,8 +107,7 @@ module.exports = React.createClass({
call.confUserId ? "none" : "block" call.confUserId ? "none" : "block"
); );
this.getVideoView().getRemoteVideoElement().style.display = "block"; this.getVideoView().getRemoteVideoElement().style.display = "block";
} } else {
else {
this.getVideoView().getLocalVideoElement().style.display = "none"; this.getVideoView().getLocalVideoElement().style.display = "none";
this.getVideoView().getRemoteVideoElement().style.display = "none"; this.getVideoView().getRemoteVideoElement().style.display = "none";
dis.dispatch({action: 'video_fullscreen', fullscreen: false}); dis.dispatch({action: 'video_fullscreen', fullscreen: false});
@ -126,11 +123,11 @@ module.exports = React.createClass({
}, },
render: function() { render: function() {
var VideoView = sdk.getComponent('voip.VideoView'); const VideoView = sdk.getComponent('voip.VideoView');
var voice; let voice;
if (this.state.call && this.state.call.type === "voice" && this.props.showVoice) { if (this.state.call && this.state.call.type === "voice" && this.props.showVoice) {
var callRoom = MatrixClientPeg.get().getRoom(this.state.call.roomId); const callRoom = MatrixClientPeg.get().getRoom(this.state.call.roomId);
voice = ( voice = (
<div className="mx_CallView_voice" onClick={ this.props.onClick }> <div className="mx_CallView_voice" onClick={ this.props.onClick }>
{_t("Active call (%(roomName)s)", {roomName: callRoom.name})} {_t("Active call (%(roomName)s)", {roomName: callRoom.name})}
@ -147,6 +144,6 @@ module.exports = React.createClass({
{ voice } { voice }
</div> </div>
); );
} },
}); });

View file

@ -13,10 +13,9 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
var React = require('react'); import React from 'react';
var MatrixClientPeg = require('../../../MatrixClientPeg'); import MatrixClientPeg from '../../../MatrixClientPeg';
var dis = require("../../../dispatcher"); import dis from '../../../dispatcher';
var CallHandler = require("../../../CallHandler");
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
module.exports = React.createClass({ module.exports = React.createClass({
@ -29,34 +28,32 @@ module.exports = React.createClass({
onAnswerClick: function() { onAnswerClick: function() {
dis.dispatch({ dis.dispatch({
action: 'answer', action: 'answer',
room_id: this.props.incomingCall.roomId room_id: this.props.incomingCall.roomId,
}); });
}, },
onRejectClick: function() { onRejectClick: function() {
dis.dispatch({ dis.dispatch({
action: 'hangup', action: 'hangup',
room_id: this.props.incomingCall.roomId room_id: this.props.incomingCall.roomId,
}); });
}, },
render: function() { render: function() {
var room = null; let room = null;
if (this.props.incomingCall) { if (this.props.incomingCall) {
room = MatrixClientPeg.get().getRoom(this.props.incomingCall.roomId); room = MatrixClientPeg.get().getRoom(this.props.incomingCall.roomId);
} }
var caller = room ? room.name : _t("unknown caller"); const caller = room ? room.name : _t("unknown caller");
let incomingCallText = null; let incomingCallText = null;
if (this.props.incomingCall) { if (this.props.incomingCall) {
if (this.props.incomingCall.type === "voice") { if (this.props.incomingCall.type === "voice") {
incomingCallText = _t("Incoming voice call from %(name)s", {name: caller}); incomingCallText = _t("Incoming voice call from %(name)s", {name: caller});
} } else if (this.props.incomingCall.type === "video") {
else if (this.props.incomingCall.type === "video") {
incomingCallText = _t("Incoming video call from %(name)s", {name: caller}); incomingCallText = _t("Incoming video call from %(name)s", {name: caller});
} } else {
else {
incomingCallText = _t("Incoming call from %(name)s", {name: caller}); incomingCallText = _t("Incoming call from %(name)s", {name: caller});
} }
} }
@ -81,6 +78,6 @@ module.exports = React.createClass({
</div> </div>
</div> </div>
); );
} },
}); });

View file

@ -16,7 +16,7 @@ limitations under the License.
'use strict'; 'use strict';
var React = require('react'); import React from 'react';
module.exports = React.createClass({ module.exports = React.createClass({
displayName: 'VideoFeed', displayName: 'VideoFeed',

View file

@ -16,11 +16,11 @@ limitations under the License.
'use strict'; 'use strict';
var React = require('react'); import React from 'react';
var ReactDOM = require('react-dom'); import ReactDOM from 'react-dom';
var sdk = require('../../../index'); import sdk from '../../../index';
var dis = require('../../../dispatcher'); import dis from '../../../dispatcher';
module.exports = React.createClass({ module.exports = React.createClass({
displayName: 'VideoView', displayName: 'VideoView',
@ -53,9 +53,10 @@ module.exports = React.createClass({
// this needs to be somewhere at the top of the DOM which // this needs to be somewhere at the top of the DOM which
// always exists to avoid audio interruptions. // always exists to avoid audio interruptions.
// Might as well just use DOM. // Might as well just use DOM.
var remoteAudioElement = document.getElementById("remoteAudio"); const remoteAudioElement = document.getElementById("remoteAudio");
if (!remoteAudioElement) { if (!remoteAudioElement) {
console.error("Failed to find remoteAudio element - cannot play audio! You need to add an <audio/> to the DOM."); console.error("Failed to find remoteAudio element - cannot play audio!"
+ "You need to add an <audio/> to the DOM.");
} }
return remoteAudioElement; return remoteAudioElement;
}, },
@ -70,22 +71,21 @@ module.exports = React.createClass({
onAction: function(payload) { onAction: function(payload) {
switch (payload.action) { switch (payload.action) {
case 'video_fullscreen': case 'video_fullscreen': {
if (!this.container) { if (!this.container) {
return; return;
} }
var element = this.container; const element = this.container;
if (payload.fullscreen) { if (payload.fullscreen) {
var requestMethod = ( const requestMethod = (
element.requestFullScreen || element.requestFullScreen ||
element.webkitRequestFullScreen || element.webkitRequestFullScreen ||
element.mozRequestFullScreen || element.mozRequestFullScreen ||
element.msRequestFullscreen element.msRequestFullscreen
); );
requestMethod.call(element); requestMethod.call(element);
} } else {
else { const exitMethod = (
var exitMethod = (
document.exitFullscreen || document.exitFullscreen ||
document.mozCancelFullScreen || document.mozCancelFullScreen ||
document.webkitExitFullscreen || document.webkitExitFullscreen ||
@ -96,17 +96,18 @@ module.exports = React.createClass({
} }
} }
break; break;
}
} }
}, },
render: function() { render: function() {
var VideoFeed = sdk.getComponent('voip.VideoFeed'); const VideoFeed = sdk.getComponent('voip.VideoFeed');
// if we're fullscreen, we don't want to set a maxHeight on the video element. // if we're fullscreen, we don't want to set a maxHeight on the video element.
var fullscreenElement = (document.fullscreenElement || const fullscreenElement = (document.fullscreenElement ||
document.mozFullScreenElement || document.mozFullScreenElement ||
document.webkitFullscreenElement); document.webkitFullscreenElement);
var maxVideoHeight = fullscreenElement ? null : this.props.maxHeight; const maxVideoHeight = fullscreenElement ? null : this.props.maxHeight;
return ( return (
<div className="mx_VideoView" ref={this.setContainer} onClick={ this.props.onClick }> <div className="mx_VideoView" ref={this.setContainer} onClick={ this.props.onClick }>
@ -119,5 +120,5 @@ module.exports = React.createClass({
</div> </div>
</div> </div>
); );
} },
}); });