You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

reducer.js 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // @flow
  2. import { ReducerRegistry } from '../base/redux';
  3. import { BACKGROUND_ENABLED, SET_VIRTUAL_BACKGROUND } from './actionTypes';
  4. /**
  5. * Reduces redux actions which activate/deactivate virtual background image, or
  6. * indicate if the virtual image background is activated/deactivated. The
  7. * backgroundEffectEnabled flag indicate if virtual background effect is activated.
  8. *
  9. * @param {State} state - The current redux state.
  10. * @param {Action} action - The redux action to reduce.
  11. * @param {string} action.type - The type of the redux action to reduce..
  12. * @returns {State} The next redux state that is the result of reducing the
  13. * specified action.
  14. */
  15. ReducerRegistry.register('features/virtual-background', (state = {}, action) => {
  16. const { virtualSource, isVirtualBackground, backgroundEffectEnabled } = action;
  17. switch (action.type) {
  18. case SET_VIRTUAL_BACKGROUND: {
  19. return {
  20. ...state,
  21. virtualSource,
  22. isVirtualBackground
  23. };
  24. }
  25. case BACKGROUND_ENABLED: {
  26. return {
  27. ...state,
  28. backgroundEffectEnabled
  29. };
  30. }
  31. }
  32. return state;
  33. });