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] AddSubjectScreen 코드정리 #83

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from

Conversation

kamja0510
Copy link
Contributor

@kamja0510 kamja0510 commented Feb 17, 2025

Related issue 🛠

Work Description ✏️

  • 네이밍 변경
  • 상수화
  • 문자열 추출
  • state를 인자로 받기
  • statusBar 색상 변경

Screenshot 📸

Uncompleted Tasks 😅

  • 텍스트필드 검증 함수 공통 함수화

To Reviewers 📢

제일 만만한 뷰부터 시작해보았습니다.
하면서 고민을 했던점

  1. state를 인자로 전달해야하는 이유에 대해서 고민했고 리팩토링 회의록에 적어놓았습니다.
  2. 이벤트 네이밍은 on[컴포넌트][이벤트(현재형)] 으로 가는 것이 좋을 것 같습니다. kotlin 공식문서나 안드로이드 공식문서에서 이렇게 하라는 것은 찾지 못했지만 제가 찾아본 내에서는 compose api가 이 형식을 사용하고 있기 때문입니다.
  3. 저희가 Button을 Btn으로 쓰자고 결론이 났었는데 이 부분은 Button으로 바꾸면 좋을 것 같습니다. 네이밍은 명시적이고 일관적으로 작성해야하는데 줄여쓰는 것은 그 두가지 모두 해당되지 않는 것 같습니다.

Copy link
Contributor

@beom84 beom84 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다! 수정사항을 다 반영해주셨네요!

Copy link
Contributor

Choose a reason for hiding this comment

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

p5 : 디테일 와캬퍄


data object NavigateToBack : AddSubjectSideEffect

data class ShowSuccessAddSubjectSnackBar(val message: String) : AddSubjectSideEffect
Copy link
Contributor

Choose a reason for hiding this comment

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

p5 : 저희가 snackBar 함수를 사용할때 동일한 snackBar함수를 사용합니다. 특정 이유가 아니라면 ShowSnackBar함수 네이밍을 바꿀 필요가 없지않을까요?

Copy link
Collaborator

@HAJIEUN02 HAJIEUN02 Feb 21, 2025

Choose a reason for hiding this comment

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

p5
하나의 스크린에서 다른 스낵바가 여러개 띄워질 수 있는 경우에 이런 식으로 사이드이펙트를 분리하고 싶다면, message를 인자로 주는 것이 아니라 그냥 고정된 걸로 사용하는게 분리의 측면에서 더 맞는 게 아닐까 싶어요
그게 아니라면 승범오빠 말대로 공통된 스낵바 네이밍을 사용하면서 메세지만 갈아끼우는 걸로 하는게 좋을 듯합니당

import org.android.bbangzip.presentation.type.BbangZipButtonSize
import org.android.bbangzip.presentation.type.BbangZipButtonType
import org.android.bbangzip.presentation.util.modifier.addFocusCleaner
import org.android.bbangzip.ui.theme.BbangZipTheme

private const val TEXT_FIELD_MAX_CHARACTER = 10
Copy link
Contributor

Choose a reason for hiding this comment

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

p3 : 이 상수를 screen이 아닌 어디에 적을지 고민해보면 좋을 것 같습니다

) {
(LocalView.current.context as Activity).window.statusBarColor = BbangZipTheme.colors.backgroundNormal_FFFFFF.toArgb()
Copy link
Contributor

Choose a reason for hiding this comment

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

p5 : route가 아닌 screen에 선언하는 이유는 무엇인가요?

@@ -102,7 +106,7 @@ class AddSubjectViewModel
return when {
text.isEmpty() && !isFocused -> BbangZipTextFieldInputState.Default
text.isEmpty() && isFocused -> BbangZipTextFieldInputState.Placeholder
text.contains(Regex("[^가-힣ㄱ-ㅎㅏ-ㅣa-zA-Z0-9 ]")) -> BbangZipTextFieldInputState.Alert
text.contains(Regex(NON_KOREAN_ENGLISH_NUMERIC_REGEX)) -> BbangZipTextFieldInputState.Alert
Copy link
Contributor

Choose a reason for hiding this comment

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

p5 : regex에서 제공하는건가요? 신기하네요!

@@ -165,4 +170,5 @@
<string name="modify_subject_name_guideline">한글/영문/숫자 조합으로 최대 10자까지 입력 가능해요</string>
<string name="modify_motivation_message_placeholder">예) 이번에 열심히 공부해서 빵점 탈출!</string>
<string name="modify_motivation_message_guideline">한글/영문/숫자/기호 조합으로 최대25자까지 입력 가능해요</string>
<string name="add_subject_textfield_label">과목명</string>
Copy link
Contributor

Choose a reason for hiding this comment

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

p5 : 위치 조정해주세요!

@@ -0,0 +1,5 @@
package org.android.bbangzip.presentation.util.constant

Copy link
Contributor

Choose a reason for hiding this comment

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

좋네요..!

Copy link
Collaborator

@HAJIEUN02 HAJIEUN02 left a comment

Choose a reason for hiding this comment

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

굿뜨!

@@ -102,7 +106,7 @@ class AddSubjectViewModel
return when {
text.isEmpty() && !isFocused -> BbangZipTextFieldInputState.Default
text.isEmpty() && isFocused -> BbangZipTextFieldInputState.Placeholder
text.contains(Regex("[^가-힣ㄱ-ㅎㅏ-ㅣa-zA-Z0-9 ]")) -> BbangZipTextFieldInputState.Alert
text.contains(Regex(NON_KOREAN_ENGLISH_NUMERIC_REGEX)) -> BbangZipTextFieldInputState.Alert
Copy link
Collaborator

Choose a reason for hiding this comment

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

p4
요거 Regex 사용하면 객체가 하나 생성되어서 성능 측면에서 좋지 않다고 해요. 싱글톤으로 생성하는 방식에 대해 고만해보면 조을거같타툐
저도 과제 때 받은 코리라 아직 반영못한 부분이라 같이 생각해보면 조을듯해요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[refactor] AddSubjectScreen 코드 정리
3 participants