feat: add version string to notification

This commit is contained in:
Zamitto 2024-07-05 12:30:34 -03:00
parent 9e7b27afe6
commit b7f94102da
6 changed files with 14 additions and 6 deletions

View File

@ -200,7 +200,7 @@
"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_update_available": "New update available", "new_update_available": "Version {{version}} available",
"restart_to_install_update": "Restart Hydra to install the update" "restart_to_install_update": "Restart Hydra to install the update"
}, },
"system_tray": { "system_tray": {

View File

@ -199,7 +199,8 @@
"game_ready_to_install": "{{title}} está listo para instalarse", "game_ready_to_install": "{{title}} está listo para instalarse",
"repack_list_updated": "Lista de repacks actualizadas", "repack_list_updated": "Lista de repacks actualizadas",
"repack_count_one": "{{count}} repack ha sido añadido", "repack_count_one": "{{count}} repack ha sido añadido",
"repack_count_other": "{{count}} repacks añadidos" "repack_count_other": "{{count}} repacks añadidos",
"new_update_available": "Version {{version}} disponible"
}, },
"system_tray": { "system_tray": {
"open": "Abrir Hydra", "open": "Abrir Hydra",

View File

@ -196,7 +196,7 @@
"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_update_available": "Nova versão disponível", "new_update_available": "Versão {{version}} disponível",
"restart_to_install_update": "Reinicie o Hydra para instalar a nova versão" "restart_to_install_update": "Reinicie o Hydra para instalar a nova versão"
}, },
"system_tray": { "system_tray": {

View File

@ -197,7 +197,8 @@
"game_ready_to_install": "{{title}} готова к установке", "game_ready_to_install": "{{title}} готова к установке",
"repack_list_updated": "Список репаков обновлен", "repack_list_updated": "Список репаков обновлен",
"repack_count_one": "{{count}} репак добавлен", "repack_count_one": "{{count}} репак добавлен",
"repack_count_other": "{{count}} репаков добавлено" "repack_count_other": "{{count}} репаков добавлено",
"new_update_available": "Доступна версия {{version}}"
}, },
"system_tray": { "system_tray": {
"open": "Открыть Hydra", "open": "Открыть Hydra",

View File

@ -21,14 +21,17 @@ const mockValuesForDebug = () => {
sendEvent({ type: "update-downloaded" }); sendEvent({ type: "update-downloaded" });
}; };
const newVersionInfo = { version: "" };
const checkForUpdates = async (_event: Electron.IpcMainInvokeEvent) => { 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 });
newVersionInfo.version = info.version;
}) })
.once("update-downloaded", () => { .once("update-downloaded", () => {
sendEvent({ type: "update-downloaded" }); sendEvent({ type: "update-downloaded" });
publishNotificationUpdateReadyToInstall(); publishNotificationUpdateReadyToInstall(newVersionInfo.version);
}); });
if (app.isPackaged) { if (app.isPackaged) {

View File

@ -67,10 +67,13 @@ export const publishNewRepacksNotifications = async (count: number) => {
} }
}; };
export const publishNotificationUpdateReadyToInstall = async () => { export const publishNotificationUpdateReadyToInstall = async (
version: string
) => {
new Notification({ new Notification({
title: t("new_update_available", { title: t("new_update_available", {
ns: "notifications", ns: "notifications",
version,
}), }),
body: t("restart_to_install_update", { body: t("restart_to_install_update", {
ns: "notifications", ns: "notifications",