From 9eb90bac622f0f9465804bd5f89948a03fcc0cde Mon Sep 17 00:00:00 2001 From: Chubby Granny Chaser Date: Wed, 5 Jun 2024 14:20:32 +0100 Subject: [PATCH] feat: moving notifications --- src/main/services/notifications.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/services/notifications.ts b/src/main/services/notifications.ts index 0eb60c0d..127399f5 100644 --- a/src/main/services/notifications.ts +++ b/src/main/services/notifications.ts @@ -22,3 +22,23 @@ export const publishDownloadCompleteNotification = async (game: Game) => { }).show(); } }; + +export const publishNewRepacksNotifications = async (count: number) => { + const userPreferences = await userPreferencesRepository.findOne({ + where: { id: 1 }, + }); + + if (count > 0 && userPreferences?.repackUpdatesNotificationsEnabled) { + new Notification({ + title: t("repack_list_updated", { + ns: "notifications", + lng: userPreferences?.language || "en", + }), + body: t("repack_count", { + ns: "notifications", + lng: userPreferences?.language || "en", + count: count, + }), + }).show(); + } +};