feat: use sound lib

This commit is contained in:
Zamitto 2024-10-29 22:17:45 -03:00
parent 9fa9f6d85a
commit 39f731352f
2 changed files with 13 additions and 7 deletions

View file

@ -51,7 +51,7 @@
"color.js": "^1.2.0", "color.js": "^1.2.0",
"create-desktop-shortcuts": "^1.11.0", "create-desktop-shortcuts": "^1.11.0",
"date-fns": "^3.6.0", "date-fns": "^3.6.0",
"dexie": "^4.0.8", "dexie": "^4.0.9",
"electron-log": "^5.2.0", "electron-log": "^5.2.0",
"electron-updater": "^6.3.9", "electron-updater": "^6.3.9",
"flexsearch": "^0.7.43", "flexsearch": "^0.7.43",
@ -64,12 +64,12 @@
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"lottie-react": "^2.4.0", "lottie-react": "^2.4.0",
"parse-torrent": "^11.0.17", "parse-torrent": "^11.0.17",
"piscina": "^4.5.1",
"react-hook-form": "^7.53.0", "react-hook-form": "^7.53.0",
"react-i18next": "^14.1.0", "react-i18next": "^14.1.0",
"react-loading-skeleton": "^3.4.0", "react-loading-skeleton": "^3.4.0",
"react-redux": "^9.1.1", "react-redux": "^9.1.1",
"react-router-dom": "^6.22.3", "react-router-dom": "^6.22.3",
"piscina": "^4.7.0",
"sudo-prompt": "^9.2.1", "sudo-prompt": "^9.2.1",
"tar": "^7.4.3", "tar": "^7.4.3",
"typeorm": "^0.3.20", "typeorm": "^0.3.20",
@ -79,10 +79,11 @@
"zod": "^3.23.8" "zod": "^3.23.8"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^19.3.0", "@types/sound-play": "^1.1.3",
"@commitlint/config-conventional": "^19.2.2", "@commitlint/cli": "^19.5.0",
"@commitlint/config-conventional": "^19.5.0",
"@electron-toolkit/eslint-config-prettier": "^2.0.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", "@electron-toolkit/tsconfig": "^1.0.1",
"@sentry/vite-plugin": "^2.20.1", "@sentry/vite-plugin": "^2.20.1",
"@swc/core": "^1.4.16", "@swc/core": "^1.4.16",

View file

@ -8,6 +8,7 @@ import { Toast } from "powertoast";
import fs from "node:fs"; import fs from "node:fs";
import axios from "axios"; import axios from "axios";
import path from "node:path"; import path from "node:path";
import sound from "sound-play";
const getGameIconNativeImage = async (gameId: number) => { const getGameIconNativeImage = async (gameId: number) => {
try { try {
@ -100,11 +101,15 @@ export const publishNewAchievementNotification = async (achievement: {
title: "New achievement unlocked", title: "New achievement unlocked",
message: achievement.displayName, message: achievement.displayName,
icon: iconPath, icon: iconPath,
sound: true, silent: true,
audio: "ms-appx:///resources/achievement.wav",
progress: { progress: {
value: 30, value: 30,
valueOverride: "30/100 achievements", valueOverride: "30/100 achievements",
}, },
}).show(); }).show();
const audioPath = path.join(app.getAppPath(), "resources", "achievement.wav");
console.log(audioPath);
sound.play(audioPath);
}; };