Skip to content

Conversation

wjdrjs00
Copy link
Member

@wjdrjs00 wjdrjs00 commented Aug 9, 2025

[ PR Content ]

자동 로그인 로직을 변경했습니다.

Related issue

Screenshot 📸

  • N/A

Work Description

  • 기존 토큰값 유무만으로 판단하고 있던 자동 로그인 로직을 reissue api 를 통해 검증하도록 수정했습니다.
    • 수정 이유: 앱 가입 중 종료하는 사용자에 따른 엣지 케이스 발생
    • api 호출 시점은 기존과 같이 스플래시 화면 진입 시 수행합니다.
    • 응답값의 role값 기반으로 다음 화면으로 넘어가도록 분기 처리 로직을 구현했습니다.
    • 기존 role 파싱 간 발생 하는 한 오류를 UNKNOWN 타입으로 정의하여, 앱 종료가 아닌 로그인 화면으로 넘어갈 수 있도록 변경했습니다.

To Reviewers 📢

  • 리뷰는 언제나 환영입니다요~

Summary by CodeRabbit

  • 신규 기능

    • 자동 로그인 기능이 도입되어, 저장된 리프레시 토큰을 활용한 자동 인증 및 사용자 역할 기반 분기 처리가 가능합니다.
    • 스플래시 화면에서 약관 동의 및 온보딩 화면으로의 네비게이션이 추가되었습니다.
    • 사용자 역할(UserRole)에 ONBOARDING, WITHDRAWN, UNKNOWN이 추가되었습니다.
  • 개선 및 변경

    • 기존 토큰 존재 여부 확인 방식이 제거되고, 사용자 역할 기반의 상태 관리 및 네비게이션으로 전환되었습니다.
    • 자동 로그인 실패 시 인증 토큰이 자동으로 삭제됩니다.
    • "Auto-Login" 헤더를 통한 인증 재시도 제어가 적용되었습니다.
  • 버그 수정

    • 알 수 없는 사용자 역할 처리 시 예외 대신 UNKNOWN 역할로 안전하게 처리됩니다.

- ONBOARDING, WITHDRAWN, UNKNOWN 추가
- hasTokenUsecase 제거
- 리프레시 토큰을 기반으로 자동 로그인 시도
- UserRole에 따라 약관 동의, 온보딩, 홈 화면으로 이동
- TokenAuthenticator에서 AUTO_LOGIN_HEADER가 있는 경우 인증을 건너뛰도록 수정
@wjdrjs00 wjdrjs00 requested a review from l5x5l August 9, 2025 05:41
@wjdrjs00 wjdrjs00 self-assigned this Aug 9, 2025
@wjdrjs00 wjdrjs00 added 🔨 Refactor 기존 기능 개선 🧤 대현 labels Aug 9, 2025
Copy link

coderabbitai bot commented Aug 9, 2025

Walkthrough

자동 로그인 로직이 기존의 토큰 존재 여부 확인 방식에서 리프레시 토큰 기반의 자동 로그인 방식으로 전면 교체되었습니다. Splash 화면의 상태와 네비게이션 흐름이 사용자 역할(UserRole)에 따라 분기되도록 변경되었으며, 관련 데이터 소스, 리포지토리, 유즈케이스, ViewModel, UI, 네트워크 계층이 모두 이에 맞게 수정·확장되었습니다.

Changes

