From d5b6a3f2d63b69a4bb8ed0b48d3114f4f7b32aa1 Mon Sep 17 00:00:00 2001 From: klaus Date: Tue, 6 Jan 2026 11:14:34 +0900 Subject: [PATCH] =?UTF-8?q?=EB=9D=BC=EC=9D=B4=EB=B8=8C=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20UTC=20=EC=8B=9C=EC=9E=91=20=EC=8B=9C=EA=B0=84=20?= =?UTF-8?q?=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 라이브 상세 응답에 beginDateTimeUtc 필드를 사용해 로컬 시간으로 표시한다. --- app/build.gradle | 2 +- .../live/room/detail/GetRoomDetailResponse.kt | 1 + .../room/detail/LiveRoomDetailFragment.kt | 32 ++++++++++++++++--- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 01bfb618..ef20e38d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -63,7 +63,7 @@ android { applicationId "kr.co.vividnext.sodalive" minSdk 23 targetSdk 35 - versionCode 210 + versionCode 211 versionName "1.46.0" } diff --git a/app/src/main/java/kr/co/vividnext/sodalive/live/room/detail/GetRoomDetailResponse.kt b/app/src/main/java/kr/co/vividnext/sodalive/live/room/detail/GetRoomDetailResponse.kt index 950fc1c8..28272fe1 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/live/room/detail/GetRoomDetailResponse.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/live/room/detail/GetRoomDetailResponse.kt @@ -19,6 +19,7 @@ data class GetRoomDetailResponse( @SerializedName("tags") val tags: List, @SerializedName("channelName") val channelName: String?, @SerializedName("beginDateTime") val beginDateTime: String, + @SerializedName("beginDateTimeUtc") val beginDateTimeUtc: String, @SerializedName("isNotification") val isNotification: Boolean, @SerializedName("numberOfParticipants") val numberOfParticipants: Int, @SerializedName("numberOfParticipantsTotal") val numberOfParticipantsTotal: Int, diff --git a/app/src/main/java/kr/co/vividnext/sodalive/live/room/detail/LiveRoomDetailFragment.kt b/app/src/main/java/kr/co/vividnext/sodalive/live/room/detail/LiveRoomDetailFragment.kt index 1d473c1a..5460af99 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/live/room/detail/LiveRoomDetailFragment.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/live/room/detail/LiveRoomDetailFragment.kt @@ -26,10 +26,11 @@ import kr.co.vividnext.sodalive.common.SharedPreferenceManager import kr.co.vividnext.sodalive.databinding.FragmentLiveRoomDetailBinding import kr.co.vividnext.sodalive.databinding.ItemLiveDetailUserSummaryBinding import kr.co.vividnext.sodalive.explorer.profile.UserProfileActivity -import kr.co.vividnext.sodalive.extensions.convertDateFormat import kr.co.vividnext.sodalive.extensions.dpToPx import org.koin.android.ext.android.inject +import java.text.SimpleDateFormat import java.util.Locale +import java.util.TimeZone class LiveRoomDetailFragment( private val roomId: Long, @@ -123,9 +124,10 @@ class LiveRoomDetailFragment( } binding.tvTitle.text = response.title - binding.tvDate.text = response.beginDateTime.convertDateFormat( - from = "yyyy.MM.dd EEE hh:mm a", - to = getString(R.string.screen_live_room_detail_date_format) + binding.tvDate.text = formatUtcToLocal( + utcDateString = response.beginDateTimeUtc, + fromFormat = "yyyy-MM-dd'T'HH:mm:ss", + toFormat = getString(R.string.screen_live_room_detail_date_format) ) if (response.price > 0) { @@ -366,4 +368,26 @@ class LiveRoomDetailFragment( startActivity(shareIntent) } } + + private fun formatUtcToLocal( + utcDateString: String, + fromFormat: String, + toFormat: String + ): String { + val fromDateFormat = SimpleDateFormat(fromFormat, Locale.getDefault()) + fromDateFormat.timeZone = TimeZone.getTimeZone("UTC") + val toDateFormat = SimpleDateFormat(toFormat, Locale.getDefault()) + toDateFormat.timeZone = TimeZone.getDefault() + + return try { + val date = fromDateFormat.parse(utcDateString) + if (date != null) { + toDateFormat.format(date) + } else { + utcDateString + } + } catch (e: Exception) { + utcDateString + } + } }