Conversation
📝 WalkthroughWalkthrough사용자 회원탈퇴 기능을 구현하기 위해 API 연동 레이어부터 프레젠테이션 레이어까지 전반적인 기능을 추가했습니다. 원격 데이터 소스, 저장소, 뷰모델에 회원탈퇴 메서드를 추가하고, 로컬 저장소의 캐시 및 기본설정을 초기화하는 기능도 함께 구현했습니다. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant MyPageScreen
participant MyPageViewModel
participant AuthRepository
participant AuthRemoteDataSource
participant AuthService
participant PreferenceDataSource
participant AuthSessionManager
User->>MyPageScreen: BadgeButton 클릭
MyPageScreen->>MyPageViewModel: OnMyArtistSelectClick
MyPageViewModel->>AuthRepository: withdrawal()
par 원격 탈퇴 처리
AuthRepository->>AuthRemoteDataSource: withdrawal()
AuthRemoteDataSource->>AuthService: DELETE /api/v1/auth/withdrawal
AuthService-->>AuthRemoteDataSource: BaseResponse<Unit>
AuthRemoteDataSource-->>AuthRepository: Result.success()
and 로컬 데이터 정리
AuthRepository->>PreferenceDataSource: clearAll()
PreferenceDataSource->>PreferenceDataSource: _cachedAccessToken = null
PreferenceDataSource->>PreferenceDataSource: _cachedRefreshToken = null
end
AuthRepository->>AuthSessionManager: logout()
AuthSessionManager-->>MyPageViewModel: 로그아웃 완료
MyPageViewModel->>MyPageViewModel: Timber.i() 성공 로깅
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (2 warnings, 1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@app/src/main/java/com/poti/android/data/repository/AuthRepositoryImpl.kt`:
- Around line 42-46: The remote withdrawal result is not being checked: modify
AuthRepositoryImpl.withdrawal() so it captures the response from
authRemoteDataSource.withdrawal(), verify the response indicates success (e.g.,
response.isSuccessful / response.status / throws on error), and only call
preferenceDataSource.clearAll() and authSessionManager.triggerLogout() after
confirming success; if the remote call fails, propagate/return the error via
httpResponseHandler.safeApiCall rather than performing local cleanup. Ensure you
reference authRemoteDataSource.withdrawal(), httpResponseHandler.safeApiCall,
preferenceDataSource.clearAll(), and authSessionManager.triggerLogout() when
making this change.
In
`@app/src/main/java/com/poti/android/presentation/user/mypage/MyPageViewModel.kt`:
- Around line 32-35: The OnMyArtistSelectClick intent in MyPageViewModel is
incorrectly invoking authRepository.withdrawal(), causing account deletion on
artist-selection clicks; update MyPageViewModel so
MyPageUiIntent.OnMyArtistSelectClick triggers the artist-selection flow (e.g.,
call a method to open artist selection UI or emit an event) and remove the
withdrawal() call from that intent, and instead add a distinct intent (e.g.,
MyPageUiIntent.OnWithdrawalClick) that alone calls authRepository.withdrawal()
within launchScope and handles onSuccess/onFailure; adjust any consumers of
MyPageUiIntent accordingly.
🧹 Nitpick comments (1)
app/src/main/java/com/poti/android/presentation/user/mypage/MyPageViewModel.kt (1)
32-36: 회원탈퇴 결과를 UI로 전달하는 사이드 이펙트 추가 권장현재 성공/실패가 Timber 로그에만 기록되고 UI에는 전달되지 않습니다. 탈퇴 완료 후 로그인/온보딩 이동, 토스트 등 일회성 이벤트는
sendEffect로 분리해 처리해주세요. 코딩 가이드라인에 따라.
| override suspend fun withdrawal(): Result<Unit> = httpResponseHandler.safeApiCall { | ||
| authRemoteDataSource.withdrawal() | ||
| preferenceDataSource.clearAll() | ||
| authSessionManager.triggerLogout() | ||
| } |
There was a problem hiding this comment.
탈퇴 응답을 확인하지 않아 실패가 누락될 수 있습니다.
withdrawal() 결과를 처리하지 않아 서버 실패가 성공으로 간주될 수 있습니다. 성공 확인 후 로컬 정리/로그아웃을 수행하는 흐름으로 수정해 주세요.
🔧 수정 제안
override suspend fun withdrawal(): Result<Unit> = httpResponseHandler.safeApiCall {
- authRemoteDataSource.withdrawal()
+ authRemoteDataSource.withdrawal()
+ .handleApiResponse()
+ .getOrThrow()
preferenceDataSource.clearAll()
authSessionManager.triggerLogout()
}🤖 Prompt for AI Agents
In `@app/src/main/java/com/poti/android/data/repository/AuthRepositoryImpl.kt`
around lines 42 - 46, The remote withdrawal result is not being checked: modify
AuthRepositoryImpl.withdrawal() so it captures the response from
authRemoteDataSource.withdrawal(), verify the response indicates success (e.g.,
response.isSuccessful / response.status / throws on error), and only call
preferenceDataSource.clearAll() and authSessionManager.triggerLogout() after
confirming success; if the remote call fails, propagate/return the error via
httpResponseHandler.safeApiCall rather than performing local cleanup. Ensure you
reference authRemoteDataSource.withdrawal(), httpResponseHandler.safeApiCall,
preferenceDataSource.clearAll(), and authSessionManager.triggerLogout() when
making this change.
| MyPageUiIntent.OnMyArtistSelectClick -> launchScope { | ||
| authRepository.withdrawal() | ||
| .onSuccess { Timber.d("Withdrawal Success") } | ||
| .onFailure { e -> Timber.e(e, "Withdrawal Failed") } |
There was a problem hiding this comment.
아티스트 선택 인텐트가 회원탈퇴로 연결되는 치명적 오동작
Line 32-35에서 OnMyArtistSelectClick이 authRepository.withdrawal()로 바로 이어집니다. MyPageScreen에서는 이 인텐트가 아티스트 선택(BadgeButton) 클릭에 연결되어 있어, 사용자가 아티스트 선택을 누를 때 계정이 탈퇴될 수 있습니다. 회원탈퇴 전용 인텐트/버튼으로 분리하거나, 이 인텐트는 아티스트 선택 흐름으로 처리해주세요.
🤖 Prompt for AI Agents
In
`@app/src/main/java/com/poti/android/presentation/user/mypage/MyPageViewModel.kt`
around lines 32 - 35, The OnMyArtistSelectClick intent in MyPageViewModel is
incorrectly invoking authRepository.withdrawal(), causing account deletion on
artist-selection clicks; update MyPageViewModel so
MyPageUiIntent.OnMyArtistSelectClick triggers the artist-selection flow (e.g.,
call a method to open artist selection UI or emit an event) and remove the
withdrawal() call from that intent, and instead add a distinct intent (e.g.,
MyPageUiIntent.OnWithdrawalClick) that alone calls authRepository.withdrawal()
within launchScope and handles onSuccess/onFailure; adjust any consumers of
MyPageUiIntent accordingly.
Related issue 🛠️
Work Description ✏️
Uncompleted Tasks 😅
N/A
To Reviewers 📢
Summary by CodeRabbit
릴리스 노트
새로운 기능
버그 수정
✏️ Tip: You can customize this high-level summary in your review settings.