Skip to content

Commit

Permalink
SDA-4715 - Updates the in memory config data
Browse files Browse the repository at this point in the history
  • Loading branch information
KiranNiranjan committed Nov 14, 2024
1 parent 632265c commit f09b662
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
37 changes: 23 additions & 14 deletions src/app/window-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
*/
Expand Down
2 changes: 2 additions & 0 deletions src/app/window-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,8 @@ export const updateFeaturesForCloudConfig = async (
clearInterval(autoUpdateIntervalId);
}
}
// Refreshes the in-memory window handler's config
windowHandler.fetchConfigFields();
};

/**
Expand Down

0 comments on commit f09b662

Please sign in to comment.