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

reducer.ts 1.2KB

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