mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 00:33:49 +03:00
fix: missing first call on check for updates
This commit is contained in:
parent
e4fefdedb6
commit
8f1acb48a0
@ -1,7 +1,7 @@
|
||||
import type { AppUpdaterEvent } from "@types";
|
||||
import { registerEvent } from "../register-event";
|
||||
import updater, { UpdateInfo } from "electron-updater";
|
||||
import { WindowManager } from "@main/services";
|
||||
import { logger, WindowManager } from "@main/services";
|
||||
import { app } from "electron";
|
||||
import { publishNotificationUpdateReadyToInstall } from "@main/services/notifications";
|
||||
|
||||
@ -36,7 +36,9 @@ const checkForUpdates = async (_event: Electron.IpcMainInvokeEvent) => {
|
||||
|
||||
if (app.isPackaged) {
|
||||
autoUpdater.autoDownload = isAutoInstallAvailable;
|
||||
autoUpdater.checkForUpdates();
|
||||
autoUpdater.checkForUpdates().then((result) => {
|
||||
logger.log(`Check for updates result: ${result}`);
|
||||
});
|
||||
} else if (sendEventsForDebug) {
|
||||
mockValuesForDebug();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { SyncIcon } from "@primer/octicons-react";
|
||||
import { Link } from "../link/link";
|
||||
import * as styles from "./header.css";
|
||||
@ -40,18 +40,22 @@ export function AutoUpdateSubHeader() {
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const checkInterval = setInterval(() => {
|
||||
const checkForUpdates = useCallback(() => {
|
||||
window.electron.checkForUpdates().then((isAutoInstallAvailable) => {
|
||||
console.log("checking for updates");
|
||||
setIsAutoInstallAvailable(isAutoInstallAvailable);
|
||||
});
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
checkForUpdates();
|
||||
const checkInterval = setInterval(() => {
|
||||
checkForUpdates();
|
||||
}, CHECK_FOR_UPDATES_INTERVAL);
|
||||
|
||||
return () => {
|
||||
clearInterval(checkInterval);
|
||||
};
|
||||
}, []);
|
||||
}, [checkForUpdates]);
|
||||
|
||||
if (!newVersion) return null;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user