feat: small refactor

This commit is contained in:
Zamitto
2025-06-03 12:23:50 -03:00
parent c5be5e94e8
commit 4552256038
4 changed files with 11 additions and 13 deletions

View File

@@ -142,10 +142,10 @@ const processAchievementFileDiff = async (
game: Game,
file: AchievementFile
) => {
const unlockedAchievements = parseAchievementFile(file.filePath, file.type);
console.log("achievements length", unlockedAchievements.length);
if (unlockedAchievements.length) {
return mergeAchievements(game, unlockedAchievements, true);
const parsedAchievements = parseAchievementFile(file.filePath, file.type);
if (parsedAchievements.length) {
return mergeAchievements(game, parsedAchievements, true);
}
return 0;

View File

@@ -135,6 +135,12 @@ export const mergeAchievements = async (
};
});
achievementsLogger.log(
"Publishing achievement notification",
game.objectId,
game.title
);
if (userPreferences.achievementCustomNotificationsEnabled !== false) {
WindowManager.notificationWindow?.webContents.send(
"on-achievement-unlocked",

View File

@@ -34,9 +34,7 @@ export const uploadGamesBatch = async () => {
await mergeWithRemoteGames();
if (HydraApi.isLoggedIn()) {
AchievementWatcherManager.preSearchAchievements();
}
AchievementWatcherManager.preSearchAchievements();
if (WindowManager.mainWindow)
WindowManager.mainWindow.webContents.send("on-library-batch-complete");

View File

@@ -112,8 +112,6 @@ export interface UserFriend {
id: string;
displayName: string;
profileImageUrl: string | null;
createdAt: string;
updatedAt: string;
currentGame:
| (ShopAssets & {
sessionDurationInSeconds: number;
@@ -146,8 +144,6 @@ export interface UserRelation {
AId: string;
BId: string;
status: "ACCEPTED" | "PENDING";
createdAt: string;
updatedAt: string;
}
export type UserProfileCurrentGame = GameRunning &
@@ -330,8 +326,6 @@ export type CatalogueSearchResult = {
genres: string[];
objectId: string;
shop: GameShop;
createdAt: Date;
updatedAt: Date;
title: string;
installCount: number;
achievementCount: number;