feat: achievement notification custom position and animations

This commit is contained in:
Zamitto
2025-05-15 19:42:23 -03:00
parent 42e8a68c08
commit 6f43da8d28
13 changed files with 502 additions and 152 deletions

View File

@@ -87,7 +87,7 @@ import "./cloud-save/upload-save-game";
import "./cloud-save/delete-game-artifact";
import "./cloud-save/select-game-backup-path";
import "./notifications/publish-new-repacks-notification";
import "./notifications/update-achievement-notification-window-position";
import "./notifications/update-achievement-notification-window";
import "./themes/add-custom-theme";
import "./themes/delete-custom-theme";
import "./themes/get-all-custom-themes";

View File

@@ -1,19 +0,0 @@
import { registerEvent } from "../register-event";
import { WindowManager } from "@main/services";
const updateAchievementCustomNotificationWindowPosition = async (
_event: Electron.IpcMainInvokeEvent
) => {
const { x, y } = await WindowManager.getNotificationWindowPosition();
WindowManager.notificationWindow?.setPosition(x, y);
WindowManager.notificationWindow?.webContents.send(
"on-test-achievement-notification"
);
};
registerEvent(
"updateAchievementCustomNotificationWindowPosition",
updateAchievementCustomNotificationWindowPosition
);

View File

@@ -0,0 +1,29 @@
import { db, levelKeys } from "@main/level";
import { registerEvent } from "../register-event";
import { WindowManager } from "@main/services";
import { UserPreferences } from "@types";
const updateAchievementCustomNotificationWindow = async (
_event: Electron.IpcMainInvokeEvent
) => {
const userPreferences = await db.get<string, UserPreferences>(
levelKeys.userPreferences,
{
valueEncoding: "json",
}
);
WindowManager.closeNotificationWindow();
if (
userPreferences.achievementNotificationsEnabled &&
userPreferences.achievementCustomNotificationsEnabled !== false
) {
WindowManager.createNotificationWindow(true);
}
};
registerEvent(
"updateAchievementCustomNotificationWindow",
updateAchievementCustomNotificationWindow
);