Skip to content

refactor: 푸시 알림 토큰 로직 브릿지 방식으로 수정#134

Merged
ff1451 merged 2 commits intodevelopfrom
133-refactor-푸시-알림-토큰-로직-브릿지-형식-및-네이티브-처리로-변경
Feb 25, 2026

Hidden character warning

The head ref may contain hidden characters: "133-refactor-\ud478\uc2dc-\uc54c\ub9bc-\ud1a0\ud070-\ub85c\uc9c1-\ube0c\ub9bf\uc9c0-\ud615\uc2dd-\ubc0f-\ub124\uc774\ud2f0\ube0c-\ucc98\ub9ac\ub85c-\ubcc0\uacbd"
Merged

refactor: 푸시 알림 토큰 로직 브릿지 방식으로 수정#134
ff1451 merged 2 commits intodevelopfrom
133-refactor-푸시-알림-토큰-로직-브릿지-형식-및-네이티브-처리로-변경

Conversation

@ff1451
Copy link
Copy Markdown
Collaborator

@ff1451 ff1451 commented Feb 25, 2026

테스트를 위해 일단 머지 후 추후 재리뷰하겠습니다.

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능

    • 모바일(React Native) 연동 개선: 토큰 갱신, 로그인 완료, 로그아웃 시 모바일 쪽으로 상태 메시지 전송 추가
  • 리팩토링

    • 모바일 환경에서의 푸시 토큰 등록 로직 제거
    • 인증 초기화 절차 단순화로 초기 로딩/인증 성능 향상

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 25, 2026

📝 Walkthrough

Walkthrough

React Native WebView 브릿지 통합을 위해 웹 푸시 토큰 등록 로직을 제거하고, 인증 흐름에서 브리지로 메시지를 전송하도록 변경했습니다. accessToken 갱신 시, 로그인 완료 시, 로그아웃 시에 window.ReactNativeWebView.postMessage로 각각 TOKEN_REFRESH, LOGIN_COMPLETE, LOGOUT 타입 메시지를 전달합니다. notification 등록 함수는 브리지 존재 시 POST 호출을 건너뜁니다. 전역 타입 정의(global.d.ts)에 Window.ReactNativeWebView의 postMessage 시그니처를 추가했습니다.

Possibly related issues

  • 관련 이슈: BCSDLab/KONECT_FRONT_END 이슈 133
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 푸시 알림 토큰 로직을 브릿지 방식으로 리팩토링하는 변경사항을 명확히 요약하고 있으며, 실제 코드 변경(ReactNativeWebView 통합, 토큰 등록 흐름 제거 등)과 일치합니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 133-refactor-푸시-알림-토큰-로직-브릿지-형식-및-네이티브-처리로-변경

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/apis/notification/index.ts (1)

5-5: 프로덕션 콘솔 로그는 제거 또는 로거로 대체를 권장합니다.

Line 5 로그는 운영 환경 노이즈를 만들 수 있어, 디버그 전용 로거/환경 분기 처리로 정리하는 편이 좋습니다.

수정 예시
-    console.log('RN WebView 환경: 웹에서 푸시 토큰 등록 생략 (네이티브가 처리)');
     return;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/apis/notification/index.ts` at line 5, The console.log call printing "RN
WebView 환경: 웹에서 푸시 토큰 등록 생략 (네이티브가 처리)" should not remain as a plain production
log; replace it with a debug-level logger or gate it behind an environment
check. Locate the console.log in src/apis/notification/index.ts and either
remove it, change it to use the project's logger (e.g., processLogger.debug or
logger.debug) or wrap it with a NODE_ENV/__DEV__ conditional so it only runs in
non-production builds, ensuring no noisy logs in production.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/apis/client.ts`:
- Around line 166-168: The bridge postMessage call to window.ReactNativeWebView
in the token refresh path must not be allowed to throw and trigger the outer
catch that resets auth; wrap the
window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'TOKEN_REFRESH',
accessToken: newAccessToken })) call in its own try/catch and swallow or
non-fatally log any error (do not rethrow), so bridge delivery failures do not
cause authentication initialization/redirect; ensure you keep the original
payload and only affect error handling around
window.ReactNativeWebView.postMessage.

