mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-20 17:53:55 +00:00
feat: adding optional common redist install
This commit is contained in:
@@ -44,7 +44,10 @@
|
|||||||
"downloading_metadata": "Baixando metadados de {{title}}…",
|
"downloading_metadata": "Baixando metadados de {{title}}…",
|
||||||
"downloading": "Baixando {{title}}… ({{percentage}} concluído) - Conclusão {{eta}} - {{speed}}",
|
"downloading": "Baixando {{title}}… ({{percentage}} concluído) - Conclusão {{eta}} - {{speed}}",
|
||||||
"calculating_eta": "Baixando {{title}}… ({{percentage}} concluído) - Calculando tempo restante…",
|
"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": {
|
"game_details": {
|
||||||
"open_download_options": "Ver opções de download",
|
"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", {
|
WindowManager.mainWindow?.webContents.send("common-redist-progress", {
|
||||||
component: component,
|
log: tail,
|
||||||
complete: tail?.includes(installationCompleteMessage),
|
complete: tail?.includes(installationCompleteMessage),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -313,11 +313,11 @@ contextBridge.exposeInMainWorld("electron", {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
onCommonRedistProgress: (
|
onCommonRedistProgress: (
|
||||||
cb: (value: { component: string; complete: boolean }) => void
|
cb: (value: { log: string; complete: boolean }) => void
|
||||||
) => {
|
) => {
|
||||||
const listener = (
|
const listener = (
|
||||||
_event: Electron.IpcRendererEvent,
|
_event: Electron.IpcRendererEvent,
|
||||||
value: { component: string; complete: boolean }
|
value: { log: string; complete: boolean }
|
||||||
) => cb(value);
|
) => cb(value);
|
||||||
ipcRenderer.on("common-redist-progress", listener);
|
ipcRenderer.on("common-redist-progress", listener);
|
||||||
return () => ipcRenderer.removeListener("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>;
|
canInstallCommonRedist: () => Promise<boolean>;
|
||||||
installCommonRedist: () => Promise<void>;
|
installCommonRedist: () => Promise<void>;
|
||||||
onCommonRedistProgress: (
|
onCommonRedistProgress: (
|
||||||
cb: (value: { component: string; complete: boolean }) => void
|
cb: (value: { log: string; complete: boolean }) => void
|
||||||
) => () => Electron.IpcRenderer;
|
) => () => Electron.IpcRenderer;
|
||||||
platform: NodeJS.Platform;
|
platform: NodeJS.Platform;
|
||||||
|
|
||||||
|
|||||||
@@ -54,6 +54,12 @@ export function SettingsGeneral() {
|
|||||||
setCanInstallCommonRedist(canInstall);
|
setCanInstallCommonRedist(canInstall);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const interval = setInterval(() => {
|
||||||
|
window.electron.canInstallCommonRedist().then((canInstall) => {
|
||||||
|
setCanInstallCommonRedist(canInstall);
|
||||||
|
});
|
||||||
|
}, 1000 * 5);
|
||||||
|
|
||||||
setLanguageOptions(
|
setLanguageOptions(
|
||||||
orderBy(
|
orderBy(
|
||||||
Object.entries(languageResources).map(([language, value]) => {
|
Object.entries(languageResources).map(([language, value]) => {
|
||||||
@@ -66,6 +72,10 @@ export function SettingsGeneral() {
|
|||||||
"asc"
|
"asc"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
clearInterval(interval);
|
||||||
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user