mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-23 19:01:02 +00:00
feat: achievement notification custom position and animations
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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
|
||||
);
|
||||
@@ -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
|
||||
);
|
||||
Reference in New Issue
Block a user