diff --git a/frontend/src/stores/notification.store.ts b/frontend/src/stores/notification.store.ts index 676d425..ae2ca60 100644 --- a/frontend/src/stores/notification.store.ts +++ b/frontend/src/stores/notification.store.ts @@ -6,13 +6,11 @@ import { DEFAULT_PAGE_SIZE } from '@/types/pagination' import { escapeHtml, relativeTimeKo, taskDueInfo } from '@/shared/utils/format' import type { ApiNotification, NotificationView } from '@/types/notification' -// Level1 — 페이지가 열려 있을 때(특히 백그라운드 탭/최소화) OS 토스트. -// 포커스 상태면 인앱 종 알림만(active 사용자 방해 금지). 닫혀 있으면 서비스워커 푸시가 담당. +// Level1 — 페이지가 열려 있으면(포커스 여부 무관) 항상 OS 토스트를 띄운다. +// 페이지가 닫혀 있을 때는 서비스워커 푸시가 담당(SW 는 열린 탭이 있으면 표시 생략 → 중복 방지). function showLocalNotification(view: NotificationView): void { if (typeof Notification === 'undefined') return if (Notification.permission !== 'granted') return - if (typeof document !== 'undefined' && document.visibilityState === 'visible') - return try { const notif = new Notification('Relay', { body: view.text, @@ -194,7 +192,7 @@ export const useNotificationStore = defineStore('notification', () => { items.value.unshift(n) total.value += 1 if (!n.read) unreadCount.value += 1 - // OS 토스트(Level1) — 백그라운드/최소화 상태일 때만 + // OS 토스트(Level1) — 페이지가 열려 있으면 포커스 여부와 무관하게 표시 showLocalNotification(toView(n)) } catch { // 파싱 실패(하트비트 등 비정상 페이로드) 무시