Skip to content

MyPageEditName 화면 Compose 마이그레이션 + MVI 전환#402

Open
unam98 wants to merge 4 commits into
developfrom
feature/mypage-editname-compose
Open

MyPageEditName 화면 Compose 마이그레이션 + MVI 전환#402
unam98 wants to merge 4 commits into
developfrom
feature/mypage-editname-compose

Conversation

@unam98

@unam98 unam98 commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

작업 배경

  • Runnect-Android Compose 전환 로드맵의 일환으로 MyPage 서브 화면 중 가장 단순한 닉네임 수정(EditName) 화면부터 시작
  • AI 기반 유지보수 안전망 구축: 기존 LiveData+XML 구조를 StateFlow+MVI+Compose로 전환하고 단위 테스트로 로직 스펙을 고정

변경 사항

영역 내용
MyPageEditNameContract.kt EditNameUiState / EditNameIntent / EditNameEffect 신규 정의
MyPageEditNameViewModel.kt BaseViewModel+LiveData → MviViewModel+StateFlow/Effect 전환
MyPageEditNameScreen.kt Compose 화면 신규 작성 (툴바, 프로필 이미지, 닉네임 입력필드, 로딩 오버레이)
MyPageEditNameActivity.kt BindingActivityAppCompatActivity + setContent {} 적용
activity_my_page_edit_name.xml 삭제 (DataBinding 레이아웃 제거)
MyPageEditNameViewModelTest.kt Init / UpdateNickname / Submit 성공·실패 4케이스 단위 테스트

영향 범위

  • MyPageEditNameActivity 화면 렌더링 방식 변경 (XML → Compose)
  • ViewModel 상태 관리 방식 변경 (LiveData → StateFlow)
  • 외부 진입점(MyPageFragment.navigateToEditName)은 동일한 Intent Extra(nickname, profile_img)를 유지하므로 호출부 변경 없음

검증 매트릭스

영향 범위 테스트 코드
초기 닉네임·프로필 이미지 세팅 Init 인텐트는 닉네임과 프로필 이미지를 초기화한다
닉네임 입력 → 상태 반영 UpdateNickname 인텐트는 닉네임 상태를 갱신한다
완료 버튼 탭 → 저장 성공 후 화면 종료 Submit 성공 시 isLoading이 false로 복원되고 NavigateSuccess 이펙트가 발생한다
완료 버튼 탭 → 중복 닉네임 오류 토스트 Submit 실패 시 isLoading이 false로 복원되고 ShowDuplicateError 이펙트가 발생한다 — 중복 오류는 다른 유저 계정 필요, 단위 테스트로 대체

Before / After 영상

Before (XML/DataBinding) After (Compose/MVI)
before_v3.mp4
after_v3.mp4

Before 시나리오: ① 초기 닉네임(run001) + 완료 활성 → ② 삭제 → 완료 비활성 → ③ 새 닉네임 입력 → 완료 재활성 → ④ 완료 탭 → 저장 성공 + 화면 종료

After 시나리오: ① 초기 닉네임(나무나미) + 완료 활성 → ② 삭제 → 완료 비활성 → ③ run001 입력 → 완료 재활성 → ④ 완료 탭 → 저장 성공 + 화면 종료

Test Plan

  • MyPageEditNameViewModelTest 4케이스 로컬 통과
  • Before/After 영상: 시나리오 ①②③ 커버 (④ 중복 오류는 단위 테스트로 검증)
  • CI testDebugUnitTest 통과 확인

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Reworked the “Edit Name” experience with a new Compose-based screen.
    • Added live nickname editing, submit action, loading indicator, and back/cancel handling.
    • Added a back button label for the updated screen.
  • Bug Fixes

    • Improved duplicate nickname handling with a clear warning message.
    • Ensured successful name changes return the updated nickname properly.
  • Tests

    • Added unit coverage for initialization, nickname updates, submit success, and submit failure flows.

unam98 added 2 commits June 26, 2026 23:54
- 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과 동일하게)
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4c5b99c6-5f8c-4569-8229-b06ab1c3ac7d

📥 Commits

Reviewing files that changed from the base of the PR and between 0afd0d9 and 5c5facc.

📒 Files selected for processing (5)
  • app/src/main/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameActivity.kt
  • app/src/main/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameScreen.kt
  • app/src/main/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameViewModel.kt
  • app/src/main/res/values/strings.xml
  • app/src/test/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameViewModelTest.kt
🚧 Files skipped from review as they are similar to previous changes (4)
  • app/src/main/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameScreen.kt
  • app/src/main/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameViewModel.kt
  • app/src/main/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameActivity.kt
  • app/src/test/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameViewModelTest.kt

📝 Walkthrough

Walkthrough

The 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.

Changes

Edit Name Compose/MVI Migration

Layer / File(s) Summary
State contract and ViewModel base swap
app/src/main/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameContract.kt, app/src/main/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameViewModel.kt
EditNameUiState, EditNameIntent, and EditNameEffect are introduced, and the ViewModel moves to the MVI base with the new state type.
Intent handling and submit flow
app/src/main/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameViewModel.kt
handleIntent() now applies init and nickname updates, then submits through userRepository.updateNickName() while toggling loading state and emitting navigation or duplicate-error effects.
Compose screen layout
app/src/main/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameScreen.kt, app/src/main/res/values/strings.xml
The new composable renders the toolbar, profile image, nickname field, submit state, and loading overlay, with 7-character input limiting and IME Done handling.
Activity host and effect handling
app/src/main/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameActivity.kt
The activity now calls setContent, forwards UI callbacks as intents, collects effects with repeatOnLifecycle, returns the updated nickname on success, and keeps the back-press transition behavior.
ViewModel tests
app/src/test/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameViewModelTest.kt
Coroutine tests cover init, nickname updates, submit success, and submit failure with mocked repository flows and effect assertions.

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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

I hop through Compose with a twitchy nose,
One nickname field where the soft state grows.
A carrot-bright effect goes ping,
And my little ears cheer when the tests all sing. 🐰

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: migrating MyPageEditName to Compose and MVI.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/mypage-editname-compose

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

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6139d87 and ebc6326.

📒 Files selected for processing (6)
  • app/src/main/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameActivity.kt
  • app/src/main/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameContract.kt
  • app/src/main/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameScreen.kt
  • app/src/main/java/com/runnect/runnect/presentation/mypage/editname/MyPageEditNameViewModel.kt
  • app/src/main/res/layout/activity_my_page_edit_name.xml
  • app/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

@unam98 unam98 self-assigned this Jun 26, 2026
unam98 added 2 commits June 27, 2026 17:07
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 발행
  (네트워크·서버 오류를 중복 닉네임 오류로 오표기하던 문제 수정)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant