feat: 포그라운드 푸시 알림 소리 추가
- Capacitor 패키지 추가 (@capacitor/core, @capacitor/push-notifications) - 포그라운드에서 푸시 수신 시 알림 소리 재생 - 알림 소리 파일 추가 (push_notification.wav)
This commit is contained in:
@@ -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));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user