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.4KB

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