Merge pull request #14097 from ramonlsouza/issue-14069

fix: Keep the state of the presentation after sharing the screen
This commit is contained in:
Anton Georgiev 2022-01-20 09:10:25 -05:00 committed by GitHub
commit f69b8c1a54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,6 +72,7 @@ class ScreenshareComponent extends React.Component {
constructor() {
super();
this.state = {
restoreOnUnmount: true,
loaded: false,
autoplayBlocked: false,
isStreamHealthy: false,
@ -112,7 +113,10 @@ class ScreenshareComponent extends React.Component {
notify(intl.formatMessage(intlMessages.screenshareStarted), 'info', 'desktop');
if (getSwapLayout()) toggleSwapLayout(layoutContextDispatch);
if (getSwapLayout()) {
toggleSwapLayout(layoutContextDispatch)
this.setState({ restoreOnUnmount: false });
};
if (hidePresentation) {
layoutContextDispatch({
@ -132,7 +136,14 @@ class ScreenshareComponent extends React.Component {
}
componentWillUnmount() {
const { intl, fullscreenContext, layoutContextDispatch, hidePresentation } = this.props;
const {
intl,
fullscreenContext,
layoutContextDispatch,
hidePresentation,
toggleSwapLayout,
} = this.props;
const { restoreOnUnmount } = this.state;
screenshareHasEnded();
window.removeEventListener('screensharePlayFailed', this.handlePlayElementFailed);
unsubscribeFromStreamStateChange('screenshare', this.onStreamStateChange);
@ -149,11 +160,12 @@ class ScreenshareComponent extends React.Component {
});
}
if (hidePresentation) {
if (hidePresentation || !restoreOnUnmount) {
layoutContextDispatch({
type: ACTIONS.SET_PRESENTATION_IS_OPEN,
value: false,
});
toggleSwapLayout(layoutContextDispatch);
}
}