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
feat(prejoin): make initPrejoin sync.
Hristo Terezov1de13818470f
diff --git a/conference.js b/conference.jsindex c718b0e0bc..197a64a50c 100644--- a/conference.js+++ b/conference.js@@ -155,8 +155,7 @@ import {import { isModerationNotificationDisplayed } from './react/features/notifications/functions';import { mediaPermissionPromptVisibilityChanged } from './react/features/overlay/actions';import { suspendDetected } from './react/features/power-monitor/actions';-import { initPrejoin } from './react/features/prejoin/actions';-import { isPrejoinPageVisible } from './react/features/prejoin/functions';+import { initPrejoin, isPrejoinPageVisible } from './react/features/prejoin/functions';import { disableReceiver, stopReceiver } from './react/features/remote-control/actions';import { setScreenAudioShareState } from './react/features/screen-share/actions.web';import { isScreenAudioShared } from './react/features/screen-share/functions';@@ -618,7 +617,7 @@ export default {// Note: Not sure if initPrejoin needs to be async. But let's wait for it just to be sure the// tracks are added.- await dispatch(initPrejoin(tracks, errors));+ initPrejoin(tracks, errors, dispatch);} else {APP.store.dispatch(displayErrorsForCreateInitialLocalTracks(errors));setGUMPendingStateOnFailedTracks(tracks, APP.store.dispatch);diff --git a/react/features/prejoin/actions.web.ts b/react/features/prejoin/actions.web.tsindex 4e28dda072..5cafbc4db5 100644--- a/react/features/prejoin/actions.web.ts+++ b/react/features/prejoin/actions.web.ts@@ -7,7 +7,7 @@ import { connect } from '../base/connection/actions';import { createLocalTrack } from '../base/lib-jitsi-meet/functions';import { isVideoMutedByUser } from '../base/media/functions';import { updateSettings } from '../base/settings/actions';-import { replaceLocalTrack, trackAdded } from '../base/tracks/actions';+import { replaceLocalTrack } from '../base/tracks/actions';import {createLocalTracksF,getLocalAudioTrack,@@ -20,7 +20,6 @@ import { NOTIFICATION_TIMEOUT_TYPE } from '../notifications/constants';import { INotificationProps } from '../notifications/types';import {- PREJOIN_INITIALIZED,PREJOIN_JOINING_IN_PROGRESS,SET_DEVICE_STATUS,SET_DIALOUT_COUNTRY,@@ -36,7 +35,7 @@ import {getDialOutCountry,getFullDialOutNumber,isJoinByPhoneDialogVisible-} from './functions';+} from './functions.any';import logger from './logger';const dialOutStatusToKeyMap = {@@ -185,23 +184,6 @@ export function dialOut(onSuccess: Function, onFail: Function) {};}-/**- * Adds all the newly created tracks to store on init.- *- * @param {Object[]} tracks - The newly created tracks.- * @param {Object} errors - The errors from creating the tracks.- *- * @returns {Function}- */-export function initPrejoin(tracks: Object[], errors: Object) {- return function(dispatch: IStore['dispatch']) {- dispatch(setPrejoinDeviceErrors(errors));- dispatch(prejoinInitialized());-- tracks.forEach(track => dispatch(trackAdded(track)));- };-}-/*** Action used to start the conference.*@@ -294,17 +276,6 @@ export function openDialInPage() {};}-/**- * Action used to signal that the prejoin page has been initialized.- *- * @returns {Object}- */-function prejoinInitialized() {- return {- type: PREJOIN_INITIALIZED- };-}-/*** Creates a new audio track based on a device id and replaces the current one.*diff --git a/react/features/prejoin/components/web/PrejoinApp.tsx b/react/features/prejoin/components/web/PrejoinApp.tsxindex 7aaa5d592d..0b1e0dd2a2 100644--- a/react/features/prejoin/components/web/PrejoinApp.tsx+++ b/react/features/prejoin/components/web/PrejoinApp.tsx@@ -1,5 +1,4 @@import React, { ComponentType } from 'react';-import { batch } from 'react-redux';import BaseApp from '../../../base/app/components/BaseApp';import { setConfig } from '../../../base/config/actions';@@ -8,7 +7,7 @@ import GlobalStyles from '../../../base/ui/components/GlobalStyles.web';import JitsiThemeProvider from '../../../base/ui/components/JitsiThemeProvider.web';import DialogContainer from '../../../base/ui/components/web/DialogContainer';import { setupInitialDevices } from '../../../conference/actions.web';-import { initPrejoin } from '../../actions.web';+import { initPrejoin } from '../../functions.web';import PrejoinThirdParty from './PrejoinThirdParty';@@ -64,9 +63,7 @@ export default class PrejoinApp extends BaseApp<Props> {const tracks = await tryCreateLocalTracks;- batch(() => {- dispatch?.(initPrejoin(tracks, errors));- });+ initPrejoin(tracks, errors, dispatch);}/**diff --git a/react/features/prejoin/functions.ts b/react/features/prejoin/functions.any.tssimilarity index 100%rename from react/features/prejoin/functions.tsrename to react/features/prejoin/functions.any.tsdiff --git a/react/features/prejoin/functions.native.ts b/react/features/prejoin/functions.native.tsnew file mode 100644index 0000000000..fb2a6bc39a--- /dev/null+++ b/react/features/prejoin/functions.native.ts@@ -0,0 +1 @@+export * from './functions.any';diff --git a/react/features/prejoin/functions.web.ts b/react/features/prejoin/functions.web.tsnew file mode 100644index 0000000000..675eba7f49--- /dev/null+++ b/react/features/prejoin/functions.web.ts@@ -0,0 +1,32 @@+import { batch } from 'react-redux';++import { IStore } from '../app/types';+import { trackAdded } from '../base/tracks/actions.any';++import { PREJOIN_INITIALIZED } from './actionTypes';+import { setPrejoinDeviceErrors } from './actions.web';++export * from './functions.any';++/**+ * Adds all the newly created tracks to store on init.+ *+ * @param {Object[]} tracks - The newly created tracks.+ * @param {Object} errors - The errors from creating the tracks.+ * @param {Function} dispatch - The redux dispatch function.+ * @returns {void}+ */+export function initPrejoin(tracks: Object[], errors: Object, dispatch?: IStore['dispatch']) {+ if (!dispatch) {+ return;+ }++ batch(() => {+ dispatch(setPrejoinDeviceErrors(errors));+ dispatch({+ type: PREJOIN_INITIALIZED+ });++ tracks.forEach(track => dispatch(trackAdded(track)));+ });+}diff --git a/react/features/prejoin/middleware.web.ts b/react/features/prejoin/middleware.web.tsindex 374dc3262d..bbe92f0428 100644--- a/react/features/prejoin/middleware.web.ts+++ b/react/features/prejoin/middleware.web.ts@@ -21,7 +21,7 @@ import {setDeviceStatusWarning,setJoiningInProgress} from './actions';-import { isPrejoinPageVisible } from './functions';+import { isPrejoinPageVisible } from './functions.any';import logger from './logger';/**