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 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import ReducerRegistry from '../../base/redux/ReducerRegistry';
  2. import { assign } from '../../base/redux/functions';
  3. import { SET_CONFERENCE_TIMESTAMP, SET_SESSION_ID, SET_WATCH_REACHABLE } from './actionTypes';
  4. export interface IMobileWatchOSState {
  5. conferenceTimestamp?: number;
  6. sessionID: number;
  7. watchReachable?: boolean;
  8. }
  9. const INITIAL_STATE = {
  10. sessionID: new Date().getTime()
  11. };
  12. /**
  13. * Reduces the Redux actions of the feature features/mobile/watchos.
  14. */
  15. ReducerRegistry.register<IMobileWatchOSState>('features/mobile/watchos',
  16. (state = INITIAL_STATE, action): IMobileWatchOSState => {
  17. switch (action.type) {
  18. case SET_CONFERENCE_TIMESTAMP: {
  19. return assign(state, {
  20. conferenceTimestamp: action.conferenceTimestamp
  21. });
  22. }
  23. case SET_SESSION_ID: {
  24. return assign(state, {
  25. sessionID: action.sessionID,
  26. conferenceTimestamp: 0
  27. });
  28. }
  29. case SET_WATCH_REACHABLE: {
  30. return assign(state, {
  31. watchReachable: action.watchReachable
  32. });
  33. }
  34. default:
  35. return state;
  36. }
  37. });