Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

PrejoinApp.tsx 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. import React, { ComponentType } from 'react';
  2. import { batch } from 'react-redux';
  3. import BaseApp from '../../../base/app/components/BaseApp';
  4. import { setConfig } from '../../../base/config/actions';
  5. import { createPrejoinTracks } from '../../../base/tracks/functions.web';
  6. import GlobalStyles from '../../../base/ui/components/GlobalStyles.web';
  7. import JitsiThemeProvider from '../../../base/ui/components/JitsiThemeProvider.web';
  8. import DialogContainer from '../../../base/ui/components/web/DialogContainer';
  9. import { setupInitialDevices } from '../../../conference/actions.web';
  10. import { initPrejoin } from '../../actions.web';
  11. import PrejoinThirdParty from './PrejoinThirdParty';
  12. type Props = {
  13. /**
  14. * Indicates the style type that needs to be applied.
  15. */
  16. styleType: string;
  17. };
  18. /**
  19. * Wrapper application for prejoin.
  20. *
  21. * @augments BaseApp
  22. */
  23. export default class PrejoinApp extends BaseApp<Props> {
  24. /**
  25. * Navigates to {@link Prejoin} upon mount.
  26. *
  27. * @returns {void}
  28. */
  29. async componentDidMount() {
  30. await super.componentDidMount();
  31. const { store } = this.state;
  32. const { dispatch } = store ?? {};
  33. const { styleType } = this.props;
  34. super._navigate({
  35. component: PrejoinThirdParty,
  36. props: {
  37. className: styleType
  38. }
  39. });
  40. const { startWithAudioMuted, startWithVideoMuted } = store
  41. ? store.getState()['features/base/settings']
  42. : { startWithAudioMuted: undefined,
  43. startWithVideoMuted: undefined };
  44. dispatch?.(setConfig({
  45. prejoinConfig: {
  46. enabled: true
  47. },
  48. startWithAudioMuted,
  49. startWithVideoMuted
  50. }));
  51. await dispatch?.(setupInitialDevices());
  52. const { tryCreateLocalTracks, errors } = createPrejoinTracks();
  53. const tracks = await tryCreateLocalTracks;
  54. batch(() => {
  55. dispatch?.(initPrejoin(tracks, errors));
  56. });
  57. }
  58. /**
  59. * Overrides the parent method to inject {@link AtlasKitThemeProvider} as
  60. * the top most component.
  61. *
  62. * @override
  63. */
  64. _createMainElement(component: ComponentType<any>, props: Object) {
  65. return (
  66. <JitsiThemeProvider>
  67. <GlobalStyles />
  68. { super._createMainElement(component, props) }
  69. </JitsiThemeProvider>
  70. );
  71. }
  72. /**
  73. * Renders the platform specific dialog container.
  74. *
  75. * @returns {React$Element}
  76. */
  77. _renderDialogContainer() {
  78. return (
  79. <JitsiThemeProvider>
  80. <DialogContainer />
  81. </JitsiThemeProvider>
  82. );
  83. }
  84. }