GiveNicknameActivity Compose 전환 및 테스트 추가#404
Conversation
📝 WalkthroughWalkthrough
ChangesGiveNickname Compose Migration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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
🧹 Nitpick comments (1)
app/src/main/java/com/runnect/runnect/presentation/login/GiveNickNameViewModel.kt (1)
27-29: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winKeep the nickname-length rule below the Compose layer too.
updateNickNameInput()is now a public entrypoint, but the 7-character cap only exists inGiveNicknameScreen.kt. Move that validation into the ViewModel or a shared validator so non-UI callers cannot submit over-limit nicknames through this method.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/src/main/java/com/runnect/runnect/presentation/login/GiveNickNameViewModel.kt` around lines 27 - 29, The nickname length check currently only exists in GiveNicknameScreen, so public callers can still push over-limit values through GiveNickNameViewModel.updateNickNameInput. Move the 7-character validation into GiveNickNameViewModel itself or a shared validator used by updateNickNameInput and the Compose screen, and ensure the ViewModel rejects or truncates invalid input before assigning nickName.value.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@app/src/main/java/com/runnect/runnect/presentation/login/GiveNicknameScreen.kt`:
- Around line 102-106: Freeze nickname edits during the loading state by
preventing input changes while UiState.Loading is active. Update
GiveNicknameScreen and the NicknameTextField usage so onNickNameChange is
ignored or the field is disabled whenever state is Loading, keeping the
displayed nickname and the in-flight save request in sync. Apply the same
protection anywhere else nickname input is wired up, including the related code
in the other affected section.
- Around line 159-160: The nickname input handling in GiveNicknameScreen
currently ignores any pasted value longer than NICKNAME_MAX_LENGTH, so oversized
input is dropped instead of being accepted predictably. Update the onValueChange
logic in the nickname field to clamp nextValue to NICKNAME_MAX_LENGTH before
calling onNickNameChange, so the field always forwards a truncated value rather
than skipping the update.
---
Nitpick comments:
In
`@app/src/main/java/com/runnect/runnect/presentation/login/GiveNickNameViewModel.kt`:
- Around line 27-29: The nickname length check currently only exists in
GiveNicknameScreen, so public callers can still push over-limit values through
GiveNickNameViewModel.updateNickNameInput. Move the 7-character validation into
GiveNickNameViewModel itself or a shared validator used by updateNickNameInput
and the Compose screen, and ensure the ViewModel rejects or truncates invalid
input before assigning nickName.value.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 11d156a0-7eb3-45c0-aa2c-2b75755f2e43
📒 Files selected for processing (6)
app/src/androidTest/java/com/runnect/runnect/presentation/login/GiveNicknameScreenTest.ktapp/src/main/java/com/runnect/runnect/presentation/login/GiveNickNameViewModel.ktapp/src/main/java/com/runnect/runnect/presentation/login/GiveNicknameActivity.ktapp/src/main/java/com/runnect/runnect/presentation/login/GiveNicknameScreen.ktapp/src/main/res/layout/activity_give_nickname.xmlapp/src/test/java/com/runnect/runnect/presentation/login/GiveNickNameViewModelTest.kt
💤 Files with no reviewable changes (1)
- app/src/main/res/layout/activity_give_nickname.xml
| NicknameTextField( | ||
| nickName = state.nickName, | ||
| onNickNameChange = onNickNameChange, | ||
| onDone = { focusManager.clearFocus() } | ||
| ) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Freeze nickname edits while the request is in flight.
updateNickName() submits the current nickname immediately, but this field still accepts new input during UiState.Loading. That can leave the screen showing nickname B while the app is still saving nickname A.
Suggested fix
NicknameTextField(
nickName = state.nickName,
+ isEditable = !state.isLoading,
onNickNameChange = onNickNameChange,
onDone = { focusManager.clearFocus() }
)
@@
private fun NicknameTextField(
nickName: String,
+ isEditable: Boolean,
onNickNameChange: (String) -> Unit,
onDone: () -> Unit,
) {
BasicTextField(
value = nickName,
onValueChange = { nextValue ->
- if (nextValue.length <= NICKNAME_MAX_LENGTH) onNickNameChange(nextValue)
+ if (isEditable && nextValue.length <= NICKNAME_MAX_LENGTH) {
+ onNickNameChange(nextValue)
+ }
},Also applies to: 151-173
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@app/src/main/java/com/runnect/runnect/presentation/login/GiveNicknameScreen.kt`
around lines 102 - 106, Freeze nickname edits during the loading state by
preventing input changes while UiState.Loading is active. Update
GiveNicknameScreen and the NicknameTextField usage so onNickNameChange is
ignored or the field is disabled whenever state is Loading, keeping the
displayed nickname and the in-flight save request in sync. Apply the same
protection anywhere else nickname input is wired up, including the related code
in the other affected section.
| onValueChange = { nextValue -> | ||
| if (nextValue.length <= NICKNAME_MAX_LENGTH) onNickNameChange(nextValue) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Clamp oversized input instead of dropping it.
Pasting more than 7 characters into an empty field currently leaves the value unchanged. Truncate to NICKNAME_MAX_LENGTH before forwarding the update so long pastes still behave predictably.
Suggested fix
onValueChange = { nextValue ->
- if (nextValue.length <= NICKNAME_MAX_LENGTH) onNickNameChange(nextValue)
+ onNickNameChange(nextValue.take(NICKNAME_MAX_LENGTH))
},📝 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.
| onValueChange = { nextValue -> | |
| if (nextValue.length <= NICKNAME_MAX_LENGTH) onNickNameChange(nextValue) | |
| onValueChange = { nextValue -> | |
| onNickNameChange(nextValue.take(NICKNAME_MAX_LENGTH)) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
`@app/src/main/java/com/runnect/runnect/presentation/login/GiveNicknameScreen.kt`
around lines 159 - 160, The nickname input handling in GiveNicknameScreen
currently ignores any pasted value longer than NICKNAME_MAX_LENGTH, so oversized
input is dropped instead of being accepted predictably. Update the onValueChange
logic in the nickname field to clamp nextValue to NICKNAME_MAX_LENGTH before
calling onNickNameChange, so the field always forwards a truncated value rather
than skipping the update.
작업 배경
변경 사항
GiveNicknameActivitysetContentCompose 화면으로 전환하고 기존 Analytics/토큰 저장/화면 이동 side effect를 유지GiveNicknameScreenGiveNickNameViewModelupdateNickNameInput추가GiveNickNameViewModelTestGiveNicknameScreenTestactivity_give_nickname.xml영향 범위
검증 매트릭스
updateNickNameInput은 닉네임 값을 갱신한다updateNickName 성공 시 Loading 이후 Success 상태로 갱신된다updateNickName 실패 시 statusCode와 Failure 상태로 갱신된다닉네임_입력_화면_요소가_노출된다닉네임이_비어있으면_시작하기_버튼은_비활성화된다닉네임을_입력하면_변경_콜백이_호출된다시작하기_버튼을_누르면_콜백이_호출된다로딩_상태면_인디케이터가_노출된다Test Plan
./gradlew testDebugUnitTest --tests 'com.runnect.runnect.presentation.login.GiveNickNameViewModelTest'3/3 통과./gradlew connectedDebugAndroidTest -Pandroid.testInstrumentationRunnerArguments.class=com.runnect.runnect.presentation.login.GiveNicknameScreenTest5/5 통과./gradlew assembleDebug통과Before / After 영상
give_nickname_before.mp4
give_nickname_after.mp4
빈 닉네임 상태와 닉네임 입력 후 시작 버튼 활성화 상태를 비교했습니다.
🤖 Generated with Claude Code