From c57e713696ca829a6493270f4855841db587d08c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Wed, 8 Feb 2017 17:25:49 +0100 Subject: [PATCH] [RN] Fix full-screen mode when coming back from the background On Android the status and navigation bars are shown again after coming back from the background, so enter full-screen mode again if needed. --- react/features/background/index.js | 1 + react/features/full-screen/middleware.js | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/react/features/background/index.js b/react/features/background/index.js index 200d25492..4cdf36b5e 100644 --- a/react/features/background/index.js +++ b/react/features/background/index.js @@ -1,2 +1,3 @@ +export * from './actionTypes'; import './middleware'; import './reducer'; diff --git a/react/features/full-screen/middleware.js b/react/features/full-screen/middleware.js index 2c8e86d0d..a76e55a8e 100644 --- a/react/features/full-screen/middleware.js +++ b/react/features/full-screen/middleware.js @@ -3,6 +3,7 @@ import { StatusBar } from 'react-native'; import { Immersive } from 'react-native-immersive'; +import { APP_STATE_CHANGED } from '../background'; import { CONFERENCE_FAILED, CONFERENCE_LEFT, @@ -23,9 +24,20 @@ import { MiddlewareRegistry } from '../base/redux'; * @returns {Function} */ MiddlewareRegistry.register(store => next => action => { - let fullScreen; + let fullScreen = null; switch (action.type) { + case APP_STATE_CHANGED: { + // Check if we just came back from the background and reenable full + // screen mode if necessary. + if (action.appState === 'active') { + const conference = store.getState()['features/base/conference']; + + fullScreen = conference ? !conference.audioOnly : false; + } + break; + } + case CONFERENCE_WILL_JOIN: { const conference = store.getState()['features/base/conference']; @@ -37,10 +49,6 @@ MiddlewareRegistry.register(store => next => action => { case CONFERENCE_LEFT: fullScreen = false; break; - - default: - fullScreen = null; - break; } if (fullScreen !== null) {