feat(config): Add config option to allow unsetting local video flip

This commit is contained in:
Vlad Piersec 2021-03-17 15:21:19 +02:00 committed by vp8x8
parent 92735478d1
commit 7fce181080
3 changed files with 40 additions and 1 deletions

View File

@ -618,6 +618,10 @@ var config = {
// the menu has option to flip the locally seen video for local presentations
// disableLocalVideoFlip: false,
// A property used to unset the default flip state of the local video.
// When it is set to 'true', the local(self) video will not be mirrored anymore.
// doNotFlipLocalVideo: false,
// Mainly privacy related settings
// Disables all invite functions from the app (share, invite, dial out...etc)

View File

@ -97,6 +97,7 @@ export default [
'disableTileView',
'displayJids',
'doNotStoreRoom',
'doNotFlipLocalVideo',
'dropbox',
'e2eping',
'enableDisplayNameInStats',

View File

@ -6,9 +6,10 @@ import { APP_WILL_MOUNT } from '../app';
import { getFeatureFlag } from '../flags/functions';
import { addKnownDomains } from '../known-domains';
import { MiddlewareRegistry } from '../redux';
import { updateSettings } from '../settings';
import { parseURIString } from '../util';
import { SET_CONFIG } from './actionTypes';
import { SET_CONFIG, OVERWRITE_CONFIG } from './actionTypes';
import { updateConfig } from './actions';
import { _CONFIG_STORE_PREFIX } from './constants';
@ -26,6 +27,9 @@ MiddlewareRegistry.register(store => next => action => {
case SET_CONFIG:
return _setConfig(store, next, action);
case OVERWRITE_CONFIG:
return _updateSettings(store, next, action);
}
return next(action);
@ -115,6 +119,12 @@ function _setConfig({ dispatch, getState }, next, action) {
config.resolution = resolutionFlag;
}
if (action.config.doNotFlipLocalVideo === true) {
dispatch(updateSettings({
localFlipX: false
}));
}
dispatch(updateConfig(config));
// FIXME On Web we rely on the global 'config' variable which gets altered
@ -128,3 +138,27 @@ function _setConfig({ dispatch, getState }, next, action) {
return result;
}
/**
* Updates settings based on some config values.
*
* @param {Store} store - The redux store in which the specified {@code action}
* is being dispatched.
* @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
* specified {@code action} in the specified {@code store}.
* @param {Action} action - The redux action which is being {@code dispatch}ed
* in the specified {@code store}.
* @private
* @returns {*} The return value of {@code next(action)}.
*/
function _updateSettings({ dispatch }, next, action) {
const { config: { doNotFlipLocalVideo } } = action;
if (doNotFlipLocalVideo === true) {
dispatch(updateSettings({
localFlipX: false
}));
}
return next(action);
}