Coding style: consistency, documentation comments, formatting

This commit is contained in:
Lyubo Marinov 2018-08-31 15:06:48 -05:00 committed by Любомир Маринов
parent 4283d8b342
commit e446acb045
4 changed files with 64 additions and 60 deletions

View File

@ -9,7 +9,6 @@ import { connect as reactReduxConnect } from 'react-redux';
import { appNavigate } from '../../app'; import { appNavigate } from '../../app';
import { connect, disconnect } from '../../base/connection'; import { connect, disconnect } from '../../base/connection';
import { DialogContainer } from '../../base/dialog'; import { DialogContainer } from '../../base/dialog';
import { CalleeInfoContainer } from '../../invite';
import { getParticipantCount } from '../../base/participants'; import { getParticipantCount } from '../../base/participants';
import { Container, LoadingIndicator, TintedView } from '../../base/react'; import { Container, LoadingIndicator, TintedView } from '../../base/react';
import { TestConnectionInfo } from '../../base/testing'; import { TestConnectionInfo } from '../../base/testing';
@ -17,6 +16,7 @@ import { createDesiredLocalTracks } from '../../base/tracks';
import { ConferenceNotification } from '../../calendar-sync'; import { ConferenceNotification } from '../../calendar-sync';
import { Filmstrip } from '../../filmstrip'; import { Filmstrip } from '../../filmstrip';
import { LargeVideo } from '../../large-video'; import { LargeVideo } from '../../large-video';
import { CalleeInfoContainer } from '../../invite';
import { NotificationsContainer } from '../../notifications'; import { NotificationsContainer } from '../../notifications';
import { setToolboxVisible, Toolbox } from '../../toolbox'; import { setToolboxVisible, Toolbox } from '../../toolbox';
@ -30,8 +30,8 @@ type Props = {
/** /**
* The indicator which determines that we are still connecting to the * The indicator which determines that we are still connecting to the
* conference which includes establishing the XMPP connection and then * conference which includes establishing the XMPP connection and then
* joining the room. If truthy, then an activity/loading indicator will * joining the room. If truthy, then an activity/loading indicator will be
* be rendered. * rendered.
* *
* @private * @private
*/ */
@ -48,6 +48,7 @@ type Props = {
* The handler which dispatches the (redux) action connect. * The handler which dispatches the (redux) action connect.
* *
* @private * @private
* @returns {void}
*/ */
_onConnect: Function, _onConnect: Function,
@ -55,6 +56,7 @@ type Props = {
* The handler which dispatches the (redux) action disconnect. * The handler which dispatches the (redux) action disconnect.
* *
* @private * @private
* @returns {void}
*/ */
_onDisconnect: Function, _onDisconnect: Function,
@ -63,9 +65,9 @@ type Props = {
* associated {@code Conference}. * associated {@code Conference}.
* *
* @private * @private
* @returns {boolean} As the associated conference is unconditionally * @returns {boolean} As the associated conference is unconditionally left
* left and exiting the app while it renders a {@code Conference} is * and exiting the app while it renders a {@code Conference} is undesired,
* undesired, {@code true} is always returned. * {@code true} is always returned.
*/ */
_onHardwareBackPress: Function, _onHardwareBackPress: Function,
@ -92,10 +94,13 @@ type Props = {
_room: string, _room: string,
/** /**
* The handler which dispatches the (redux) action setToolboxVisible to * The handler which dispatches the (redux) action {@link setToolboxVisible}
* show/hide the Toolbox. * to show/hide the {@link Toolbox}.
* *
* @param {boolean} visible - {@code true} to show the {@code Toolbox} or
* {@code false} to hide it.
* @private * @private
* @returns {void}
*/ */
_setToolboxVisible: Function, _setToolboxVisible: Function,
@ -281,6 +286,7 @@ class Conference extends Component<Props> {
*/} */}
<Filmstrip /> <Filmstrip />
</View> </View>
<TestConnectionInfo /> <TestConnectionInfo />
{ {
@ -362,8 +368,8 @@ function _mapDispatchToProps(dispatch) {
* Dispatches actions to create the desired local tracks and for * Dispatches actions to create the desired local tracks and for
* connecting to the conference. * connecting to the conference.
* *
* @returns {void}
* @private * @private
* @returns {void}
*/ */
_onConnect() { _onConnect() {
dispatch(createDesiredLocalTracks()); dispatch(createDesiredLocalTracks());
@ -373,8 +379,8 @@ function _mapDispatchToProps(dispatch) {
/** /**
* Dispatches an action disconnecting from the conference. * Dispatches an action disconnecting from the conference.
* *
* @returns {void}
* @private * @private
* @returns {void}
*/ */
_onDisconnect() { _onDisconnect() {
dispatch(disconnect()); dispatch(disconnect());
@ -395,12 +401,12 @@ function _mapDispatchToProps(dispatch) {
}, },
/** /**
* Dispatches an action changing the visibility of the Toolbox. * Dispatches an action changing the visibility of the {@link Toolbox}.
* *
* @param {boolean} visible - True to show the Toolbox or false to hide * @param {boolean} visible - {@code true} to show the {@code Toolbox}
* it. * or {@code false} to hide it.
* @returns {void}
* @private * @private
* @returns {void}
*/ */
_setToolboxVisible(visible) { _setToolboxVisible(visible) {
dispatch(setToolboxVisible(visible)); dispatch(setToolboxVisible(visible));

View File

@ -5,9 +5,9 @@ import React, { Component } from 'react';
import { isFilmstripVisible } from '../../filmstrip'; import { isFilmstripVisible } from '../../filmstrip';
import { LocalRecordingLabel } from '../../local-recording'; import { LocalRecordingLabel } from '../../local-recording';
import { RecordingLabel } from '../../recording'; import { RecordingLabel } from '../../recording';
import { TranscribingLabel } from '../../transcribing';
import { shouldDisplayTileView } from '../../video-layout'; import { shouldDisplayTileView } from '../../video-layout';
import { VideoQualityLabel } from '../../video-quality'; import { VideoQualityLabel } from '../../video-quality';
import { TranscribingLabel } from '../../transcribing/';
/** /**
* The type of the React {@code Component} props of {@link AbstractLabels}. * The type of the React {@code Component} props of {@link AbstractLabels}.
@ -15,13 +15,13 @@ import { TranscribingLabel } from '../../transcribing/';
export type Props = { export type Props = {
/** /**
* Whether or not the filmstrip is displayed with remote videos. Used to * Whether the filmstrip is displayed with remote videos. Used to determine
* determine display classes to set. * display classes to set.
*/ */
_filmstripVisible: boolean, _filmstripVisible: boolean,
/** /**
* Whether or not the video quality label should be displayed. * Whether the video quality label should be displayed.
*/ */
_showVideoQualityLabel: boolean _showVideoQualityLabel: boolean
}; };
@ -34,11 +34,23 @@ export type Props = {
*/ */
export default class AbstractLabels<P: Props, S> extends Component<P, S> { export default class AbstractLabels<P: Props, S> extends Component<P, S> {
/** /**
* Renders the {@code RecordingLabel} that is platform independent. * Renders the {@code LocalRecordingLabel}.
* *
* @protected * @protected
* @returns {React$Element}
*/
_renderLocalRecordingLabel() {
return (
<LocalRecordingLabel />
);
}
/**
* Renders the {@code RecordingLabel} that is platform independent.
*
* @param {string} mode - The recording mode that this label is rendered * @param {string} mode - The recording mode that this label is rendered
* for. * for.
* @protected
* @returns {React$Element} * @returns {React$Element}
*/ */
_renderRecordingLabel(mode: string) { _renderRecordingLabel(mode: string) {
@ -47,6 +59,18 @@ export default class AbstractLabels<P: Props, S> extends Component<P, S> {
); );
} }
/**
* Renders the {@code TranscribingLabel}.
*
* @protected
* @returns {React$Element}
*/
_renderTranscribingLabel() {
return (
<TranscribingLabel />
);
}
/** /**
* Renders the {@code VideoQualityLabel} that is platform independent. * Renders the {@code VideoQualityLabel} that is platform independent.
* *
@ -58,37 +82,13 @@ export default class AbstractLabels<P: Props, S> extends Component<P, S> {
<VideoQualityLabel /> <VideoQualityLabel />
); );
} }
/**
* Renders the {@code TranscribingLabel}.
*
* @returns {React$Element}
* @protected
*/
_renderTranscribingLabel() {
return (
<TranscribingLabel />
);
} }
/** /**
* Renders the {@code LocalRecordingLabel}. * Maps (parts of) the redux state to the associated props of the {@link Labels}
* {@code Component}.
* *
* @returns {React$Element} * @param {Object} state - The redux state.
* @protected
*/
_renderLocalRecordingLabel() {
return (
<LocalRecordingLabel />
);
}
}
/**
* Maps (parts of) the Redux state to the associated props for the
* {@code Labels} component.
*
* @param {Object} state - The Redux state.
* @private * @private
* @returns {{ * @returns {{
* _filmstripVisible: boolean, * _filmstripVisible: boolean,

View File

@ -1,4 +1,5 @@
// @flow // @flow
import React from 'react'; import React from 'react';
import { View } from 'react-native'; import { View } from 'react-native';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
@ -23,7 +24,7 @@ class Labels extends AbstractLabels<Props, *> {
* @inheritdoc * @inheritdoc
*/ */
render() { render() {
const _wide = !isNarrowAspectRatio(this); const wide = !isNarrowAspectRatio(this);
const { _filmstripVisible } = this.props; const { _filmstripVisible } = this.props;
return ( return (
@ -31,7 +32,7 @@ class Labels extends AbstractLabels<Props, *> {
pointerEvents = 'box-none' pointerEvents = 'box-none'
style = { [ style = { [
styles.indicatorContainer, styles.indicatorContainer,
_wide && _filmstripVisible && styles.indicatorContainerWide wide && _filmstripVisible && styles.indicatorContainerWide
] }> ] }>
{ {
this._renderRecordingLabel( this._renderRecordingLabel(
@ -48,10 +49,9 @@ class Labels extends AbstractLabels<Props, *> {
); );
} }
_renderRecordingLabel: string => React$Element<*> _renderRecordingLabel: string => React$Element<*>;
_renderVideoQualityLabel: () => React$Element<*>
_renderVideoQualityLabel: () => React$Element<*>;
} }
/** /**
@ -76,6 +76,4 @@ function _mapStateToProps(state) {
}; };
} }
export default connect(_mapStateToProps)( export default connect(_mapStateToProps)(makeAspectRatioAware(Labels));
makeAspectRatioAware(Labels)
);

View File

@ -23,7 +23,7 @@ type State = {
* @type {boolean} * @type {boolean}
*/ */
filmstripBecomingVisible: boolean filmstripBecomingVisible: boolean
} };
/** /**
* A container to hold video status labels, including recording status and * A container to hold video status labels, including recording status and
@ -99,13 +99,13 @@ class Labels extends AbstractLabels<Props, State> {
); );
} }
_renderRecordingLabel: string => React$Element<*> _renderLocalRecordingLabel: () => React$Element<*>;
_renderVideoQualityLabel: () => React$Element<*> _renderRecordingLabel: string => React$Element<*>;
_renderTranscribingLabel: () => React$Element<*> _renderTranscribingLabel: () => React$Element<*>;
_renderLocalRecordingLabel: () => React$Element<*> _renderVideoQualityLabel: () => React$Element<*>;
} }
export default connect(_mapStateToProps)(Labels); export default connect(_mapStateToProps)(Labels);