feat: 포그라운드 푸시 알림 소리 추가

- Capacitor 패키지 추가 (@capacitor/core, @capacitor/push-notifications)
- 포그라운드에서 푸시 수신 시 알림 소리 재생
- 알림 소리 파일 추가 (push_notification.wav)
This commit is contained in:
2025-12-23 08:49:07 +09:00
parent a332e0cee4
commit 03cf96d4bb
4 changed files with 32 additions and 1 deletions

21
package-lock.json generated
View File

@@ -5,6 +5,8 @@
"packages": { "packages": {
"": { "": {
"dependencies": { "dependencies": {
"@capacitor/core": "^8.0.0",
"@capacitor/push-notifications": "^8.0.0",
"htmx.org": "^2.0.8" "htmx.org": "^2.0.8"
}, },
"devDependencies": { "devDependencies": {
@@ -32,6 +34,24 @@
"url": "https://github.com/sponsors/sindresorhus" "url": "https://github.com/sponsors/sindresorhus"
} }
}, },
"node_modules/@capacitor/core": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/@capacitor/core/-/core-8.0.0.tgz",
"integrity": "sha512-250HTVd/W/KdMygoqaedisvNbHbpbQTN2Hy/8ZYGm1nAqE0Fx7sGss4l0nDg33STxEdDhtVRoL2fIaaiukKseA==",
"license": "MIT",
"dependencies": {
"tslib": "^2.1.0"
}
},
"node_modules/@capacitor/push-notifications": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/@capacitor/push-notifications/-/push-notifications-8.0.0.tgz",
"integrity": "sha512-xJWQLqAfC8b2ETqAPmwDnkKB4t/lVrbYc2D8VpA2fSu10JFSL/R722Vk0Lfl9Lo9WusmyIiQbVfILNQ3iFNGKw==",
"license": "MIT",
"peerDependencies": {
"@capacitor/core": ">=8.0.0"
}
},
"node_modules/@esbuild/aix-ppc64": { "node_modules/@esbuild/aix-ppc64": {
"version": "0.25.12", "version": "0.25.12",
"resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz",
@@ -2607,7 +2627,6 @@
"version": "2.8.1", "version": "2.8.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"dev": true,
"license": "0BSD" "license": "0BSD"
}, },
"node_modules/update-browserslist-db": { "node_modules/update-browserslist-db": {

View File

@@ -18,6 +18,8 @@
"vite": "^7.0.7" "vite": "^7.0.7"
}, },
"dependencies": { "dependencies": {
"@capacitor/core": "^8.0.0",
"@capacitor/push-notifications": "^8.0.0",
"htmx.org": "^2.0.8" "htmx.org": "^2.0.8"
} }
} }

Binary file not shown.

View File

@@ -1,5 +1,15 @@
import './bootstrap'; import './bootstrap';
import htmx from 'htmx.org'; import htmx from 'htmx.org';
import { Capacitor } from '@capacitor/core';
import { PushNotifications } from '@capacitor/push-notifications';
// HTMX를 전역으로 설정 // HTMX를 전역으로 설정
window.htmx = htmx; window.htmx = htmx;
// Capacitor 앱에서만 실행 (포그라운드 푸시 알림 소리)
if (Capacitor.isNativePlatform()) {
PushNotifications.addListener('pushNotificationReceived', (notification) => {
const audio = new Audio('/sounds/push_notification.wav');
audio.play().catch(e => console.log('Audio play failed:', e));
});
}