mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: creating notification for update available
This commit is contained in:
parent
4be3db8007
commit
b09f2c055f
4 changed files with 38 additions and 7 deletions
|
@ -3,6 +3,10 @@ import { registerEvent } from "../register-event";
|
|||
import updater, { UpdateInfo } from "electron-updater";
|
||||
import { WindowManager } from "@main/services";
|
||||
import { app } from "electron";
|
||||
import {
|
||||
publishNotificationUpdateAvailable,
|
||||
publishNotificationUpdateReadyToInstall,
|
||||
} from "@main/services/notifications";
|
||||
|
||||
const { autoUpdater } = updater;
|
||||
|
||||
|
@ -24,14 +28,18 @@ const checkForUpdates = async (_event: Electron.IpcMainInvokeEvent) => {
|
|||
autoUpdater
|
||||
.once("update-available", (info: UpdateInfo) => {
|
||||
sendEvent({ type: "update-available", info });
|
||||
if (!isAutoInstallAvailable) {
|
||||
publishNotificationUpdateAvailable();
|
||||
}
|
||||
})
|
||||
.once("update-downloaded", () => {
|
||||
sendEvent({ type: "update-downloaded" });
|
||||
publishNotificationUpdateReadyToInstall();
|
||||
});
|
||||
|
||||
if (app.isPackaged) {
|
||||
autoUpdater.autoDownload = isAutoInstallAvailable;
|
||||
autoUpdater.checkForUpdatesAndNotify();
|
||||
autoUpdater.checkForUpdates();
|
||||
} else if (sendEventsForDebug) {
|
||||
mockValuesForDebug();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue