Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[refactor] 닉네임 유효성 검증 로직 개선 #304

Merged
merged 4 commits into from
Jul 27, 2024

Conversation

leeeha
Copy link
Member

@leeeha leeeha commented Jun 26, 2024

📝 Work Description

  • 로직이 조금 복잡해서 이슈에 설명을 적어뒀어요! 매번 실행 결과로 확인하는 것보다 테스트 코드를 작성해보면 좋겠다는 생각이 들었습니다!
  • 입력값이 비어있는 상태에서 공백만 입력했을 때도 에러가 표시되도록 수정했어요.
  • ErrorCode라는 enum class를 InputError sealed interface 안의 Nickname 클래스로 바꿨어요.
  • 입력 에러 상태를 아래와 같이 화면에 따라 구분할 수 있게 코드를 작성해봤어요! 더 나은 방법이 있다면 의견 부탁드립니다!
sealed interface InputError {
    enum class Nickname : InputError {
        BLANK_INPUT,
        INVALID_CHAR,
        UNCHECKED_DUPLICATION,
        DUPLICATED
    }

    object Upload : InputError
}

📸 Screenshot

스크린샷 2024-06-26 오후 5 53 57

📣 To Reviewers

  • 다음주 평일 내로 리뷰 부탁드립니다~!

@leeeha leeeha added 하은 🐰 refactor 🧹 코드 리팩토링 labels Jun 26, 2024
@leeeha leeeha requested a review from sxunea June 26, 2024 16:09
@leeeha leeeha self-assigned this Jun 26, 2024

private fun checkLength(nickname: String) = nickname.length in MIN_LENGTH..MAX_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.

최대 8자까지만 입력 가능하도록 EditText에 maxLength 제한을 걸어뒀기 때문에
checkLength 함수는 불필요하다 판단해서 제거했습니다!

@leeeha leeeha merged commit c7d77f5 into develop Jul 27, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor 🧹 코드 리팩토링 하은 🐰
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

[refactor] 닉네임 유효성 검증 로직 개선
2 participants