From f09b66251cb49dd7e1f249b49adcc53f50348300 Mon Sep 17 00:00:00 2001 From: Kiran Niranjan Date: Thu, 14 Nov 2024 12:10:33 +0100 Subject: [PATCH] SDA-4715 - Updates the in memory config data --- src/app/window-handler.ts | 37 +++++++++++++++++++++++-------------- src/app/window-utils.ts | 2 ++ 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/app/window-handler.ts b/src/app/window-handler.ts index 49b64e888..4f3a3bc6c 100644 --- a/src/app/window-handler.ts +++ b/src/app/window-handler.ts @@ -131,6 +131,21 @@ export const IS_NODE_INTEGRATION_ENABLED: boolean = false; export const AUX_CLICK = 'Auxclick'; // Timeout on restarting SDA in case it's stuck const LISTEN_TIMEOUT: number = 25 * 1000; +const REQUIRED_CONFIG_FIELDS = [ + 'isCustomTitleBar', + 'mainWinPos', + 'minimizeOnClose', + 'notificationSettings', + 'alwaysOnTop', + 'locale', + 'customFlags', + 'clientSwitch', + 'enableRendererLogs', + 'enableBrowserLogin', + 'browserLoginAutoConnect', + 'devToolsEnabled', +]; + export class WindowHandler { /** * Verifies if the url is valid and @@ -243,20 +258,7 @@ export class WindowHandler { */ public async createApplication() { // Use these variables only on initial setup - this.config = config.getConfigFields([ - 'isCustomTitleBar', - 'mainWinPos', - 'minimizeOnClose', - 'notificationSettings', - 'alwaysOnTop', - 'locale', - 'customFlags', - 'clientSwitch', - 'enableRendererLogs', - 'enableBrowserLogin', - 'browserLoginAutoConnect', - 'devToolsEnabled', - ]); + this.config = config.getConfigFields(REQUIRED_CONFIG_FIELDS); logger.info( `window-handler: main windows initialized with following config data`, this.config, @@ -964,6 +966,13 @@ export class WindowHandler { }); } + /** + * Fetches the required configuration fields from the `config` module. + */ + public fetchConfigFields = () => { + this.config = config.getConfigFields(REQUIRED_CONFIG_FIELDS); + }; + /** * Gets the main window */ diff --git a/src/app/window-utils.ts b/src/app/window-utils.ts index e967da7d4..8002221b6 100644 --- a/src/app/window-utils.ts +++ b/src/app/window-utils.ts @@ -1289,6 +1289,8 @@ export const updateFeaturesForCloudConfig = async ( clearInterval(autoUpdateIntervalId); } } + // Refreshes the in-memory window handler's config + windowHandler.fetchConfigFields(); }; /**