From 8c3b522f43c42c92caf4de08c6dc630414d8c29c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=86=A1=EC=98=81=EB=AF=BC?= Date: Sun, 28 Jan 2024 18:56:08 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=82=B4=20=ED=8E=98=EC=9D=B4=EC=A7=80?= =?UTF-8?q?=20=EA=B7=B8=EB=A3=B9=20=EA=B0=80=EC=9E=85=20=EC=9D=BC=EC=9E=90?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/no5ing/bbibbi/data/model/member/Member.kt | 4 +++- .../view/main/profile/ProfilePageMemberBar.kt | 14 ++++++++++++-- .../main/java/com/no5ing/bbibbi/util/DateParser.kt | 7 +++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/no5ing/bbibbi/data/model/member/Member.kt b/app/src/main/java/com/no5ing/bbibbi/data/model/member/Member.kt index 5ff6bc4..b7d7f3b 100644 --- a/app/src/main/java/com/no5ing/bbibbi/data/model/member/Member.kt +++ b/app/src/main/java/com/no5ing/bbibbi/data/model/member/Member.kt @@ -16,6 +16,7 @@ data class Member( val imageUrl: String?, val familyId: String?, val dayOfBirth: String, + val familyJoinAt: String?, ) : Parcelable, BaseModel() { @IgnoredOnParcel val isBirthdayToday: Boolean = LocalDate @@ -36,7 +37,8 @@ data class Member( _name = "DeletedMember", imageUrl = null, familyId = null, - dayOfBirth = "2001-12-30" + dayOfBirth = "2001-12-30", + familyJoinAt = null, ) } } diff --git a/app/src/main/java/com/no5ing/bbibbi/presentation/feature/view/main/profile/ProfilePageMemberBar.kt b/app/src/main/java/com/no5ing/bbibbi/presentation/feature/view/main/profile/ProfilePageMemberBar.kt index 1984a9d..4724371 100644 --- a/app/src/main/java/com/no5ing/bbibbi/presentation/feature/view/main/profile/ProfilePageMemberBar.kt +++ b/app/src/main/java/com/no5ing/bbibbi/presentation/feature/view/main/profile/ProfilePageMemberBar.kt @@ -29,6 +29,8 @@ import com.no5ing.bbibbi.data.model.APIResponse import com.no5ing.bbibbi.data.model.member.Member import com.no5ing.bbibbi.presentation.component.CircleProfileImage import com.no5ing.bbibbi.presentation.theme.bbibbiScheme +import com.no5ing.bbibbi.presentation.theme.bbibbiTypo +import com.no5ing.bbibbi.util.toLocalizedDate @Composable fun ProfilePageMemberBar( @@ -105,9 +107,17 @@ fun ProfilePageMemberBar( ) } } - Spacer(modifier = Modifier.height(20.dp)) + if (viewerMemberId == memberState.value.data.memberId) { + Spacer(modifier = Modifier.height(12.dp)) + Text( + text = "${toLocalizedDate(memberState.value.data.familyJoinAt ?: "2000-01-01")} 가입", + style = MaterialTheme.bbibbiTypo.caption, + color = MaterialTheme.bbibbiScheme.icon, + ) + } + Spacer(modifier = Modifier.height(24.dp)) Divider(thickness = 1.dp, color = MaterialTheme.bbibbiScheme.backgroundSecondary) - Spacer(modifier = Modifier.height(20.dp)) + Spacer(modifier = Modifier.height(24 .dp)) } } } \ No newline at end of file diff --git a/app/src/main/java/com/no5ing/bbibbi/util/DateParser.kt b/app/src/main/java/com/no5ing/bbibbi/util/DateParser.kt index 59725c5..4cb5c32 100644 --- a/app/src/main/java/com/no5ing/bbibbi/util/DateParser.kt +++ b/app/src/main/java/com/no5ing/bbibbi/util/DateParser.kt @@ -36,6 +36,13 @@ fun toLocalizedDate(time: ZonedDateTime): String { return yearDateFormatter.format(time) } +fun toLocalizedDate(date: String): String { + val localDate = LocalDate.parse(date) + if (localDate.year == ZonedDateTime.now().year) + return dateFormatter.format(localDate) + return yearDateFormatter.format(localDate) +} + fun todayAsString() = LocalDate.now().toString() fun getZonedDateTimeString() = ZonedDateTime.now().toString()