앱 브리지 메소드명 변경: updateMessageCount -> updateAlarmCount
- updateMessageCount를 updateAlarmCount로 변경 - BridgeMessageType.UPDATE_MESSAGE_COUNT를 UPDATE_ALARM_COUNT로 변경 - header에서 알림 카운트 조회 시 네이티브 앱에 카운트 업데이트 적용 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -166,9 +166,9 @@ class AppBridge {
|
|||||||
return this.sendMessage(BridgeMessageType.GET_LANGUAGE);
|
return this.sendMessage(BridgeMessageType.GET_LANGUAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 메시지 카운트 업데이트
|
// 알림 카운트 업데이트
|
||||||
async updateMessageCount(count: number): Promise<void> {
|
async updateAlarmCount(count: number): Promise<void> {
|
||||||
return this.sendMessage(BridgeMessageType.UPDATE_MESSAGE_COUNT, { count });
|
return this.sendMessage(BridgeMessageType.UPDATE_ALARM_COUNT, { count });
|
||||||
}
|
}
|
||||||
|
|
||||||
// 네이티브 환경 체크
|
// 네이티브 환경 체크
|
||||||
|
|||||||
@@ -64,8 +64,8 @@ export enum BridgeMessageType {
|
|||||||
SET_LANGUAGE = 'setLanguage',
|
SET_LANGUAGE = 'setLanguage',
|
||||||
GET_LANGUAGE = 'getLanguage',
|
GET_LANGUAGE = 'getLanguage',
|
||||||
|
|
||||||
// 메시지 카운트 업데이트
|
// 알림 카운트 업데이트
|
||||||
UPDATE_MESSAGE_COUNT = 'updateMessageCount',
|
UPDATE_ALARM_COUNT = 'updateAlarmCount',
|
||||||
|
|
||||||
// 푸시 알림 권한 확인
|
// 푸시 알림 권한 확인
|
||||||
IS_PUSH_NOTIFICATION_ENABLED = 'isPushNotificationEnabled',
|
IS_PUSH_NOTIFICATION_ENABLED = 'isPushNotificationEnabled',
|
||||||
|
|||||||
@@ -190,9 +190,9 @@ class AppBridge {
|
|||||||
return this.sendMessage(BridgeMessageType.GET_LANGUAGE);
|
return this.sendMessage(BridgeMessageType.GET_LANGUAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 메시지 카운트 업데이트
|
// 알림 카운트 업데이트
|
||||||
async updateMessageCount(count: number): Promise<void> {
|
async updateAlarmCount(count: number): Promise<void> {
|
||||||
return this.sendMessage(BridgeMessageType.UPDATE_MESSAGE_COUNT, { count });
|
return this.sendMessage(BridgeMessageType.UPDATE_ALARM_COUNT, { count });
|
||||||
}
|
}
|
||||||
|
|
||||||
// 푸시 알림 권한 확인
|
// 푸시 알림 권한 확인
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { useStore } from '@/shared/model/store';
|
|||||||
import { ChangeEvent, useEffect, useState } from 'react';
|
import { ChangeEvent, useEffect, useState } from 'react';
|
||||||
import { AppAlarmUnreadCountParams, AppAlarmUnreadCountResponse, MERCHANT_ADMIN_APP } from '@/entities/alarm/model/types';
|
import { AppAlarmUnreadCountParams, AppAlarmUnreadCountResponse, MERCHANT_ADMIN_APP } from '@/entities/alarm/model/types';
|
||||||
import { useAppAlarmUnreadCountMutation } from '@/entities/alarm/api/use-app-alarm-unread-count-mutation';
|
import { useAppAlarmUnreadCountMutation } from '@/entities/alarm/api/use-app-alarm-unread-count-mutation';
|
||||||
|
import { appBridge } from '@/utils/appBridge';
|
||||||
|
|
||||||
export const HeaderNavigation = ({
|
export const HeaderNavigation = ({
|
||||||
onBack,
|
onBack,
|
||||||
@@ -63,6 +64,12 @@ export const HeaderNavigation = ({
|
|||||||
};
|
};
|
||||||
appAlarmUnreadCount(params).then((rs: AppAlarmUnreadCountResponse) => {
|
appAlarmUnreadCount(params).then((rs: AppAlarmUnreadCountResponse) => {
|
||||||
setUnreadCount(rs.unreadCount);
|
setUnreadCount(rs.unreadCount);
|
||||||
|
// 네이티브 앱에 알림 카운트 업데이트
|
||||||
|
if(appBridge.isNativeEnvironment()){
|
||||||
|
appBridge.updateAlarmCount(rs.unreadCount).catch((error) => {
|
||||||
|
console.error('Failed to update alarm count:', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user