From 3adb596511e6e7b0b70487835fb15340e648f299 Mon Sep 17 00:00:00 2001 From: ttipo Date: Wed, 1 Jul 2026 01:13:17 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=8D=B0=EC=8A=A4=ED=81=AC=ED=86=B1=20?= =?UTF-8?q?=EC=95=8C=EB=A6=BC=EC=9D=84=20=ED=8F=AC=EC=BB=A4=EC=8A=A4=20?= =?UTF-8?q?=EC=A4=91=EC=97=90=EB=8F=84=20=ED=95=AD=EC=83=81=20=ED=91=9C?= =?UTF-8?q?=EC=8B=9C=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 기존엔 받는 사람이 앱 화면을 보고 있으면(포커스) OS 토스트를 띄우지 않고 종 알림만 갱신했으나, 화면을 보고 있어도 토스트가 뜨도록 변경한다. 서비스워커의 중복 방지(열린 탭 있으면 표시 생략)는 그대로라 토스트는 여전히 1개다. Co-Authored-By: Claude Opus 4.8 (1M context) --- frontend/src/stores/notification.store.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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 { // 파싱 실패(하트비트 등 비정상 페이로드) 무시