From a2453c27e4dc18d6196bf009b5982fb3d2d6b7c0 Mon Sep 17 00:00:00 2001 From: Kiran Niranjan Date: Tue, 14 Jun 2022 13:44:21 +0530 Subject: [PATCH] SDA-3726 - Use separate logic to update the window maximized state (#1433) --- src/app/window-actions.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/app/window-actions.ts b/src/app/window-actions.ts index 11437a17..173104ca 100644 --- a/src/app/window-actions.ts +++ b/src/app/window-actions.ts @@ -85,8 +85,23 @@ const saveWindowSettings = async (): Promise => { } }; +const windowMaximized = async (): Promise => { + 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 &&