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
[RN] Clarify, simplify the source code
Lyubomir Marinov51a1a7ed22b9
diff --git a/react/features/app/reducer.js b/react/features/app/reducer.jsindex 706fd7dfc3..d6922b8c36 100644--- a/react/features/app/reducer.js+++ b/react/features/app/reducer.js@@ -2,25 +2,19 @@ import { ReducerRegistry } from '../base/redux';import { APP_WILL_MOUNT, APP_WILL_UNMOUNT } from './actionTypes';-/**- * The initial Redux state of features/app.- */-const INITIAL_STATE = {- /**- * The one and only (i.e. singleton) App instance which is currently- * mounted.- *- * @type {App}- */- app: undefined-};--ReducerRegistry.register('features/app', (state = INITIAL_STATE, action) => {+ReducerRegistry.register('features/app', (state = {}, action) => {switch (action.type) {case APP_WILL_MOUNT:if (state.app !== action.app) {return {...state,++ /**+ * The one and only (i.e. singleton) App instance which is+ * currently mounted.+ *+ * @type {App}+ */app: action.app};}@@ -30,7 +24,7 @@ ReducerRegistry.register('features/app', (state = INITIAL_STATE, action) => {if (state.app === action.app) {return {...state,- app: INITIAL_STATE.app+ app: undefined};}break;diff --git a/react/features/base/lib-jitsi-meet/functions.js b/react/features/base/lib-jitsi-meet/functions.jsindex 8f01b6cb86..27438b6035 100644--- a/react/features/base/lib-jitsi-meet/functions.js+++ b/react/features/base/lib-jitsi-meet/functions.js@@ -4,11 +4,11 @@ import { loadScript } from '../../base/util';* Loads config.js file from remote server.** @param {string} host - Host where config.js is hosted.- * @param {string} configLocation='/config.js' - Relative pah to config.js file.+ * @param {string} path='/config.js' - Relative pah to config.js file.* @returns {Promise<Object>}*/-export function loadConfig(host, configLocation = '/config.js') {- return loadScript(new URL(configLocation, host).toString())+export function loadConfig(host, path = '/config.js') {+ return loadScript(new URL(path, host).toString()).then(() => {const config = window.config;@@ -21,11 +21,9 @@ export function loadConfig(host, configLocation = '/config.js') {return config;})- .catch(error => {- console.error(- `Failed to load ${configLocation} from ${host}`,- error);+ .catch(err => {+ console.error(`Failed to load ${path} from ${host}`, err);- throw error;+ throw err;});}diff --git a/react/features/base/lib-jitsi-meet/reducer.js b/react/features/base/lib-jitsi-meet/reducer.jsindex cab5476689..f7a7e1b889 100644--- a/react/features/base/lib-jitsi-meet/reducer.js+++ b/react/features/base/lib-jitsi-meet/reducer.js@@ -59,15 +59,31 @@ ReducerRegistry.register(};case SET_CONFIG:- return {- ...state,- config: {- ...action.config,- ...state.config- }- };+ return _setConfig(state, action);default:return state;}});++/**+ * Reduces a specific Redux action SET_CONFIG of the feature+ * base/lib-jitsi-meet.+ *+ * @param {Object} state - The Redux state of the feature base/lib-jitsi-meet.+ * @param {Action} action - The Redux action SET_CONFIG to reduce.+ * @private+ * @returns {Object} The new state of the feature base/lib-jitsi-meet after the+ * reduction of the specified action.+ */+function _setConfig(state, action) {+ return {+ ...state,+ config: {+ // The final config is the result of augmenting the default config+ // with whatever the deployment has chosen to override/overwrite.+ ...INITIAL_STATE.config,+ ...action.config+ }+ };+}