Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(android) disable full-screen when screen-sharing

Saúl Ibarra Corretgé609942654a3a
diff --git a/react/features/mobile/full-screen/functions.ts b/react/features/mobile/full-screen/functions.ts
new file mode 100644
index 0000000000..7db7e531bc
--- /dev/null
+++ b/react/features/mobile/full-screen/functions.ts
@@ -0,0 +1,22 @@
+import { IReduxState } from '../../app/types';
+import { getCurrentConference } from '../../base/conference/functions';
+import { isAnyDialogOpen } from '../../base/dialog/functions';
+import { FULLSCREEN_ENABLED } from '../../base/flags/constants';
+import { getFeatureFlag } from '../../base/flags/functions';
+import { isLocalVideoTrackDesktop } from '../../base/tracks/functions.any';
+
+/**
+ * Checks whether full-screen state should be used or not.
+ *
+ * @param {IReduxState} state - The redux state.
+ * @returns {boolean} - Whether full-screen state shuld be used or not.
+ */
+export function shouldUseFullScreen(state: IReduxState) {
+ const { enabled: audioOnly } = state['features/base/audio-only'];
+ const conference = getCurrentConference(state);
+ const dialogOpen = isAnyDialogOpen(state);
+ const fullscreenEnabled = getFeatureFlag(state, FULLSCREEN_ENABLED, true);
+ const isDesktopSharing = isLocalVideoTrackDesktop(state);
+
+ return conference ? !audioOnly && !dialogOpen && !isDesktopSharing && fullscreenEnabled : false;
+}
diff --git a/react/features/mobile/full-screen/middleware.ts b/react/features/mobile/full-screen/middleware.ts
index 65de61861f..058e771544 100644
--- a/react/features/mobile/full-screen/middleware.ts
+++ b/react/features/mobile/full-screen/middleware.ts
@@ -2,14 +2,11 @@ import ImmersiveMode from 'react-native-immersive-mode';
import { IStore } from '../../app/types';
import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from '../../base/app/actionTypes';
-import { getCurrentConference } from '../../base/conference/functions';
-import { isAnyDialogOpen } from '../../base/dialog/functions';
-import { FULLSCREEN_ENABLED } from '../../base/flags/constants';
-import { getFeatureFlag } from '../../base/flags/functions';
import MiddlewareRegistry from '../../base/redux/MiddlewareRegistry';
import StateListenerRegistry from '../../base/redux/StateListenerRegistry';
import { _setImmersiveSubscription } from './actions';
+import { shouldUseFullScreen } from './functions';
import logger from './logger';
type BarVisibilityType = {
@@ -48,14 +45,7 @@ MiddlewareRegistry.register(store => next => action => {
});
StateListenerRegistry.register(
- /* selector */ state => {
- const { enabled: audioOnly } = state['features/base/audio-only'];
- const conference = getCurrentConference(state);
- const dialogOpen = isAnyDialogOpen(state);
- const fullscreenEnabled = getFeatureFlag(state, FULLSCREEN_ENABLED, true);
-
- return conference ? !audioOnly && !dialogOpen && fullscreenEnabled : false;
- },
+ /* selector */ shouldUseFullScreen,
/* listener */ fullScreen => _setFullScreen(fullScreen)
);
@@ -73,13 +63,7 @@ function _onImmersiveChange({ getState }: IStore) {
const { appState } = state['features/background'];
if (appState === 'active') {
- const { enabled: audioOnly } = state['features/base/audio-only'];
- const conference = getCurrentConference(state);
- const dialogOpen = isAnyDialogOpen(state);
- const fullscreenEnabled = getFeatureFlag(state, FULLSCREEN_ENABLED, true);
- const fullScreen = conference ? !audioOnly && !dialogOpen && fullscreenEnabled : false;
-
- _setFullScreen(fullScreen);
+ _setFullScreen(shouldUseFullScreen(state));
}
}