mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-03 08:43:48 +03:00
feat: show notification only when update is ready to install
This commit is contained in:
parent
b09f2c055f
commit
d2b3017de9
@ -200,8 +200,8 @@
|
|||||||
"repack_list_updated": "Repack list updated",
|
"repack_list_updated": "Repack list updated",
|
||||||
"repack_count_one": "{{count}} repack added",
|
"repack_count_one": "{{count}} repack added",
|
||||||
"repack_count_other": "{{count}} repacks added",
|
"repack_count_other": "{{count}} repacks added",
|
||||||
"new_version_title": "New Hydra version available",
|
"new_version_available": "New Hydra version available",
|
||||||
"new_version_body": "Restart Hydra to install the new version"
|
"restart_to_install_new_version": "Restart Hydra to install the new version"
|
||||||
},
|
},
|
||||||
"system_tray": {
|
"system_tray": {
|
||||||
"open": "Open Hydra",
|
"open": "Open Hydra",
|
||||||
|
@ -195,7 +195,9 @@
|
|||||||
"game_ready_to_install": "{{title}} está pronto para ser instalado",
|
"game_ready_to_install": "{{title}} está pronto para ser instalado",
|
||||||
"repack_list_updated": "Lista de repacks atualizada",
|
"repack_list_updated": "Lista de repacks atualizada",
|
||||||
"repack_count_one": "{{count}} novo repack",
|
"repack_count_one": "{{count}} novo repack",
|
||||||
"repack_count_other": "{{count}} novos repacks"
|
"repack_count_other": "{{count}} novos repacks",
|
||||||
|
"new_version_available": "Nova versão do Hydra disponível",
|
||||||
|
"restart_to_install_new_version": "Reinicie o Hydra para instalar a nova versão"
|
||||||
},
|
},
|
||||||
"system_tray": {
|
"system_tray": {
|
||||||
"open": "Abrir Hydra",
|
"open": "Abrir Hydra",
|
||||||
|
@ -3,10 +3,7 @@ import { registerEvent } from "../register-event";
|
|||||||
import updater, { UpdateInfo } from "electron-updater";
|
import updater, { UpdateInfo } from "electron-updater";
|
||||||
import { WindowManager } from "@main/services";
|
import { WindowManager } from "@main/services";
|
||||||
import { app } from "electron";
|
import { app } from "electron";
|
||||||
import {
|
import { publishNotificationUpdateReadyToInstall } from "@main/services/notifications";
|
||||||
publishNotificationUpdateAvailable,
|
|
||||||
publishNotificationUpdateReadyToInstall,
|
|
||||||
} from "@main/services/notifications";
|
|
||||||
|
|
||||||
const { autoUpdater } = updater;
|
const { autoUpdater } = updater;
|
||||||
|
|
||||||
@ -28,9 +25,6 @@ const checkForUpdates = async (_event: Electron.IpcMainInvokeEvent) => {
|
|||||||
autoUpdater
|
autoUpdater
|
||||||
.once("update-available", (info: UpdateInfo) => {
|
.once("update-available", (info: UpdateInfo) => {
|
||||||
sendEvent({ type: "update-available", info });
|
sendEvent({ type: "update-available", info });
|
||||||
if (!isAutoInstallAvailable) {
|
|
||||||
publishNotificationUpdateAvailable();
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.once("update-downloaded", () => {
|
.once("update-downloaded", () => {
|
||||||
sendEvent({ type: "update-downloaded" });
|
sendEvent({ type: "update-downloaded" });
|
||||||
|
@ -69,21 +69,10 @@ export const publishNewRepacksNotifications = async (count: number) => {
|
|||||||
|
|
||||||
export const publishNotificationUpdateReadyToInstall = async () => {
|
export const publishNotificationUpdateReadyToInstall = async () => {
|
||||||
new Notification({
|
new Notification({
|
||||||
title: t("new_version_title", {
|
title: t("new_version_available", {
|
||||||
ns: "notifications",
|
ns: "notifications",
|
||||||
}),
|
}),
|
||||||
body: t("new_version_body", {
|
body: t("restart_to_install_new_version", {
|
||||||
ns: "notifications",
|
|
||||||
}),
|
|
||||||
}).show();
|
|
||||||
};
|
|
||||||
|
|
||||||
export const publishNotificationUpdateAvailable = async () => {
|
|
||||||
new Notification({
|
|
||||||
title: t("new_version_title", {
|
|
||||||
ns: "notifications",
|
|
||||||
}),
|
|
||||||
body: t("new_version_body", {
|
|
||||||
ns: "notifications",
|
ns: "notifications",
|
||||||
}),
|
}),
|
||||||
}).show();
|
}).show();
|
||||||
|
Loading…
Reference in New Issue
Block a user