您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

PrejoinApp.js 2.8KB

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