diff --git a/package-lock.json b/package-lock.json index d0b4d1c2..f543a0c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,8 @@ "packages": { "": { "dependencies": { + "@capacitor/core": "^8.0.0", + "@capacitor/push-notifications": "^8.0.0", "htmx.org": "^2.0.8" }, "devDependencies": { @@ -32,6 +34,24 @@ "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": { "version": "0.25.12", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", @@ -2607,7 +2627,6 @@ "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", - "dev": true, "license": "0BSD" }, "node_modules/update-browserslist-db": { diff --git a/package.json b/package.json index f385d0fa..bccf5d64 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,8 @@ "vite": "^7.0.7" }, "dependencies": { + "@capacitor/core": "^8.0.0", + "@capacitor/push-notifications": "^8.0.0", "htmx.org": "^2.0.8" } } diff --git a/public/sounds/push_notification.wav b/public/sounds/push_notification.wav new file mode 100644 index 00000000..59238b1b Binary files /dev/null and b/public/sounds/push_notification.wav differ diff --git a/resources/js/app.js b/resources/js/app.js index 1138a52b..897f935e 100644 --- a/resources/js/app.js +++ b/resources/js/app.js @@ -1,5 +1,15 @@ import './bootstrap'; import htmx from 'htmx.org'; +import { Capacitor } from '@capacitor/core'; +import { PushNotifications } from '@capacitor/push-notifications'; // 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)); + }); +}