Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
fix(mobile/navigation): fix conference join hang when SDK launched in background (#17180)
Alex Mat574a6ad9e08e
diff --git a/react/features/app/components/App.native.tsx b/react/features/app/components/App.native.tsxindex 93c26fcfce..bea8cbdf6c 100644--- a/react/features/app/components/App.native.tsx+++ b/react/features/app/components/App.native.tsx@@ -1,5 +1,5 @@import React, { ComponentType } from 'react';-import { NativeModules, Platform, StyleSheet, View } from 'react-native';+import { AppState, NativeModules, Platform, StyleSheet, View } from 'react-native';import DeviceInfo from 'react-native-device-info';import { SafeAreaProvider } from 'react-native-safe-area-context';// @ts-ignore@@ -153,7 +153,17 @@ export class App extends AbstractApp<IProps> {}, 50);});- await rootNavigationReady;+ // SDK launched in background (device locked, no screen unlock):+ // - AppState !== 'active' means UI is not on screen+ // - url is already set meaning host app started SDK with a specific room+ // In this case NavigationContainer.onReady will never fire until the screen+ // is unlocked, causing the polling loop to hang indefinitely.+ const isBackgroundSDKLaunch = AppState.currentState !== 'active'+ && typeof url !== 'undefined';++ if (!isBackgroundSDKLaunch) {+ await rootNavigationReady;+ }// Update specified server URL.if (typeof url !== 'undefined') {diff --git a/react/features/mobile/navigation/components/RootNavigationContainer.tsx b/react/features/mobile/navigation/components/RootNavigationContainer.tsxindex 8628020fb8..b088189a04 100644--- a/react/features/mobile/navigation/components/RootNavigationContainer.tsx+++ b/react/features/mobile/navigation/components/RootNavigationContainer.tsx@@ -4,6 +4,7 @@ import React, { useCallback } from 'react';import { connect } from 'react-redux';import { IReduxState, IStore } from '../../../app/types';+import { getConferenceState } from '../../../base/conference/functions';import DialInSummary from '../../../invite/components/dial-in-summary/native/DialInSummary';import Prejoin from '../../../prejoin/components/native/Prejoin';import UnsafeRoomWarning from '../../../prejoin/components/native/UnsafeRoomWarning';@@ -40,6 +41,11 @@ interface IProps {*/dispatch: IStore['dispatch'];+ /**+ * True if a room is already set at launch time (background SDK launch).+ */+ hasRoomOnLaunch: boolean;+/*** Is welcome page available?*/@@ -47,9 +53,13 @@ interface IProps {}-const RootNavigationContainer = ({ dispatch, isWelcomePageAvailable }: IProps) => {+const RootNavigationContainer = ({ dispatch, hasRoomOnLaunch, isWelcomePageAvailable }: IProps) => {+ // Background SDK launch goes straight to conference; normal launch shows the connecting spinner.const initialRouteName = isWelcomePageAvailable- ? screen.welcome.main : screen.connecting;+ ? screen.welcome.main+ : hasRoomOnLaunch+ ? screen.conference.root+ : screen.connecting;const onReady = useCallback(() => {dispatch({type: _ROOT_NAVIGATION_READY,@@ -106,7 +116,10 @@ const RootNavigationContainer = ({ dispatch, isWelcomePageAvailable }: IProps) =* @returns {IProps}*/function mapStateToProps(state: IReduxState) {+ const { room } = getConferenceState(state);+return {+ hasRoomOnLaunch: Boolean(room),isWelcomePageAvailable: isWelcomePageEnabled(state)};}