From 39f731352f3038083fb6885107c1a14ec230b091 Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Tue, 29 Oct 2024 22:17:45 -0300 Subject: [PATCH] feat: use sound lib --- package.json | 11 ++++++----- src/main/services/notifications.ts | 9 +++++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 0fce540b..4096775f 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "color.js": "^1.2.0", "create-desktop-shortcuts": "^1.11.0", "date-fns": "^3.6.0", - "dexie": "^4.0.8", + "dexie": "^4.0.9", "electron-log": "^5.2.0", "electron-updater": "^6.3.9", "flexsearch": "^0.7.43", @@ -64,12 +64,12 @@ "lodash-es": "^4.17.21", "lottie-react": "^2.4.0", "parse-torrent": "^11.0.17", - "piscina": "^4.5.1", "react-hook-form": "^7.53.0", "react-i18next": "^14.1.0", "react-loading-skeleton": "^3.4.0", "react-redux": "^9.1.1", "react-router-dom": "^6.22.3", + "piscina": "^4.7.0", "sudo-prompt": "^9.2.1", "tar": "^7.4.3", "typeorm": "^0.3.20", @@ -79,10 +79,11 @@ "zod": "^3.23.8" }, "devDependencies": { - "@commitlint/cli": "^19.3.0", - "@commitlint/config-conventional": "^19.2.2", + "@types/sound-play": "^1.1.3", + "@commitlint/cli": "^19.5.0", + "@commitlint/config-conventional": "^19.5.0", "@electron-toolkit/eslint-config-prettier": "^2.0.0", - "@electron-toolkit/eslint-config-ts": "^1.0.1", + "@electron-toolkit/eslint-config-ts": "^2.0.0", "@electron-toolkit/tsconfig": "^1.0.1", "@sentry/vite-plugin": "^2.20.1", "@swc/core": "^1.4.16", diff --git a/src/main/services/notifications.ts b/src/main/services/notifications.ts index 70e8a71f..3ff53ca0 100644 --- a/src/main/services/notifications.ts +++ b/src/main/services/notifications.ts @@ -8,6 +8,7 @@ import { Toast } from "powertoast"; import fs from "node:fs"; import axios from "axios"; import path from "node:path"; +import sound from "sound-play"; const getGameIconNativeImage = async (gameId: number) => { try { @@ -100,11 +101,15 @@ export const publishNewAchievementNotification = async (achievement: { title: "New achievement unlocked", message: achievement.displayName, icon: iconPath, - sound: true, - audio: "ms-appx:///resources/achievement.wav", + silent: true, progress: { value: 30, valueOverride: "30/100 achievements", }, }).show(); + + const audioPath = path.join(app.getAppPath(), "resources", "achievement.wav"); + + console.log(audioPath); + sound.play(audioPath); };