Skip to content

[Feature] 로그아웃 및 세션 만료 GlobalNavEvent 적용#87

Closed
UiHyeon-Kim wants to merge 3 commits intodevelopfrom
feature/apply_global_event
Closed

[Feature] 로그아웃 및 세션 만료 GlobalNavEvent 적용#87
UiHyeon-Kim wants to merge 3 commits intodevelopfrom
feature/apply_global_event

Conversation

@UiHyeon-Kim
Copy link
Copy Markdown
Member

@UiHyeon-Kim UiHyeon-Kim commented Mar 22, 2026

✨ 주요 변경 사항

  • SessionEventBus: 앱 전역 세션 상태 전파를 위한 이벤트 버스 인터페이스 및 구현체 추가
  • TokenRefresher: 토큰 갱신 실패(400, 401) 시 세션 만료 이벤트 발행 로직 추가
  • MainActivity: 세션 만료 이벤트 구독 및 로그인 화면 이동, 스낵바 알림 표시 처리
  • DataModule: SessionEventBus 의존성 바인딩 설정 추가

  • onNavigateToLogin 콜백을 onGlobalNavEvent(GlobalNavEvent.Logout) 호출로 변경
  • MyPageNavigation 및 PickleNavHost에서 GlobalNavEvent를 전달받도록 파라미터 수정
  • SettingScreen에서 직접 수행하던 로그인 경로 이동 로직을 상위 NavHost로 위임

✅ 체크리스트

  • 🌱 merge 브랜치 확인
  • 🛠️ 빌드 성공

🔍 중점 리뷰 사항

  • 기존 작성된 GlobalNavEvent를 사용하고자 한 방향이 맞는지 확인 부탁드립니다

📸 스크린샷

디자인 변경사항 없음.

- SessionEventBus: 앱 전역 세션 상태 전파를 위한 이벤트 버스 인터페이스 및 구현체 추가
- TokenRefresher: 토큰 갱신 실패(400, 401) 시 세션 만료 이벤트 발행 로직 추가
- MainActivity: 세션 만료 이벤트 구독 및 로그인 화면 이동, 스낵바 알림 표시 처리
- DataModule: SessionEventBus 의존성 바인딩 설정 추가
- onNavigateToLogin 콜백을 onGlobalNavEvent(GlobalNavEvent.Logout) 호출로 변경
- MyPageNavigation 및 PickleNavHost에서 GlobalNavEvent를 전달받도록 파라미터 수정
- SettingScreen에서 직접 수행하던 로그인 경로 이동 로직을 상위 NavHost로 위임
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 PR은 사용자 세션 만료를 앱 전반에 걸쳐 효율적으로 처리하기 위한 글로벌 이벤트 버스 시스템을 도입합니다. 토큰 갱신 실패 시 세션 만료 이벤트를 발행하고, MainActivity에서 이를 감지하여 사용자에게 스낵바 알림과 함께 로그인 화면으로 자동 전환되도록 합니다. 이를 통해 세션 관리 로직을 중앙화하고, 여러 화면에서 로그인 경로 이동 로직을 GlobalNavEvent를 통해 일관되게 처리하도록 리팩토링하여 앱의 안정성과 유지보수성을 향상시킵니다.

Highlights

  • SessionEventBus 도입: 앱 전역 세션 상태 전파를 위한 이벤트 버스 인터페이스 및 구현체가 추가되었습니다.
  • 토큰 갱신 실패 처리: TokenRefresher에서 토큰 갱신 실패(400, 401) 시 세션 만료 이벤트를 발행하는 로직이 추가되었습니다.
  • MainActivity의 세션 만료 처리: MainActivity가 세션 만료 이벤트를 구독하여 로그인 화면으로 이동하고 스낵바 알림을 표시하도록 변경되었습니다.
  • 의존성 주입 설정: DataModule에 SessionEventBus 의존성 바인딩 설정이 추가되었습니다.
  • 글로벌 네비게이션 이벤트 활용: onNavigateToLogin 콜백이 onGlobalNavEvent(GlobalNavEvent.Logout) 호출로 변경되었으며, MyPageNavigation 및 PickleNavHost에서 GlobalNavEvent를 전달받도록 파라미터가 수정되었습니다.
  • 설정 화면 로그인 로직 위임: SettingScreen에서 직접 수행하던 로그인 경로 이동 로직이 상위 NavHost로 위임되었습니다.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a0223d00-223e-4f2e-a737-cc27402aaf35

