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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. /**
  20. * Wrapper application for prejoin.
  21. *
  22. * @extends BaseApp
  23. */
  24. export default class PrejoinApp extends BaseApp<Props> {
  25. _init: Promise<*>;
  26. /**
  27. * Navigates to {@link Prejoin} upon mount.
  28. *
  29. * @returns {void}
  30. */
  31. componentDidMount() {
  32. super.componentDidMount();
  33. this._init.then(async () => {
  34. const { store } = this.state;
  35. const { dispatch } = store;
  36. const { showAvatar, showJoinActions } = this.props;
  37. super._navigate({
  38. component: Prejoin,
  39. props: {
  40. showAvatar,
  41. showJoinActions
  42. }
  43. });
  44. const { startWithAudioMuted, startWithVideoMuted } = store.getState()['features/base/settings'];
  45. dispatch(setConfig({
  46. prejoinPageEnabled: true,
  47. startWithAudioMuted,
  48. startWithVideoMuted
  49. }));
  50. const { tryCreateLocalTracks, errors } = createPrejoinTracks();
  51. const tracks = await tryCreateLocalTracks;
  52. dispatch(initPrejoin(tracks, errors));
  53. });
  54. }
  55. /**
  56. * Overrides the parent method to inject {@link AtlasKitThemeProvider} as
  57. * the top most component.
  58. *
  59. * @override
  60. */
  61. _createMainElement(component, props) {
  62. return (
  63. <AtlasKitThemeProvider mode = 'dark'>
  64. { super._createMainElement(component, props) }
  65. </AtlasKitThemeProvider>
  66. );
  67. }
  68. /**
  69. * Renders the platform specific dialog container.
  70. *
  71. * @returns {React$Element}
  72. */
  73. _renderDialogContainer() {
  74. return null;
  75. }
  76. }