(null);
- const [newVersion, setNewVersion] = useState("");
-
- const { t } = useTranslation("splash");
-
- useEffect(() => {
- const unsubscribe = window.electron.onAutoUpdaterEvent(
- (event: AppUpdaterEvents) => {
- setStatus(event);
-
- switch (event.type) {
- case "error":
- window.electron.continueToMainWindow();
- break;
- case "update-available":
- setNewVersion(event.info.version);
- break;
- case "update-cancelled":
- window.electron.continueToMainWindow();
- break;
- case "update-downloaded":
- window.electron.restartAndInstallUpdate();
- break;
- case "update-not-available":
- window.electron.continueToMainWindow();
- break;
- }
- }
- );
-
- window.electron.checkForUpdates();
-
- return () => {
- unsubscribe();
- };
- }, []);
-
- const renderUpdateInfo = () => {
- switch (status?.type) {
- case "download-progress":
- return (
- <>
- {t("downloading_version", { version: newVersion })}
-
- >
- );
- case "checking-for-updates":
- return {t("searching_updates")}
;
- case "update-available":
- return {t("update_found", { version: newVersion })}
;
- case "update-downloaded":
- return {t("restarting_and_applying")}
;
- default:
- return <>>;
- }
- };
-
- return (
-
-
-
-
- );
-}
diff --git a/src/types/index.ts b/src/types/index.ts
index 0abce31f..958708f2 100644
--- a/src/types/index.ts
+++ b/src/types/index.ts
@@ -1,5 +1,5 @@
import type { Downloader, GameStatus } from "@shared";
-import { ProgressInfo, UpdateInfo } from "electron-updater";
+import { UpdateInfo } from "electron-updater";
export type GameShop = "steam" | "epic";
export type CatalogueCategory = "recently_added" | "trending";
@@ -146,10 +146,5 @@ export interface SteamGame {
}
export type AppUpdaterEvents =
- | { type: "error" }
- | { type: "checking-for-updates" }
- | { type: "update-not-available" }
- | { type: "update-available"; info: UpdateInfo }
- | { type: "update-downloaded" }
- | { type: "download-progress"; info: ProgressInfo }
- | { type: "update-cancelled" };
+ | { type: "update-available"; info: Partial }
+ | { type: "update-downloaded" };