From d99550945991a01d9adfa974993aa37c46967a29 Mon Sep 17 00:00:00 2001 From: kxxhyorim Date: Thu, 29 Feb 2024 18:14:51 +0900 Subject: [PATCH] =?UTF-8?q?[UI]=20MissionProcess=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=EB=90=9C=20TimeStap=20=ED=98=95=EC=8B=9D=20=EC=A0=81=EC=9A=A9?= =?UTF-8?q?=20(#208)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common_ui/model/MissionProcessInfoUI.kt | 12 +++---- .../common_ui/model/mapper/UiMapper.kt | 31 +++++++++++++++---- .../com/lgtm/domain/usecase/MissionUseCase.kt | 12 +++---- 3 files changed, 37 insertions(+), 18 deletions(-) diff --git a/common-ui/src/main/java/com/lgtm/android/common_ui/model/MissionProcessInfoUI.kt b/common-ui/src/main/java/com/lgtm/android/common_ui/model/MissionProcessInfoUI.kt index bee08774..00121966 100644 --- a/common-ui/src/main/java/com/lgtm/android/common_ui/model/MissionProcessInfoUI.kt +++ b/common-ui/src/main/java/com/lgtm/android/common_ui/model/MissionProcessInfoUI.kt @@ -4,15 +4,15 @@ import android.text.SpannableString import java.io.Serializable data class MissionProcessInfoUI( - val waitingForPaymentDate: String?, + val waitingForPaymentDate: SpannableString?, val waitingForPaymentDetail: SpannableString? = null, - val paymentConfirmationDate: String?, + val paymentConfirmationDate: SpannableString?, val paymentConfirmationDetail: SpannableString? = null, - val missionProceedingDate: String?, + val missionProceedingDate: SpannableString?, val missionProceedingDetail: SpannableString? = null, - val codeReviewDate: String?, + val codeReviewDate: SpannableString?, val codeReviewDetail: SpannableString? = null, - val missionFinishedDate: String?, - val feedbackReviewedDate: String?, + val missionFinishedDate: SpannableString?, + val feedbackReviewedDate: SpannableString?, val depositorName: String? = null, ) : Serializable \ No newline at end of file diff --git a/common-ui/src/main/java/com/lgtm/android/common_ui/model/mapper/UiMapper.kt b/common-ui/src/main/java/com/lgtm/android/common_ui/model/mapper/UiMapper.kt index 5dedb6ea..87072bc6 100644 --- a/common-ui/src/main/java/com/lgtm/android/common_ui/model/mapper/UiMapper.kt +++ b/common-ui/src/main/java/com/lgtm/android/common_ui/model/mapper/UiMapper.kt @@ -136,6 +136,25 @@ fun createRedSpannableText(text: String, redTextStart: Int, redTextEnd: Int): Sp return spannableText } +fun createLgtmDateTimeSpannable(localDateTime: LocalDateTime?): SpannableString { + return when (localDateTime) { + null -> SpannableString("-") + + else -> { + val time = localDateTime.format(korean12HourTimeFormatter) + val date = localDateTime.format(dotStyleDateFormatter) + val spannableText = SpannableString("$date | $time") + spannableText.setSpan( + ForegroundColorSpan(Color.parseColor(LGTM_GRAY_3)), + date.length + 1, + date.length + 2, + Spannable.SPAN_EXCLUSIVE_INCLUSIVE + ) + spannableText + } + } +} + fun MissionProcessInfoVO.toUiModel( role: Role, processStatus: ProcessState, @@ -198,12 +217,12 @@ fun MissionProcessInfoVO.toUiModel( else null return MissionProcessInfoUI( - waitingForPaymentDate = waitingForPaymentDate, - paymentConfirmationDate = paymentConfirmationDate, - missionProceedingDate = missionProceedingDate, - codeReviewDate = codeReviewDate, - feedbackReviewedDate = feedbackReviewedDate, - missionFinishedDate = missionFinishedDate, + waitingForPaymentDate = createLgtmDateTimeSpannable(waitingForPaymentDate), + paymentConfirmationDate = createLgtmDateTimeSpannable(paymentConfirmationDate), + missionProceedingDate = createLgtmDateTimeSpannable(missionProceedingDate), + codeReviewDate = createLgtmDateTimeSpannable(codeReviewDate), + feedbackReviewedDate = createLgtmDateTimeSpannable(feedbackReviewedDate), + missionFinishedDate = createLgtmDateTimeSpannable(missionFinishedDate), waitingForPaymentDetail = waitingForPaymentDetail, paymentConfirmationDetail = paymentConfirmationDetail, missionProceedingDetail = missionProceedingDetail, diff --git a/domain/src/main/java/com/lgtm/domain/usecase/MissionUseCase.kt b/domain/src/main/java/com/lgtm/domain/usecase/MissionUseCase.kt index 17751acd..2905a718 100644 --- a/domain/src/main/java/com/lgtm/domain/usecase/MissionUseCase.kt +++ b/domain/src/main/java/com/lgtm/domain/usecase/MissionUseCase.kt @@ -163,12 +163,12 @@ class MissionUseCase @Inject constructor( private fun formattingTimestamps(missionProcessInfo: MissionProcessInfoVO): MissionProcessInfoVO { return missionProcessInfo.copy( - waitingForPaymentDate = convertTimestampToCustomFormat(missionProcessInfo.waitingForPaymentDate), - paymentConfirmationDate = convertTimestampToCustomFormat(missionProcessInfo.paymentConfirmationDate), - missionProceedingDate = convertTimestampToCustomFormat(missionProcessInfo.missionProceedingDate), - codeReviewDate = convertTimestampToCustomFormat(missionProcessInfo.codeReviewDate), - missionFinishedDate = convertTimestampToCustomFormat(missionProcessInfo.missionFinishedDate), - feedbackReviewedDate = convertTimestampToCustomFormat(missionProcessInfo.feedbackReviewedDate) + waitingForPaymentDate = missionProcessInfo.waitingForPaymentDate, + paymentConfirmationDate = missionProcessInfo.paymentConfirmationDate, + missionProceedingDate = missionProcessInfo.missionProceedingDate, + codeReviewDate = missionProcessInfo.codeReviewDate, + missionFinishedDate = missionProcessInfo.missionFinishedDate, + feedbackReviewedDate = missionProcessInfo.feedbackReviewedDate ) }