Add some types

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-07-20 13:47:07 +02:00
parent 66a3b0fe5f
commit 6491a00645
No known key found for this signature in database
GPG key ID: 55C211A1226CB17D

View file

@ -277,7 +277,7 @@ export default class CallView extends React.Component<IProps, IState> {
return { primary, secondary }; return { primary, secondary };
} }
private showControls() { private showControls(): void {
if (this.state.showMoreMenu || this.state.showDialpad) return; if (this.state.showMoreMenu || this.state.showDialpad) return;
if (!this.state.controlsVisible) { if (!this.state.controlsVisible) {
@ -291,7 +291,7 @@ export default class CallView extends React.Component<IProps, IState> {
this.controlsHideTimer = window.setTimeout(this.onControlsHideTimer, CONTROLS_HIDE_DELAY); this.controlsHideTimer = window.setTimeout(this.onControlsHideTimer, CONTROLS_HIDE_DELAY);
} }
private onDialpadClick = () => { private onDialpadClick = (): void => {
if (!this.state.showDialpad) { if (!this.state.showDialpad) {
if (this.controlsHideTimer) { if (this.controlsHideTimer) {
clearTimeout(this.controlsHideTimer); clearTimeout(this.controlsHideTimer);
@ -314,21 +314,21 @@ export default class CallView extends React.Component<IProps, IState> {
} }
}; };
private onMicMuteClick = () => { private onMicMuteClick = (): void => {
const newVal = !this.state.micMuted; const newVal = !this.state.micMuted;
this.props.call.setMicrophoneMuted(newVal); this.props.call.setMicrophoneMuted(newVal);
this.setState({ micMuted: newVal }); this.setState({ micMuted: newVal });
}; };
private onVidMuteClick = () => { private onVidMuteClick = (): void => {
const newVal = !this.state.vidMuted; const newVal = !this.state.vidMuted;
this.props.call.setLocalVideoMuted(newVal); this.props.call.setLocalVideoMuted(newVal);
this.setState({ vidMuted: newVal }); this.setState({ vidMuted: newVal });
}; };
private onScreenshareClick = async () => { private onScreenshareClick = async (): Promise<void> => {
const isScreensharing = await this.props.call.setScreensharingEnabled( const isScreensharing = await this.props.call.setScreensharingEnabled(
!this.state.screensharing, !this.state.screensharing,
async (): Promise<DesktopCapturerSource> => { async (): Promise<DesktopCapturerSource> => {
@ -340,7 +340,7 @@ export default class CallView extends React.Component<IProps, IState> {
this.setState({ screensharing: isScreensharing }); this.setState({ screensharing: isScreensharing });
}; };
private onMoreClick = () => { private onMoreClick = (): void => {
if (this.controlsHideTimer) { if (this.controlsHideTimer) {
clearTimeout(this.controlsHideTimer); clearTimeout(this.controlsHideTimer);
this.controlsHideTimer = null; this.controlsHideTimer = null;
@ -352,14 +352,14 @@ export default class CallView extends React.Component<IProps, IState> {
}); });
}; };
private closeDialpad = () => { private closeDialpad = (): void => {
this.setState({ this.setState({
showDialpad: false, showDialpad: false,
}); });
this.controlsHideTimer = window.setTimeout(this.onControlsHideTimer, CONTROLS_HIDE_DELAY); this.controlsHideTimer = window.setTimeout(this.onControlsHideTimer, CONTROLS_HIDE_DELAY);
}; };
private closeContextMenu = () => { private closeContextMenu = (): void => {
this.setState({ this.setState({
showMoreMenu: false, showMoreMenu: false,
}); });
@ -369,7 +369,7 @@ export default class CallView extends React.Component<IProps, IState> {
// we register global shortcuts here, they *must not conflict* with local shortcuts elsewhere or both will fire // we register global shortcuts here, they *must not conflict* with local shortcuts elsewhere or both will fire
// Note that this assumes we always have a CallView on screen at any given time // Note that this assumes we always have a CallView on screen at any given time
// CallHandler would probably be a better place for this // CallHandler would probably be a better place for this
private onNativeKeyDown = ev => { private onNativeKeyDown = (ev): void => {
let handled = false; let handled = false;
const ctrlCmdOnly = isOnlyCtrlOrCmdKeyEvent(ev); const ctrlCmdOnly = isOnlyCtrlOrCmdKeyEvent(ev);
@ -399,7 +399,7 @@ export default class CallView extends React.Component<IProps, IState> {
} }
}; };
private onRoomAvatarClick = () => { private onRoomAvatarClick = (): void => {
const userFacingRoomId = CallHandler.sharedInstance().roomIdForCall(this.props.call); const userFacingRoomId = CallHandler.sharedInstance().roomIdForCall(this.props.call);
dis.dispatch({ dis.dispatch({
action: 'view_room', action: 'view_room',
@ -407,7 +407,7 @@ export default class CallView extends React.Component<IProps, IState> {
}); });
}; };
private onSecondaryRoomAvatarClick = () => { private onSecondaryRoomAvatarClick = (): void => {
const userFacingRoomId = CallHandler.sharedInstance().roomIdForCall(this.props.secondaryCall); const userFacingRoomId = CallHandler.sharedInstance().roomIdForCall(this.props.secondaryCall);
dis.dispatch({ dis.dispatch({
@ -416,24 +416,24 @@ export default class CallView extends React.Component<IProps, IState> {
}); });
}; };
private onCallResumeClick = () => { private onCallResumeClick = (): void => {
const userFacingRoomId = CallHandler.sharedInstance().roomIdForCall(this.props.call); const userFacingRoomId = CallHandler.sharedInstance().roomIdForCall(this.props.call);
CallHandler.sharedInstance().setActiveCallRoomId(userFacingRoomId); CallHandler.sharedInstance().setActiveCallRoomId(userFacingRoomId);
}; };
private onTransferClick = () => { private onTransferClick = (): void => {
const transfereeCall = CallHandler.sharedInstance().getTransfereeForCallId(this.props.call.callId); const transfereeCall = CallHandler.sharedInstance().getTransfereeForCallId(this.props.call.callId);
this.props.call.transferToCall(transfereeCall); this.props.call.transferToCall(transfereeCall);
}; };
private onHangupClick = () => { private onHangupClick = (): void => {
dis.dispatch({ dis.dispatch({
action: 'hangup', action: 'hangup',
room_id: CallHandler.sharedInstance().roomIdForCall(this.props.call), room_id: CallHandler.sharedInstance().roomIdForCall(this.props.call),
}); });
}; };
private onToggleSidebar = () => { private onToggleSidebar = (): void => {
let vidMuted = this.state.vidMuted; let vidMuted = this.state.vidMuted;
if (this.state.screensharing) { if (this.state.screensharing) {
vidMuted = this.state.sidebarShown; vidMuted = this.state.sidebarShown;