Cohort / File(s) Change Summary
Splash 화면 네비게이션 및 상태/인텐트/사이드이펙트
app/src/main/java/com/threegap/bitnagil/MainNavHost.kt, presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashScreen.kt, presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashViewModel.kt, presentation/src/main/java/com/threegap/bitnagil/presentation/splash/model/SplashIntent.kt, presentation/src/main/java/com/threegap/bitnagil/presentation/splash/model/SplashSideEffect.kt, presentation/src/main/java/com/threegap/bitnagil/presentation/splash/model/SplashState.kt
SplashScreenContainer 및 ViewModel이 UserRole 기반 자동 로그인 로직을 반영하도록 변경. 새로운 네비게이션 콜백 및 사이드이펙트, 상태 필드(userRole, isAutoLoginCompleted) 추가.
도메인: 자동 로그인 유즈케이스 및 UserRole 확장
domain/src/main/java/com/threegap/bitnagil/domain/auth/usecase/AutoLoginUseCase.kt, domain/src/main/java/com/threegap/bitnagil/domain/auth/model/UserRole.kt, domain/src/main/java/com/threegap/bitnagil/domain/auth/usecase/HasTokenUseCase.kt
AutoLoginUseCase 신규 추가, UserRole에 ONBOARDING, WITHDRAWN, UNKNOWN 추가 및 fromString 개선, HasTokenUseCase 삭제.
도메인/데이터: AuthRepository 및 데이터소스 인터페이스/구현
domain/src/main/java/com/threegap/bitnagil/domain/auth/repository/AuthRepository.kt, data/src/main/java/com/threegap/bitnagil/data/auth/repositoryimpl/AuthRepositoryImpl.kt, data/src/main/java/com/threegap/bitnagil/data/auth/datasource/AuthLocalDataSource.kt, data/src/main/java/com/threegap/bitnagil/data/auth/datasourceimpl/AuthLocalDataSourceImpl.kt, data/src/main/java/com/threegap/bitnagil/data/auth/datasource/AuthRemoteDataSource.kt, data/src/main/java/com/threegap/bitnagil/data/auth/datasourceimpl/AuthRemoteDataSourceImpl.kt
AuthRepository 및 관련 데이터소스에 reissueToken, getRefreshToken, clearAuthToken 등 리프레시 토큰 기반 자동 로그인 관련 메서드 추가/변경. 기존 hasToken 메서드 제거.
네트워크 계층: AuthService 및 TokenAuthenticator
data/src/main/java/com/threegap/bitnagil/data/auth/service/AuthService.kt, core/network/src/main/java/com/threegap/bitnagil/network/auth/TokenAuthenticator.kt
토큰 재발급 API(postReissueToken) 추가, Auto-Login 헤더 처리 로직 도입(재시도 방지 및 헤더 제거).
로컬 데이터 저장소
core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/storage/AuthTokenDataStore.kt, core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/storage/AuthTokenDataStoreImpl.kt
AuthTokenDataStore 인터페이스 및 구현에서 hasToken 메서드 제거.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SplashScreen
    participant SplashViewModel
    participant AutoLoginUseCase
    participant AuthRepository
    participant AuthLocalDataSource
    participant AuthRemoteDataSource

    User->>SplashScreen: 앱 실행
    SplashScreen->>SplashViewModel: onCreate/init
    SplashViewModel->>AutoLoginUseCase: invoke()
    AutoLoginUseCase->>AuthRepository: getRefreshToken()
    AuthRepository->>AuthLocalDataSource: getRefreshToken()
    AuthLocalDataSource-->>AuthRepository: refreshToken
    AuthRepository-->>AutoLoginUseCase: refreshToken
    AutoLoginUseCase->>AuthRepository: reissueToken(refreshToken)
    AuthRepository->>AuthRemoteDataSource: reissueToken(refreshToken)
    AuthRemoteDataSource-->>AuthRepository: Result<AuthSession>
    AuthRepository-->>AutoLoginUseCase: Result<AuthSession>
    alt 성공
        AutoLoginUseCase->>AuthRepository: updateAuthToken()
        AutoLoginUseCase-->>SplashViewModel: UserRole 반환
    else 실패
        AutoLoginUseCase->>AuthRepository: clearAuthToken()
        AutoLoginUseCase-->>SplashViewModel: UserRole.UNKNOWN 반환
    end
    SplashViewModel->>SplashScreen: 상태 업데이트 및 역할별 네비게이션
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20분

Assessment against linked issues

