Files
sam-manage/resources/js/app.js
hskwon 03cf96d4bb feat: 포그라운드 푸시 알림 소리 추가
- Capacitor 패키지 추가 (@capacitor/core, @capacitor/push-notifications)
- 포그라운드에서 푸시 수신 시 알림 소리 재생
- 알림 소리 파일 추가 (push_notification.wav)
2025-12-23 08:49:07 +09:00

16 lines
553 B
JavaScript

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));
});
}