Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

actions.ts 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // @ts-expect-error
  2. import UIEvents from '../../../../service/UI/UIEvents';
  3. import { createAudioOnlyChangedEvent } from '../../analytics/AnalyticsEvents';
  4. import { sendAnalytics } from '../../analytics/functions';
  5. import { IStore } from '../../app/types';
  6. import { SET_AUDIO_ONLY } from './actionTypes';
  7. import logger from './logger';
  8. declare let APP: any;
  9. /**
  10. * Sets the audio-only flag for the current JitsiConference.
  11. *
  12. * @param {boolean} audioOnly - True if the conference should be audio only; false, otherwise.
  13. * @returns {{
  14. * type: SET_AUDIO_ONLY,
  15. * audioOnly: boolean
  16. * }}
  17. */
  18. export function setAudioOnly(audioOnly: boolean) {
  19. return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
  20. const { enabled: oldValue } = getState()['features/base/audio-only'];
  21. if (oldValue !== audioOnly) {
  22. sendAnalytics(createAudioOnlyChangedEvent(audioOnly));
  23. logger.log(`Audio-only ${audioOnly ? 'enabled' : 'disabled'}`);
  24. dispatch({
  25. type: SET_AUDIO_ONLY,
  26. audioOnly
  27. });
  28. if (typeof APP !== 'undefined') {
  29. // TODO This should be a temporary solution that lasts only until video
  30. // tracks and all ui is moved into react/redux on the web.
  31. APP.UI.emitEvent(UIEvents.TOGGLE_AUDIO_ONLY, audioOnly);
  32. }
  33. }
  34. };
  35. }
  36. /**
  37. * Toggles the audio-only flag for the current JitsiConference.
  38. *
  39. * @returns {Function}
  40. */
  41. export function toggleAudioOnly() {
  42. return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
  43. const { enabled } = getState()['features/base/audio-only'];
  44. return dispatch(setAudioOnly(!enabled));
  45. };
  46. }