Skip to content

Commit

Permalink
[REFACTOR] 최근 리뷰의 평가(추천/비추천) Nullable 처리 및 관련 코드 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
aurora32s committed Jul 2, 2023
1 parent 89f931e commit 9c06c97
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.peonlee.home.adapter.viewholder.review

import androidx.core.view.isGone
import com.peonlee.common.util.TimeUtil
import com.peonlee.core.ui.designsystem.chip.MediumChip
import com.peonlee.core.ui.extensions.getString
Expand Down Expand Up @@ -32,10 +33,15 @@ class RecentReviewViewHolder(
)
)
// 추천/비추천 chip
if (item.recommended) {
setRecommendedChip(binding.chipRecommended)
if (item.recommended != null) {
if (item.recommended) {
setRecommendedChip(binding.chipRecommended)
} else {
setNoneRecommendedChip(binding.chipRecommended)
}
} else {
setNoneRecommendedChip(binding.chipRecommended)
// 평가(추천/비추천)이 null 인 경우에는 Chip 제거
binding.chipRecommended.isGone = true
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ data class RecentReviewUiModel(
override val id: Long,
override val viewType: MainHomeViewType = MainHomeViewType.RECENT_REVIEW,
val product: ProductUiModel, // 상품 정보
val recommended: Boolean, // 평가(like, unlike)
val recommended: Boolean?, // 평가(like, unlike)
val comment: String?, // 댓글(없을 수도 있음)
val userName: String, // 작성한 사용자 닉네임
val updateDate: LocalDateTime // 해당 리뷰를 작성한 날짜
Expand Down

0 comments on commit 9c06c97

Please sign in to comment.