mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-11 13:56:16 +00:00
feat: adding optional common redist install
This commit is contained in:
@@ -44,7 +44,10 @@
|
||||
"downloading_metadata": "Baixando metadados de {{title}}…",
|
||||
"downloading": "Baixando {{title}}… ({{percentage}} concluído) - Conclusão {{eta}} - {{speed}}",
|
||||
"calculating_eta": "Baixando {{title}}… ({{percentage}} concluído) - Calculando tempo restante…",
|
||||
"checking_files": "Verificando arquivos de {{title}}…"
|
||||
"checking_files": "Verificando arquivos de {{title}}…",
|
||||
"installing_common_redist": "{{log}}…",
|
||||
"installation_complete": "Instalação concluída",
|
||||
"installation_complete_message": "Componentes recomendados instalados com sucesso"
|
||||
},
|
||||
"game_details": {
|
||||
"open_download_options": "Ver opções de download",
|
||||
|
||||
@@ -56,10 +56,8 @@ export class CommonRedistManager {
|
||||
}
|
||||
}
|
||||
|
||||
const [_, component] = tail?.split("Installing ") ?? [];
|
||||
|
||||
WindowManager.mainWindow?.webContents.send("common-redist-progress", {
|
||||
component: component,
|
||||
log: tail,
|
||||
complete: tail?.includes(installationCompleteMessage),
|
||||
});
|
||||
});
|
||||
|
||||
@@ -313,11 +313,11 @@ contextBridge.exposeInMainWorld("electron", {
|
||||
};
|
||||
},
|
||||
onCommonRedistProgress: (
|
||||
cb: (value: { component: string; complete: boolean }) => void
|
||||
cb: (value: { log: string; complete: boolean }) => void
|
||||
) => {
|
||||
const listener = (
|
||||
_event: Electron.IpcRendererEvent,
|
||||
value: { component: string; complete: boolean }
|
||||
value: { log: string; complete: boolean }
|
||||
) => cb(value);
|
||||
ipcRenderer.on("common-redist-progress", listener);
|
||||
return () => ipcRenderer.removeListener("common-redist-progress", listener);
|
||||
|
||||
2
src/renderer/src/declaration.d.ts
vendored
2
src/renderer/src/declaration.d.ts
vendored
@@ -237,7 +237,7 @@ declare global {
|
||||
canInstallCommonRedist: () => Promise<boolean>;
|
||||
installCommonRedist: () => Promise<void>;
|
||||
onCommonRedistProgress: (
|
||||
cb: (value: { component: string; complete: boolean }) => void
|
||||
cb: (value: { log: string; complete: boolean }) => void
|
||||
) => () => Electron.IpcRenderer;
|
||||
platform: NodeJS.Platform;
|
||||
|
||||
|
||||
@@ -54,6 +54,12 @@ export function SettingsGeneral() {
|
||||
setCanInstallCommonRedist(canInstall);
|
||||
});
|
||||
|
||||
const interval = setInterval(() => {
|
||||
window.electron.canInstallCommonRedist().then((canInstall) => {
|
||||
setCanInstallCommonRedist(canInstall);
|
||||
});
|
||||
}, 1000 * 5);
|
||||
|
||||
setLanguageOptions(
|
||||
orderBy(
|
||||
Object.entries(languageResources).map(([language, value]) => {
|
||||
@@ -66,6 +72,10 @@ export function SettingsGeneral() {
|
||||
"asc"
|
||||
)
|
||||
);
|
||||
|
||||
return () => {
|
||||
clearInterval(interval);
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user