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

reducer.js 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import { ReducerRegistry } from '../base/redux';
  2. import {
  3. _TRANSCRIBER_JOINED,
  4. _TRANSCRIBER_LEFT,
  5. _POTENTIAL_TRANSCRIBER_JOINED,
  6. SET_PENDING_TRANSCRIBING_NOTIFICATION_UID
  7. } from '../transcribing/actionTypes';
  8. /**
  9. * Returns initial state for transcribing feature part of Redux store.
  10. *
  11. * @returns {{
  12. * isTranscribing: boolean,
  13. * isDialing: boolean,
  14. * transcriberJID: null,
  15. * potentialTranscriberJIDs: Array
  16. * }}
  17. * @private
  18. */
  19. function _getInitialState() {
  20. return {
  21. /**
  22. * Indicates whether there is currently an active transcriber in the
  23. * room
  24. *
  25. * @type {boolean}
  26. */
  27. isTranscribing: false,
  28. /**
  29. * Indicates whether the transcriber has been dialed into the room and
  30. * we're currently awaiting successfull joining or failure of joining
  31. *
  32. * @type {boolean}
  33. */
  34. isDialing: false,
  35. /**
  36. * Indicates whether the transcribing feature is in the process of
  37. * terminating; the transcriber has been told to leave.
  38. */
  39. isTerminating: false,
  40. /**
  41. * The JID of the active transcriber
  42. *
  43. * @type { string }
  44. */
  45. transcriberJID: null,
  46. /**
  47. * A list containing potential JID's of transcriber participants
  48. *
  49. * @type { Array }
  50. */
  51. potentialTranscriberJIDs: []
  52. };
  53. }
  54. /**
  55. * Reduces the Redux actions of the feature features/transcribing.
  56. */
  57. ReducerRegistry.register('features/transcribing',
  58. (state = _getInitialState(), action) => {
  59. switch (action.type) {
  60. case _TRANSCRIBER_JOINED:
  61. return {
  62. ...state,
  63. isTranscribing: true,
  64. isDialing: false,
  65. transcriberJID: action.transcriberJID
  66. };
  67. case _TRANSCRIBER_LEFT:
  68. return {
  69. ...state,
  70. isTerminating: false,
  71. isTranscribing: false,
  72. transcriberJID: undefined,
  73. potentialTranscriberJIDs: []
  74. };
  75. case _POTENTIAL_TRANSCRIBER_JOINED:
  76. return {
  77. ...state,
  78. potentialTranscriberJIDs:
  79. [ action.transcriberJID ]
  80. .concat(state.potentialTranscriberJIDs)
  81. };
  82. case SET_PENDING_TRANSCRIBING_NOTIFICATION_UID:
  83. return {
  84. ...state,
  85. pendingNotificationUid: action.uid
  86. };
  87. default:
  88. return state;
  89. }
  90. });