📥 Commits

Reviewing files that changed from the base of the PR and between 4271008 and 5be1e46.

📒 Files selected for processing (3)
  • app/src/main/java/com/smtm/pickle/MainActivity.kt
  • app/src/main/res/values/strings.xml
  • data/src/main/java/com/smtm/pickle/data/event/SessionEventBusImpl.kt
✅ Files skipped from review due to trivial changes (1)
  • app/src/main/res/values/strings.xml
🚧 Files skipped from review as they are similar to previous changes (2)
  • data/src/main/java/com/smtm/pickle/data/event/SessionEventBusImpl.kt
  • app/src/main/java/com/smtm/pickle/MainActivity.kt

📝 Walkthrough

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능

    • 세션 만료 감지 시 로그인 화면으로 이동 후 스낵바로 알림 표시
    • 세션 만료 이벤트를 발행/구독하는 이벤트 버스 도입
  • 개선 사항

    • 토큰 갱신 실패 시 자동으로 세션 만료 이벤트 발생 및 토큰 정리
    • 마이페이지/설정 내 네비게이션 위임으로 전역 네비게이션 흐름 일원화

Walkthrough

도메인에 SessionEventBus 인터페이스를 추가하고 데이터 계층에 구현체와 Hilt 바인딩을 도입했습니다. 토큰 갱신 실패(401/400) 시 세션 만료 이벤트를 발행하도록 확장하고, MainActivity에서 이를 수집해 전역 네비게이션 이벤트로 변환해 로그인으로 이동 및 스낵바를 표시하도록 연결했습니다.

Changes

Cohort / File(s) Summary
도메인: 세션 이벤트 버스 인터페이스
domain/src/main/java/com/smtm/pickle/domain/event/SessionEventBus.kt
세션 만료를 알리는 val sessionExpired: Flow<Unit>suspend fun emitSessionExpired()를 정의한 새로운 인터페이스 추가
데이터: 구현체 및 DI 바인딩
data/src/main/java/com/smtm/pickle/data/event/SessionEventBusImpl.kt, data/src/main/java/com/smtm/pickle/data/di/DataModule.kt
Channel.CONFLATED 기반의 SessionEventBusImpl 추가 및 Hilt 모듈에서 인터페이스로 바인딩하도록 등록
토큰 리프레시 로직 확장
data/src/main/java/com/smtm/pickle/data/source/remote/auth/TokenRefresher.kt
토큰 갱신 실패(HTTP 401/400) 경로에서 저장 토큰 삭제 후 sessionEventBus.emitSessionExpired() 호출하도록 변경
프레젠테이션: 설정 화면 → 글로벌 이벤트로 리팩토링
presentation/src/main/java/com/smtm/pickle/presentation/setting/SettingScreen.kt, presentation/src/main/java/com/smtm/pickle/presentation/mypage/navigation/MyPageNavigation.kt
onNavigateToLogin 콜백을 onGlobalNavEvent: (GlobalNavEvent) -> Unit로 교체하고, 내비게이션 호출을 글로벌 이벤트로 위임
네비게이션 호스트 연결 업데이트
presentation/src/main/java/com/smtm/pickle/presentation/navigation/PickleNavHost.kt
myPageDestinations 호출에 onGlobalNavEvent 파라미터를 명시적으로 전달하도록 수정
앱: MainActivity에 이벤트 수집 및 스낵바 표시 추가
app/src/main/java/com/smtm/pickle/MainActivity.kt, app/src/main/res/values/strings.xml
Hilt로 SessionEventBus 주입, LaunchedEffect에서 sessionExpired 수집하여 GlobalNavEvent.SessionExpired로 처리 및 스낵바 표시; 세션 만료 문자열 리소스 추가

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 분

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 주요 변경 사항인 GlobalNavEvent를 활용한 세션 만료 및 로그아웃 처리를 명확하게 나타내고 있습니다.
Description check ✅ Passed PR 설명이 주요 변경 사항, 체크리스트, 리뷰 포인트를 포함하고 있으며 구조화되어 있습니다.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/apply_global_event

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Code Review

