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(dynamic-branding): expose when the branded look is still being applied
Hristo Terezov82f5aa383f79
diff --git a/react/features/dynamic-branding/functions.any.ts b/react/features/dynamic-branding/functions.any.tsindex 0ea689c817..f2b23d524b 100644--- a/react/features/dynamic-branding/functions.any.ts+++ b/react/features/dynamic-branding/functions.any.ts@@ -51,6 +51,30 @@ export function isDynamicBrandingDataLoaded(state: IReduxState) {return state['features/dynamic-branding'].customizationReady;}+/**+ * Tells whether the deployment is configured to fetch dynamic branding for the current conference.+ *+ * @param {Object} state - Global state of the app.+ * @returns {boolean}+ */+export function isDynamicBrandingConfigured(state: IReduxState): boolean {+ return Boolean(getDynamicBrandingUrl(state));+}++/**+ * Tells whether dynamic branding is expected but not fully applied yet: the data has not arrived+ * (or failed) or the custom icons it asked for are still being loaded. While this is the case the+ * UI shows the default look, which is about to change.+ *+ * @param {Object} state - Global state of the app.+ * @returns {boolean}+ */+export function isDynamicBrandingPending(state: IReduxState): boolean {+ const { brandedIconsPending, customizationReady } = state['features/dynamic-branding'];++ return isDynamicBrandingConfigured(state) && (!customizationReady || brandedIconsPending);+}+/*** Loads the SVG content of the given branding icons. The icons are requested in parallel and* each request is bounded by a timeout, so a slow or dead URL delays neither the other icons nordiff --git a/react/features/dynamic-branding/middleware.any.ts b/react/features/dynamic-branding/middleware.any.tsindex 22398de5a8..ecaa78e436 100644--- a/react/features/dynamic-branding/middleware.any.ts+++ b/react/features/dynamic-branding/middleware.any.ts@@ -27,6 +27,9 @@ MiddlewareRegistry.register(store => next => action => {.then(icons => store.dispatch(setDynamicBrandingIcons(icons))).catch((error: any) => {logger.error('Error fetching branded custom icons:', error);++ // Nothing is going to arrive anymore, so do not leave the icons marked as pending.+ store.dispatch(setDynamicBrandingIcons({}));});}diff --git a/react/features/dynamic-branding/reducer.ts b/react/features/dynamic-branding/reducer.tsindex 5e84c10423..8e814bb31c 100644--- a/react/features/dynamic-branding/reducer.ts+++ b/react/features/dynamic-branding/reducer.ts@@ -42,6 +42,16 @@ const DEFAULT_STATE = {*/backgroundImageUrl: '',+ /**+ * Whether the branding data asked for custom icons whose content is still being loaded. The+ * icons are applied separately from the rest of the branding, so this tells when the branded+ * look is not complete yet.+ *+ * @public+ * @type {boolean}+ */+ brandedIconsPending: false,+/*** Flag indicating that the branding data can be displayed.* This is used in order to avoid image flickering / text changing(blipping).@@ -165,6 +175,7 @@ export interface IDynamicBrandingState {backgroundColor: string;backgroundImageUrl: string;brandedIcons?: Record<string, string>;+ brandedIconsPending: boolean;customizationFailed: boolean;customizationReady: boolean;defaultBranding: boolean;@@ -197,6 +208,7 @@ ReducerRegistry.register<IDynamicBrandingState>(STORE_NAME, (state = DEFAULT_STAavatarBackgrounds,backgroundColor,backgroundImageUrl,+ customIcons,defaultBranding,didPageUrl,groupChatRequiresPermission,@@ -219,6 +231,7 @@ ReducerRegistry.register<IDynamicBrandingState>(STORE_NAME, (state = DEFAULT_STAavatarBackgrounds,backgroundColor,backgroundImageUrl,+ brandedIconsPending: Boolean(customIcons),defaultBranding,didPageUrl,groupChatRequiresPermission,@@ -251,7 +264,8 @@ ReducerRegistry.register<IDynamicBrandingState>(STORE_NAME, (state = DEFAULT_STAcase SET_DYNAMIC_BRANDING_ICONS:return {...state,- brandedIcons: action.icons+ brandedIcons: action.icons,+ brandedIconsPending: false};case SET_DYNAMIC_BRANDING_READY: