Merge branch 'main' of github.com:hydralauncher/hydra

This commit is contained in:
Chubby Granny Chaser
2025-05-21 19:08:10 +01:00
17 changed files with 986 additions and 284 deletions

View File

@@ -395,7 +395,16 @@ export class WindowManager {
this.notificationWindow?.webContents.send(
"on-achievement-unlocked",
userPreferences.achievementCustomNotificationPosition ?? "top-left",
[generateAchievementCustomNotificationTest(t, language)]
[
generateAchievementCustomNotificationTest(t, language),
generateAchievementCustomNotificationTest(t, language, {
isRare: true,
isHidden: true,
}),
generateAchievementCustomNotificationTest(t, language, {
isPlatinum: true,
}),
]
);
}
@@ -460,9 +469,8 @@ export class WindowManager {
}
});
editorWindow.webContents.on("before-input-event", (event, input) => {
editorWindow.webContents.on("before-input-event", (_event, input) => {
if (input.key === "F12") {
event.preventDefault();
this.mainWindow?.webContents.toggleDevTools();
}
});

View File

@@ -1,15 +1,25 @@
import type { FriendGameSession } from "@main/generated/envelope";
import { db, levelKeys } from "@main/level";
import { HydraApi } from "@main/services/hydra-api";
import { publishFriendStartedPlayingGameNotification } from "@main/services/notifications";
import { GameStats } from "@types";
import type { GameStats, UserPreferences, UserProfile } from "@types";
export const friendGameSessionEvent = async (payload: FriendGameSession) => {
const userPreferences = await db.get<string, UserPreferences | null>(
levelKeys.userPreferences,
{
valueEncoding: "json",
}
);
if (userPreferences?.friendStartGameNotificationsEnabled === false) return;
const [friend, gameStats] = await Promise.all([
HydraApi.get(`/users/${payload.friendId}`),
HydraApi.get<UserProfile>(`/users/${payload.friendId}`),
HydraApi.get<GameStats>(
`/games/stats?objectId=${payload.objectId}&shop=steam`
),
]);
]).catch(() => [null, null]);
if (friend && gameStats) {
publishFriendStartedPlayingGameNotification(friend, gameStats);