get userPreferences moved to close event

This commit is contained in:
Hachi-R 2024-05-04 15:07:19 -03:00
parent 5fda06477d
commit 58f58d0c63
2 changed files with 552 additions and 404 deletions

View File

@ -26,7 +26,7 @@ export class WindowManager {
}
}
public static async createMainWindow() {
public static createMainWindow() {
// Create the browser window.
this.mainWindow = new BrowserWindow({
width: 1200,
@ -50,15 +50,15 @@ export class WindowManager {
this.loadURL();
this.mainWindow.removeMenu();
const userPreferences = await userPreferencesRepository.findOne({
where: { id: 1 },
});
this.mainWindow.on("ready-to-show", () => {
if (!app.isPackaged) WindowManager.mainWindow?.webContents.openDevTools();
});
this.mainWindow.on("close", () => {
this.mainWindow.on("close", async () => {
const userPreferences = await userPreferencesRepository.findOne({
where: { id: 1 },
});
if (userPreferences?.preferQuitInsteadOfHiding) {
app.quit();
}

944
yarn.lock

File diff suppressed because it is too large Load Diff