Comply w/ coding style

This commit is contained in:
Lyubo Marinov 2017-03-27 22:50:47 -05:00
parent 2d5f0479bd
commit 165294bfb1
3 changed files with 38 additions and 34 deletions

View File

@ -10,8 +10,7 @@ import { Symbol } from '../base/react';
*
* @protected
*/
export const _SET_APP_STATE_LISTENER
= Symbol('_SET_APP_STATE_LISTENER');
export const _SET_APP_STATE_LISTENER = Symbol('_SET_APP_STATE_LISTENER');
/**
* The type of redux action which signals that video will be muted because the
@ -28,8 +27,7 @@ export const _SET_BACKGROUND_VIDEO_MUTED
= Symbol('_SET_BACKGROUND_VIDEO_MUTED');
/**
* The type of redux action which signals that the video channel's lastN value
* must be changed.
* The type of redux action which sets the video channel's lastN (value).
*
* {
* type: _SET_LASTN,
@ -38,9 +36,7 @@ export const _SET_BACKGROUND_VIDEO_MUTED
*
* @protected
*/
export const _SET_LASTN
= Symbol('_SET_LASTN');
export const _SET_LASTN = Symbol('_SET_LASTN');
/**
* The type of redux action which signals that the app state has changed (in

View File

@ -7,25 +7,6 @@ import {
APP_STATE_CHANGED
} from './actionTypes';
/**
* Signals that the App state has changed (in terms of execution state). The
* application can be in 3 states: 'active', 'inactive' and 'background'.
*
* @param {string} appState - The new App state.
* @public
* @returns {{
* type: APP_STATE_CHANGED,
* appState: string
* }}
* @see {@link https://facebook.github.io/react-native/docs/appstate.html}
*/
export function appStateChanged(appState: string) {
return {
type: APP_STATE_CHANGED,
appState
};
}
/**
* Sets the listener to be used with React Native's AppState API.
*
@ -61,21 +42,29 @@ export function _setBackgroundVideoMuted(muted: boolean) {
const { audioOnly } = getState()['features/base/conference'];
if (!audioOnly) {
const { config } = getState()['features/base/lib-jitsi-meet'];
const defaultLastN
= typeof config.channelLastN === 'undefined'
? -1 : config.channelLastN;
let lastN;
if (muted) {
lastN = 0;
} else {
const { config } = getState()['features/base/lib-jitsi-meet'];
lastN = config.channelLastN;
if (typeof lastN === 'undefined') {
lastN = -1;
}
}
dispatch({
type: _SET_LASTN,
lastN: muted ? 0 : defaultLastN
lastN
});
}
if (muted) {
const mediaState = getState()['features/base/media'];
const { video } = getState()['features/base/media'];
if (mediaState.video.muted) {
if (video.muted) {
// Video is already muted, do nothing.
return;
}
@ -97,3 +86,22 @@ export function _setBackgroundVideoMuted(muted: boolean) {
dispatch(setVideoMuted(muted));
};
}
/**
* Signals that the App state has changed (in terms of execution state). The
* application can be in 3 states: 'active', 'inactive' and 'background'.
*
* @param {string} appState - The new App state.
* @public
* @returns {{
* type: APP_STATE_CHANGED,
* appState: string
* }}
* @see {@link https://facebook.github.io/react-native/docs/appstate.html}
*/
export function appStateChanged(appState: string) {
return {
type: APP_STATE_CHANGED,
appState
};
}

View File

@ -54,7 +54,7 @@ MiddlewareRegistry.register(store => next => action => {
try {
conference.setLastN(action.lastN);
} catch (err) {
console.warn(`Error setting lastN: ${err}`);
console.warn(`Failed to set lastN: ${err}`);
}
}