-
Notifications
You must be signed in to change notification settings - Fork 1
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
[FEAT/#79] 탐색 기본 뷰 / 조회수 많은 공고 통신 #89
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.
state랑 sideEffect 관리 넘넘 잘해줘서 보는 내내 행복,,,,, 진짜 성장해가는 게 보여요,,,,,최고💚💚
|
||
interface SearchViewsDataSource { | ||
suspend fun getSearchViews(): SearchViewsResponseDto | ||
} |
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.
SearchDataSource
로 파일명을 해준 다음에 그 다음에 서치 관련 함수들을 넣어주면 코드 관리하기 편할 것 같아용!
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.
개큰박수..
@Serializable | ||
data class SearchViewsResponseDto( | ||
@SerialName("status") | ||
val status: Int, | ||
@SerialName("message") | ||
val message: String, | ||
@SerialName("result") | ||
val result: Result, | ||
) { |
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.
BaseResponse 사용해주면 이 부분 쓸 필요가 없어진답니당!
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.
스껄허게 고쳤읍니다
class SearchViewModel @Inject constructor( | ||
private val searchViewsRepository: SearchViewsRepository, |
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.
여기두 네이밍을 바꾼다면 SearchRepository
로 바꿀 수 있을 것 같네용
_sideEffect.emit(SearchViewsSideEffect.Toast(R.string.server_success)) | ||
}.onFailure { |
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 SearchViewsState( | ||
var searchViewsList: UiState<List<SearchViewsResponseModel>> = UiState.Loading, | ||
) |
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.
완벽함니다!!
status = 200, | ||
message = "탐색 > 조회수 많은 공고를 조회하는데 성공했습니다", | ||
result = SearchViewsResponseDto.Result( | ||
accountments = listOf( | ||
SearchViewsResponseDto.SearchViewsData( | ||
internshipAnnouncementId = 23L, | ||
companyImage = "https://image.dongascience.com/Photo/2019/09/d2468576cecf1313437de5a883bfa2ed.jpg", |
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.
아린씨 정말 최고야,,, 특히 sideEffect 쓰는거랑 state 관리하는 부분 정말 많이 배워갑니다!! 개큰박수!!👏🏻👏🏻👏🏻👏🏻👏🏻
keyboardController?.hide() | ||
focusManager.clearFocus() | ||
onDoneAction?.invoke() | ||
if (value.isNotEmpty() && value.isNotBlank()) { |
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.
isNotEmpty와 isNotBlank를 함께 사용하신 이유가 궁금해요!! 저는 isNotBlank가 isNotEmpty를 포함하고 있는 개념이라고 이해하고 있었거든요🥹
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.
헉 예리하다 ㅜㅜ! 맞아요 isNotBlank 안에 isNotEmpty 개념이 포함되어서 isNotBlank만 써줘도 될 것 같습니닷
if (value.isNotEmpty() && value.isNotBlank()) { | ||
keyboardController?.hide() | ||
focusManager.clearFocus() | ||
onDoneAction?.invoke() |
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.
invoke()함수 사용하지 않아도 괜찮을 것 같다는 생각이 살짝쿵 드네요..!!!
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.
null 체크를 if문으로 하는 것으로 수정했습니다!
private val searchService: SearchService | ||
): SearchViewsDataSource { | ||
override suspend fun getSearchViews(): SearchViewsResponseDto { | ||
return SearchViewsResponseDto( |
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.
오,, 이렇게 하는 방법이 있네요..!!
@SerialName("status") | ||
val status: Int, | ||
@SerialName("message") | ||
val message: String, | ||
@SerialName("result") | ||
val result: Result, |
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.
이부분 BaseResponse 사용하면 좋을 것 같아요!!
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.
넹!
viewModel.sideEffect.flowWithLifecycle(lifecycle = lifecycleOwner.lifecycle) | ||
.collect { sideEffect -> | ||
when (sideEffect) { | ||
is SearchViewsSideEffect.Toast -> {} |
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.
여기서 toast 확장함수 써주면 좋을 것 같아요!! sideEffect.message 쓰면 toast를 띄울 수 있다고 합니다(샤라웃 투 이유빈❤️)
SearchViewsResponseModel( | ||
title = entity.title, | ||
companyImage = entity.companyImage, | ||
announcementId = entity.announcementId | ||
) |
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.
DTO쪽에서 매핑해주면 더 깔끔할 것 같아요!!
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.
엔티티 네이밍에선 요청 응답 관련한 정보는 필요 없을 것 같다고 생각됩니다!!
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.
앗 InternshipAnnouncement으로 통일하겠씁니다!
⛳️ Work Description
📸 Screenshot
79.mp4
📢 To Reviewers