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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // @flow
  2. import { ReducerRegistry } from '../base/redux';
  3. import {
  4. ADD_PENDING_INVITE_REQUEST,
  5. REMOVE_PENDING_INVITE_REQUESTS,
  6. SET_CALLEE_INFO_VISIBLE,
  7. SET_INVITE_DIALOG_VISIBLE,
  8. UPDATE_DIAL_IN_NUMBERS_FAILED,
  9. UPDATE_DIAL_IN_NUMBERS_SUCCESS
  10. } from './actionTypes';
  11. const logger = require('jitsi-meet-logger').getLogger(__filename);
  12. const DEFAULT_STATE = {
  13. /**
  14. * The indicator which determines whether (the) {@code CalleeInfo} is
  15. * visible.
  16. *
  17. * @type {boolean|undefined}
  18. */
  19. calleeInfoVisible: false,
  20. inviteDialogVisible: false,
  21. numbersEnabled: true,
  22. pendingInviteRequests: []
  23. };
  24. ReducerRegistry.register('features/invite', (state = DEFAULT_STATE, action) => {
  25. switch (action.type) {
  26. case ADD_PENDING_INVITE_REQUEST:
  27. return {
  28. ...state,
  29. pendingInviteRequests: [
  30. ...state.pendingInviteRequests,
  31. action.request
  32. ]
  33. };
  34. case REMOVE_PENDING_INVITE_REQUESTS:
  35. return {
  36. ...state,
  37. pendingInviteRequests: []
  38. };
  39. case SET_CALLEE_INFO_VISIBLE:
  40. return {
  41. ...state,
  42. calleeInfoVisible: action.calleeInfoVisible,
  43. initialCalleeInfo: action.initialCalleeInfo
  44. };
  45. case SET_INVITE_DIALOG_VISIBLE:
  46. return {
  47. ...state,
  48. inviteDialogVisible: action.visible
  49. };
  50. case UPDATE_DIAL_IN_NUMBERS_FAILED:
  51. return {
  52. ...state,
  53. error: action.error
  54. };
  55. case UPDATE_DIAL_IN_NUMBERS_SUCCESS: {
  56. if (Array.isArray(action.dialInNumbers)) {
  57. return {
  58. ...state,
  59. conferenceID: action.conferenceID,
  60. numbers: action.dialInNumbers,
  61. numbersEnabled: true
  62. };
  63. }
  64. // this is the old format which is deprecated
  65. logger.warn('Using deprecated API for retrieving phone numbers');
  66. const { numbersEnabled } = action.dialInNumbers;
  67. return {
  68. ...state,
  69. conferenceID: action.conferenceID,
  70. numbers: action.dialInNumbers,
  71. numbersEnabled
  72. };
  73. }
  74. }
  75. return state;
  76. });