Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading