mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: refactoring achievements watcher
This commit is contained in:
parent
c18c41ac95
commit
44e59a5f6f
12 changed files with 120 additions and 57 deletions
|
@ -5,10 +5,6 @@ import { createGame, updateGamePlaytime } from "./library-sync";
|
|||
import { GameRunning } from "@types";
|
||||
import { PythonInstance } from "./download";
|
||||
import { Game } from "@main/entity";
|
||||
import {
|
||||
startGameAchievementObserver,
|
||||
stopGameAchievementObserver,
|
||||
} from "@main/services/achievements/game-achievements-observer";
|
||||
|
||||
export const gamesPlaytime = new Map<
|
||||
number,
|
||||
|
@ -78,8 +74,6 @@ function onOpenGame(game: Game) {
|
|||
} else {
|
||||
createGame({ ...game, lastTimePlayed: new Date() }).catch(() => {});
|
||||
}
|
||||
|
||||
startGameAchievementObserver(game);
|
||||
}
|
||||
|
||||
function onTickGame(game: Game) {
|
||||
|
@ -116,8 +110,6 @@ function onTickGame(game: Game) {
|
|||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
|
||||
startGameAchievementObserver(game);
|
||||
}
|
||||
|
||||
const onCloseGame = (game: Game) => {
|
||||
|
@ -133,6 +125,4 @@ const onCloseGame = (game: Game) => {
|
|||
} else {
|
||||
createGame(game).catch(() => {});
|
||||
}
|
||||
|
||||
stopGameAchievementObserver(game.id);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue