MyPageEditName 화면 Compose 마이그레이션 + MVI 전환#402
Conversation
- MyPageEditNameViewModel: BaseViewModel+LiveData → MviViewModel+StateFlow/Effect
- MyPageEditNameScreen.kt: Compose 화면 신규 작성 (XML 레이아웃 제거)
- MyPageEditNameActivity: BindingActivity → AppCompatActivity, setContent {} 적용
- MyPageEditNameViewModelTest: Init/UpdateNickname/Submit 성공·실패 4케이스 단위 테스트 작성
- statusBarsPadding() 추가: edge-to-edge 적용 시 툴바가 상태바에 겹치던 문제 수정 - border: unfocused/focused 모두 M2(#7E71FF) + radius 10dp (XML과 동일하게)
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughThe edit-name flow moves from XML/ViewBinding and LiveData to Compose and MVI. The activity now hosts the composable, the ViewModel emits state and effects for nickname updates, and tests cover init and submit outcomes. ChangesEdit Name Compose/MVI Migration
Sequence Diagram(s)sequenceDiagram
participant MyPageEditNameActivity
participant MyPageEditNameViewModel
participant UserRepository
MyPageEditNameActivity->>MyPageEditNameViewModel: handleIntent(EditNameIntent.Init)
MyPageEditNameActivity->>MyPageEditNameViewModel: handleIntent(EditNameIntent.UpdateNickname)
MyPageEditNameActivity->>MyPageEditNameViewModel: handleIntent(EditNameIntent.Submit)
MyPageEditNameViewModel->>UserRepository: updateNickName(RequestPatchNickName(nickname))
UserRepository-->>MyPageEditNameViewModel: Flow result
MyPageEditNameViewModel-->>MyPageEditNameActivity: EditNameEffect.NavigateSuccess / ShowDuplicateError
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
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: 5
🤖 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/mypage/editname/MyPageEditNameActivity.kt`:
- Around line 41-44: The toolbar back handler in MyPageEditNameActivity finishes
the activity without the same exit animation as the system back path. Update the
onBackClick callback (and the other matching back handler mentioned in the diff)
to apply the same slide_in_left/slide_out_right transition used elsewhere before
or after finish(), so both back affordances behave consistently.
- Around line 32-34: The EditName screen re-dispatches Init from
MyPageEditNameActivity on every onCreate, which can overwrite in-progress edits
after configuration changes. Make the hydration in MyPageEditNameViewModel
idempotent by ignoring repeat Init calls once state is already initialized, or
guard the Init dispatch in MyPageEditNameActivity so it only runs for the first
creation and not during recreation.
In
`@app/src/main/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameScreen.kt`:
- Around line 101-106: The back arrow in MyPageEditNameScreen’s Image is
currently unnamed for screen readers because its contentDescription is null.
Update the Image used with onBackClick to use an accessibility label, preferably
an existing localized “back” string from the screen’s resources or a new one if
needed, so the toolbar’s only back affordance is announced properly.
- Around line 55-78: Freeze the edit form in MyPageEditNameScreen while a submit
is in progress so the nickname cannot be changed after the request starts. In
the composable that renders NicknameTextField and the submit/finish action, use
state.isLoading to disable editing and any done/submit interaction until loading
completes. Make sure the final submitted value comes from the same nickname
captured when the ViewModel starts the update flow, not a later UI change, and
apply the same disabled-state behavior anywhere else the edit form is shown.
In
`@app/src/main/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameViewModel.kt`:
- Around line 36-38: The submit failure handling in MyPageEditNameViewModel is
too broad because the current onFailure branch always posts
EditNameEffect.ShowDuplicateError. Update the failure handling to inspect the
actual error/type/status coming back from the repository in this view model
flow, and only emit ShowDuplicateError for the duplicate-nickname case. Add a
separate generic failure effect/path for non-duplicate cases such as network,
server, or auth errors so the UI can show the correct message.
🪄 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: f4830f7b-7a9c-462e-82e2-4ae254464508
📒 Files selected for processing (6)
app/src/main/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameActivity.ktapp/src/main/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameContract.ktapp/src/main/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameScreen.ktapp/src/main/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameViewModel.ktapp/src/main/res/layout/activity_my_page_edit_name.xmlapp/src/test/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameViewModelTest.kt
💤 Files with no reviewable changes (1)
- app/src/main/res/layout/activity_my_page_edit_name.xml
OutlinedTextField는 M3 내부 contentPadding으로 최소 높이가 56dp이지만 원본 XML AppCompatEditText는 커스텀 background로 44dp를 사용했음. height(44.dp) 강제 시 텍스트가 세로 클리핑되는 버그 수정. BasicTextField + decorationBox로 XML과 동일한 레이아웃 재현.
- savedInstanceState == null 가드로 회전 시 편집 중 닉네임 초기화 방지 - 툴바 뒤로 버튼에 overridePendingTransition 적용(시스템 뒤로와 동일) - isLoading 중 submitEnabled/NicknameTextField.enabled = false로 폼 잠금 - 뒤로 버튼 Image contentDescription 추가(스크린리더 대응) - onFailure에서 getCode() == 400일 때만 ShowDuplicateError 발행 (네트워크·서버 오류를 중복 닉네임 오류로 오표기하던 문제 수정)
작업 배경
변경 사항
MyPageEditNameContract.ktEditNameUiState/EditNameIntent/EditNameEffect신규 정의MyPageEditNameViewModel.ktBaseViewModel+LiveData →MviViewModel+StateFlow/Effect 전환MyPageEditNameScreen.ktMyPageEditNameActivity.ktBindingActivity→AppCompatActivity+setContent {}적용activity_my_page_edit_name.xmlMyPageEditNameViewModelTest.kt영향 범위
MyPageEditNameActivity화면 렌더링 방식 변경 (XML → Compose)MyPageFragment.navigateToEditName)은 동일한 Intent Extra(nickname,profile_img)를 유지하므로 호출부 변경 없음검증 매트릭스
Init 인텐트는 닉네임과 프로필 이미지를 초기화한다UpdateNickname 인텐트는 닉네임 상태를 갱신한다Submit 성공 시 isLoading이 false로 복원되고 NavigateSuccess 이펙트가 발생한다Submit 실패 시 isLoading이 false로 복원되고 ShowDuplicateError 이펙트가 발생한다— 중복 오류는 다른 유저 계정 필요, 단위 테스트로 대체Before / After 영상
before_v3.mp4
after_v3.mp4
Before 시나리오: ① 초기 닉네임(run001) + 완료 활성 → ② 삭제 → 완료 비활성 → ③ 새 닉네임 입력 → 완료 재활성 → ④ 완료 탭 → 저장 성공 + 화면 종료
After 시나리오: ① 초기 닉네임(나무나미) + 완료 활성 → ② 삭제 → 완료 비활성 → ③ run001 입력 → 완료 재활성 → ④ 완료 탭 → 저장 성공 + 화면 종료
Test Plan
MyPageEditNameViewModelTest4케이스 로컬 통과testDebugUnitTest통과 확인🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Tests