From cf428c7466f938a6ac34d1071995195b823d81fc Mon Sep 17 00:00:00 2001 From: Jay Sheen Date: Tue, 28 Oct 2025 19:25:22 +0900 Subject: [PATCH] =?UTF-8?q?=EC=95=B1=20=EB=B8=8C=EB=A6=AC=EC=A7=80=20?= =?UTF-8?q?=EB=A9=94=EC=86=8C=EB=93=9C=EB=AA=85=20=EB=B3=80=EA=B2=BD:=20up?= =?UTF-8?q?dateMessageCount=20->=20updateAlarmCount?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - updateMessageCount를 updateAlarmCount로 변경 - BridgeMessageType.UPDATE_MESSAGE_COUNT를 UPDATE_ALARM_COUNT로 변경 - header에서 알림 카운트 조회 시 네이티브 앱에 카운트 업데이트 적용 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/shared/lib/appBridge.ts | 6 +++--- src/types/bridge.ts | 4 ++-- src/utils/appBridge.ts | 6 +++--- src/widgets/navigation/header.tsx | 9 ++++++++- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/shared/lib/appBridge.ts b/src/shared/lib/appBridge.ts index fda242b..08f4cc2 100644 --- a/src/shared/lib/appBridge.ts +++ b/src/shared/lib/appBridge.ts @@ -166,9 +166,9 @@ class AppBridge { return this.sendMessage(BridgeMessageType.GET_LANGUAGE); } - // 메시지 카운트 업데이트 - async updateMessageCount(count: number): Promise { - return this.sendMessage(BridgeMessageType.UPDATE_MESSAGE_COUNT, { count }); + // 알림 카운트 업데이트 + async updateAlarmCount(count: number): Promise { + return this.sendMessage(BridgeMessageType.UPDATE_ALARM_COUNT, { count }); } // 네이티브 환경 체크 diff --git a/src/types/bridge.ts b/src/types/bridge.ts index de6b1df..f5fa197 100644 --- a/src/types/bridge.ts +++ b/src/types/bridge.ts @@ -64,8 +64,8 @@ export enum BridgeMessageType { SET_LANGUAGE = 'setLanguage', GET_LANGUAGE = 'getLanguage', - // 메시지 카운트 업데이트 - UPDATE_MESSAGE_COUNT = 'updateMessageCount', + // 알림 카운트 업데이트 + UPDATE_ALARM_COUNT = 'updateAlarmCount', // 푸시 알림 권한 확인 IS_PUSH_NOTIFICATION_ENABLED = 'isPushNotificationEnabled', diff --git a/src/utils/appBridge.ts b/src/utils/appBridge.ts index 8eb98aa..0527e5e 100644 --- a/src/utils/appBridge.ts +++ b/src/utils/appBridge.ts @@ -190,9 +190,9 @@ class AppBridge { return this.sendMessage(BridgeMessageType.GET_LANGUAGE); } - // 메시지 카운트 업데이트 - async updateMessageCount(count: number): Promise { - return this.sendMessage(BridgeMessageType.UPDATE_MESSAGE_COUNT, { count }); + // 알림 카운트 업데이트 + async updateAlarmCount(count: number): Promise { + return this.sendMessage(BridgeMessageType.UPDATE_ALARM_COUNT, { count }); } // 푸시 알림 권한 확인 diff --git a/src/widgets/navigation/header.tsx b/src/widgets/navigation/header.tsx index 10e6244..f1798fc 100644 --- a/src/widgets/navigation/header.tsx +++ b/src/widgets/navigation/header.tsx @@ -2,7 +2,7 @@ import { useNavigate } from '@/shared/lib/hooks/use-navigate'; import { Menu } from '@/shared/ui/menu'; import { IMAGE_ROOT } from '@/shared/constants/common'; import { PATHS } from '@/shared/constants/paths'; -import { +import { HeaderType, HeaderNavigationProps } from '@/entities/common/model/types'; @@ -10,6 +10,7 @@ import { useStore } from '@/shared/model/store'; import { ChangeEvent, useEffect, useState } from 'react'; import { AppAlarmUnreadCountParams, AppAlarmUnreadCountResponse, MERCHANT_ADMIN_APP } from '@/entities/alarm/model/types'; import { useAppAlarmUnreadCountMutation } from '@/entities/alarm/api/use-app-alarm-unread-count-mutation'; +import { appBridge } from '@/utils/appBridge'; export const HeaderNavigation = ({ onBack, @@ -63,6 +64,12 @@ export const HeaderNavigation = ({ }; appAlarmUnreadCount(params).then((rs: AppAlarmUnreadCountResponse) => { setUnreadCount(rs.unreadCount); + // 네이티브 앱에 알림 카운트 업데이트 + if(appBridge.isNativeEnvironment()){ + appBridge.updateAlarmCount(rs.unreadCount).catch((error) => { + console.error('Failed to update alarm count:', error); + }); + } }); } };