mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-26 04:11:02 +00:00
feat: adding recursive automatic extraction
This commit is contained in:
5
src/renderer/src/declaration.d.ts
vendored
5
src/renderer/src/declaration.d.ts
vendored
@@ -149,6 +149,8 @@ declare global {
|
||||
onLibraryBatchComplete: (cb: () => void) => () => Electron.IpcRenderer;
|
||||
resetGameAchievements: (shop: GameShop, objectId: string) => Promise<void>;
|
||||
/* User preferences */
|
||||
authenticateRealDebrid: (apiToken: string) => Promise<RealDebridUser>;
|
||||
authenticateTorBox: (apiToken: string) => Promise<TorBoxUser>;
|
||||
getUserPreferences: () => Promise<UserPreferences | null>;
|
||||
updateUserPreferences: (
|
||||
preferences: Partial<UserPreferences>
|
||||
@@ -157,8 +159,7 @@ declare global {
|
||||
enabled: boolean;
|
||||
minimized: boolean;
|
||||
}) => Promise<void>;
|
||||
authenticateRealDebrid: (apiToken: string) => Promise<RealDebridUser>;
|
||||
authenticateTorBox: (apiToken: string) => Promise<TorBoxUser>;
|
||||
extractGameDownload: (shop: GameShop, objectId: string) => Promise<boolean>;
|
||||
onAchievementUnlocked: (cb: () => void) => () => Electron.IpcRenderer;
|
||||
onExtractionComplete: (
|
||||
cb: (shop: GameShop, objectId: string) => void
|
||||
|
||||
@@ -10,11 +10,11 @@ import {
|
||||
|
||||
import { Downloader, formatBytes, steamUrlBuilder } from "@shared";
|
||||
import { DOWNLOADER_NAME } from "@renderer/constants";
|
||||
import { useAppSelector, useDownload } from "@renderer/hooks";
|
||||
import { useAppSelector, useDownload, useLibrary } from "@renderer/hooks";
|
||||
|
||||
import "./download-group.scss";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useMemo } from "react";
|
||||
import { useCallback, useMemo } from "react";
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuItem,
|
||||
@@ -22,6 +22,7 @@ import {
|
||||
import {
|
||||
ColumnsIcon,
|
||||
DownloadIcon,
|
||||
FileDirectoryIcon,
|
||||
LinkIcon,
|
||||
PlayIcon,
|
||||
QuestionIcon,
|
||||
@@ -56,6 +57,8 @@ export function DownloadGroup({
|
||||
(state) => state.userPreferences.value
|
||||
);
|
||||
|
||||
const { updateLibrary } = useLibrary();
|
||||
|
||||
const {
|
||||
lastPacket,
|
||||
progress,
|
||||
@@ -89,6 +92,14 @@ export function DownloadGroup({
|
||||
return map;
|
||||
}, [seedingStatus]);
|
||||
|
||||
const extractGameDownload = useCallback(
|
||||
async (shop: GameShop, objectId: string) => {
|
||||
await window.electron.extractGameDownload(shop, objectId);
|
||||
updateLibrary();
|
||||
},
|
||||
[updateLibrary]
|
||||
);
|
||||
|
||||
const getGameInfo = (game: LibraryGame) => {
|
||||
const download = game.download!;
|
||||
|
||||
@@ -201,6 +212,14 @@ export function DownloadGroup({
|
||||
},
|
||||
icon: <DownloadIcon />,
|
||||
},
|
||||
{
|
||||
label: t("extract"),
|
||||
disabled: game.download.extracting,
|
||||
icon: <FileDirectoryIcon />,
|
||||
onClick: () => {
|
||||
extractGameDownload(game.shop, game.objectId);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: t("stop_seeding"),
|
||||
disabled: deleting,
|
||||
|
||||
@@ -238,15 +238,13 @@ export function DownloadSettingsModal({
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{selectedDownloader !== Downloader.Torrent && (
|
||||
<CheckboxField
|
||||
label={t("automatically_extract_downloaded_files")}
|
||||
checked={automaticExtractionEnabled}
|
||||
onChange={() =>
|
||||
setAutomaticExtractionEnabled(!automaticExtractionEnabled)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
<CheckboxField
|
||||
label={t("automatically_extract_downloaded_files")}
|
||||
checked={automaticExtractionEnabled}
|
||||
onChange={() =>
|
||||
setAutomaticExtractionEnabled(!automaticExtractionEnabled)
|
||||
}
|
||||
/>
|
||||
|
||||
<Button
|
||||
onClick={handleStartClick}
|
||||
|
||||
@@ -134,6 +134,7 @@ export function GameOptionsModal({
|
||||
|
||||
const handleClearExecutablePath = async () => {
|
||||
await window.electron.updateExecutablePath(game.shop, game.objectId, null);
|
||||
|
||||
updateGame();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user