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.

PrejoinApp.js 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // @flow
  2. import { AtlasKitThemeProvider } from '@atlaskit/theme';
  3. import React from 'react';
  4. import { batch } from 'react-redux';
  5. import { BaseApp } from '../../../features/base/app';
  6. import { setConfig } from '../../base/config';
  7. import { createPrejoinTracks } from '../../base/tracks';
  8. import { getConferenceOptions } from '../../conference/functions';
  9. import { initPrejoin, makePrecallTest } from '../actions';
  10. import Prejoin from './Prejoin';
  11. type Props = {
  12. /**
  13. * Indicates whether the avatar should be shown when video is off
  14. */
  15. showAvatar: boolean,
  16. /**
  17. * Flag signaling the visibility of join label, input and buttons
  18. */
  19. showJoinActions: boolean,
  20. /**
  21. * Flag signaling the visibility of the skip prejoin toggle
  22. */
  23. showSkipPrejoin: boolean,
  24. };
  25. /**
  26. * Wrapper application for prejoin.
  27. *
  28. * @extends BaseApp
  29. */
  30. export default class PrejoinApp extends BaseApp<Props> {
  31. _init: Promise<*>;
  32. /**
  33. * Navigates to {@link Prejoin} upon mount.
  34. *
  35. * @returns {void}
  36. */
  37. componentDidMount() {
  38. super.componentDidMount();
  39. this._init.then(async () => {
  40. const { store } = this.state;
  41. const { dispatch } = store;
  42. const { showAvatar, showJoinActions, showSkipPrejoin } = this.props;
  43. super._navigate({
  44. component: Prejoin,
  45. props: {
  46. showAvatar,
  47. showJoinActions,
  48. showSkipPrejoin
  49. }
  50. });
  51. const { startWithAudioMuted, startWithVideoMuted } = store.getState()['features/base/settings'];
  52. dispatch(setConfig({
  53. prejoinPageEnabled: true,
  54. startWithAudioMuted,
  55. startWithVideoMuted
  56. }));
  57. const { tryCreateLocalTracks, errors } = createPrejoinTracks();
  58. const tracks = await tryCreateLocalTracks;
  59. batch(() => {
  60. dispatch(initPrejoin(tracks, errors));
  61. dispatch(makePrecallTest(getConferenceOptions(store.getState())));
  62. });
  63. });
  64. }
  65. /**
  66. * Overrides the parent method to inject {@link AtlasKitThemeProvider} as
  67. * the top most component.
  68. *
  69. * @override
  70. */
  71. _createMainElement(component, props) {
  72. return (
  73. <AtlasKitThemeProvider mode = 'dark'>
  74. { super._createMainElement(component, props) }
  75. </AtlasKitThemeProvider>
  76. );
  77. }
  78. /**
  79. * Renders the platform specific dialog container.
  80. *
  81. * @returns {React$Element}
  82. */
  83. _renderDialogContainer() {
  84. return null;
  85. }
  86. }