안녕하세요. 로그아웃 및 세션 만료 처리를 위해 GlobalNavEventSessionEventBus를 도입하여 전역 이벤트를 처리하도록 개선한 점이 인상 깊습니다. 아키텍처 관점에서 관심사를 분리하고 코드의 응집도를 높이는 좋은 시도라고 생각합니다. 중점 리뷰 사항으로 요청주신 GlobalNavEvent 활용 방향은 적절하며, 앱의 전역적인 탐색 흐름을 관리하는 데 효과적인 패턴입니다. 코드의 완성도를 더욱 높이기 위해 몇 가지 제안 사항을 남깁니다.

Comment thread app/src/main/java/com/smtm/pickle/MainActivity.kt Outdated
Comment thread data/src/main/java/com/smtm/pickle/data/event/SessionEventBusImpl.kt Outdated
Copy link
Copy Markdown

@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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/src/main/java/com/smtm/pickle/MainActivity.kt`:
- Around line 77-80: Replace the hardcoded Korean message passed to
GlobalNavEvent.SessionExpired in the LaunchedEffect block: move the string into
strings.xml (e.g., name it session_expired_message) and read it here via
stringResource(...) or context.getString(...) before calling
handleGlobalNavEvent; update the call inside
sessionEventBus.sessionExpired.collect so GlobalNavEvent.SessionExpired receives
the localized resource string instead of the literal.

In `@data/src/main/java/com/smtm/pickle/data/event/SessionEventBusImpl.kt`:
- Around line 12-15: SessionEventBusImpl currently uses a buffered Channel and
calls blocking _channel.send(Unit) inside emitSessionExpired, which can block
the OkHttp/auth thread; change the channel to a conflated channel
(Channel<Unit>(Channel.CONFLATED)) and replace the blocking send call in
emitSessionExpired with a non-blocking _channel.trySend(Unit) (optionally check
the result or ignore it), keeping sessionExpired = _channel.receiveAsFlow()
unchanged to deliver the latest idempotent signal without blocking.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 06f2d1c0-4cb0-437c-b348-92d736c56fb8

📥 Commits

Reviewing files that changed from the base of the PR and between 62e754e and 4271008.

📒 Files selected for processing (8)
  • app/src/main/java/com/smtm/pickle/MainActivity.kt
  • data/src/main/java/com/smtm/pickle/data/di/DataModule.kt
  • data/src/main/java/com/smtm/pickle/data/event/SessionEventBusImpl.kt
  • data/src/main/java/com/smtm/pickle/data/source/remote/auth/TokenRefresher.kt
  • domain/src/main/java/com/smtm/pickle/domain/event/SessionEventBus.kt
  • presentation/src/main/java/com/smtm/pickle/presentation/mypage/navigation/MyPageNavigation.kt
  • presentation/src/main/java/com/smtm/pickle/presentation/navigation/PickleNavHost.kt
  • presentation/src/main/java/com/smtm/pickle/presentation/setting/SettingScreen.kt

Comment thread app/src/main/java/com/smtm/pickle/MainActivity.kt
Comment thread data/src/main/java/com/smtm/pickle/data/event/SessionEventBusImpl.kt Outdated
- strings.xml: `global_session_expired` 문자열 추가
- MainActivity: 하드코딩된 세션 만료 메시지를 리소스 ID로 대체
- SessionEventBusImpl: Channel 타입을 `CONFLATED`로 변경하고 `trySend`를 사용하여 이벤트 처리 최적화
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

리뷰 중 코드 리뷰 진행 상태

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants