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

108 lines
2.8 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> {
/**
* The deferred for the initialisation {{promise, resolve, reject}}.
*/
_init: Object;
2020-06-29 07:45:58 +00:00
/**
* Navigates to {@link Prejoin} upon mount.
*
* @returns {void}
*/
async componentDidMount() {
await super.componentDidMount();
const { store } = this.state;
const { dispatch } = store;
const { styleType } = this.props;
super._navigate({
component: PrejoinThirdParty,
props: {
className: styleType
}
});
const { startWithAudioMuted, startWithVideoMuted } = store.getState()['features/base/settings'];
dispatch(setConfig({
prejoinConfig: {
enabled: true
},
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
}
}