[RN] Add ability to enable / disable the filmstrip (Coding style: comments, naming)

This commit is contained in:
Lyubo Marinov 2018-02-12 11:42:38 -06:00
parent 7bd8b7948f
commit 240fff74c7
6 changed files with 54 additions and 32 deletions

View File

@ -355,9 +355,9 @@ function _mapDispatchToProps(dispatch) {
} }
/** /**
* Maps (parts of) the Redux state to the associated Conference's props. * Maps (parts of) the redux state to the associated {@code Conference}'s props.
* *
* @param {Object} state - The Redux state. * @param {Object} state - The redux state.
* @private * @private
* @returns {{ * @returns {{
* _connecting: boolean, * _connecting: boolean,

View File

@ -25,9 +25,9 @@ declare var interfaceConfig: Object;
type Props = { type Props = {
/** /**
* Whether or not the current local user is recording the conference. * Whether the local participant is recording the conference.
*/ */
_isRecording: boolean, _iAmRecorder: boolean,
dispatch: Function, dispatch: Function,
t: Function t: Function
@ -102,9 +102,10 @@ class Conference extends Component<Props> {
*/ */
render() { render() {
const { filmStripOnly, VIDEO_QUALITY_LABEL_DISABLED } = interfaceConfig; const { filmStripOnly, VIDEO_QUALITY_LABEL_DISABLED } = interfaceConfig;
const hideVideoQualityLabel = filmStripOnly const hideVideoQualityLabel
|| VIDEO_QUALITY_LABEL_DISABLED = filmStripOnly
|| this.props._isRecording; || VIDEO_QUALITY_LABEL_DISABLED
|| this.props._iAmRecorder;
return ( return (
<div <div
@ -153,18 +154,17 @@ class Conference extends Component<Props> {
* @param {Object} state - The Redux state. * @param {Object} state - The Redux state.
* @private * @private
* @returns {{ * @returns {{
* _isRecording: boolean * _iAmRecorder: boolean
* }} * }}
*/ */
function _mapStateToProps(state) { function _mapStateToProps(state) {
return { return {
/** /**
* Indicates if the current user is recording the conference, ie, they * Whether the local participant is recording the conference.
* are a recorder.
* *
* @private * @private
*/ */
_isRecording: state['features/base/config'].iAmRecorder _iAmRecorder: state['features/base/config'].iAmRecorder
}; };
} }

View File

@ -1,6 +1,5 @@
/** /**
* The type of (redux) action which sets whether the filmstrip is enabled or * The type of (redux) action which sets whether the filmstrip is enabled.
* not.
* *
* { * {
* type: SET_FILMSTRIP_ENABLED, * type: SET_FILMSTRIP_ENABLED,
@ -21,7 +20,7 @@ export const SET_FILMSTRIP_ENABLED = Symbol('SET_FILMSTRIP_ENABLED');
export const SET_FILMSTRIP_HOVERED = Symbol('SET_FILMSTRIP_HOVERED'); export const SET_FILMSTRIP_HOVERED = Symbol('SET_FILMSTRIP_HOVERED');
/** /**
* The type of (redux) action which sets the visibility of the filmstrip. * The type of (redux) action which sets whether the filmstrip is visible.
* *
* { * {
* type: SET_FILMSTRIP_VISIBLE, * type: SET_FILMSTRIP_VISIBLE,

View File

@ -1,3 +1,5 @@
// @flow
import { import {
SET_FILMSTRIP_ENABLED, SET_FILMSTRIP_ENABLED,
SET_FILMSTRIP_HOVERED, SET_FILMSTRIP_HOVERED,
@ -5,15 +7,15 @@ import {
} from './actionTypes'; } from './actionTypes';
/** /**
* Sets if the filmstrip should be enabled. * Sets whether the filmstrip is enabled.
* *
* @param {boolean} enabled - Whether the filmstrip should be enabled. * @param {boolean} enabled - Whether the filmstrip is enabled.
* @returns {{ * @returns {{
* type: SET_FILMSTRIP_ENABLED, * type: SET_FILMSTRIP_ENABLED,
* enabled: boolean * enabled: boolean
* }} * }}
*/ */
export function setFilmstripEnabled(enabled) { export function setFilmstripEnabled(enabled: boolean) {
return { return {
type: SET_FILMSTRIP_ENABLED, type: SET_FILMSTRIP_ENABLED,
enabled enabled
@ -21,16 +23,15 @@ export function setFilmstripEnabled(enabled) {
} }
/** /**
* Sets if the filmstrip is currently being hovered over. * Sets whether the filmstrip is being hovered (over).
* *
* @param {boolean} hovered - Whether or not the filmstrip is currently being * @param {boolean} hovered - Whether the filmstrip is being hovered (over).
* hovered over.
* @returns {{ * @returns {{
* type: SET_FILMSTRIP_HOVERED, * type: SET_FILMSTRIP_HOVERED,
* hovered: boolean * hovered: boolean
* }} * }}
*/ */
export function setFilmstripHovered(hovered) { export function setFilmstripHovered(hovered: boolean) {
return { return {
type: SET_FILMSTRIP_HOVERED, type: SET_FILMSTRIP_HOVERED,
hovered hovered
@ -38,15 +39,15 @@ export function setFilmstripHovered(hovered) {
} }
/** /**
* Sets if the filmstrip should be visible. * Sets whether the filmstrip is visible.
* *
* @param {boolean} visible - Whether the filmstrip should be visible. * @param {boolean} visible - Whether the filmstrip is visible.
* @returns {{ * @returns {{
* type: SET_FILMSTRIP_VISIBLE, * type: SET_FILMSTRIP_VISIBLE,
* visible: boolean * visible: boolean
* }} * }}
*/ */
export function setFilmstripVisible(visible) { export function setFilmstripVisible(visible: boolean) {
return { return {
type: SET_FILMSTRIP_VISIBLE, type: SET_FILMSTRIP_VISIBLE,
visible visible

View File

@ -10,7 +10,7 @@ import {
makeAspectRatioAware makeAspectRatioAware
} from '../../base/responsive-ui'; } from '../../base/responsive-ui';
import { styles } from './_'; import styles from './styles';
import Thumbnail from './Thumbnail'; import Thumbnail from './Thumbnail';
/** /**
@ -63,14 +63,11 @@ class Filmstrip extends Component<Props> {
= isNarrowAspectRatio_ = isNarrowAspectRatio_
? styles.filmstripNarrow ? styles.filmstripNarrow
: styles.filmstripWide; : styles.filmstripWide;
const {
_participants: participants,
_visible: visible } = this.props;
return ( return (
<Container <Container
style = { filmstripStyle } style = { filmstripStyle }
visible = { visible }> visible = { this.props._visible }>
<ScrollView <ScrollView
horizontal = { isNarrowAspectRatio_ } horizontal = { isNarrowAspectRatio_ }
showsHorizontalScrollIndicator = { false } showsHorizontalScrollIndicator = { false }
@ -78,7 +75,9 @@ class Filmstrip extends Component<Props> {
{ {
/* eslint-disable react/jsx-wrap-multilines */ /* eslint-disable react/jsx-wrap-multilines */
this._sort(participants, isNarrowAspectRatio_) this._sort(
this.props._participants,
isNarrowAspectRatio_)
.map(p => .map(p =>
<Thumbnail <Thumbnail
key = { p.id } key = { p.id }
@ -127,9 +126,9 @@ class Filmstrip extends Component<Props> {
} }
/** /**
* Function that maps parts of Redux state tree into component props. * Maps (parts of) the redux state to the associated {@code Filmstrip}'s props.
* *
* @param {Object} state - Redux state. * @param {Object} state - The redux state.
* @private * @private
* @returns {{ * @returns {{
* _participants: Participant[], * _participants: Participant[],

View File

@ -1,3 +1,5 @@
// @flow
import { ReducerRegistry } from '../base/redux'; import { ReducerRegistry } from '../base/redux';
import { import {
@ -7,7 +9,20 @@ import {
} from './actionTypes'; } from './actionTypes';
const DEFAULT_STATE = { const DEFAULT_STATE = {
/**
* The indicator which determines whether the {@link Filmstrip} is enabled.
*
* @public
* @type {boolean}
*/
enabled: true, enabled: true,
/**
* The indicator which determines whether the {@link Filmstrip} is visible.
*
* @public
* @type {boolean}
*/
visible: true visible: true
}; };
@ -24,6 +39,14 @@ ReducerRegistry.register(
case SET_FILMSTRIP_HOVERED: case SET_FILMSTRIP_HOVERED:
return { return {
...state, ...state,
/**
* The indicator which determines whether the {@link Filmstrip}
* is being hovered (over).
*
* @public
* @type {boolean}
*/
hovered: action.hovered hovered: action.hovered
}; };