라이브 상세 UTC 시작 시간 반영
라이브 상세 응답에 beginDateTimeUtc 필드를 사용해 로컬 시간으로 표시한다.
This commit is contained in:
@@ -63,7 +63,7 @@ android {
|
|||||||
applicationId "kr.co.vividnext.sodalive"
|
applicationId "kr.co.vividnext.sodalive"
|
||||||
minSdk 23
|
minSdk 23
|
||||||
targetSdk 35
|
targetSdk 35
|
||||||
versionCode 210
|
versionCode 211
|
||||||
versionName "1.46.0"
|
versionName "1.46.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ data class GetRoomDetailResponse(
|
|||||||
@SerializedName("tags") val tags: List<String>,
|
@SerializedName("tags") val tags: List<String>,
|
||||||
@SerializedName("channelName") val channelName: String?,
|
@SerializedName("channelName") val channelName: String?,
|
||||||
@SerializedName("beginDateTime") val beginDateTime: String,
|
@SerializedName("beginDateTime") val beginDateTime: String,
|
||||||
|
@SerializedName("beginDateTimeUtc") val beginDateTimeUtc: String,
|
||||||
@SerializedName("isNotification") val isNotification: Boolean,
|
@SerializedName("isNotification") val isNotification: Boolean,
|
||||||
@SerializedName("numberOfParticipants") val numberOfParticipants: Int,
|
@SerializedName("numberOfParticipants") val numberOfParticipants: Int,
|
||||||
@SerializedName("numberOfParticipantsTotal") val numberOfParticipantsTotal: Int,
|
@SerializedName("numberOfParticipantsTotal") val numberOfParticipantsTotal: Int,
|
||||||
|
|||||||
@@ -26,10 +26,11 @@ import kr.co.vividnext.sodalive.common.SharedPreferenceManager
|
|||||||
import kr.co.vividnext.sodalive.databinding.FragmentLiveRoomDetailBinding
|
import kr.co.vividnext.sodalive.databinding.FragmentLiveRoomDetailBinding
|
||||||
import kr.co.vividnext.sodalive.databinding.ItemLiveDetailUserSummaryBinding
|
import kr.co.vividnext.sodalive.databinding.ItemLiveDetailUserSummaryBinding
|
||||||
import kr.co.vividnext.sodalive.explorer.profile.UserProfileActivity
|
import kr.co.vividnext.sodalive.explorer.profile.UserProfileActivity
|
||||||
import kr.co.vividnext.sodalive.extensions.convertDateFormat
|
|
||||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||||
import org.koin.android.ext.android.inject
|
import org.koin.android.ext.android.inject
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
import java.util.TimeZone
|
||||||
|
|
||||||
class LiveRoomDetailFragment(
|
class LiveRoomDetailFragment(
|
||||||
private val roomId: Long,
|
private val roomId: Long,
|
||||||
@@ -123,9 +124,10 @@ class LiveRoomDetailFragment(
|
|||||||
}
|
}
|
||||||
|
|
||||||
binding.tvTitle.text = response.title
|
binding.tvTitle.text = response.title
|
||||||
binding.tvDate.text = response.beginDateTime.convertDateFormat(
|
binding.tvDate.text = formatUtcToLocal(
|
||||||
from = "yyyy.MM.dd EEE hh:mm a",
|
utcDateString = response.beginDateTimeUtc,
|
||||||
to = getString(R.string.screen_live_room_detail_date_format)
|
fromFormat = "yyyy-MM-dd'T'HH:mm:ss",
|
||||||
|
toFormat = getString(R.string.screen_live_room_detail_date_format)
|
||||||
)
|
)
|
||||||
|
|
||||||
if (response.price > 0) {
|
if (response.price > 0) {
|
||||||
@@ -366,4 +368,26 @@ class LiveRoomDetailFragment(
|
|||||||
startActivity(shareIntent)
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user