mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-22 02:13:59 +00:00
feat: show notification only when update is ready to install
This commit is contained in:
@@ -3,10 +3,7 @@ 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";
|
||||
import { publishNotificationUpdateReadyToInstall } from "@main/services/notifications";
|
||||
|
||||
const { autoUpdater } = updater;
|
||||
|
||||
@@ -28,9 +25,6 @@ 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" });
|
||||
|
||||
@@ -69,21 +69,10 @@ export const publishNewRepacksNotifications = async (count: number) => {
|
||||
|
||||
export const publishNotificationUpdateReadyToInstall = async () => {
|
||||
new Notification({
|
||||
title: t("new_version_title", {
|
||||
title: t("new_version_available", {
|
||||
ns: "notifications",
|
||||
}),
|
||||
body: t("new_version_body", {
|
||||
ns: "notifications",
|
||||
}),
|
||||
}).show();
|
||||
};
|
||||
|
||||
export const publishNotificationUpdateAvailable = async () => {
|
||||
new Notification({
|
||||
title: t("new_version_title", {
|
||||
ns: "notifications",
|
||||
}),
|
||||
body: t("new_version_body", {
|
||||
body: t("restart_to_install_new_version", {
|
||||
ns: "notifications",
|
||||
}),
|
||||
}).show();
|
||||
|
||||
Reference in New Issue
Block a user