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.ts 847B

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