jiti-meet/react/features/prejoin/components/PrejoinApp.js

107 lines
2.9 KiB
JavaScript
Raw Normal View History

2020-06-29 07:45:58 +00:00
// @flow
import { AtlasKitThemeProvider } from '@atlaskit/theme';
import React from 'react';
import { batch } from 'react-redux';
2020-06-29 07:45:58 +00:00
import { BaseApp } from '../../../features/base/app';
import { getConferenceOptions } from '../../base/conference/functions';
2020-06-29 07:45:58 +00:00
import { setConfig } from '../../base/config';
import { DialogContainer } from '../../base/dialog';
2020-06-29 07:45:58 +00:00
import { createPrejoinTracks } from '../../base/tracks';
2021-11-23 09:06:20 +00:00
import GlobalStyles from '../../base/ui/components/GlobalStyles';
import JitsiThemeProvider from '../../base/ui/components/JitsiThemeProvider';
import { initPrejoin, makePrecallTest } from '../actions';
2020-06-29 07:45:58 +00:00
import PrejoinThirdParty from './PrejoinThirdParty';
2020-06-29 07:45:58 +00:00
type Props = {
/**
* Indicates the style type that needs to be applied.
2020-06-29 07:45:58 +00:00
*/
styleType: string
}
2020-06-29 07:45:58 +00:00
/**
* Wrapper application for prejoin.
*
2021-11-04 21:10:43 +00:00
* @augments BaseApp
2020-06-29 07:45:58 +00:00
*/
export default class PrejoinApp extends BaseApp<Props> {
_init: Promise<*>;
/**
* Navigates to {@link Prejoin} upon mount.
*
* @returns {void}
*/
componentDidMount() {
super.componentDidMount();
this._init.then(async () => {
const { store } = this.state;
const { dispatch } = store;
const { styleType } = this.props;
2020-06-29 07:45:58 +00:00
super._navigate({
component: PrejoinThirdParty,
2020-06-29 07:45:58 +00:00
props: {
className: styleType
2020-06-29 07:45:58 +00:00
}
});
const { startWithAudioMuted, startWithVideoMuted } = store.getState()['features/base/settings'];
dispatch(setConfig({
prejoinConfig: {
enabled: true
},
2020-06-29 07:45:58 +00:00
startWithAudioMuted,
startWithVideoMuted
}));
const { tryCreateLocalTracks, errors } = createPrejoinTracks();
const tracks = await tryCreateLocalTracks;
batch(() => {
dispatch(initPrejoin(tracks, errors));
dispatch(makePrecallTest(getConferenceOptions(store.getState())));
});
2020-06-29 07:45:58 +00:00
});
}
/**
* Overrides the parent method to inject {@link AtlasKitThemeProvider} as
* the top most component.
*
* @override
*/
_createMainElement(component, props) {
return (
<JitsiThemeProvider>
<AtlasKitThemeProvider mode = 'dark'>
2021-11-23 09:06:20 +00:00
<GlobalStyles />
{ super._createMainElement(component, props) }
</AtlasKitThemeProvider>
</JitsiThemeProvider>
2020-06-29 07:45:58 +00:00
);
}
/**
* Renders the platform specific dialog container.
*
* @returns {React$Element}
*/
_renderDialogContainer() {
return (
<JitsiThemeProvider>
<AtlasKitThemeProvider mode = 'dark'>
<DialogContainer />
</AtlasKitThemeProvider>
</JitsiThemeProvider>
);
2020-06-29 07:45:58 +00:00
}
}