fix: notifications not working on first run

This commit is contained in:
Zamitto
2025-05-17 20:32:24 -03:00
parent 276c098fbc
commit a5aabe0ad7
8 changed files with 36 additions and 16 deletions

View File

@@ -333,14 +333,22 @@ export class WindowManager {
public static async createNotificationWindow() {
if (this.notificationWindow) return;
const userPreferences = await db.get<string, UserPreferences>(
const userPreferences = await db.get<string, UserPreferences | undefined>(
levelKeys.userPreferences,
{
valueEncoding: "json",
}
);
if (
userPreferences?.achievementNotificationsEnabled === false ||
userPreferences?.achievementCustomNotificationsEnabled === false
) {
return;
}
const { x, y } = await this.getNotificationWindowPosition(
userPreferences.achievementCustomNotificationPosition
userPreferences?.achievementCustomNotificationPosition
);
this.notificationWindow = new BrowserWindow({