fix: window not opening sometimes when clicking on tray

This commit is contained in:
Zamitto
2025-09-03 06:49:26 -03:00
parent 2b6d8eba78
commit a7ec632a21
3 changed files with 11 additions and 11 deletions

View File

@@ -4,7 +4,6 @@ import { Downloader } from "@shared";
import { levelKeys, db } from "./level";
import type { UserPreferences } from "@types";
import {
WSClient,
SystemPath,
CommonRedistManager,
TorBoxClient,
@@ -47,7 +46,7 @@ export const loadState = async () => {
await HydraApi.setupApi().then(() => {
uploadGamesBatch();
WSClient.connect();
// WSClient.connect();
});
const downloads = await downloadsSublevel

View File

@@ -11,7 +11,6 @@ import { getUserData } from "./user/get-user-data";
import { db } from "@main/level";
import { levelKeys } from "@main/level/sublevels";
import type { Auth, User } from "@types";
import { WSClient } from "./ws/ws-client";
interface HydraApiOptions {
needsAuth?: boolean;
@@ -103,8 +102,8 @@ export class HydraApi {
WindowManager.mainWindow.webContents.send("on-signin");
await clearGamesRemoteIds();
uploadGamesBatch();
WSClient.close();
WSClient.connect();
// WSClient.close();
// WSClient.connect();
}
}

View File

@@ -181,6 +181,9 @@ export class WindowManager {
});
this.mainWindow.on("close", async () => {
const mainWindow = this.mainWindow;
this.mainWindow = null;
const userPreferences = await db.get<string, UserPreferences>(
levelKeys.userPreferences,
{
@@ -188,9 +191,11 @@ export class WindowManager {
}
);
if (this.mainWindow) {
const lastBounds = this.mainWindow.getBounds();
const isMaximized = this.mainWindow.isMaximized() ?? false;
if (mainWindow) {
mainWindow.setProgressBar(-1);
const lastBounds = mainWindow.getBounds();
const isMaximized = mainWindow.isMaximized() ?? false;
const screenConfig = isMaximized
? {
x: undefined,
@@ -207,9 +212,6 @@ export class WindowManager {
if (userPreferences?.preferQuitInsteadOfHiding) {
app.quit();
}
WindowManager.mainWindow?.setProgressBar(-1);
WindowManager.mainWindow = null;
});
this.mainWindow.webContents.setWindowOpenHandler((handler) => {