SDA-3475 - Fix sending bounds to main web contents (#1302)

This commit is contained in:
Kiran Niranjan 2021-11-30 11:11:52 +05:30 committed by GitHub
parent e477ee61b4
commit 830f0d3676
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,7 +30,7 @@ const PERMISSIONS_NAMESPACE = 'Permissions';
const saveWindowSettings = async (): Promise<void> => {
const browserWindow = BrowserWindow.getFocusedWindow() as ICustomBrowserWindow;
const mainWindow = windowHandler.getMainWindow();
const mainWebContents = windowHandler.getMainWebContents();
if (browserWindow && windowExists(browserWindow)) {
let [x, y] = browserWindow.getPosition();
@ -39,8 +39,8 @@ const saveWindowSettings = async (): Promise<void> => {
// Only send bound changes over to client for pop-out windows
if (
browserWindow.winName !== apiName.mainWindowName &&
mainWindow &&
windowExists(mainWindow)
mainWebContents &&
!mainWebContents.isDestroyed()
) {
const boundsChange: IBoundsChange = {
x,
@ -49,7 +49,7 @@ const saveWindowSettings = async (): Promise<void> => {
height,
windowName: browserWindow.winName,
};
mainWindow.webContents.send('boundsChange', boundsChange);
mainWebContents.send('boundsChange', boundsChange);
}
// Update the config file