fix : 일반 알림 포어그라운드 수신 Firebase onMessage로 교체#127
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the usePushNotification hook to use Firebase's onMessage handler for foreground notifications, resolving potential conflicts with expo-notifications. However, the updated logic introduces a bug where notifications without a defined type are ignored. A code suggestion has been provided to ensure only tracking-specific notifications are filtered out, preserving the display of standard notifications.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| const type = remoteMessage.data?.type; | ||
| if (!type || TRACKING_TYPES.has(type)) return; |
There was a problem hiding this comment.
기존 구현에서는 data?.type이 없더라도 알림을 정상적으로 표시했으나, 변경된 코드에서는 !type 조건으로 인해 type이 없는 일반 알림(예: Firebase 콘솔에서 테스트로 발송한 알림이나 data 페이로드가 없는 순수 알림)이 포어그라운드에서 무시되는 문제가 발생합니다.\n\ntype이 존재하고 TRACKING_TYPES에 포함된 경우에만 제외하도록 조건을 수정해야 합니다.
| const type = remoteMessage.data?.type; | |
| if (!type || TRACKING_TYPES.has(type)) return; | |
| const type = remoteMessage.data?.type; | |
| if (type && TRACKING_TYPES.has(type)) return; |
요약
addNotificationReceivedListener→ FirebaseonMessage로 교체addNotificationReceivedListener는 포어그라운드 FCM을 받지 못하는 문제 수정변경 파일
hooks/use-push-notification.ts— 포어그라운드 FCM 수신을 FirebaseonMessage로 처리, 트래킹 타입 제외 후 시스템 배너 표시역할 분리
use-push-notification.tsuse-tracking-fcm.tsTRACKING_PHOTO_MILESTONE,TRACKING_SUMMIT_REACHED테스트 체크리스트