In `@src/pages/User/MyPage/hooks/useLogout.ts`:
- Around line 13-15: In the useLogout hook, the bridge call
window.ReactNativeWebView.postMessage can throw and prevent the rest of the
logout sequence (clearAuth() and navigate('/')) from running; wrap the
postMessage call in a try/catch (or promise catch) so any exception is
caught/logged but does not stop execution, then always call clearAuth() and
navigate('/') after the bridge attempt; specifically update the block that
references window.ReactNativeWebView.postMessage to run inside try {
window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'LOGOUT' })) }
catch (e) { /* log or ignore */ } so clearAuth() and navigate('/') run
unconditionally.

In `@src/stores/authStore.ts`:
- Around line 37-39: The postMessage call to window.ReactNativeWebView with the
LOGIN_COMPLETE payload (window.ReactNativeWebView.postMessage(JSON.stringify({
type: 'LOGIN_COMPLETE', accessToken }))) is throwing and bubbling into the
surrounding catch, which rolls back the successful auth state; wrap this bridge
call in its own try/catch (or check for existence and guard it) so any
exceptions are swallowed/logged locally and do not rethrow, ensuring the auth
success path in authStore (the surrounding login flow) is not invalidated by
bridge failures.

---

Nitpick comments:
In `@src/apis/notification/index.ts`:
- Line 5: The console.log call printing "RN WebView 환경: 웹에서 푸시 토큰 등록 생략 (네이티브가
처리)" should not remain as a plain production log; replace it with a debug-level
logger or gate it behind an environment check. Locate the console.log in
src/apis/notification/index.ts and either remove it, change it to use the
project's logger (e.g., processLogger.debug or logger.debug) or wrap it with a
NODE_ENV/__DEV__ conditional so it only runs in non-production builds, ensuring
no noisy logs in production.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3f97cee and 32ca6a9.

📒 Files selected for processing (5)
  • src/apis/client.ts
  • src/apis/notification/index.ts
  • src/global.d.ts
  • src/pages/User/MyPage/hooks/useLogout.ts
  • src/stores/authStore.ts

Comment thread src/apis/client.ts Outdated
Comment thread src/pages/User/MyPage/hooks/useLogout.ts Outdated
Comment thread src/stores/authStore.ts Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
src/stores/authStore.ts (1)

37-43: 이전 리뷰 피드백 잘 반영됨 — LOGIN_COMPLETE 브릿지 호출이 인증 상태를 롤백하지 않습니다.

try-catch로 분리되어 Line 35의 set({ user, isAuthenticated: true, ... })이 이미 완료된 후 브릿지 호출이 실패해도 인증 상태가 유지됩니다.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/stores/authStore.ts` around lines 37 - 43, No changes required: the
try-catch around window.ReactNativeWebView.postMessage(JSON.stringify({ type:
'LOGIN_COMPLETE', accessToken })) correctly prevents bridge delivery failures
from rolling back the prior set({ user, isAuthenticated: true, ... }) call;
leave the current behavior as-is (optionally add a processLogger.error or
console.warn in the catch if you want to record the bridge failure).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@src/stores/authStore.ts`:
- Around line 37-43: No changes required: the try-catch around
window.ReactNativeWebView.postMessage(JSON.stringify({ type: 'LOGIN_COMPLETE',
accessToken })) correctly prevents bridge delivery failures from rolling back
the prior set({ user, isAuthenticated: true, ... }) call; leave the current
behavior as-is (optionally add a processLogger.error or console.warn in the
catch if you want to record the bridge failure).

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 32ca6a9 and 10d976b.

📒 Files selected for processing (4)
  • src/apis/client.ts
  • src/apis/notification/index.ts
  • src/pages/User/MyPage/hooks/useLogout.ts
  • src/stores/authStore.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/apis/client.ts

@ff1451 ff1451 merged commit 9c3beab into develop Feb 25, 2026
2 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Feb 25, 2026
ff1451 added a commit that referenced this pull request Feb 25, 2026
* chore: 타입 변경 반영

