-
Notifications
You must be signed in to change notification settings - Fork 0
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
[chore] 프로필 수정 API 변경사항 적용 및 일부 로직 변경 #239
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
자세한 건 낼 보겠슴 ㅜㅜ
isDefaultImage = if (editProfile.image.isNullOrEmpty()) { | ||
"true" | ||
} else { | ||
"false" | ||
}.toRequestBody("application/json".toMediaType()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isDefaultImage = if (editProfile.image.isNullOrEmpty()) { | |
"true" | |
} else { | |
"false" | |
}.toRequestBody("application/json".toMediaType()) | |
isDefaultImage = Json.encodeToString(if (editProfile.image.isNullOrEmpty()) { | |
true | |
} else { | |
false | |
}).toRequestBody("application/json".toMediaType()) |
일케 하면 "true" 이런 거 안 써두 되지롱
근데 여기 if문 너무 많아서 복잡해지는 것 같아서 고민 좀 해보겠슴다
오늘 너무 바빠서 낼 할게오 ㅠㅠ,,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
image를 매핑할 때 https:// 를 추출해주면 좋을 것 같숩니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
또,, 생각해보니까 isNullOrEmpty()의 리턴 값은 Boolean 값이니 이런 식으로 쓸 수도 있겠다 싶네용!
isDefaultImage = if (editProfile.image.isNullOrEmpty()) { | |
"true" | |
} else { | |
"false" | |
}.toRequestBody("application/json".toMediaType()) | |
isDefaultImage = editProfile.image.isNullOrEmpty().toString().toRequestBody("application/json".toMediaType()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
집 가서 마저 달게오 ㅜㅜ
@@ -42,6 +42,7 @@ object ApiConstraints { | |||
const val DATES = "dates" | |||
const val TIME = "time" | |||
const val NEAREST = "nearest" | |||
const val ISDEFAULTIMAGE = "isDefaultImage" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const val ISDEFAULTIMAGE = "isDefaultImage" | |
const val IS_DEFAULT_IMAGE = "isDefaultImage" |
이런 식으로 하는 게 좋을 것 같숩니당
@@ -6,5 +6,6 @@ import org.sopt.dateroad.domain.model.Profile | |||
fun Profile.toEditProfile(): EditProfile = EditProfile( | |||
name = this.name, | |||
tags = this.tag, | |||
image = this.imageUrl | |||
image = this.imageUrl, | |||
isDefaultImage = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거 디폴트 값을 주신 이유가 있나요????
isDefaultImage = if (editProfile.image.isNullOrEmpty()) { | ||
"true" | ||
} else { | ||
"false" | ||
}.toRequestBody("application/json".toMediaType()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
image를 매핑할 때 https:// 를 추출해주면 좋을 것 같숩니다
isDefaultImage = if (editProfile.image.isNullOrEmpty()) { | ||
"true" | ||
} else { | ||
"false" | ||
}.toRequestBody("application/json".toMediaType()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
또,, 생각해보니까 isNullOrEmpty()의 리턴 값은 Boolean 값이니 이런 식으로 쓸 수도 있겠다 싶네용!
isDefaultImage = if (editProfile.image.isNullOrEmpty()) { | |
"true" | |
} else { | |
"false" | |
}.toRequestBody("application/json".toMediaType()) | |
isDefaultImage = editProfile.image.isNullOrEmpty().toString().toRequestBody("application/json".toMediaType()) |
val image: String? = "" | ||
val image: String? = "", | ||
val isDefaultImage: Boolean = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Data Layer의 모델은 데이터에 대한 처리를 위해 (보통 서버 통신) 필요한 data class를 작성하지만, Domain Layer의 모델은 이를 가공하여 뷰에서 사용하는 or UI로직에 필요한 data class를 작성한다고 했었던 거 기억나시나용?? 그렇기 때문에 isDefaultImage의 값은 필요가 없다는 생각인데,,! 어떻게 생각하시나요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
쓰다보니 또 코리 폭탄이 되어버렸네요 ㅠ 죄송합니다.
프로필 수정 로직도 변경했으니까 이거 이슈랑 PR에 추가해주고 스크린샷도 넣어주시면 감사하겠습니다 (좀 자세히 써주셍 ㅋㅋ)
ProfileType.EDIT -> { | ||
val currentImage = uiState.profile.imageUrl | ||
val currentTags = uiState.profile.tag | ||
Log.d("ㅋㅋ", "프로필 태그: $currentTags, 수정 태그: ${uiState.editProfile.tags}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
로그 지워주세용
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Component는 전반적으로 사용되는 부분이니까 수정 전 논의 부탁드립니당 ㅠㅠ
@@ -37,6 +37,7 @@ fun DateRoadTextFieldWithButton( | |||
modifier: Modifier = Modifier, | |||
validateState: TextFieldValidateResult = TextFieldValidateResult.Basic, | |||
title: String? = null, | |||
titleHint: String? = null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
titleDescription 어떠셔요? 힌트라기보다는 단순히 설명이라는 느낌이 강해서,,!
@@ -78,7 +85,10 @@ fun DateRoadTextFieldWithButton( | |||
.padding(vertical = 16.dp), | |||
value = value, | |||
onValueChange = { | |||
if (it.length <= maxLength) onValueChange(it) | |||
val filteredValue = it.filter { char -> | |||
char.toString().matches(Regex("[ㄱ-ㅎ가-힣a-zA-Z0-9]")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regex 객체 생성은 CPU 리소스를 크게 잡아먹는 연산 중 하나입니다! 그래서 이런 식으로 검사를 진행할 때마다 Regex 객체를 생성해주게 되면 성능이 크게 저하되는 문제가 발생합니다 ㅠㅠ Companion Object 등의 싱글턴 패턴을 활용해서 객체를 한 번만 초기화 시켜주고 검사를 진행할 때 matches만 호출해주는 것이 더 효과적이에요!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
그리구 정규식 내부에 있는 string 상수화 진행해주세용
onValueChange = { | ||
if (it.length <= maxLength) onValueChange(it) | ||
val filteredValue = it.filter { char -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
지금은 해당 컴포넌트를 프로필 수정/등록 뷰에서만 사용해서 큰 문제가 없겠지만 추후 확장성을 생각한다면 해당 함수를 호이스팅 해주는 것이 좋아 보입니다! 다른 뷰에서는 특수문자를 막을 필요가 없을 수도 있으니까요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이게 제가 위에서 컴포넌트 수정 전 논의를 먼저해달라고 한 가장 큰이유이기도 함!!
data class FetchProfile( | ||
val fetchProfileLoadState: LoadState, | ||
val editProfile: EditProfile, | ||
val nicknameValidateResult: TextFieldValidateResult, | ||
val isEnrollButtonEnabled: Boolean | ||
) : ProfileEvent() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
서버 통신이 완료될 시점에 nicknameValidateResult 값과 isEnrollButtonEnabled (얜 어차피 초기 값이 false라 따로 지정 안 해줘도 될 것 같숨다?)을 지정해야할 이유가 딱히 없어보여요! profileType을 통해 탑바 등을 바꿔줄 때 같이 해줘도 될 것 같다는 생각 입니다.
Related issue 🛠
Work Description ✏️
Screenshot 📸
Screen_recording_20240912_095701.mp4
Uncompleted Tasks 😅
To Reviewers 📢
안드데로 파이띵 ㅜ