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/DevicesPanelEntry.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/HtmlUtils.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
limitations under the License.
*/
var React = require("react");
var dis = require("../../../dispatcher");
var CallHandler = require("../../../CallHandler");
var sdk = require('../../../index');
var MatrixClientPeg = require("../../../MatrixClientPeg");
import React from 'react';
import dis from '../../../dispatcher';
import CallHandler from '../../../CallHandler';
import sdk from '../../../index';
import MatrixClientPeg from '../../../MatrixClientPeg';
import { _t } from '../../../languageHandler';
module.exports = React.createClass({
@ -73,10 +73,10 @@ module.exports = React.createClass({
},
showCall: function() {
var call;
let call;
if (this.props.room) {
var roomId = this.props.room.roomId;
const roomId = this.props.room.roomId;
call = CallHandler.getCallForRoom(roomId) ||
(this.props.ConferenceHandler ?
this.props.ConferenceHandler.getConferenceCallForRoom(roomId) :
@ -86,9 +86,7 @@ module.exports = React.createClass({
if (this.call) {
this.setState({ call: call });
}
}
else {
} else {
call = CallHandler.getAnyActiveCall();
this.setState({ call: call });
}
@ -109,8 +107,7 @@ module.exports = React.createClass({
call.confUserId ? "none" : "block"
);
this.getVideoView().getRemoteVideoElement().style.display = "block";
}
else {
} else {
this.getVideoView().getLocalVideoElement().style.display = "none";
this.getVideoView().getRemoteVideoElement().style.display = "none";
dis.dispatch({action: 'video_fullscreen', fullscreen: false});
@ -126,11 +123,11 @@ module.exports = React.createClass({
},
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) {
var callRoom = MatrixClientPeg.get().getRoom(this.state.call.roomId);
const callRoom = MatrixClientPeg.get().getRoom(this.state.call.roomId);
voice = (
<div className="mx_CallView_voice" onClick={ this.props.onClick }>
{_t("Active call (%(roomName)s)", {roomName: callRoom.name})}
@ -147,6 +144,6 @@ module.exports = React.createClass({
{ voice }
</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
limitations under the License.
*/
var React = require('react');
var MatrixClientPeg = require('../../../MatrixClientPeg');
var dis = require("../../../dispatcher");
var CallHandler = require("../../../CallHandler");
import React from 'react';
import MatrixClientPeg from '../../../MatrixClientPeg';
import dis from '../../../dispatcher';
import { _t } from '../../../languageHandler';
module.exports = React.createClass({
@ -29,34 +28,32 @@ module.exports = React.createClass({
onAnswerClick: function() {
dis.dispatch({
action: 'answer',
room_id: this.props.incomingCall.roomId
room_id: this.props.incomingCall.roomId,
});
},
onRejectClick: function() {
dis.dispatch({
action: 'hangup',
room_id: this.props.incomingCall.roomId
room_id: this.props.incomingCall.roomId,
});
},
render: function() {
var room = null;
let room = null;
if (this.props.incomingCall) {
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;
if (this.props.incomingCall) {
if (this.props.incomingCall.type === "voice") {
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});
}
else {
} else {
incomingCallText = _t("Incoming call from %(name)s", {name: caller});
}
}
@ -81,6 +78,6 @@ module.exports = React.createClass({
</div>
</div>
);
}
},
});

View file

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

View file

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