Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(dynamic-branding) Fix bogus mUI dependency on mobile (#10375)

Horatiu Muresand84ba85f58d3
diff --git a/react/features/dynamic-branding/actions.js b/react/features/dynamic-branding/actions.js
index 4a8df56cce..8f22281256 100644
--- a/react/features/dynamic-branding/actions.js
+++ b/react/features/dynamic-branding/actions.js
@@ -9,7 +9,7 @@ import {
SET_DYNAMIC_BRANDING_FAILED,
SET_DYNAMIC_BRANDING_READY
} from './actionTypes';
-import { getDynamicBrandingUrl } from './functions';
+import { getDynamicBrandingUrl } from './functions.any';
const logger = getLogger(__filename);
diff --git a/react/features/dynamic-branding/functions.any.js b/react/features/dynamic-branding/functions.any.js
new file mode 100644
index 0000000000..c9acaca935
--- /dev/null
+++ b/react/features/dynamic-branding/functions.any.js
@@ -0,0 +1,48 @@
+// @flow
+
+import { loadConfig } from '../base/lib-jitsi-meet';
+
+/**
+ * Extracts the fqn part from a path, where fqn represents
+ * tenant/roomName.
+ *
+ * @param {string} path - The URL path.
+ * @returns {string}
+ */
+export function extractFqnFromPath() {
+ const parts = window.location.pathname.split('/');
+ const len = parts.length;
+
+ return parts.length > 2 ? `${parts[len - 2]}/${parts[len - 1]}` : '';
+}
+
+/**
+ * Returns the url used for fetching dynamic branding.
+ *
+ * @returns {string}
+ */
+export async function getDynamicBrandingUrl() {
+ const config = await loadConfig(window.location.href);
+ const { dynamicBrandingUrl } = config;
+
+ if (dynamicBrandingUrl) {
+ return dynamicBrandingUrl;
+ }
+
+ const { brandingDataUrl: baseUrl } = config;
+ const fqn = extractFqnFromPath();
+
+ if (baseUrl && fqn) {
+ return `${baseUrl}?conferenceFqn=${encodeURIComponent(fqn)}`;
+ }
+}
+
+/**
+ * Selector used for getting the load state of the dynamic branding data.
+ *
+ * @param {Object} state - Global state of the app.
+ * @returns {boolean}
+ */
+export function isDynamicBrandingDataLoaded(state: Object) {
+ return state['features/dynamic-branding'].customizationReady;
+}
diff --git a/react/features/dynamic-branding/functions.js b/react/features/dynamic-branding/functions.web.js
similarity index 59%
rename from react/features/dynamic-branding/functions.js
rename to react/features/dynamic-branding/functions.web.js
index 7fca88a3e4..81983c2930 100644
--- a/react/features/dynamic-branding/functions.js
+++ b/react/features/dynamic-branding/functions.web.js
@@ -1,55 +1,10 @@
// @flow
+
import { createMuiTheme } from '@material-ui/core/styles';
-import { loadConfig } from '../base/lib-jitsi-meet';
import { font, colors, colorMap, spacing, shape, typography, breakpoints } from '../base/ui/Tokens';
import { createColorTokens } from '../base/ui/utils';
-/**
- * Extracts the fqn part from a path, where fqn represents
- * tenant/roomName.
- *
- * @param {string} path - The URL path.
- * @returns {string}
- */
-export function extractFqnFromPath() {
- const parts = window.location.pathname.split('/');
- const len = parts.length;
-
- return parts.length > 2 ? `${parts[len - 2]}/${parts[len - 1]}` : '';
-}
-
-/**
- * Returns the url used for fetching dynamic branding.
- *
- * @returns {string}
- */
-export async function getDynamicBrandingUrl() {
- const config = await loadConfig(window.location.href);
- const { dynamicBrandingUrl } = config;
-
- if (dynamicBrandingUrl) {
- return dynamicBrandingUrl;
- }
-
- const { brandingDataUrl: baseUrl } = config;
- const fqn = extractFqnFromPath();
-
- if (baseUrl && fqn) {
- return `${baseUrl}?conferenceFqn=${encodeURIComponent(fqn)}`;
- }
-}
-
-/**
- * Selector used for getting the load state of the dynamic branding data.
- *
- * @param {Object} state - Global state of the app.
- * @returns {boolean}
- */
-export function isDynamicBrandingDataLoaded(state: Object) {
- return state['features/dynamic-branding'].customizationReady;
-}
-
/**
* Creates MUI branding theme based on the custom theme json.
*
@@ -117,13 +72,13 @@ export function createMuiBrandingTheme(customTheme: Object) {
}
/**
- * Overwrites recursively values from object 2 into object 1 based on common keys.
- * (Merges object2 into object1).
- *
- * @param {Object} obj1 - The object holding the merged values.
- * @param {Object} obj2 - The object to compare to and take values from.
- * @returns {void}
- */
+* Overwrites recursively values from object 2 into object 1 based on common keys.
+* (Merges object2 into object1).
+*
+* @param {Object} obj1 - The object holding the merged values.
+* @param {Object} obj2 - The object to compare to and take values from.
+* @returns {void}
+*/
function overwriteRecurrsive(obj1: Object, obj2: Object) {
Object.keys(obj2).forEach(key => {
if (obj1.hasOwnProperty(key)) {
diff --git a/react/features/dynamic-branding/index.js b/react/features/dynamic-branding/index.js
index abee882188..b780791827 100644
--- a/react/features/dynamic-branding/index.js
+++ b/react/features/dynamic-branding/index.js
@@ -1,2 +1,2 @@
export * from './actions';
-export * from './functions';
+export * from './functions.any';
diff --git a/react/features/dynamic-branding/middleware.js b/react/features/dynamic-branding/middleware.web.js
similarity index 91%
rename from react/features/dynamic-branding/middleware.js
rename to react/features/dynamic-branding/middleware.web.js
index 38085c20bc..778c10a999 100644
--- a/react/features/dynamic-branding/middleware.js
+++ b/react/features/dynamic-branding/middleware.web.js
@@ -5,7 +5,7 @@ import { MiddlewareRegistry } from '../base/redux';
import { SET_DYNAMIC_BRANDING_DATA } from './actionTypes';
import { fetchCustomBrandingData } from './actions';
-import { createMuiBrandingTheme } from './functions';
+import { createMuiBrandingTheme } from './functions.web';
MiddlewareRegistry.register(store => next => action => {
switch (action.type) {
diff --git a/react/features/feedback/actions.js b/react/features/feedback/actions.js
index a7edbe5b50..522a545d55 100644
--- a/react/features/feedback/actions.js
+++ b/react/features/feedback/actions.js
@@ -4,7 +4,7 @@ import type { Dispatch } from 'redux';
import { FEEDBACK_REQUEST_IN_PROGRESS } from '../../../modules/UI/UIErrors';
import { openDialog } from '../base/dialog';
-import { extractFqnFromPath } from '../dynamic-branding/functions';
+import { extractFqnFromPath } from '../dynamic-branding';
import { isVpaasMeeting } from '../jaas/functions';
import {
diff --git a/react/features/invite/components/add-people-dialog/web/AddPeopleDialog.js b/react/features/invite/components/add-people-dialog/web/AddPeopleDialog.js
index 9f24a51dd7..4f1b3a0ea9 100644
--- a/react/features/invite/components/add-people-dialog/web/AddPeopleDialog.js
+++ b/react/features/invite/components/add-people-dialog/web/AddPeopleDialog.js
@@ -8,7 +8,7 @@ import { Dialog } from '../../../../base/dialog';
import { translate } from '../../../../base/i18n';
import { JitsiRecordingConstants } from '../../../../base/lib-jitsi-meet';
import { connect } from '../../../../base/redux';
-import { isDynamicBrandingDataLoaded } from '../../../../dynamic-branding/functions';
+import { isDynamicBrandingDataLoaded } from '../../../../dynamic-branding';
import EmbedMeetingTrigger from '../../../../embed-meeting/components/EmbedMeetingTrigger';
import { isVpaasMeeting } from '../../../../jaas/functions';
import { getActiveSession } from '../../../../recording';
diff --git a/react/features/reactions/functions.any.js b/react/features/reactions/functions.any.js
index ec04dd75f4..7ecfb6cb8d 100644
--- a/react/features/reactions/functions.any.js
+++ b/react/features/reactions/functions.any.js
@@ -4,7 +4,7 @@ import { v4 as uuidv4 } from 'uuid';
import { getFeatureFlag, REACTIONS_ENABLED } from '../base/flags';
import { getLocalParticipant } from '../base/participants';
-import { extractFqnFromPath } from '../dynamic-branding/functions';
+import { extractFqnFromPath } from '../dynamic-branding';
import { REACTIONS, SOUNDS_THRESHOLDS } from './constants';
import logger from './logger';
diff --git a/react/features/screenshot-capture/ScreenshotCaptureSummary.js b/react/features/screenshot-capture/ScreenshotCaptureSummary.js
index 7d32680114..4b39c0604f 100644
--- a/react/features/screenshot-capture/ScreenshotCaptureSummary.js
+++ b/react/features/screenshot-capture/ScreenshotCaptureSummary.js
@@ -6,7 +6,7 @@ import './createImageBitmap';
import { createScreensharingCaptureTakenEvent, sendAnalytics } from '../analytics';
import { getCurrentConference } from '../base/conference';
-import { extractFqnFromPath } from '../dynamic-branding/functions';
+import { extractFqnFromPath } from '../dynamic-branding';
import {
CLEAR_INTERVAL,