Skip to content

Commit

Permalink
[AN] fix: 모임 상세 예외 케이스 구현 (#783)
Browse files Browse the repository at this point in the history
  • Loading branch information
jinuemong authored Jan 6, 2025
1 parent bbd917c commit ea063ba
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.happy.friendogly.presentation.ui.club.common.mapper

import com.happy.friendogly.domain.model.ClubDetail
import com.happy.friendogly.domain.model.ClubState
import com.happy.friendogly.presentation.ui.club.detail.model.ClubDetailUiModel
import com.happy.friendogly.presentation.ui.club.detail.model.ClubDetailViewType

Expand All @@ -10,7 +11,10 @@ fun ClubDetail.toPresentation(): ClubDetailUiModel {
filters = allowedGender.toGenderGroupFilters() + allowedSize.toSizeGroupFilters(),
content = content,
title = title,
petProfiles = petDetails.map { it.toPresentation() },
petProfiles =
petDetails
.map { it.toPresentation() }
.sortedByDescending { it.isMyPet },
userProfiles = memberDetails.map { it.toPresentation() },
clubDate = createdAt,
currentNumberOfPeople = currentMemberCount,
Expand All @@ -24,6 +28,7 @@ fun ClubDetail.toPresentation(): ClubDetailUiModel {
clubDetailViewType =
ClubDetailViewType.from(
isMine = isMine,
isOpenState = status == ClubState.OPEN,
isMyParticipated = alreadyParticipate,
canParticipation = canParticipate,
isUserPetEmpty = isMyPetsEmpty,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fun TextView.bindDetailViewTypeBackground(clubDetailViewType: ClubDetailViewType
R.color.coral400,
)

ClubDetailViewType.END_RECRUITMENT ->
ClubDetailViewType.END_RECRUITMENT, ClubDetailViewType.NO_AVAILABLE_PET ->
ContextCompat.getColorStateList(
context,
R.color.gray300,
Expand All @@ -35,6 +35,7 @@ fun TextView.bindDetailViewTypeText(clubDetailViewType: ClubDetailViewType?) {
ClubDetailViewType.RECRUITMENT -> context.getString(R.string.club_detail_participate_text)
ClubDetailViewType.END_RECRUITMENT -> context.getString(R.string.club_detail_un_participate_text)
ClubDetailViewType.MINE, ClubDetailViewType.PARTICIPATED -> context.getString(R.string.club_detail_mine_text)
ClubDetailViewType.NO_AVAILABLE_PET -> context.getString(R.string.club_detail_no_available_pet)
}
this.text = text
}
Expand All @@ -49,7 +50,9 @@ fun TextView.bindDetailViewTypeStyle(clubDetailViewType: ClubDetailViewType?) {
ClubDetailViewType.MINE,
-> R.style.Theme_AppCompat_TextView_SemiBold_White_Size14

ClubDetailViewType.END_RECRUITMENT -> R.style.Theme_AppCompat_TextView_SemiBold_Gray07_Size14
ClubDetailViewType.END_RECRUITMENT,
ClubDetailViewType.NO_AVAILABLE_PET,
-> R.style.Theme_AppCompat_TextView_SemiBold_Gray07_Size14
}
this.setTextAppearance(textStyle)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ enum class ClubDetailViewType {
END_RECRUITMENT,
PARTICIPATED,
MINE,
NO_AVAILABLE_PET,
;

companion object {
fun from(
isMine: Boolean,
isOpenState: Boolean,
isMyParticipated: Boolean,
canParticipation: Boolean,
isUserPetEmpty: Boolean,
Expand All @@ -20,6 +22,8 @@ enum class ClubDetailViewType {
PARTICIPATED
} else if (canParticipation or isUserPetEmpty) {
RECRUITMENT
} else if (!canParticipation && isOpenState) {
NO_AVAILABLE_PET
} else {
END_RECRUITMENT
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ fun FrameLayout.bindMyParticipation(clubDetailViewType: ClubDetailViewType) {
when (clubDetailViewType) {
ClubDetailViewType.RECRUITMENT,
ClubDetailViewType.END_RECRUITMENT,
ClubDetailViewType.NO_AVAILABLE_PET,
-> false

ClubDetailViewType.PARTICIPATED,
ClubDetailViewType.MINE,
-> true
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
<string name="club_detail_participate_text">참여하기</string>
<string name="club_detail_un_participate_text">모집종료</string>
<string name="club_detail_mine_text">모임보기</string>
<string name="club_detail_no_available_pet">참여 불가</string>
<string name="club_detail_update">수정하기</string>
<string name="club_detail_delete">방나가기</string>
<string name="club_detail_report">신고하기</string>
Expand Down

0 comments on commit ea063ba

Please sign in to comment.