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 // the menu has option to flip the locally seen video for local presentations
// disableLocalVideoFlip: false, // 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 // Mainly privacy related settings
// Disables all invite functions from the app (share, invite, dial out...etc) // Disables all invite functions from the app (share, invite, dial out...etc)

View File

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

View File

@ -6,9 +6,10 @@ import { APP_WILL_MOUNT } from '../app';
import { getFeatureFlag } from '../flags/functions'; import { getFeatureFlag } from '../flags/functions';
import { addKnownDomains } from '../known-domains'; import { addKnownDomains } from '../known-domains';
import { MiddlewareRegistry } from '../redux'; import { MiddlewareRegistry } from '../redux';
import { updateSettings } from '../settings';
import { parseURIString } from '../util'; import { parseURIString } from '../util';
import { SET_CONFIG } from './actionTypes'; import { SET_CONFIG, OVERWRITE_CONFIG } from './actionTypes';
import { updateConfig } from './actions'; import { updateConfig } from './actions';
import { _CONFIG_STORE_PREFIX } from './constants'; import { _CONFIG_STORE_PREFIX } from './constants';
@ -26,6 +27,9 @@ MiddlewareRegistry.register(store => next => action => {
case SET_CONFIG: case SET_CONFIG:
return _setConfig(store, next, action); return _setConfig(store, next, action);
case OVERWRITE_CONFIG:
return _updateSettings(store, next, action);
} }
return next(action); return next(action);
@ -115,6 +119,12 @@ function _setConfig({ dispatch, getState }, next, action) {
config.resolution = resolutionFlag; config.resolution = resolutionFlag;
} }
if (action.config.doNotFlipLocalVideo === true) {
dispatch(updateSettings({
localFlipX: false
}));
}
dispatch(updateConfig(config)); dispatch(updateConfig(config));
// FIXME On Web we rely on the global 'config' variable which gets altered // 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; 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);
}