Merge branch 'feat/migration-to-scss-3-remake' of https://github.com/hydralauncher/hydra into feat/migration-to-scss-3-remake

This commit is contained in:
Hachi-R 2025-02-02 20:34:18 -03:00
commit 6d1c8d165a
13 changed files with 35 additions and 29 deletions

File diff suppressed because one or more lines are too long

View file

@ -46,9 +46,9 @@ const addGameToLibrary = async (
await gamesSublevel.put(levelKeys.game(shop, objectId), game); await gamesSublevel.put(levelKeys.game(shop, objectId), game);
updateLocalUnlockedAchivements(game!); updateLocalUnlockedAchivements(game);
createGame(game!).catch(() => {}); createGame(game).catch(() => {});
} }
}; };

View file

@ -1,3 +1,2 @@
export { db } from "./level"; export { db } from "./level";
export * from "./sublevels"; export * from "./sublevels";

View file

@ -2,5 +2,4 @@ export * from "./downloads";
export * from "./games"; export * from "./games";
export * from "./game-shop-cache"; export * from "./game-shop-cache";
export * from "./game-achievements"; export * from "./game-achievements";
export * from "./keys"; export * from "./keys";

View file

@ -234,6 +234,8 @@ export class DownloadManager {
}); });
WindowManager.mainWindow?.setProgressBar(-1); WindowManager.mainWindow?.setProgressBar(-1);
WindowManager.mainWindow?.webContents.send("on-download-progress", null);
if (downloadKey === this.downloadingGameId) { if (downloadKey === this.downloadingGameId) {
this.downloadingGameId = null; this.downloadingGameId = null;
} }

View file

@ -35,22 +35,20 @@ export const mergeWithRemoteGames = async () => {
name: "getById", name: "getById",
}); });
if (steamGame) { const iconUrl = steamGame?.clientIcon
const iconUrl = steamGame?.clientIcon ? steamUrlBuilder.icon(game.objectId, steamGame.clientIcon)
? steamUrlBuilder.icon(game.objectId, steamGame.clientIcon) : null;
: null;
gamesSublevel.put(levelKeys.game(game.shop, game.objectId), { gamesSublevel.put(levelKeys.game(game.shop, game.objectId), {
objectId: game.objectId, objectId: game.objectId,
title: steamGame?.name, title: steamGame?.name,
remoteId: game.id, remoteId: game.id,
shop: game.shop, shop: game.shop,
iconUrl, iconUrl,
lastTimePlayed: game.lastTimePlayed, lastTimePlayed: game.lastTimePlayed,
playTimeInMilliseconds: game.playTimeInMilliseconds, playTimeInMilliseconds: game.playTimeInMilliseconds,
isDeleted: false, isDeleted: false,
}); });
}
} }
} }
}) })

View file

@ -21,11 +21,18 @@ export const getSteamAppDetails = async (
}); });
return axios return axios
.get( .get<SteamAppDetailsResponse>(
`http://store.steampowered.com/api/appdetails?${searchParams.toString()}` `http://store.steampowered.com/api/appdetails?${searchParams.toString()}`
) )
.then((response) => { .then((response) => {
if (response.data[objectId].success) return response.data[objectId].data; if (response.data[objectId].success) {
const data = response.data[objectId].data;
return {
...data,
objectId,
};
}
return null; return null;
}) })
.catch((err) => { .catch((err) => {

View file

@ -32,10 +32,10 @@ contextBridge.exposeInMainWorld("electron", {
ipcRenderer.invoke("pauseGameSeed", shop, objectId), ipcRenderer.invoke("pauseGameSeed", shop, objectId),
resumeGameSeed: (shop: GameShop, objectId: string) => resumeGameSeed: (shop: GameShop, objectId: string) =>
ipcRenderer.invoke("resumeGameSeed", shop, objectId), ipcRenderer.invoke("resumeGameSeed", shop, objectId),
onDownloadProgress: (cb: (value: DownloadProgress) => void) => { onDownloadProgress: (cb: (value: DownloadProgress | null) => void) => {
const listener = ( const listener = (
_event: Electron.IpcRendererEvent, _event: Electron.IpcRendererEvent,
value: DownloadProgress value: DownloadProgress | null
) => cb(value); ) => cb(value);
ipcRenderer.on("on-download-progress", listener); ipcRenderer.on("on-download-progress", listener);
return () => ipcRenderer.removeListener("on-download-progress", listener); return () => ipcRenderer.removeListener("on-download-progress", listener);

View file

@ -84,7 +84,7 @@ export function App() {
useEffect(() => { useEffect(() => {
const unsubscribe = window.electron.onDownloadProgress( const unsubscribe = window.electron.onDownloadProgress(
(downloadProgress) => { (downloadProgress) => {
if (downloadProgress.progress === 1) { if (downloadProgress?.progress === 1) {
clearDownload(); clearDownload();
updateLibrary(); updateLibrary();
return; return;

View file

@ -50,7 +50,7 @@ declare global {
pauseGameSeed: (shop: GameShop, objectId: string) => Promise<void>; pauseGameSeed: (shop: GameShop, objectId: string) => Promise<void>;
resumeGameSeed: (shop: GameShop, objectId: string) => Promise<void>; resumeGameSeed: (shop: GameShop, objectId: string) => Promise<void>;
onDownloadProgress: ( onDownloadProgress: (
cb: (value: DownloadProgress) => void cb: (value: DownloadProgress | null) => void
) => () => Electron.IpcRenderer; ) => () => Electron.IpcRenderer;
onSeedingStatus: ( onSeedingStatus: (
cb: (value: SeedingStatus[]) => void cb: (value: SeedingStatus[]) => void

View file

@ -18,9 +18,9 @@ export const downloadSlice = createSlice({
name: "download", name: "download",
initialState, initialState,
reducers: { reducers: {
setLastPacket: (state, action: PayloadAction<DownloadProgress>) => { setLastPacket: (state, action: PayloadAction<DownloadProgress | null>) => {
state.lastPacket = action.payload; state.lastPacket = action.payload;
if (!state.gameId) state.gameId = action.payload.gameId; if (!state.gameId && action.payload) state.gameId = action.payload.gameId;
}, },
clearDownload: (state) => { clearDownload: (state) => {
state.lastPacket = null; state.lastPacket = null;

View file

@ -114,7 +114,7 @@ export function useDownload() {
pauseSeeding, pauseSeeding,
resumeSeeding, resumeSeeding,
clearDownload: () => dispatch(clearDownload()), clearDownload: () => dispatch(clearDownload()),
setLastPacket: (packet: DownloadProgress) => setLastPacket: (packet: DownloadProgress | null) =>
dispatch(setLastPacket(packet)), dispatch(setLastPacket(packet)),
}; };
} }

View file

@ -25,6 +25,7 @@ export interface SteamMovies {
export interface SteamAppDetails { export interface SteamAppDetails {
name: string; name: string;
steam_appid: number;
detailed_description: string; detailed_description: string;
about_the_game: string; about_the_game: string;
short_description: string; short_description: string;