feat: add ablity to pause and resume the seeding process

This commit is contained in:
Hachi-R
2024-11-08 21:29:40 -03:00
parent c556a00e4a
commit b32952f076
11 changed files with 120 additions and 0 deletions

View File

@@ -46,6 +46,8 @@ declare global {
cancelGameDownload: (gameId: number) => Promise<void>;
pauseGameDownload: (gameId: number) => Promise<void>;
resumeGameDownload: (gameId: number) => Promise<void>;
pauseGameSeed: (gameId: number) => Promise<void>;
resumeGameSeed: (gameId: number) => Promise<void>;
onDownloadProgress: (
cb: (value: DownloadProgress) => void
) => () => Electron.IpcRenderer;

View File

@@ -66,6 +66,16 @@ export function useDownload() {
updateLibrary();
});
const pauseSeeding = async (gameId: number) => {
await window.electron.pauseGameSeed(gameId);
await updateLibrary();
};
const resumeSeeding = async (gameId: number) => {
await window.electron.resumeGameSeed(gameId);
await updateLibrary();
};
const calculateETA = () => {
if (!lastPacket || lastPacket.timeRemaining < 0) return "";
@@ -96,6 +106,8 @@ export function useDownload() {
removeGameFromLibrary,
removeGameInstaller,
isGameDeleting,
pauseSeeding,
resumeSeeding,
clearDownload: () => dispatch(clearDownload()),
setLastPacket: (packet: DownloadProgress) =>
dispatch(setLastPacket(packet)),