SDA-4715 - Updates the in memory config data (#2226)

This commit is contained in:
Kiran Niranjan 2024-11-20 09:07:16 +01:00 committed by GitHub
parent 632265c6ec
commit 09d2f8dccf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 14 deletions

View File

@ -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
*/

View File

@ -1289,6 +1289,8 @@ export const updateFeaturesForCloudConfig = async (
clearInterval(autoUpdateIntervalId);
}
}
// Refreshes the in-memory window handler's config
windowHandler.fetchConfigFields();
};
/**