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_count_one": "{{count}} repack 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"
},
"system_tray": {

View File

@ -199,7 +199,8 @@
"game_ready_to_install": "{{title}} está listo para instalarse",
"repack_list_updated": "Lista de repacks actualizadas",
"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": {
"open": "Abrir Hydra",

View File

@ -196,7 +196,7 @@
"repack_list_updated": "Lista de repacks atualizada",
"repack_count_one": "{{count}} novo repack",
"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"
},
"system_tray": {

View File

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

View File

@ -21,14 +21,17 @@ const mockValuesForDebug = () => {
sendEvent({ type: "update-downloaded" });
};
const newVersionInfo = { version: "" };
const checkForUpdates = async (_event: Electron.IpcMainInvokeEvent) => {
autoUpdater
.once("update-available", (info: UpdateInfo) => {
sendEvent({ type: "update-available", info });
newVersionInfo.version = info.version;
})
.once("update-downloaded", () => {
sendEvent({ type: "update-downloaded" });
publishNotificationUpdateReadyToInstall();
publishNotificationUpdateReadyToInstall(newVersionInfo.version);
});
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({
title: t("new_update_available", {
ns: "notifications",
version,
}),
body: t("restart_to_install_update", {
ns: "notifications",