SDA-3726 - Use separate logic to update the window maximized state (#1433)

This commit is contained in:
Kiran Niranjan 2022-06-14 13:44:21 +05:30 committed by GitHub
parent 17edd19a71
commit a2453c27e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -85,8 +85,23 @@ const saveWindowSettings = async (): Promise<void> => {
}
};
const windowMaximized = async (): Promise<void> => {
const browserWindow = BrowserWindow.getFocusedWindow() as ICustomBrowserWindow;
if (browserWindow && windowExists(browserWindow)) {
const isMaximized = browserWindow.isMaximized();
const isFullScreen = browserWindow.isFullScreen();
if (browserWindow.winName === apiName.mainWindowName) {
const { mainWinPos } = config.getUserConfigFields(['mainWinPos']);
await config.updateUserConfig({
mainWinPos: { ...mainWinPos, ...{ isMaximized, isFullScreen } },
});
}
}
};
const throttledWindowChanges = throttle(async (eventName, window) => {
await saveWindowSettings();
await windowMaximized();
notification.moveNotificationToTop();
if (
window &&