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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import ReducerRegistry from '../base/redux/ReducerRegistry';
  2. import {
  3. RESET_SHARED_VIDEO_STATUS,
  4. SET_ALLOWED_URL_DOMAINS,
  5. SET_CONFIRM_SHOW_VIDEO,
  6. SET_SHARED_VIDEO_STATUS
  7. } from './actionTypes';
  8. import { DEFAULT_ALLOWED_URL_DOMAINS } from './constants';
  9. const initialState = {
  10. allowedUrlDomains: DEFAULT_ALLOWED_URL_DOMAINS
  11. };
  12. export interface ISharedVideoState {
  13. allowedUrlDomains: Array<string>;
  14. confirmShowVideo?: boolean;
  15. muted?: boolean;
  16. ownerId?: string;
  17. status?: string;
  18. time?: number;
  19. videoUrl?: string;
  20. volume?: number;
  21. }
  22. /**
  23. * Reduces the Redux actions of the feature features/shared-video.
  24. */
  25. ReducerRegistry.register<ISharedVideoState>('features/shared-video',
  26. (state = initialState, action): ISharedVideoState => {
  27. const { videoUrl, status, time, ownerId, muted, volume } = action;
  28. switch (action.type) {
  29. case RESET_SHARED_VIDEO_STATUS:
  30. return {
  31. ...initialState,
  32. allowedUrlDomains: state.allowedUrlDomains
  33. };
  34. case SET_CONFIRM_SHOW_VIDEO: {
  35. return {
  36. ...state,
  37. confirmShowVideo: action.value
  38. };
  39. }
  40. case SET_SHARED_VIDEO_STATUS:
  41. return {
  42. ...state,
  43. muted,
  44. ownerId,
  45. status,
  46. time,
  47. videoUrl,
  48. volume
  49. };
  50. case SET_ALLOWED_URL_DOMAINS: {
  51. return {
  52. ...state,
  53. allowedUrlDomains: action.allowedUrlDomains
  54. };
  55. }
  56. default:
  57. return state;
  58. }
  59. });