Objective Addressed Explanation
리프래시 토큰 기반의 자동 로그인으로 수정 (#83)

Assessment against linked issues: Out-of-scope changes

(해당 변경사항 내에서는 요구사항과 무관한 기능적 코드 변경이 발견되지 않았습니다.)

Possibly related PRs

Suggested labels

✨ Feature

Suggested reviewers

  • l5x5l

Poem

🐇
Splash에서 토큰을 넘어서
역할 따라 길을 여는 새 아침!
리프래시 토큰 들고 자동 로그인 춤,
온보딩, 약관, 홈으로 hop hop hop!
바뀐 흐름에 깡총깡총,
코드도 토끼도 한 뼘 더 성장!

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/#83-auto-login

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

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

🧹 Nitpick comments (14)
data/src/main/java/com/threegap/bitnagil/data/auth/datasource/AuthRemoteDataSource.kt (1)

12-12: reissueToken 도입 👍 — 공백 토큰 호출 가드/계약 문서화 제안

시그니처는 목적에 부합합니다. 다만 refreshToken이 빈 문자열인 경우까지 네트워크 호출이 가지 않도록 계약을 명확히 해 주세요(상위 레이어에서 호출 금지 또는 Impl에서 가드). KDoc에 “blank면 실패 반환” 같은 정책을 남기면 유지보수에 도움이 됩니다.

data/src/main/java/com/threegap/bitnagil/data/auth/datasource/AuthLocalDataSource.kt (1)

4-4: null/blank 정책을 명시해 호출부 혼선을 줄이세요

getRefreshToken이 null을 반환할 수 있으니 “빈 문자열은 반환하지 않고 null만 반환한다” 같은 규칙을 KDoc로 명시하면 호출부에서의 분기 단순화에 도움이 됩니다. 가능하면 저장 시점에 trim/검증해 항상 null 또는 유효 토큰만 나오도록 하는 것도 좋습니다.

data/src/main/java/com/threegap/bitnagil/data/auth/service/AuthService.kt (2)

31-35: 보안: 로깅 인터셉터에서 Refresh-Token 헤더 마스킹 권장

해당 API는 민감한 Refresh-Token을 헤더로 전송합니다. OkHttp 로깅(또는 자체 네트워크 로깅)을 사용 중이라면 반드시 헤더 레닥션을 적용해 토큰이 로그/크래시리포트에 남지 않게 하세요.

예시:

val logging = HttpLoggingInterceptor().apply {
    level = HttpLoggingInterceptor.Level.BODY
    redactHeader("Authorization")
    redactHeader("Refresh-Token")
}
val client = OkHttpClient.Builder()
    .addInterceptor(logging)
    .build()

31-35: 헤더 문자열 상수화(옵션)

헤더 키/값(특히 "Refresh-Token", "Auto-Login", "No-Service-Token")을 상수로 중앙집중 관리하면 오타/일관성 이슈를 줄일 수 있습니다. Retrofit @headers에는 “No-Service-Token: true” 같은 전체 문자열 상수를 사용해야 합니다.

예시:

// 공용 상수
object HttpHeaders {
    const val NO_SERVICE_TOKEN_TRUE = "No-Service-Token: true"
    const val AUTO_LOGIN_TRUE = "Auto-Login: true"
    const val REFRESH_TOKEN = "Refresh-Token"
}

// 사용
@Headers(HttpHeaders.NO_SERVICE_TOKEN_TRUE, HttpHeaders.AUTO_LOGIN_TRUE)
suspend fun postReissueToken(
    @Header(HttpHeaders.REFRESH_TOKEN) refreshToken: String,
): BaseResponse<LoginResponseDto>
presentation/src/main/java/com/threegap/bitnagil/presentation/splash/model/SplashSideEffect.kt (1)

8-9: 내비게이션 사이드이펙트 추가 적절. 이름 일관성만 확인해주세요.

Route/Screen 쪽에서 OnBoarding(대문자 B)을 쓰고, 여기서는 Onboarding을 씁니다. 전역적으로 표기 일관성을 맞추는 것을 권장합니다.

app/src/main/java/com/threegap/bitnagil/MainNavHost.kt (1)

41-50: 중복 내비게이션 방지 옵션 추가 제안(launchSingleTop).

스플래시 진입 시 자동 로그인 결과에 따라 빠르게 연속 트리거될 가능성을 방지하려면 launchSingleTop = true를 함께 지정하는 것을 권장합니다. 기존 popUpTo는 백스택 정리에 도움을 주지만 중복 네비게이션 자체를 차단하지는 않습니다.

아래와 같이 수정 제안드립니다.

- navigator.navController.navigate(Route.TermsAgreement) {
-     popUpTo<Route.Splash> { inclusive = true }
- }
+ navigator.navController.navigate(Route.TermsAgreement) {
+     launchSingleTop = true
+     popUpTo<Route.Splash> { inclusive = true }
+ }

- navigator.navController.navigate(Route.OnBoarding()) {
-     popUpTo<Route.Splash> { inclusive = true }
- }
+ navigator.navController.navigate(Route.OnBoarding()) {
+     launchSingleTop = true
+     popUpTo<Route.Splash> { inclusive = true }
+ }
presentation/src/main/java/com/threegap/bitnagil/presentation/splash/model/SplashState.kt (1)

9-10: userRole의 널 제거 권장(UNKNOWN 기본값 사용).

이미 도메인에 UNKNOWN이 도입되었으므로 상태에서 UserRole? 대신 UserRole = UserRole.UNKNOWN로 두면 널 처리 분기를 줄여 가독성과 안정성이 좋아집니다.

-    val userRole: UserRole? = null,
+    val userRole: UserRole = UserRole.UNKNOWN,
presentation/src/main/java/com/threegap/bitnagil/presentation/splash/model/SplashIntent.kt (2)

7-7: 의도 명확성 OK. 널 대신 UNKNOWN 활용 고려.

SetUserRole(UserRole?) 대신 UserRole = UNKNOWN를 사용하면 뷰모델/리듀서의 분기 단순화에 유리합니다. SplashState 변경과 같이 적용하면 일관성이 높아집니다.


10-11: 이름 표기 일관성 제안(OnBoarding vs Onboarding).

Route/Screen에서 OnBoarding 표기를 사용 중이라면 Intent도 NavigateToOnBoarding로 맞추는 것을 권장합니다. 전역 네이밍 일관성은 추적과 검색에 도움이 됩니다.

core/network/src/main/java/com/threegap/bitnagil/network/auth/TokenAuthenticator.kt (1)

22-22: 헤더 “존재 여부” 대신 “값 확인”으로 오탐 방지 제안

현재는 헤더 존재만으로 재인증을 우회합니다. 향후 다른 요청에서 동일 키를 잘못 넣을 경우 의도치 않게 재인증이 스킵될 수 있습니다. "true" 값일 때만 우회하도록 완화하는 것을 권장합니다.

가능한 최소 변경(diff):

-        if (response.request.header(AUTO_LOGIN_HEADER) != null) return null
+        if (response.request.header(AUTO_LOGIN_HEADER)?.equals("true", ignoreCase = true) == true) {
+            return null
+        }

또한(선택) 헤더 누락 대비 이중 안전장치로, 재발급 API 경로/태그 기반 예외를 추가하는 것도 고려해볼 수 있습니다.

domain/src/main/java/com/threegap/bitnagil/domain/auth/usecase/AutoLoginUseCase.kt (1)

15-23: 토큰 저장/정리 결과 무시됨 → 원자성/에러 처리 강화 제안

  • updateAuthToken(...)clearAuthToken()Result<Unit>를 반환하는데, 현재 결과를 무시합니다. 원격 재발급 성공 후 로컬 저장 실패 시 불일치가 생길 수 있으므로 최소한 실패 로깅/대응을 권장합니다.
  • 더 나아가 “재발급 + 로컬 저장”을 레포지토리 단에서 원자적으로 처리하도록 합치는 설계를 검토해보세요(예: AuthRepository.reissueAndPersist(): Result<UserRole>). 도메인단에서 부수효과를 분리하는 현재 방식도 가능하지만, 일관성과 오류 복구 관점에서 레포지토리 내 원자화가 안전합니다.

예시(경미한 보강):

 .onSuccess { authSession ->
-    authRepository.updateAuthToken(
+    authRepository.updateAuthToken(
         accessToken = authSession.accessToken,
         refreshToken = authSession.refreshToken,
-    )
+    ).onFailure { /* TODO: 로깅 또는 재시도/폴백 정책 */ }
 }
 .onFailure {
-    authRepository.clearAuthToken()
+    authRepository.clearAuthToken().onFailure { /* TODO: 로깅 */ }
 }
domain/src/main/java/com/threegap/bitnagil/domain/auth/repository/AuthRepository.kt (1)

12-15: 리프레시 토큰 인자 노출 축소 제안

  • reissueToken(refreshToken: String) 대신 reissueToken()로 RT 취득을 레포지토리 내부로 숨기면 도메인 계층에서 민감 토큰을 다루지 않아도 되어 응집도와 보안성이 올라갑니다. 선택사항이나, 장기적으로 유지보수성이 좋아집니다.
data/src/main/java/com/threegap/bitnagil/data/auth/repositoryimpl/AuthRepositoryImpl.kt (1)

38-48: 재발급 성공 시 로컬 저장까지 레포지토리에서 일괄 처리 옵션

  • 현재는 도메인 유즈케이스에서 저장을 호출합니다. 불일치(원격 성공, 로컬 실패) 가능성을 줄이려면 레포지토리의 reissueToken 내에서 로컬 저장까지 처리하고, 그 결과를 단일 Result로 반환하는 방식도 고려해볼 만합니다. 선택사항입니다.
presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashViewModel.kt (1)

35-39: Intent 명명 컨벤션과 정합성 개선 제안

SetUserRole이 상태 업데이트 자체를 표현하는 명명입니다. 팀 MVI 컨벤션(서버 응답 성공 결과를 나타내는 Intent: 예, LoadXxxSuccess)에 맞추려면 AutoLoginCompleted 또는 ResolveUserRoleSuccess 같은 이름을 고려해볼 만합니다. 동작은 문제 없습니다.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4877f78 and 0e00baa.

📒 Files selected for processing (19)
  • app/src/main/java/com/threegap/bitnagil/MainNavHost.kt (1 hunks)
  • core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/storage/AuthTokenDataStore.kt (0 hunks)
  • core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/storage/AuthTokenDataStoreImpl.kt (0 hunks)
  • core/network/src/main/java/com/threegap/bitnagil/network/auth/TokenAuthenticator.kt (3 hunks)
  • data/src/main/java/com/threegap/bitnagil/data/auth/datasource/AuthLocalDataSource.kt (1 hunks)
  • data/src/main/java/com/threegap/bitnagil/data/auth/datasource/AuthRemoteDataSource.kt (1 hunks)
  • data/src/main/java/com/threegap/bitnagil/data/auth/datasourceimpl/AuthLocalDataSourceImpl.kt (1 hunks)
  • data/src/main/java/com/threegap/bitnagil/data/auth/datasourceimpl/AuthRemoteDataSourceImpl.kt (1 hunks)
  • data/src/main/java/com/threegap/bitnagil/data/auth/repositoryimpl/AuthRepositoryImpl.kt (1 hunks)
  • data/src/main/java/com/threegap/bitnagil/data/auth/service/AuthService.kt (1 hunks)
  • domain/src/main/java/com/threegap/bitnagil/domain/auth/model/UserRole.kt (2 hunks)
  • domain/src/main/java/com/threegap/bitnagil/domain/auth/repository/AuthRepository.kt (1 hunks)
  • domain/src/main/java/com/threegap/bitnagil/domain/auth/usecase/AutoLoginUseCase.kt (1 hunks)
  • domain/src/main/java/com/threegap/bitnagil/domain/auth/usecase/HasTokenUseCase.kt (0 hunks)
  • presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashScreen.kt (1 hunks)
  • presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashViewModel.kt (3 hunks)
  • presentation/src/main/java/com/threegap/bitnagil/presentation/splash/model/SplashIntent.kt (1 hunks)
  • presentation/src/main/java/com/threegap/bitnagil/presentation/splash/model/SplashSideEffect.kt (1 hunks)
  • presentation/src/main/java/com/threegap/bitnagil/presentation/splash/model/SplashState.kt (1 hunks)
💤 Files with no reviewable changes (3)
  • core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/storage/AuthTokenDataStore.kt
  • domain/src/main/java/com/threegap/bitnagil/domain/auth/usecase/HasTokenUseCase.kt
  • core/datastore/src/main/java/com/threegap/bitnagil/datastore/auth/storage/AuthTokenDataStoreImpl.kt
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-07-23T13:32:26.263Z
Learnt from: l5x5l
PR: YAPP-Github/Bitnagil-Android#41
File: presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/model/MyPageIntent.kt:6-6
Timestamp: 2025-07-23T13:32:26.263Z
Learning: In the Bitnagil Android project's MVI architecture, Intent classes like `LoadMyPageSuccess` are named to represent successful API response results that carry loaded data, not just user actions. This naming convention is used for future API integration where the intent will be triggered when my page data loading succeeds from the server.

Applied to files:

  • presentation/src/main/java/com/threegap/bitnagil/presentation/splash/model/SplashSideEffect.kt
  • app/src/main/java/com/threegap/bitnagil/MainNavHost.kt
  • presentation/src/main/java/com/threegap/bitnagil/presentation/splash/model/SplashIntent.kt
  • presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashViewModel.kt
📚 Learning: 2025-07-11T03:54:23.348Z
Learnt from: wjdrjs00
PR: YAPP-Github/Bitnagil-Android#25
File: presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashViewModel.kt:50-65
Timestamp: 2025-07-11T03:54:23.348Z
Learning: AuthTokenDataStoreImpl.hasToken() 메소드에서 예외 발생 시 false를 반환하도록 이미 예외 처리가 구현되어 있어, 상위 레이어에서 추가적인 예외 처리가 불필요합니다.

Applied to files:

  • data/src/main/java/com/threegap/bitnagil/data/auth/datasource/AuthLocalDataSource.kt
  • data/src/main/java/com/threegap/bitnagil/data/auth/datasourceimpl/AuthLocalDataSourceImpl.kt
📚 Learning: 2025-07-06T04:26:03.870Z
Learnt from: wjdrjs00
PR: YAPP-Github/Bitnagil-Android#19
File: core/network/src/main/java/com/threegap/bitnagil/network/auth/TokenAuthenticator.kt:16-20
Timestamp: 2025-07-06T04:26:03.870Z
Learning: TokenAuthenticator 클래스는 현재 임시 코드로 구현되어 있으며, 실제 토큰 재발급 API 연동 시점에 올바른 구현으로 수정될 예정입니다.

Applied to files:

  • core/network/src/main/java/com/threegap/bitnagil/network/auth/TokenAuthenticator.kt
  • data/src/main/java/com/threegap/bitnagil/data/auth/repositoryimpl/AuthRepositoryImpl.kt
📚 Learning: 2025-07-03T09:05:30.067Z
Learnt from: wjdrjs00
PR: YAPP-Github/Bitnagil-Android#16
File: core/network/src/main/java/com/threegap/bitnagil/network/auth/TokenAuthenticator.kt:12-46
Timestamp: 2025-07-03T09:05:30.067Z
Learning: 이 프로젝트에서는 네트워크 모듈을 점진적으로 개발하고 있으며, TokenAuthenticator 같은 인증 관련 기능은 실제 API 연동 작업 시점에 NetworkModule에 연결할 예정입니다.

Applied to files:

  • core/network/src/main/java/com/threegap/bitnagil/network/auth/TokenAuthenticator.kt
📚 Learning: 2025-07-23T13:31:46.809Z
Learnt from: l5x5l
PR: YAPP-Github/Bitnagil-Android#41
File: presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/model/MyPageState.kt:6-14
Timestamp: 2025-07-23T13:31:46.809Z
Learning: In the Bitnagil Android project, MviState interface extends Parcelable, so any class implementing MviState automatically implements Parcelable. Therefore, Parcelize annotation works correctly without explicitly adding Parcelable implementation.

Applied to files:

  • presentation/src/main/java/com/threegap/bitnagil/presentation/splash/model/SplashState.kt
  • presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashViewModel.kt
🧬 Code Graph Analysis (2)
data/src/main/java/com/threegap/bitnagil/data/auth/datasourceimpl/AuthRemoteDataSourceImpl.kt (1)
data/src/main/java/com/threegap/bitnagil/data/common/SafeApiCall.kt (1)
  • safeApiCall (10-25)
presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashViewModel.kt (1)
presentation/src/main/java/com/threegap/bitnagil/presentation/common/mviviewmodel/MviViewModel.kt (2)
  • sendSideEffect (23-23)
  • sendIntent (30-37)
🔇 Additional comments (11)
domain/src/main/java/com/threegap/bitnagil/domain/auth/model/UserRole.kt (1)

6-8: UserRole 기반 when 분기 없음 — 분기 누락 우려 없음

위 스크립트 실행 결과 UserRole을 조건으로 하는 when 분기문이 전혀 발견되지 않았습니다.
따라서 ONBOARDING, WITHDRAWN, UNKNOWN 추가로 인한 분기 누락 이슈는 없습니다. 안심하고 머지하세요.

data/src/main/java/com/threegap/bitnagil/data/auth/datasource/AuthLocalDataSource.kt (1)

4-4: hasToken 사용 잔여 확인 완료

rg 검색 결과 저장소 전반에 hasToken( 호출이 전혀 남아있지 않음을 확인했습니다. 관련 수정 누락에 따른 런타임 오류 우려는 없습니다.

data/src/main/java/com/threegap/bitnagil/data/auth/service/AuthService.kt (1)

31-35: 엔드포인트/헤더 구성 적절합니다

Auto-Login 헤더로 Authenticator 루프를 회피하고, No-Service-Token으로 불필요한 토큰 주입을 막는 설정이 명확합니다. 서버 계약과 일치한다면 이 구성이 가장 깔끔합니다.

core/network/src/main/java/com/threegap/bitnagil/network/auth/TokenAuthenticator.kt (1)

22-22: Auto-Login 헤더 기반 루프 방지 의도 적합 — 재시도에서 헤더 제거까지 LGTM

  • Auto-Login 헤더가 있는 요청은 재인증을 시도하지 않고(null 반환), 재발급 후 재시도 요청에서는 해당 헤더를 제거하는 흐름이 잘 맞습니다. 토큰 재발급 API 자체에서의 무한 재시도/순환을 막는 데에 효과적입니다.

Also applies to: 86-86, 101-102

domain/src/main/java/com/threegap/bitnagil/domain/auth/usecase/AutoLoginUseCase.kt (1)

10-27: 리프레시 토큰 기반 자동 로그인 플로우 정합성 좋습니다

  • RT 없을 때 UNKNOWN 즉시 반환, 성공 시 토큰 갱신/저장, 실패 시 정리까지 도메인 흐름이 간결하고 명확합니다.
presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashScreen.kt (1)

32-33: 새 네비게이션 경로(약관 동의/온보딩) 연결 LGTM

  • 콜백 파라미터 추가 및 collectSideEffect 분기 확장은 스플래시 내 라우팅 개편 의도와 일치합니다. 호출부(MainNavHost) 업데이트만 지속적으로 일관성 체크하면 되겠습니다.

Also applies to: 40-41

domain/src/main/java/com/threegap/bitnagil/domain/auth/repository/AuthRepository.kt (1)

12-15: 토큰 라이프사이클 API 도입 방향성 OK

  • reissueToken/getRefreshToken/updateAuthToken/clearAuthToken로 역할이 명시화되어 도메인 유즈케이스 작성이 수월해졌습니다.
data/src/main/java/com/threegap/bitnagil/data/auth/repositoryimpl/AuthRepositoryImpl.kt (1)

38-48: 신규 메서드 구현 일관성 OK

  • 원격 reissueToken 매핑, 로컬 RT 조회/업데이트/정리 위임이 인터페이스와 정합합니다.
presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashViewModel.kt (3)

19-21: AutoLoginUseCase 의존성 주입으로의 전환 적절

자동 로그인 로직의 단일 진입점으로 UseCase를 갖는 DI 구성은 책임 분리에 부합합니다.


27-27: 초기 진입 시 오토로그인 1회 트리거 적절

Splash 진입 시 비동기 실행으로 UI 블로킹 없이 처리되는 점 좋습니다.


52-60: 새 내비게이션 사이드 이펙트 추가 LGTM

약관 동의/온보딩 분기 추가가 요구사항과 일치합니다.

- 자동로그인 요청에 5초 timeout 설정
- 자동로그인 실패시 UserRole을 null로 설정
Copy link

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

♻️ Duplicate comments (2)
presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashViewModel.kt (2)

78-85: 재귀 delay 패턴 유지 – 이전 리뷰와 동일한 지적 사항

onAnimationCompleted()isAutoLoginCompletedfalse일 때마다
새 코루틴을 생성하며 자기 자신을 다시 호출합니다.
무한 대기 시 코루틴이 계속 쌓일 수 있다는 위험은 여전히 존재합니다.
※ 지난 리뷰에서 동일한 개선안을 제안드렸으므로 자세한 내용은
과거 코멘트를 참고해 주세요.


87-91: UserRole 분기에서 UNKNOWN·WITHDRAWN 명시 필요

else로 뭉뚱그리지 말고 UserRole.UNKNOWN, UserRole.WITHDRAWN, null
을 명시적으로 다루라는 지난 리뷰의 권고가 반영되지 않았습니다.
역할이 추가될 때 누락을 방지하려면 명시 분기가 안전합니다.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a868f00 and d22e0e4.

📒 Files selected for processing (1)
  • presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashViewModel.kt (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-07-23T13:32:26.263Z
Learnt from: l5x5l
PR: YAPP-Github/Bitnagil-Android#41
File: presentation/src/main/java/com/threegap/bitnagil/presentation/mypage/model/MyPageIntent.kt:6-6
Timestamp: 2025-07-23T13:32:26.263Z
Learning: In the Bitnagil Android project's MVI architecture, Intent classes like `LoadMyPageSuccess` are named to represent successful API response results that carry loaded data, not just user actions. This naming convention is used for future API integration where the intent will be triggered when my page data loading succeeds from the server.

Applied to files:

  • presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashViewModel.kt
🧬 Code Graph Analysis (1)
presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashViewModel.kt (1)
presentation/src/main/java/com/threegap/bitnagil/presentation/common/mviviewmodel/MviViewModel.kt (2)
  • sendSideEffect (23-23)
  • sendIntent (30-37)
🪛 detekt (1.23.8)
presentation/src/main/java/com/threegap/bitnagil/presentation/splash/SplashViewModel.kt

[warning] 71-71: The caught exception is swallowed. The original exception could be lost.

(detekt.exceptions.SwallowedException)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

Copy link
Contributor

@l5x5l l5x5l left a comment

Choose a reason for hiding this comment

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

고생 많으셨습니다!

@wjdrjs00 wjdrjs00 merged commit a93e2d3 into develop Aug 9, 2025
2 checks passed
@wjdrjs00 wjdrjs00 deleted the refactor/#83-auto-login branch August 9, 2025 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 Refactor 기존 기능 개선 🧤 대현
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[REFACTOR] 자동 로그인 로직 변경
2 participants