라이브 리스트, 상세, 예약 - 타임존을 적용해서 내려주는 beginDateTime을 제거하고 UTC 타임존이 적용된 beginDateTimeUtc를 사용하도록 수정
This commit is contained in:
@@ -69,7 +69,6 @@ data class LiveRoomResponse(
|
|||||||
@SerializedName("title") val title: String,
|
@SerializedName("title") val title: String,
|
||||||
@SerializedName("content") val content: String,
|
@SerializedName("content") val content: String,
|
||||||
@SerializedName("isPaid") val isPaid: Boolean,
|
@SerializedName("isPaid") val isPaid: Boolean,
|
||||||
@SerializedName("beginDateTime") val beginDateTime: String,
|
|
||||||
@SerializedName("beginDateTimeUtc") val beginDateTimeUtc: String,
|
@SerializedName("beginDateTimeUtc") val beginDateTimeUtc: String,
|
||||||
@SerializedName("coverImageUrl") val coverImageUrl: String,
|
@SerializedName("coverImageUrl") val coverImageUrl: String,
|
||||||
@SerializedName("isAdult") val isAdult: Boolean,
|
@SerializedName("isAdult") val isAdult: Boolean,
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ import org.koin.android.ext.android.inject
|
|||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
import java.util.TimeZone
|
||||||
|
|
||||||
class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
|
class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
|
||||||
ActivityUserProfileBinding::inflate
|
ActivityUserProfileBinding::inflate
|
||||||
@@ -1093,8 +1094,9 @@ class UserProfileActivity : BaseActivity<ActivityUserProfileBinding>(
|
|||||||
liveViewModel.enterRoom(roomId, onEnterRoomSuccess)
|
liveViewModel.enterRoom(roomId, onEnterRoomSuccess)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val beginDateFormat = SimpleDateFormat("yyyy.MM.dd EEE hh:mm a", Locale.ENGLISH)
|
val beginDateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH)
|
||||||
val beginDate = beginDateFormat.parse(it.beginDateTime)!!
|
beginDateFormat.timeZone = TimeZone.getTimeZone("UTC")
|
||||||
|
val beginDate = beginDateFormat.parse(it.beginDateTimeUtc)!!
|
||||||
val now = Date()
|
val now = Date()
|
||||||
|
|
||||||
val dateFormat = SimpleDateFormat("yyyy-MM-dd, HH:mm", Locale.getDefault())
|
val dateFormat = SimpleDateFormat("yyyy-MM-dd, HH:mm", Locale.getDefault())
|
||||||
|
|||||||
@@ -13,10 +13,14 @@ fun String.convertDateFormat(
|
|||||||
from: String,
|
from: String,
|
||||||
to: String,
|
to: String,
|
||||||
inputLocale: Locale = Locale.getDefault(),
|
inputLocale: Locale = Locale.getDefault(),
|
||||||
outputLocale: Locale = Locale.getDefault()
|
outputLocale: Locale = Locale.getDefault(),
|
||||||
|
inputTimeZone: TimeZone = TimeZone.getDefault(),
|
||||||
|
outputTimeZone: TimeZone = TimeZone.getDefault()
|
||||||
): String {
|
): String {
|
||||||
val fromDateFormat = SimpleDateFormat(from, inputLocale)
|
val fromDateFormat = SimpleDateFormat(from, inputLocale)
|
||||||
|
fromDateFormat.timeZone = inputTimeZone
|
||||||
val toDateFormat = SimpleDateFormat(to, outputLocale)
|
val toDateFormat = SimpleDateFormat(to, outputLocale)
|
||||||
|
toDateFormat.timeZone = outputTimeZone
|
||||||
|
|
||||||
var outputDateString = ""
|
var outputDateString = ""
|
||||||
val date = fromDateFormat.parse(this)
|
val date = fromDateFormat.parse(this)
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ import org.koin.android.ext.android.inject
|
|||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
import java.util.TimeZone
|
||||||
|
|
||||||
@OptIn(UnstableApi::class)
|
@OptIn(UnstableApi::class)
|
||||||
class HomeFragment : BaseFragment<FragmentHomeBinding>(FragmentHomeBinding::inflate) {
|
class HomeFragment : BaseFragment<FragmentHomeBinding>(FragmentHomeBinding::inflate) {
|
||||||
@@ -1254,8 +1255,9 @@ class HomeFragment : BaseFragment<FragmentHomeBinding>(FragmentHomeBinding::infl
|
|||||||
}, 300)
|
}, 300)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val beginDateFormat = SimpleDateFormat("yyyy.MM.dd EEE hh:mm a", Locale.ENGLISH)
|
val beginDateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH)
|
||||||
val beginDate = beginDateFormat.parse(it.beginDateTime)!!
|
beginDateFormat.timeZone = TimeZone.getTimeZone("UTC")
|
||||||
|
val beginDate = beginDateFormat.parse(it.beginDateTimeUtc)!!
|
||||||
val now = Date()
|
val now = Date()
|
||||||
|
|
||||||
val dateFormat = SimpleDateFormat("yyyy-MM-dd, HH:mm", Locale.getDefault())
|
val dateFormat = SimpleDateFormat("yyyy-MM-dd, HH:mm", Locale.getDefault())
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ data class GetRoomListResponse(
|
|||||||
@SerializedName("roomId") val roomId: Long,
|
@SerializedName("roomId") val roomId: Long,
|
||||||
@SerializedName("title") val title: String,
|
@SerializedName("title") val title: String,
|
||||||
@SerializedName("content") val content: String,
|
@SerializedName("content") val content: String,
|
||||||
@SerializedName("beginDateTime") val beginDateTime: String,
|
|
||||||
@SerializedName("beginDateTimeUtc") val beginDateTimeUtc: String,
|
@SerializedName("beginDateTimeUtc") val beginDateTimeUtc: String,
|
||||||
@SerializedName("numberOfParticipate") val numberOfParticipate: Int,
|
@SerializedName("numberOfParticipate") val numberOfParticipate: Int,
|
||||||
@SerializedName("numberOfPeople") val numberOfPeople: Int,
|
@SerializedName("numberOfPeople") val numberOfPeople: Int,
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ import org.koin.android.ext.android.inject
|
|||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
import java.util.TimeZone
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
@@ -902,8 +903,9 @@ class LiveFragment : BaseFragment<FragmentLiveBinding>(FragmentLiveBinding::infl
|
|||||||
}, 300)
|
}, 300)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val beginDateFormat = SimpleDateFormat("yyyy.MM.dd EEE hh:mm a", Locale.ENGLISH)
|
val beginDateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH)
|
||||||
val beginDate = beginDateFormat.parse(it.beginDateTime)!!
|
beginDateFormat.timeZone = TimeZone.getTimeZone("UTC")
|
||||||
|
val beginDate = beginDateFormat.parse(it.beginDateTimeUtc)!!
|
||||||
val now = Date()
|
val now = Date()
|
||||||
|
|
||||||
val dateFormat = SimpleDateFormat("yyyy-MM-dd, HH:mm", Locale.getDefault())
|
val dateFormat = SimpleDateFormat("yyyy-MM-dd, HH:mm", Locale.getDefault())
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import org.koin.android.ext.android.inject
|
|||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
|
import java.util.TimeZone
|
||||||
|
|
||||||
@UnstableApi
|
@UnstableApi
|
||||||
class LiveNowAllActivity : BaseActivity<ActivityLiveNowAllBinding>(
|
class LiveNowAllActivity : BaseActivity<ActivityLiveNowAllBinding>(
|
||||||
@@ -140,8 +141,9 @@ class LiveNowAllActivity : BaseActivity<ActivityLiveNowAllBinding>(
|
|||||||
viewModel.enterRoom(roomId, onEnterRoomSuccess)
|
viewModel.enterRoom(roomId, onEnterRoomSuccess)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val beginDateFormat = SimpleDateFormat("yyyy.MM.dd EEE hh:mm a", Locale.ENGLISH)
|
val beginDateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH)
|
||||||
val beginDate = beginDateFormat.parse(it.beginDateTime)!!
|
beginDateFormat.timeZone = TimeZone.getTimeZone("UTC")
|
||||||
|
val beginDate = beginDateFormat.parse(it.beginDateTimeUtc)!!
|
||||||
val now = Date()
|
val now = Date()
|
||||||
|
|
||||||
val dateFormat = SimpleDateFormat("yyyy-MM-dd, HH:mm", Locale.getDefault())
|
val dateFormat = SimpleDateFormat("yyyy-MM-dd, HH:mm", Locale.getDefault())
|
||||||
|
|||||||
@@ -14,6 +14,6 @@ data class GetLiveReservationResponse(
|
|||||||
@SerializedName("coverImageUrl") val coverImageUrl: String,
|
@SerializedName("coverImageUrl") val coverImageUrl: String,
|
||||||
@SerializedName("price") val price: Int,
|
@SerializedName("price") val price: Int,
|
||||||
@SerializedName("masterNickname") val masterNickname: String,
|
@SerializedName("masterNickname") val masterNickname: String,
|
||||||
@SerializedName("beginDateTime") val beginDateTime: String,
|
@SerializedName("beginDateTimeUtc") val beginDateTimeUtc: String,
|
||||||
@SerializedName("cancelable") val cancelable: Boolean,
|
@SerializedName("cancelable") val cancelable: Boolean,
|
||||||
) : Parcelable
|
) : Parcelable
|
||||||
|
|||||||
@@ -16,10 +16,12 @@ import kr.co.vividnext.sodalive.base.BaseActivity
|
|||||||
import kr.co.vividnext.sodalive.common.LoadingDialog
|
import kr.co.vividnext.sodalive.common.LoadingDialog
|
||||||
import kr.co.vividnext.sodalive.common.SodaLiveApplicationHolder
|
import kr.co.vividnext.sodalive.common.SodaLiveApplicationHolder
|
||||||
import kr.co.vividnext.sodalive.databinding.ActivityLiveReservationCancelBinding
|
import kr.co.vividnext.sodalive.databinding.ActivityLiveReservationCancelBinding
|
||||||
|
import kr.co.vividnext.sodalive.extensions.convertDateFormat
|
||||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||||
import kr.co.vividnext.sodalive.main.MainActivity
|
import kr.co.vividnext.sodalive.main.MainActivity
|
||||||
import kr.co.vividnext.sodalive.mypage.can.status.CanStatusActivity
|
import kr.co.vividnext.sodalive.mypage.can.status.CanStatusActivity
|
||||||
import org.koin.android.ext.android.inject
|
import org.koin.android.ext.android.inject
|
||||||
|
import java.util.TimeZone
|
||||||
|
|
||||||
class LiveReservationCancelActivity : BaseActivity<ActivityLiveReservationCancelBinding>(
|
class LiveReservationCancelActivity : BaseActivity<ActivityLiveReservationCancelBinding>(
|
||||||
ActivityLiveReservationCancelBinding::inflate
|
ActivityLiveReservationCancelBinding::inflate
|
||||||
@@ -146,7 +148,11 @@ class LiveReservationCancelActivity : BaseActivity<ActivityLiveReservationCancel
|
|||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
private fun setReservation(response: GetLiveReservationResponse) {
|
private fun setReservation(response: GetLiveReservationResponse) {
|
||||||
binding.tvDate.text = response.beginDateTime
|
binding.tvDate.text = response.beginDateTimeUtc.convertDateFormat(
|
||||||
|
from = "yyyy-MM-dd'T'HH:mm:ss",
|
||||||
|
to = "yyyy.MM.dd EEE hh:mm a",
|
||||||
|
inputTimeZone = TimeZone.getTimeZone("UTC")
|
||||||
|
)
|
||||||
binding.tvNickname.text = response.masterNickname
|
binding.tvNickname.text = response.masterNickname
|
||||||
binding.tvTitle.text = response.title
|
binding.tvTitle.text = response.title
|
||||||
binding.ivProfile.load(response.coverImageUrl) {
|
binding.ivProfile.load(response.coverImageUrl) {
|
||||||
|
|||||||
@@ -7,8 +7,10 @@ import androidx.recyclerview.widget.RecyclerView
|
|||||||
import coil.load
|
import coil.load
|
||||||
import coil.transform.RoundedCornersTransformation
|
import coil.transform.RoundedCornersTransformation
|
||||||
import kr.co.vividnext.sodalive.databinding.ItemLiveReservationStatusBinding
|
import kr.co.vividnext.sodalive.databinding.ItemLiveReservationStatusBinding
|
||||||
|
import kr.co.vividnext.sodalive.extensions.convertDateFormat
|
||||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||||
import kr.co.vividnext.sodalive.R
|
import kr.co.vividnext.sodalive.R
|
||||||
|
import java.util.TimeZone
|
||||||
|
|
||||||
class LiveReservationStatusAdapter(
|
class LiveReservationStatusAdapter(
|
||||||
private val onClickCancel: (GetLiveReservationResponse) -> Unit
|
private val onClickCancel: (GetLiveReservationResponse) -> Unit
|
||||||
@@ -22,7 +24,11 @@ class LiveReservationStatusAdapter(
|
|||||||
|
|
||||||
fun bind(item: GetLiveReservationResponse) {
|
fun bind(item: GetLiveReservationResponse) {
|
||||||
val context = binding.root.context
|
val context = binding.root.context
|
||||||
binding.tvDate.text = item.beginDateTime
|
binding.tvDate.text = item.beginDateTimeUtc.convertDateFormat(
|
||||||
|
from = "yyyy-MM-dd'T'HH:mm:ss",
|
||||||
|
to = "yyyy.MM.dd EEE hh:mm a",
|
||||||
|
inputTimeZone = TimeZone.getTimeZone("UTC")
|
||||||
|
)
|
||||||
binding.tvNickname.text = item.masterNickname
|
binding.tvNickname.text = item.masterNickname
|
||||||
binding.tvTitle.text = item.title
|
binding.tvTitle.text = item.title
|
||||||
binding.ivProfile.load(item.coverImageUrl) {
|
binding.ivProfile.load(item.coverImageUrl) {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ data class GetRoomDetailResponse(
|
|||||||
@SerializedName("password") val password: Int?,
|
@SerializedName("password") val password: Int?,
|
||||||
@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("beginDateTimeUtc") val beginDateTimeUtc: 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,
|
||||||
|
|||||||
@@ -26,10 +26,9 @@ 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.TimeZone
|
import java.util.TimeZone
|
||||||
|
|
||||||
class LiveRoomDetailFragment(
|
class LiveRoomDetailFragment(
|
||||||
@@ -124,10 +123,10 @@ class LiveRoomDetailFragment(
|
|||||||
}
|
}
|
||||||
|
|
||||||
binding.tvTitle.text = response.title
|
binding.tvTitle.text = response.title
|
||||||
binding.tvDate.text = formatUtcToLocal(
|
binding.tvDate.text = response.beginDateTimeUtc.convertDateFormat(
|
||||||
utcDateString = response.beginDateTimeUtc,
|
from = "yyyy-MM-dd'T'HH:mm:ss",
|
||||||
fromFormat = "yyyy-MM-dd'T'HH:mm:ss",
|
to = getString(R.string.screen_live_room_detail_date_format),
|
||||||
toFormat = getString(R.string.screen_live_room_detail_date_format)
|
inputTimeZone = TimeZone.getTimeZone("UTC")
|
||||||
)
|
)
|
||||||
|
|
||||||
if (response.price > 0) {
|
if (response.price > 0) {
|
||||||
@@ -368,26 +367,4 @@ 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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,14 +136,16 @@ class LiveRoomEditViewModel(
|
|||||||
|
|
||||||
fun setRoomDetail(roomDetail: GetRoomDetailResponse) {
|
fun setRoomDetail(roomDetail: GetRoomDetailResponse) {
|
||||||
this.roomDetail = roomDetail
|
this.roomDetail = roomDetail
|
||||||
val date = roomDetail.beginDateTime.convertDateFormat(
|
val date = roomDetail.beginDateTimeUtc.convertDateFormat(
|
||||||
from = "yyyy.MM.dd EEE hh:mm a",
|
from = "yyyy-MM-dd'T'HH:mm:ss",
|
||||||
to = "yyyy.MM.dd"
|
to = "yyyy.MM.dd",
|
||||||
|
inputTimeZone = TimeZone.getTimeZone("UTC")
|
||||||
)
|
)
|
||||||
|
|
||||||
val time = roomDetail.beginDateTime.convertDateFormat(
|
val time = roomDetail.beginDateTimeUtc.convertDateFormat(
|
||||||
from = "yyyy.MM.dd EEE hh:mm a",
|
from = "yyyy-MM-dd'T'HH:mm:ss",
|
||||||
to = "a hh:mm"
|
to = "a hh:mm",
|
||||||
|
inputTimeZone = TimeZone.getTimeZone("UTC")
|
||||||
)
|
)
|
||||||
|
|
||||||
_reservationDateLiveData.value = date
|
_reservationDateLiveData.value = date
|
||||||
|
|||||||
Reference in New Issue
Block a user