Conversation
- NicknameRepository 및 NicknameRepositoryImpl 삭제 - UserRepository 인터페이스에 nickname 관련 메서드(save, get, observe) 추가 - UserRepositoryImpl에서 UserApi 및 ProfileDataStore를 사용하여 nickname 기능 구현 - RepositoryModule에서 NicknameRepository 바인딩 제거 및 AuthRepository에 @singleton 추가
- RemoteUser: id, nickname, level, invitationCode를 포함하는 신규 모델 추가 - UserApi: getProfile의 반환 타입을 ProfileResponse에서 RemoteUser로 변경
- Repository: NicknameRepository를 UserRepository로 변경하여 닉네임 관련 유스케이스에서 사용 - Model: 더 이상 사용되지 않는 User 도메인 모델 삭제
- `com.smtm.pickle.domain.usecase.nickname` 패키지를 `com.smtm.pickle.domain.usecase.user`로 이동 - `GetNicknameUseCase`, `SaveNicknameUseCase`, `ObserveNicknameUseCase` 경로 수정 및 관련 import문 업데이트
📝 WalkthroughSummary by CodeRabbit릴리스 노트
Walkthrough닉네임 책임을 별도 Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
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 Tip You can validate your CodeRabbit configuration file in your editor.If your editor has YAML language server, you can enable auto-completion and validation by adding |
Summary of ChangesHello, 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! 이 Pull Request는 닉네임 관리 기능을 Highlights
🧠 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. Changelog
Activity
Using Gemini Code AssistThe 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
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 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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
data/src/main/java/com/smtm/pickle/data/repository/UserRepositoryImpl.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
🧹 Nitpick comments (2)
domain/src/main/java/com/smtm/pickle/domain/repository/UserRepository.kt (1)
17-19: 닉네임 조회 계약의 nullability를 한쪽으로 맞춰두면 호출부가 더 단순해질 것 같습니다.지금은
getNickname()은 non-null인데observeNickname()은 nullable이라서, 이미ProfileViewModel(Line 26-32)과MyPageViewModel(Line 45-49)에서 기본값 보정이 중복되고 있습니다. 닉네임 미존재가 정상 상태라면 둘 다 nullable로, 아니라면 repository/usecase 레이어에서 non-null을 보장하는 방향으로 맞춰보시면 이후 호출부가 훨씬 깔끔해질 것 같습니다.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@domain/src/main/java/com/smtm/pickle/domain/repository/UserRepository.kt` around lines 17 - 19, Change the nickname contract so both methods share the same nullability to avoid repeated defaulting: update UserRepository.observeNickname() to return Flow<String> (matching suspend fun getNickname(): String) by mapping the underlying Flow<String?> to a non-null String with a clear default/fallback at the repository layer; adjust the concrete repository implementation to perform the null-to-default mapping and then remove the redundant defaulting in ProfileViewModel and MyPageViewModel where observeNickname() is consumed. Ensure the method signature for observeNickname and its implementation are updated together so callers no longer need to handle nullable nicknames.data/src/main/java/com/smtm/pickle/data/repository/UserRepositoryImpl.kt (1)
13-18: 구현체의@Singleton제거 권장
UserRepositoryImpl과AuthRepositoryImpl은 클래스 수준과RepositoryModule의@Binds메서드 양쪽에@Singleton을 선언하고 있습니다. 반면LedgerRepositoryImpl은 모듈의@Binds메서드에만@Singleton을 선언하고 있어, 세 구현체 간 패턴이 일관성 없습니다.Hilt에서는 일반적으로 모듈의 바인딩 메서드에만 스코프를 지정하는 것이 권장됩니다.
LedgerRepositoryImpl의 패턴에 맞춰UserRepositoryImpl과AuthRepositoryImpl에서 클래스 수준의@Singleton어노테이션과 임포트를 제거하면, 더 명확한 의존성 관리와 일관된 코드 스타일을 유지할 수 있습니다.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@data/src/main/java/com/smtm/pickle/data/repository/UserRepositoryImpl.kt` around lines 13 - 18, Remove the class-level `@Singleton` annotation and its import from UserRepositoryImpl and AuthRepositoryImpl so scoping is only declared on the `@Binds` methods in RepositoryModule (matching LedgerRepositoryImpl’s pattern); locate the annotations on the classes named UserRepositoryImpl and AuthRepositoryImpl and delete the `@Singleton` usage and any unused import, leaving the module-level `@Singleton` on the corresponding bind methods as the sole scope declaration.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@data/src/main/java/com/smtm/pickle/data/repository/UserRepositoryImpl.kt`:
- Around line 13-18: Remove the class-level `@Singleton` annotation and its import
from UserRepositoryImpl and AuthRepositoryImpl so scoping is only declared on
the `@Binds` methods in RepositoryModule (matching LedgerRepositoryImpl’s
pattern); locate the annotations on the classes named UserRepositoryImpl and
AuthRepositoryImpl and delete the `@Singleton` usage and any unused import,
leaving the module-level `@Singleton` on the corresponding bind methods as the
sole scope declaration.
In `@domain/src/main/java/com/smtm/pickle/domain/repository/UserRepository.kt`:
- Around line 17-19: Change the nickname contract so both methods share the same
nullability to avoid repeated defaulting: update
UserRepository.observeNickname() to return Flow<String> (matching suspend fun
getNickname(): String) by mapping the underlying Flow<String?> to a non-null
String with a clear default/fallback at the repository layer; adjust the
concrete repository implementation to perform the null-to-default mapping and
then remove the redundant defaulting in ProfileViewModel and MyPageViewModel
where observeNickname() is consumed. Ensure the method signature for
observeNickname and its implementation are updated together so callers no longer
need to handle nullable nicknames.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 408d218e-0db8-4b49-9716-5fcded8dc72e
📒 Files selected for processing (17)
data/src/main/java/com/smtm/pickle/data/di/RepositoryModule.ktdata/src/main/java/com/smtm/pickle/data/repository/NicknameRepositoryImpl.ktdata/src/main/java/com/smtm/pickle/data/repository/UserRepositoryImpl.ktdata/src/main/java/com/smtm/pickle/data/source/remote/api/UserApi.ktdata/src/main/java/com/smtm/pickle/data/source/remote/model/user/RemoteUser.ktdomain/src/main/java/com/smtm/pickle/domain/model/auth/User.ktdomain/src/main/java/com/smtm/pickle/domain/repository/NicknameRepository.ktdomain/src/main/java/com/smtm/pickle/domain/repository/UserRepository.ktdomain/src/main/java/com/smtm/pickle/domain/usecase/nickname/ObserveNicknameUseCase.ktdomain/src/main/java/com/smtm/pickle/domain/usecase/user/GetNicknameUseCase.ktdomain/src/main/java/com/smtm/pickle/domain/usecase/user/ObserveNicknameUseCase.ktdomain/src/main/java/com/smtm/pickle/domain/usecase/user/SaveNicknameUseCase.ktpresentation/src/main/java/com/smtm/pickle/presentation/home/HomeViewModel.ktpresentation/src/main/java/com/smtm/pickle/presentation/login/nickname/NicknameViewModel.ktpresentation/src/main/java/com/smtm/pickle/presentation/mypage/MyPageViewModel.ktpresentation/src/main/java/com/smtm/pickle/presentation/mypage/profile/ProfileViewModel.ktpresentation/src/main/java/com/smtm/pickle/presentation/mypage/profile/nicknamesetting/NicknameSettingViewModel.kt
💤 Files with no reviewable changes (4)
- domain/src/main/java/com/smtm/pickle/domain/model/auth/User.kt
- domain/src/main/java/com/smtm/pickle/domain/repository/NicknameRepository.kt
- data/src/main/java/com/smtm/pickle/data/repository/NicknameRepositoryImpl.kt
- domain/src/main/java/com/smtm/pickle/domain/usecase/nickname/ObserveNicknameUseCase.kt
- domain: `UserRepository` 및 `GetNicknameUseCase`의 반환 타입을 `String?`로 변경하여 널 허용
- presentation: `NicknameSettingViewModel`에서 닉네임이 없을 경우 기본값("유저 닉네임") 제공
- data: `AuthRepositoryImpl`, `UserRepositoryImpl` 클래스 레벨의 `@Singleton` 어노테이션 제거 및 `RepositoryModule` 파라미터명 정리
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@presentation/src/main/java/com/smtm/pickle/presentation/mypage/profile/nicknamesetting/NicknameSettingViewModel.kt`:
- Around line 45-47: 현재 _uiState.update { it.copy(editingNickname = nickname ?:
"유저 닉네임") } 로 기본 표시문구를 상태값에 넣어 저장 시 실제로 "유저 닉네임"이 서버로 전송될 가능성이 있습니다;
editingNickname은 빈 문자열 또는 실제 닉네임으로 유지하고 표시용 힌트(placeholder)는 View 쪽에서 처리하도록
변경하세요: 즉, _uiState 업데이트 시 editingNickname = nickname ?: ""(또는 기존 닉네임)으로 바꾸고, 저장
로직(예: saveNickname 또는 해당 저장 경로)이 editingNickname 값을 그대로 전송하지 않도록 빈 문자열 체크를 추가해
실제 사용자 입력이 없으면 서버에 기본 문구를 보내지 않도록 하세요.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 1fb6f858-b8b1-4691-8758-fad416b2af19
📒 Files selected for processing (7)
data/src/main/java/com/smtm/pickle/data/di/RepositoryModule.ktdata/src/main/java/com/smtm/pickle/data/repository/AuthRepositoryImpl.ktdata/src/main/java/com/smtm/pickle/data/repository/UserRepositoryImpl.ktdata/src/main/java/com/smtm/pickle/data/source/remote/model/user/ProfileResponse.ktdomain/src/main/java/com/smtm/pickle/domain/repository/UserRepository.ktdomain/src/main/java/com/smtm/pickle/domain/usecase/user/GetNicknameUseCase.ktpresentation/src/main/java/com/smtm/pickle/presentation/mypage/profile/nicknamesetting/NicknameSettingViewModel.kt
💤 Files with no reviewable changes (2)
- data/src/main/java/com/smtm/pickle/data/source/remote/model/user/ProfileResponse.kt
- data/src/main/java/com/smtm/pickle/data/repository/AuthRepositoryImpl.kt
| _uiState.update { | ||
| it.copy(editingNickname = nickname) | ||
| it.copy(editingNickname = nickname ?: "유저 닉네임") | ||
| } |
There was a problem hiding this comment.
표시용 기본 문구가 실제 저장 닉네임으로 전송될 수 있어 보입니다.
Line 46에서 editingNickname에 "유저 닉네임"을 넣으면, 사용자가 수정 없이 저장할 때 Line 68 경로로 해당 문자열이 서버에 저장될 수 있습니다. 표시용 기본 문구는 UI 힌트로 분리하고, 상태값은 빈 문자열(또는 실제 닉네임)로 유지하는 쪽을 제안드립니다.
제안 수정안
- _uiState.update {
- it.copy(editingNickname = nickname ?: "유저 닉네임")
- }
+ _uiState.update {
+ it.copy(editingNickname = nickname.orEmpty())
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| _uiState.update { | |
| it.copy(editingNickname = nickname) | |
| it.copy(editingNickname = nickname ?: "유저 닉네임") | |
| } | |
| _uiState.update { | |
| it.copy(editingNickname = nickname.orEmpty()) | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In
`@presentation/src/main/java/com/smtm/pickle/presentation/mypage/profile/nicknamesetting/NicknameSettingViewModel.kt`
around lines 45 - 47, 현재 _uiState.update { it.copy(editingNickname = nickname ?:
"유저 닉네임") } 로 기본 표시문구를 상태값에 넣어 저장 시 실제로 "유저 닉네임"이 서버로 전송될 가능성이 있습니다;
editingNickname은 빈 문자열 또는 실제 닉네임으로 유지하고 표시용 힌트(placeholder)는 View 쪽에서 처리하도록
변경하세요: 즉, _uiState 업데이트 시 editingNickname = nickname ?: ""(또는 기존 닉네임)으로 바꾸고, 저장
로직(예: saveNickname 또는 해당 저장 경로)이 editingNickname 값을 그대로 전송하지 않도록 빈 문자열 체크를 추가해
실제 사용자 입력이 없으면 서버에 기본 문구를 보내지 않도록 하세요.
✨ 주요 변경 사항
✅ 체크리스트
🔍 중점 리뷰 사항
비고
📸 스크린샷