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