您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

reducer.js 1.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // @flow
  2. import { ReducerRegistry } from '../base/redux';
  3. import {
  4. SET_EVERYONE_ENABLED_E2EE,
  5. SET_EVERYONE_SUPPORT_E2EE,
  6. SET_MAX_MODE,
  7. TOGGLE_E2EE
  8. } from './actionTypes';
  9. import { MAX_MODE } from './constants';
  10. const DEFAULT_STATE = {
  11. enabled: false,
  12. maxMode: MAX_MODE.DISABLED
  13. };
  14. /**
  15. * Reduces the Redux actions of the feature features/e2ee.
  16. */
  17. ReducerRegistry.register('features/e2ee', (state = DEFAULT_STATE, action) => {
  18. switch (action.type) {
  19. case TOGGLE_E2EE:
  20. return {
  21. ...state,
  22. enabled: action.enabled
  23. };
  24. case SET_EVERYONE_ENABLED_E2EE:
  25. return {
  26. ...state,
  27. everyoneEnabledE2EE: action.everyoneEnabledE2EE
  28. };
  29. case SET_EVERYONE_SUPPORT_E2EE:
  30. return {
  31. ...state,
  32. everyoneSupportE2EE: action.everyoneSupportE2EE
  33. };
  34. case SET_MAX_MODE: {
  35. return {
  36. ...state,
  37. maxMode: action.maxMode
  38. };
  39. }
  40. default:
  41. return state;
  42. }
  43. });