* [feat] 모집 공고에 시간 추가 및 지원서 정렬 추가 (#131)

* feat: 모집 공고에 시작, 종료 시간 추가

* feat: 지원자 목록 정렬 추가 및 시간 표시

* feat: 채팅, 모집 공고 링크 파싱 기능 추가

* feat: 인스타그램 파싱 추가

* fix: prettier error

* refactor: 유틸 분리 및 타입 변경

* chore: 타입 변경 반영

* chore: 동일 스타일 통합 및 entity 확장 사용

* chore:ios 토큰 테스트를 위한 로직 추가

* Revert "chore:ios 토큰 테스트를 위한 로직 추가"

This reverts commit 98570fc.

* hotfix: 모집 공고 textarea 길이 자동 재계산 추가

* Reapply "chore:ios 토큰 테스트를 위한 로직 추가"

This reverts commit 3a56f4a.

* chore: ios토큰

* feat: 가이드 페이지 이미지 변경

* chore: 푸시알림 로직 임시 변경

* refactor: 푸시 알림 토큰 로직 브릿지 방식으로 수정 (#134)

* refactor: 푸시 알림 토큰 로직 브릿지 방식으로 수정

* fix: try catch 적용

* feat: 페이지네이션 추가

* feat: 수정

* feat: 페이지네이션 수정

* feat: 디자인 수정

* feat: 로직 수정

* fix: key 수정

* chore: 스테이지 용 임시 UI 제거

---------

Co-authored-by: hyejun <hyejunkkim228@gmail.com>
ff1451 added a commit that referenced this pull request Mar 6, 2026
* develop → main 배포 (#125)

* feat: 알림설정 구현 (#108)

* chore: min-w 추가

* [chore] 코드래빗 설정 파일 추가 (#110)

* chore: 코드래빗 설정 파일 추가

* chore: 불필요한 tools 설정 제거

* [feat] preMember 목록 분리 및 삭제 기능 추가 (#115)

* feat: preMember 목록 분리 및 삭제 기능 추가

* chore: Pascal case

* chore: 변경된 변수명 반영

* feat: 학번 숫자 필터링 추가

* [feat] 채팅 목차 알림 상태 추가 (#113)

* chore: svg 추가

* feat: 채팅목록 알림 끄기 설정시 UI 추가

* feat: 목차 열릴시 애니메이션 추가

* [feat] 달력 카테고리 분류 추가 (#118)

* feat: 카테고리 추가

* chore: 불필요한 코드 삭제

* [refactor] 관리자 페이지 및 마이페이지 UI 수정 및 리팩토링 (#117)

* feat: 정보 카드에서 정보 페이지로 이동하도록 기능 추가

* feat: 토스트 전역상태 추가

* refactor: query 훅 분리 및 onSuccess 콜백 옵션 제거

* refactor: query 훅 사용처 수정

* refactor: 사용처 수정 2

* fix: 채팅창 스크롤 초기화 문제 수정 및 줄바꿈 기준 변경

* feat: 토글 스위치 구현

* refactor: 모집 공고 관련 목록 페이지 디자인 수정

* feat: 컴포넌트 구현 및 icon 추가

* refactor: z-index 값 수정

* refactor: API 필드 변경 사항 반영

* refactor: 모집 공고 페이지 디자인 수정 및 라우트 백 수정

* refactor: 학교 목록에 없을 시 문구 디자인 수정

* fix: lint error

* fix: 타입 변경

* feat: 모집 관련 페이지 API 추가사항 반영

* refactor: 토스트 타이머 클린업 추라

* refactor: 전역토스트 사용 변경

* refactor: 관리자 클럽 조회 훅 호출 범위 줄이기

* feat: onError handler add

* chore: add button type and remove fragment

* [feat] 문의하기 버튼 로직 추가 (#120)

* feat: API 추가 및 연결

* chore: placeholder 제거

* [fix] 채팅 스크롤 미갱신 버그 및 멤버 직위 렌더링 수정 (#122)

* fix: 채팅 스크롤 미작동 수정

* fix: 한글 출력으로 수정

* feat: 첫 글자 보여주도록 수정 (#124)

* hotfix: 동아리 소개 줄바꿈 적용 및 한 줄 소개 글자수 제한 상향

* chore: 리뷰 반영

* fix: disabled 조건 변경

* 126 fix 배포 전 qa 사항 반영 (#127)

* fix: 가입 버튼 문구 수정

* fix: 검색창 placeholder 수정

* fix: 불필요해진 UI 비활성화

* fix: 모집공고 없을 때 빈 화면 처리

* fix: 무의미한 회비페이지 수정

* feat: 토글 시 자동 페이지 이동 추가

* fix: 페이지 이동 조건 수정

---------

Co-authored-by: 김혜준 <114041848+hyejun0228@users.noreply.github.com>
Co-authored-by: hyejun <hyejunkkim228@gmail.com>

* develop -> main 배포 (#132)

* chore: 타입 변경 반영

* [feat] 모집 공고에 시간 추가 및 지원서 정렬 추가 (#131)

* feat: 모집 공고에 시작, 종료 시간 추가

* feat: 지원자 목록 정렬 추가 및 시간 표시

* feat: 채팅, 모집 공고 링크 파싱 기능 추가

* feat: 인스타그램 파싱 추가

* fix: prettier error

* refactor: 유틸 분리 및 타입 변경

* chore: 타입 변경 반영

* chore: 동일 스타일 통합 및 entity 확장 사용

* chore:ios 토큰 테스트를 위한 로직 추가

* Revert "chore:ios 토큰 테스트를 위한 로직 추가"

This reverts commit 98570fc.

* hotfix: 모집 공고 textarea 길이 자동 재계산 추가

* feat: 페이지네이션 추가

* feat: 수정

* feat: 페이지네이션 수정

* feat: 디자인 수정

* feat: 로직 수정

* fix: key 수정

* develop-> main (#135)

* chore: 타입 변경 반영

* [feat] 모집 공고에 시간 추가 및 지원서 정렬 추가 (#131)

* feat: 모집 공고에 시작, 종료 시간 추가

* feat: 지원자 목록 정렬 추가 및 시간 표시

* feat: 채팅, 모집 공고 링크 파싱 기능 추가

* feat: 인스타그램 파싱 추가

* fix: prettier error

* refactor: 유틸 분리 및 타입 변경

* chore: 타입 변경 반영

* chore: 동일 스타일 통합 및 entity 확장 사용

* chore:ios 토큰 테스트를 위한 로직 추가

* Revert "chore:ios 토큰 테스트를 위한 로직 추가"

This reverts commit 98570fc.

* hotfix: 모집 공고 textarea 길이 자동 재계산 추가

* Reapply "chore:ios 토큰 테스트를 위한 로직 추가"

This reverts commit 3a56f4a.

* chore: ios토큰

* feat: 가이드 페이지 이미지 변경

* chore: 푸시알림 로직 임시 변경

* refactor: 푸시 알림 토큰 로직 브릿지 방식으로 수정 (#134)

* refactor: 푸시 알림 토큰 로직 브릿지 방식으로 수정

* fix: try catch 적용

* feat: 페이지네이션 추가

* feat: 수정

* feat: 페이지네이션 수정

* feat: 디자인 수정

* feat: 로직 수정

* fix: key 수정

* chore: 스테이지 용 임시 UI 제거

---------

Co-authored-by: hyejun <hyejunkkim228@gmail.com>

* [feat] sentry 모니터링 추가 (#141) (#142)

* chore: sentry 의존성 추가

* feat: sentry 세팅

* chore: 워크플로우 수정 및 vite 세팅

* chore: 임시 추가

* refactor: 색상 토큰 파일 분리

* refactor: 타이포그래피 스타일 파일 분리

* refactor: 피그마 타이포그래피 네이밍으로 클래스 정렬

* fix: 리뷰 코멘트 기반 접근성 및 토큰 정리

---------

Co-authored-by: 김혜준 <114041848+hyejun0228@users.noreply.github.com>
Co-authored-by: hyejun <hyejunkkim228@gmail.com>
@ff1451 ff1451 deleted the 133-refactor-푸시-알림-토큰-로직-브릿지-형식-및-네이티브-처리로-변경 branch April 7, 2026 09:33
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.

[refactor] 푸시 알림 토큰 로직 브릿지 형식 및 네이티브 처리로 변경

1 participant