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(prejoin) Consider user selection for prejoin only on mount
Horatiu Muresand22d95e8a5b4
diff --git a/conference.js b/conference.jsindex a26c89a073..3318225a9f 100644--- a/conference.js+++ b/conference.js@@ -135,7 +135,6 @@ import { mediaPermissionPromptVisibilityChanged, toggleSlowGUMOverlay } from './import { suspendDetected } from './react/features/power-monitor';import {initPrejoin,- isPrejoinPageEnabled,isPrejoinPageVisible,makePrecallTest,setJoiningInProgress,@@ -797,7 +796,7 @@ export default {logger.warn('initial device list initialization failed', error);}- if (isPrejoinPageEnabled(APP.store.getState())) {+ if (isPrejoinPageVisible(APP.store.getState())) {_connectionPromise = connect(roomName).then(c => {// we want to initialize it early, in case of errors to be able// to gather logsdiff --git a/react/features/base/settings/middleware.js b/react/features/base/settings/middleware.jsindex 8545a010e7..c6d1f1a70b 100644--- a/react/features/base/settings/middleware.js+++ b/react/features/base/settings/middleware.js@@ -2,6 +2,7 @@import _ from 'lodash';import { PREJOIN_INITIALIZED } from '../../prejoin/actionTypes';+import { setPrejoinPageVisibility } from '../../prejoin/actions';import { APP_WILL_MOUNT } from '../app';import { setAudioOnly } from '../audio-only';import { SET_LOCATION_URL } from '../connection/actionTypes'; // minimize imports to avoid circular imports@@ -29,6 +30,7 @@ MiddlewareRegistry.register(store => next => action => {switch (action.type) {case APP_WILL_MOUNT:_initializeCallIntegration(store);+ _initializeShowPrejoin(store);break;case PREJOIN_INITIALIZED: {_maybeUpdateDisplayName(store);@@ -48,6 +50,21 @@ MiddlewareRegistry.register(store => next => action => {return result;});+/**+ * Overwrites the showPrejoin flag based on cached used selection for showing prejoin screen.+ *+ * @param {Store} store - The redux store.+ * @private+ * @returns {void}+ */+function _initializeShowPrejoin({ dispatch, getState }) {+ const { userSelectedSkipPrejoin } = getState()['features/base/settings'];++ if (userSelectedSkipPrejoin) {+ dispatch(setPrejoinPageVisibility(false));+ }+}+/*** Initializes the audio device handler based on the `disableCallIntegration` setting.*diff --git a/react/features/prejoin/actionTypes.js b/react/features/prejoin/actionTypes.jsindex 2ad5b23af3..e4bb715752 100644--- a/react/features/prejoin/actionTypes.js+++ b/react/features/prejoin/actionTypes.js@@ -14,11 +14,6 @@ export const PREJOIN_INITIALIZED = 'PREJOIN_INITIALIZED';*/export const SET_DEVICE_STATUS = 'SET_DEVICE_STATUS';-/**- * Action type to mark the fact that the 'skip prejoin' option was modified this session.- */-export const SET_SKIP_PREJOIN_CHANGING = 'SET_SKIP_PREJOIN_CHANGING';-/*** Action type to set the visibility of the prejoin page when client is forcefully reloaded.*/diff --git a/react/features/prejoin/actions.js b/react/features/prejoin/actions.jsindex 74deadca49..87fd6cb367 100644--- a/react/features/prejoin/actions.js+++ b/react/features/prejoin/actions.js@@ -27,7 +27,6 @@ import {SET_DIALOUT_NUMBER,SET_DIALOUT_STATUS,SET_PREJOIN_DISPLAY_NAME_REQUIRED,- SET_SKIP_PREJOIN_CHANGING,SET_SKIP_PREJOIN_RELOAD,SET_JOIN_BY_PHONE_DIALOG_VISIBLITY,SET_PRECALL_TEST_RESULTS,@@ -477,20 +476,6 @@ export function setDialOutNumber(value: string) {};}-/**- * Sets a flag which signals that the option to skip the prejoin- * page on join has been modified during this session.- *- * @param {boolean} value - The visibility value.- * @returns {Object}- */-export function setSkipPrejoinIsChanging(value: boolean) {- return {- type: SET_SKIP_PREJOIN_CHANGING,- value- };-}-/*** Sets the visibility of the prejoin page when a client reload* is triggered as a result of call migration initiated by Jicofo.diff --git a/react/features/prejoin/functions.js b/react/features/prejoin/functions.jsindex b306700dd0..cc64693b4d 100644--- a/react/features/prejoin/functions.js+++ b/react/features/prejoin/functions.js@@ -136,29 +136,13 @@ export function isJoinByPhoneDialogVisible(state: Object): boolean {* @param {Object} state - The state of the app.* @returns {boolean}*/-export function isPrejoinPageEnabled(state: Object): boolean {+export function isPrejoinPageVisible(state: Object): boolean {return navigator.product !== 'ReactNative'&& state['features/base/config'].prejoinConfig?.enabled- && !state['features/base/settings'].userSelectedSkipPrejoin+ && state['features/prejoin']?.showPrejoin&& !(state['features/base/config'].enableForcedReload && state['features/prejoin'].skipPrejoinOnReload);}-/**- * Returns true if the prejoin page is visible & active.- *- * @param {Object} state - The state of the app.- * @returns {boolean}- */-export function isPrejoinPageVisible(state: Object): boolean {- // If the user has changed the setting for prejoin visibility on start- // let the visibility be controlled only by the 'showPrejoin' flag.- if (state['features/prejoin'].skipPrejoinChanging) {- return state['features/prejoin']?.showPrejoin;- }-- return isPrejoinPageEnabled(state) && state['features/prejoin']?.showPrejoin;-}-/*** Returns true if we should auto-knock in case lobby is enabled for the room.*@@ -168,6 +152,6 @@ export function isPrejoinPageVisible(state: Object): boolean {export function shouldAutoKnock(state: Object): boolean {const { iAmRecorder, iAmSipGateway, autoKnockLobby } = state['features/base/config'];- return (isPrejoinPageEnabled(state) || autoKnockLobby || (iAmRecorder && iAmSipGateway))+ return (isPrejoinPageVisible(state) || autoKnockLobby || (iAmRecorder && iAmSipGateway))&& !state['features/lobby'].knocking;}diff --git a/react/features/prejoin/reducer.js b/react/features/prejoin/reducer.jsindex dbb63d6a2b..3cf37a3882 100644--- a/react/features/prejoin/reducer.js+++ b/react/features/prejoin/reducer.js@@ -11,7 +11,6 @@ import {SET_PREJOIN_DEVICE_ERRORS,SET_PREJOIN_DISPLAY_NAME_REQUIRED,SET_PREJOIN_PAGE_VISIBILITY,- SET_SKIP_PREJOIN_CHANGING,SET_SKIP_PREJOIN_RELOAD} from './actionTypes';@@ -30,7 +29,6 @@ const DEFAULT_STATE = {name: '',rawError: '',showPrejoin: true,- skipPrejoinChanging: false,skipPrejoinOnReload: false,showJoinByPhoneDialog: false};@@ -59,13 +57,6 @@ ReducerRegistry.register(...state,joiningInProgress: action.value};- case SET_SKIP_PREJOIN_CHANGING: {- return {- ...state,- skipPrejoinChanging: action.value- };- }-case SET_SKIP_PREJOIN_RELOAD: {return {...state,diff --git a/react/features/settings/actions.js b/react/features/settings/actions.jsindex 211c9ead00..f57803256b 100644--- a/react/features/settings/actions.js+++ b/react/features/settings/actions.js@@ -10,7 +10,6 @@ import {import { openDialog } from '../base/dialog';import { i18next } from '../base/i18n';import { updateSettings } from '../base/settings';-import { setPrejoinPageVisibility, setSkipPrejoinIsChanging } from '../prejoin/actions';import { setScreenshareFramerate } from '../screen-share/actions';import {@@ -88,17 +87,9 @@ export function submitMoreTab(newState: Object): Function {const showPrejoinPage = newState.showPrejoinPage;if (showPrejoinPage !== currentState.showPrejoinPage) {- // The 'showPrejoin' flag starts as 'true' on every new session.- // This prevents displaying the prejoin page when the user re-enables it.- if (showPrejoinPage && getState()['features/prejoin']?.showPrejoin) {- dispatch(setPrejoinPageVisibility(false));- }- batch(() => {- dispatch(setSkipPrejoinIsChanging(true));- dispatch(updateSettings({- userSelectedSkipPrejoin: !showPrejoinPage- }));- });+ dispatch(updateSettings({+ userSelectedSkipPrejoin: !showPrejoinPage+ }));}const enabledNotifications = newState.enabledNotifications;