Skip to content

Conversation

@kangyuri1114
Copy link
Member

Summary

내정보 수정 > EditText 입력 오류 수정

Describe your changes

  • addTextChangedListener에서도 userInfoViewModel.updateNickname(inputNickname)을 호출하던 문제 + Flow collect에서 무조건 setText 호출 → TextWatcher 재호출 → 입력 루프 꼬임이 원인 이었음
  • 값이 바뀌었을 때만 setText + 커서 위치를 setSelection으로 보정으로 문제 해결했습니다
  • 중간에 닉네임을 수정 후에 중복 확인 버튼을 클릭 시 기존 내 닉네임이 잠깐 노출되는 문제가 있었는데요, 닉네임 중복확인 호출하자마자 nickname을 입력한 닉네임으로 바로 업데이트 하도록 수정해서 해결했습니다.
edittext.mp4

Issue

To reviewers

커밋 내역 중에 afterTextChanged 관련 로직이 잠깐 있는데, afterTextChanged 로 수정하려다가 현 로직은 onTextChanged 가 필요해 롤백 했습니다 ㅎㅎ,,

닉네임 수정 후 이전 화면인 마이페이지로 진입 시 바뀐 닉네임으로 바로 보이도록 수정해야합니다 -> 바로 작업할게요

@kangyuri1114 kangyuri1114 self-assigned this Sep 21, 2025
@kangyuri1114 kangyuri1114 added the ⭐️ refactor 코드를 개선시킵니다. label Sep 21, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @kangyuri1114, 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!

이 PR은 내 정보 수정 화면에서 닉네임 입력 시 발생하던 여러 UI/UX 문제를 해결합니다. 특히, EditText 입력과 ViewModel 상태 업데이트 간의 복잡한 상호작용으로 인해 발생하던 입력 루프 버그를 수정하여 사용자가 닉네임을 원활하게 수정할 수 있도록 개선했습니다. 또한, 닉네임 중복 확인 과정에서 기존 닉네임이 일시적으로 노출되는 시각적 결함을 제거하여 사용자 경험을 향상시켰습니다.

Highlights

  • 입력 루프 문제 해결: EditText와 ViewModel 간의 상호작용에서 발생하던 입력 루프 문제를 해결했습니다. setText 호출 시 값이 변경되었을 때만 적용하고, 커서 위치를 보정하여 TextWatcher의 불필요한 재호출을 방지했습니다.
  • 닉네임 중복 확인 시 UI 개선: 닉네임 중복 확인 버튼 클릭 시 기존 닉네임이 잠시 노출되던 문제를 해결했습니다. 중복 확인 요청과 동시에 ViewModel의 닉네임을 입력된 값으로 즉시 업데이트하도록 수정했습니다.
  • 버튼 ID 명확화: 닉네임 중복 확인 버튼의 ID를 btn_check_nickname에서 btn_check_nickname_duplication으로 변경하여 목적을 명확히 했습니다.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

내 정보 수정 화면의 EditText 입력 오류를 수정한 점이 좋습니다. 입력 루프 문제를 해결하기 위해 setText 호출을 조건부로 변경하고 커서 위치를 조정한 것은 올바른 접근입니다. 또한, 닉네임 중복 확인 시 즉시 UI 상태를 업데이트하여 사용자 경험을 개선한 점도 긍정적입니다.

다만, 코드의 유지보수성과 안정성을 높이기 위해 한 가지 제안 사항이 있습니다. UserInfoActivity에서 StateFlow를 여러 번 구독하는 부분을 하나로 통합하고, 클릭 리스너 내에서 새로운 구독을 시작하는 안티패턴을 리팩토링하는 것이 좋겠습니다. 자세한 내용은 코드 리뷰 코멘트를 참고해주세요.

private fun setOnCheckNicknameClickListener() {
binding.btnCheckNickname.setOnClickListener {
private fun setOnCheckNicknameDuplicationClickListener() {
binding.btnCheckNicknameDuplication.setOnClickListener {
Copy link
Contributor

Choose a reason for hiding this comment

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

high

이 클릭 리스너 내에서 uiState를 구독하는 로직(110-126행)은 개선이 필요해 보입니다. 클릭할 때마다 새로운 collectLatest 코루틴을 시작하는 것은 안티패턴이며, 여러 구독으로 인해 비효율적이고 예측 불가능한 동작을 유발할 수 있습니다.

이 Activity에 이미 여러 uiState 구독이 존재하므로(onCreate, collectButtonEnableState, collectUIState), 모든 UI 업데이트를 처리하는 단일 구독으로 통합하는 것을 강력히 권장합니다.

닉네임 중복 확인 결과와 같은 일회성 이벤트를 처리하기 위해서는 ViewModel에서 SharedFlow를 사용하는 패턴을 고려해볼 수 있습니다. 이렇게 하면 UI 로직이 더 명확해지고 관리하기 쉬워집니다.

Copy link
Member Author

Choose a reason for hiding this comment

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

이건 해당 액티비티에 uistate 도입 리팩토링 때 같이 수정하겠씁니다!

Copy link
Member

@HI-JIN2 HI-JIN2 left a comment

Choose a reason for hiding this comment

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

굿굿 빠른 대응 감사합니다🙏

import android.widget.PopupWindow
import androidx.activity.viewModels
import androidx.core.content.ContextCompat
import androidx.core.widget.doAfterTextChanged
Copy link
Member

Choose a reason for hiding this comment

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

요거 안쓰는 것 같은데용?

안드로이드 스튜디오 업데이트하면서 커밋 옵션이 꺼져있지는 않은지 확인 한번 해주세용~

스크린샷 2025-09-21 오후 11 08 43

viewModelScope.launch {
validateUserNameUseCase(inputNickname).onStart {
_uiState.update { it.copy(loading = true) }
_uiState.update { it.copy(loading = true, nickname = inputNickname) }
Copy link
Member

Choose a reason for hiding this comment

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

xml 안에 id 변경으로 인한 수정 말고는 이 수정이 다 인거죵?!

Comment on lines 52 to 54
if (binding.etChNickname.text.toString() != state.nickname) {
binding.etChNickname.setText(state.nickname)
binding.etChNickname.setSelection(state.nickname.length) // 커서 끝으로 이동
Copy link
Member Author

Choose a reason for hiding this comment

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

@HI-JIN2
이 조건도 추가되었슴다!

Copy link
Member

Choose a reason for hiding this comment

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

요기 그냥 it으로 하는게 어떨까용 다른데 보니까 그냥 it으로 냅둔 것 같아서욥

Copy link
Member Author

Choose a reason for hiding this comment

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

수정했씀다

@kangyuri1114 kangyuri1114 merged commit 5a31f0d into develop Sep 22, 2025
1 check passed
@kangyuri1114 kangyuri1114 deleted the feat/fix-edittext-userinfo branch September 22, 2025 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⭐️ refactor 코드를 개선시킵니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

내 정보 수정 EditText 동작 이상함

3 participants