mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-27 12:51:03 +00:00
feat: show notification on launch
This commit is contained in:
@@ -13,6 +13,7 @@ import type { AchievementFile, UnlockedAchievement } from "@types";
|
||||
import { achievementsLogger } from "../logger";
|
||||
import { Cracker } from "@shared";
|
||||
import { IsNull, Not } from "typeorm";
|
||||
import { WindowManager } from "../window-manager";
|
||||
|
||||
const fileStats: Map<string, number> = new Map();
|
||||
const fltFiles: Map<string, Set<string>> = new Map();
|
||||
@@ -136,6 +137,8 @@ const processAchievementFileDiff = async (
|
||||
if (unlockedAchievements.length) {
|
||||
return mergeAchievements(game, unlockedAchievements, true);
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
export class AchievementWatcherManager {
|
||||
@@ -234,11 +237,16 @@ export class AchievementWatcherManager {
|
||||
};
|
||||
|
||||
public static preSearchAchievements = async () => {
|
||||
if (process.platform === "win32") {
|
||||
await this.preSearchAchievementsWindows();
|
||||
} else {
|
||||
await this.preSearchAchievementsWithWine();
|
||||
}
|
||||
const newAchievementsCount =
|
||||
process.platform === "win32"
|
||||
? await this.preSearchAchievementsWindows()
|
||||
: await this.preSearchAchievementsWithWine();
|
||||
|
||||
WindowManager.notificationWindow?.webContents.send(
|
||||
"on-combined-achievements-unlocked",
|
||||
newAchievementsCount.filter((achievements) => achievements).length,
|
||||
newAchievementsCount.reduce((acc, val) => acc + val, 0)
|
||||
);
|
||||
|
||||
this.hasFinishedMergingWithRemote = true;
|
||||
};
|
||||
|
||||
@@ -201,10 +201,10 @@ const getPathFromCracker = (cracker: Cracker) => {
|
||||
|
||||
if (cracker === Cracker.flt) {
|
||||
return [
|
||||
{
|
||||
folderPath: path.join(appData, "FLT"),
|
||||
fileLocation: ["stats"],
|
||||
},
|
||||
// {
|
||||
// folderPath: path.join(appData, "FLT"),
|
||||
// fileLocation: ["stats"],
|
||||
// },
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ export const mergeAchievements = async (
|
||||
const mergedLocalAchievements = unlockedAchievements.concat(newAchievements);
|
||||
|
||||
if (game.remoteId) {
|
||||
return HydraApi.put(
|
||||
await HydraApi.put(
|
||||
"/profile/games/achievements",
|
||||
{
|
||||
id: game.remoteId,
|
||||
@@ -141,12 +141,14 @@ export const mergeAchievements = async (
|
||||
publishNotification
|
||||
);
|
||||
});
|
||||
} else {
|
||||
await saveAchievementsOnLocal(
|
||||
game.objectID,
|
||||
game.shop,
|
||||
mergedLocalAchievements,
|
||||
publishNotification
|
||||
);
|
||||
}
|
||||
|
||||
return saveAchievementsOnLocal(
|
||||
game.objectID,
|
||||
game.shop,
|
||||
mergedLocalAchievements,
|
||||
publishNotification
|
||||
);
|
||||
return newAchievements.length;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user