Skip to content

fix : 일반 알림 포어그라운드 수신 Firebase onMessage로 교체#127

Merged
JioCoder merged 4 commits into
mainfrom
fix/tracking-fcm-notification
Jun 4, 2026
Merged

fix : 일반 알림 포어그라운드 수신 Firebase onMessage로 교체#127
JioCoder merged 4 commits into
mainfrom
fix/tracking-fcm-notification

Conversation

@JioCoder

@JioCoder JioCoder commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

요약

  • 일반 알림 포어그라운드 수신 경로를 addNotificationReceivedListener → Firebase onMessage로 교체
  • Firebase SDK가 FCM을 가로채는 구조에서 addNotificationReceivedListener는 포어그라운드 FCM을 받지 못하는 문제 수정

변경 파일

  • hooks/use-push-notification.ts — 포어그라운드 FCM 수신을 Firebase onMessage로 처리, 트래킹 타입 제외 후 시스템 배너 표시

역할 분리

처리 대상 동작
use-push-notification.ts 커뮤니티, 세모피드 등 일반 알림 포어그라운드 시스템 배너 표시
use-tracking-fcm.ts TRACKING_PHOTO_MILESTONE, TRACKING_SUMMIT_REACHED 인앱 PhotoWindowBanner 표시

테스트 체크리스트

  • 포어그라운드에서 커뮤니티 알림 시스템 배너 정상 표시 확인
  • 포어그라운드에서 트래킹 마일스톤 알림 중복 배너 없는지 확인
  • 백그라운드 알림 정상 수신 확인

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread hooks/use-push-notification.ts Outdated
Comment on lines +33 to +34
const type = remoteMessage.data?.type;
if (!type || TRACKING_TYPES.has(type)) return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

기존 구현에서는 data?.type이 없더라도 알림을 정상적으로 표시했으나, 변경된 코드에서는 !type 조건으로 인해 type이 없는 일반 알림(예: Firebase 콘솔에서 테스트로 발송한 알림이나 data 페이로드가 없는 순수 알림)이 포어그라운드에서 무시되는 문제가 발생합니다.\n\ntype이 존재하고 TRACKING_TYPES에 포함된 경우에만 제외하도록 조건을 수정해야 합니다.

Suggested change
const type = remoteMessage.data?.type;
if (!type || TRACKING_TYPES.has(type)) return;
const type = remoteMessage.data?.type;
if (type && TRACKING_TYPES.has(type)) return;

@JioCoder JioCoder merged commit 75f3b99 into main Jun 4, 2026
2 checks passed
@JioCoder JioCoder deleted the fix/tracking-fcm-notification branch June 4, 2026 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant