Typescript - Fix bound changes issue (#660)

This commit is contained in:
Kiran Niranjan
2019-05-22 15:53:37 +05:30
committed by Vishwas Shashidhar
parent e094aa7fff
commit 2743d1ba96
2 changed files with 8 additions and 3 deletions

View File

@@ -70,8 +70,8 @@ export interface INotificationSetting {
}
export interface ICustomRectangle extends Partial<Electron.Rectangle> {
isMaximized: boolean;
isFullScreen: boolean;
isMaximized?: boolean;
isFullScreen?: boolean;
}
class Config {

View File

@@ -7,7 +7,7 @@ import { config } from './config-handler';
import { ICustomBrowserWindow, windowHandler } from './window-handler';
import { showPopupMenu, windowExists } from './window-utils';
const saveWindowSettings = (): void => {
const saveWindowSettings = async (): Promise<void> => {
const browserWindow = BrowserWindow.getFocusedWindow() as ICustomBrowserWindow;
if (browserWindow && !browserWindow.isDestroyed()) {
@@ -15,6 +15,11 @@ const saveWindowSettings = (): void => {
const [ width, height ] = browserWindow.getSize();
if (x && y && width && height) {
browserWindow.webContents.send('boundsChange', { x, y, width, height, windowName: browserWindow.winName } as IBoundsChange);
// Update the config file
if (browserWindow.winName === apiName.mainWindowName) {
await config.updateUserConfig({ mainWinPos: { x, y, width, height } });
}
}
}