From 97ea15590532ae318fc8424bd8f5434a77a039ef Mon Sep 17 00:00:00 2001 From: hmuresan Date: Thu, 14 Oct 2021 20:00:14 +0300 Subject: [PATCH] fix(prejoin) Hide prejoin screen on init join conference --- .../base/conference/middleware.web.js | 3 +-- .../conference/components/web/Conference.js | 4 ++-- react/features/prejoin/actions.js | 7 +++---- react/features/prejoin/constants.js | 19 ------------------- react/features/prejoin/functions.js | 14 +------------- react/features/prejoin/middleware.js | 5 +---- react/features/settings/actions.js | 3 +-- 7 files changed, 9 insertions(+), 46 deletions(-) delete mode 100644 react/features/prejoin/constants.js diff --git a/react/features/base/conference/middleware.web.js b/react/features/base/conference/middleware.web.js index 778c01377..4a6f1a4f1 100644 --- a/react/features/base/conference/middleware.web.js +++ b/react/features/base/conference/middleware.web.js @@ -1,7 +1,6 @@ // @flow import { setPrejoinPageVisibility, setSkipPrejoinOnReload } from '../../prejoin'; -import { PREJOIN_SCREEN_STATES } from '../../prejoin/constants'; import { JitsiConferenceErrors } from '../lib-jitsi-meet'; import { MiddlewareRegistry } from '../redux'; @@ -14,7 +13,7 @@ MiddlewareRegistry.register(({ dispatch, getState }) => next => action => { switch (action.type) { case CONFERENCE_JOINED: { if (enableForcedReload) { - dispatch(setPrejoinPageVisibility(PREJOIN_SCREEN_STATES.HIDDEN)); + dispatch(setPrejoinPageVisibility(false)); dispatch(setSkipPrejoinOnReload(false)); } diff --git a/react/features/conference/components/web/Conference.js b/react/features/conference/components/web/Conference.js index f87d09cd5..1270b4b47 100644 --- a/react/features/conference/components/web/Conference.js +++ b/react/features/conference/components/web/Conference.js @@ -17,7 +17,7 @@ import { KnockingParticipantList, LobbyScreen } from '../../../lobby'; import { getIsLobbyVisible } from '../../../lobby/functions'; import { ParticipantsPane } from '../../../participants-pane/components/web'; import { getParticipantsPaneOpen } from '../../../participants-pane/functions'; -import { Prejoin, isPrejoinPageVisible, isPrejoinPageLoading } from '../../../prejoin'; +import { Prejoin, isPrejoinPageVisible } from '../../../prejoin'; import { fullScreenChanged, showToolbox } from '../../../toolbox/actions.web'; import { JitsiPortal, Toolbox } from '../../../toolbox/components/web'; import { LAYOUTS, getCurrentLayout } from '../../../video-layout'; @@ -391,7 +391,7 @@ function _mapStateToProps(state) { _overflowDrawer: overflowDrawer, _roomName: getConferenceNameForTitle(state), _showLobby: getIsLobbyVisible(state), - _showPrejoin: isPrejoinPageVisible(state) || isPrejoinPageLoading(state) + _showPrejoin: isPrejoinPageVisible(state) }; } diff --git a/react/features/prejoin/actions.js b/react/features/prejoin/actions.js index e354da71b..771ca25ef 100644 --- a/react/features/prejoin/actions.js +++ b/react/features/prejoin/actions.js @@ -37,7 +37,6 @@ import { SET_PREJOIN_PAGE_VISIBILITY, SET_DEVICE_STATUS } from './actionTypes'; -import { type PREJOIN_SCREEN_STATE, PREJOIN_SCREEN_STATES } from './constants'; import { getFullDialOutNumber, getDialOutConferenceUrl, @@ -260,7 +259,7 @@ export function joinConference(options?: Object, ignoreJoiningInProgress: boolea const jitsiTracks = localTracks.map(t => t.jitsiTrack); - dispatch(setPrejoinPageVisibility(PREJOIN_SCREEN_STATES.LOADING)); + dispatch(setPrejoinPageVisibility(false)); APP.conference.prejoinStart(jitsiTracks); }; @@ -556,10 +555,10 @@ export function setPrejoinDeviceErrors(value: Object) { /** * Action used to set the visibility of the prejoin page. * - * @param {string} value - The value. + * @param {boolean} value - The value. * @returns {Object} */ -export function setPrejoinPageVisibility(value: PREJOIN_SCREEN_STATE) { +export function setPrejoinPageVisibility(value: boolean) { return { type: SET_PREJOIN_PAGE_VISIBILITY, value diff --git a/react/features/prejoin/constants.js b/react/features/prejoin/constants.js deleted file mode 100644 index 4200dbdec..000000000 --- a/react/features/prejoin/constants.js +++ /dev/null @@ -1,19 +0,0 @@ -// @flow - -export type PREJOIN_SCREEN_STATE = "hidden" | "loading" | true; - - -type PREJOIN_SCREEN_STATE_TYPE = { - HIDDEN: PREJOIN_SCREEN_STATE, - LOADING: PREJOIN_SCREEN_STATE, - VISIBLE: PREJOIN_SCREEN_STATE - } - -/** - * Enum of possible prejoin screen states. - */ -export const PREJOIN_SCREEN_STATES: PREJOIN_SCREEN_STATE_TYPE = { - HIDDEN: 'hidden', - LOADING: 'loading', - VISIBLE: true // backwards compatibility with old boolean implementation -}; diff --git a/react/features/prejoin/functions.js b/react/features/prejoin/functions.js index f6da9dbd3..511429e4c 100644 --- a/react/features/prejoin/functions.js +++ b/react/features/prejoin/functions.js @@ -4,8 +4,6 @@ import { getRoomName } from '../base/conference'; import { getDialOutStatusUrl, getDialOutUrl } from '../base/config/functions'; import { isAudioMuted, isVideoMutedByUser } from '../base/media'; -import { PREJOIN_SCREEN_STATES } from './constants'; - /** * Selector for the visibility of the 'join by phone' button. * @@ -162,17 +160,7 @@ export function isPrejoinPageEnabled(state: Object): boolean { * @returns {boolean} */ export function isPrejoinPageVisible(state: Object): boolean { - return isPrejoinPageEnabled(state) && state['features/prejoin']?.showPrejoin === PREJOIN_SCREEN_STATES.VISIBLE; -} - -/** - * Returns true if the prejoin page is loading. - * - * @param {Object} state - The state of the app. - * @returns {boolean} - */ -export function isPrejoinPageLoading(state: Object): boolean { - return isPrejoinPageEnabled(state) && state['features/prejoin']?.showPrejoin === PREJOIN_SCREEN_STATES.LOADING; + return isPrejoinPageEnabled(state) && state['features/prejoin']?.showPrejoin; } /** diff --git a/react/features/prejoin/middleware.js b/react/features/prejoin/middleware.js index 90bbefc21..2eca16725 100644 --- a/react/features/prejoin/middleware.js +++ b/react/features/prejoin/middleware.js @@ -15,11 +15,8 @@ import { setJoiningInProgress, setPrejoinPageVisibility } from './actions'; -import { PREJOIN_SCREEN_STATES } from './constants'; import { isPrejoinPageVisible } from './functions'; -declare var APP: Object; - /** * The redux middleware for {@link PrejoinPage}. * @@ -88,7 +85,7 @@ MiddlewareRegistry.register(store => next => async action => { * @returns {Object} */ function _conferenceJoined({ dispatch }, next, action) { - dispatch(setPrejoinPageVisibility(PREJOIN_SCREEN_STATES.HIDDEN)); + dispatch(setPrejoinPageVisibility(false)); dispatch(setJoiningInProgress(false)); return next(action); diff --git a/react/features/settings/actions.js b/react/features/settings/actions.js index 37030eaa8..926039851 100644 --- a/react/features/settings/actions.js +++ b/react/features/settings/actions.js @@ -5,7 +5,6 @@ import { openDialog } from '../base/dialog'; import { i18next } from '../base/i18n'; import { updateSettings } from '../base/settings'; import { setPrejoinPageVisibility } from '../prejoin/actions'; -import { PREJOIN_SCREEN_STATES } from '../prejoin/constants'; import { setScreenshareFramerate } from '../screen-share/actions'; import { @@ -85,7 +84,7 @@ export function submitMoreTab(newState: Object): Function { // 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(PREJOIN_SCREEN_STATES.HIDDEN)); + dispatch(setPrejoinPageVisibility(false)); } dispatch(updateSettings({ userSelectedSkipPrejoin: !showPrejoinPage