diff --git a/SodaLive/Sources/Explorer/Profile/GetCreatorProfileResponse.swift b/SodaLive/Sources/Explorer/Profile/GetCreatorProfileResponse.swift index bfc812f..79ea92a 100644 --- a/SodaLive/Sources/Explorer/Profile/GetCreatorProfileResponse.swift +++ b/SodaLive/Sources/Explorer/Profile/GetCreatorProfileResponse.swift @@ -60,7 +60,6 @@ struct LiveRoomResponse: Decodable { let title: String let content: String let isPaid: Bool - let beginDateTime: String let beginDateTimeUtc: String let coverImageUrl: String let isAdult: Bool diff --git a/SodaLive/Sources/Explorer/Profile/UserProfileViewModel.swift b/SodaLive/Sources/Explorer/Profile/UserProfileViewModel.swift index da07f58..a44f3c9 100644 --- a/SodaLive/Sources/Explorer/Profile/UserProfileViewModel.swift +++ b/SodaLive/Sources/Explorer/Profile/UserProfileViewModel.swift @@ -203,20 +203,17 @@ final class UserProfileViewModel: ObservableObject { } self.isShowPasswordDialog = true } else { - let fromFormatter = DateFormatter() - fromFormatter.dateFormat = "yyyy.MM.dd EEE hh:mm a" - fromFormatter.locale = Locale(identifier: "en_US_POSIX") - let beginDate = fromFormatter.date(from: $0.beginDateTime)! - let now = Date() - - let timeInterval = now.timeIntervalSince(beginDate) - let hours = Int(timeInterval / 3600) - let minutes = Int((timeInterval.truncatingRemainder(dividingBy: 3600)) / 60) - - if hours >= 1 { - self.liveStartDate = beginDate.convertDateFormat(dateFormat: "yyyy-MM-dd, HH:mm") - self.nowDate = now.convertDateFormat(dateFormat: "yyyy-MM-dd, HH:mm") - self.paymentDialogDesc2 = I18n.MemberChannel.elapsedLiveWarning(hours: hours, minutes: minutes) + if let beginDate = $0.beginDateTimeUtc.parseUtcIsoDate() { + let now = Date() + let timeInterval = now.timeIntervalSince(beginDate) + let hours = Int(timeInterval / 3600) + let minutes = Int((timeInterval.truncatingRemainder(dividingBy: 3600)) / 60) + + if hours >= 1 { + self.liveStartDate = beginDate.convertDateFormat(dateFormat: "yyyy-MM-dd, HH:mm") + self.nowDate = now.convertDateFormat(dateFormat: "yyyy-MM-dd, HH:mm") + self.paymentDialogDesc2 = I18n.MemberChannel.elapsedLiveWarning(hours: hours, minutes: minutes) + } } self.paymentDialogTitle = I18n.MemberChannel.paidLiveEnterTitle diff --git a/SodaLive/Sources/Home/HomeLiveItemView.swift b/SodaLive/Sources/Home/HomeLiveItemView.swift index d2e2fa4..51fa396 100644 --- a/SodaLive/Sources/Home/HomeLiveItemView.swift +++ b/SodaLive/Sources/Home/HomeLiveItemView.swift @@ -66,7 +66,6 @@ struct HomeLiveItemView: View { roomId: 1, title: "네네코 마사로네네코 마사로네네코 마사로네네코 마사로", content: "테스트", - beginDateTime: "2025-08-10 15:00:00", beginDateTimeUtc: "2025-08-10T15:00:00", numberOfParticipate: 1, numberOfPeople: 10, diff --git a/SodaLive/Sources/Live/GetRoomListResponse.swift b/SodaLive/Sources/Live/GetRoomListResponse.swift index 0a2399f..9f99b99 100644 --- a/SodaLive/Sources/Live/GetRoomListResponse.swift +++ b/SodaLive/Sources/Live/GetRoomListResponse.swift @@ -11,7 +11,6 @@ struct GetRoomListResponse: Decodable, Hashable { let roomId: Int let title: String let content: String - let beginDateTime: String let beginDateTimeUtc: String let numberOfParticipate: Int let numberOfPeople: Int diff --git a/SodaLive/Sources/Live/LiveViewModel.swift b/SodaLive/Sources/Live/LiveViewModel.swift index b4aa1d0..184a4a3 100644 --- a/SodaLive/Sources/Live/LiveViewModel.swift +++ b/SodaLive/Sources/Live/LiveViewModel.swift @@ -368,20 +368,17 @@ final class LiveViewModel: ObservableObject { } self.isShowPasswordDialog = true } else { - let fromFormatter = DateFormatter() - fromFormatter.dateFormat = "yyyy.MM.dd EEE hh:mm a" - fromFormatter.locale = Locale(identifier: "en_US_POSIX") - let beginDate = fromFormatter.date(from: $0.beginDateTime)! - let now = Date() - - let timeInterval = now.timeIntervalSince(beginDate) - let hours = Int(timeInterval / 3600) - let minutes = Int((timeInterval.truncatingRemainder(dividingBy: 3600)) / 60) - - if hours >= 1 { - self.liveStartDate = beginDate.convertDateFormat(dateFormat: "yyyy-MM-dd, HH:mm") - self.nowDate = now.convertDateFormat(dateFormat: "yyyy-MM-dd, HH:mm") - self.paymentDialogDesc2 = "라이브를 시작한 지 \(hours)시간 \(minutes)분이 지났습니다. 라이브에 입장 후 30분 이내에 라이브가 종료될 수도 있습니다." + if let beginDate = $0.beginDateTimeUtc.parseUtcIsoDate() { + let now = Date() + let timeInterval = now.timeIntervalSince(beginDate) + let hours = Int(timeInterval / 3600) + let minutes = Int((timeInterval.truncatingRemainder(dividingBy: 3600)) / 60) + + if hours >= 1 { + self.liveStartDate = beginDate.convertDateFormat(dateFormat: "yyyy-MM-dd, HH:mm") + self.nowDate = now.convertDateFormat(dateFormat: "yyyy-MM-dd, HH:mm") + self.paymentDialogDesc2 = "라이브를 시작한 지 \(hours)시간 \(minutes)분이 지났습니다. 라이브에 입장 후 30분 이내에 라이브가 종료될 수도 있습니다." + } } self.paymentDialogTitle = "유료 라이브 입장" diff --git a/SodaLive/Sources/Live/Now/All/LiveNowAllItemView.swift b/SodaLive/Sources/Live/Now/All/LiveNowAllItemView.swift index 5cd90e1..a673297 100644 --- a/SodaLive/Sources/Live/Now/All/LiveNowAllItemView.swift +++ b/SodaLive/Sources/Live/Now/All/LiveNowAllItemView.swift @@ -135,7 +135,6 @@ struct LiveNowAllItemView_Previews: PreviewProvider { roomId: 99, title: "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttest", content: "testtest", - beginDateTime: "2022.05.23 Mon 03:00 PM", beginDateTimeUtc: "2025-08-10T15:00:00", numberOfParticipate: 3, numberOfPeople: 5, @@ -154,4 +153,3 @@ struct LiveNowAllItemView_Previews: PreviewProvider { ) } } - diff --git a/SodaLive/Sources/Live/Now/LiveNowItemView.swift b/SodaLive/Sources/Live/Now/LiveNowItemView.swift index 02615c6..6e0af8f 100644 --- a/SodaLive/Sources/Live/Now/LiveNowItemView.swift +++ b/SodaLive/Sources/Live/Now/LiveNowItemView.swift @@ -106,7 +106,6 @@ struct LiveNowItemView_Previews: PreviewProvider { roomId: 99, title: "testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttest", content: "testtest", - beginDateTime: "2022.05.23 Mon 03:00 PM", beginDateTimeUtc: "2025-08-10T15:00:00", numberOfParticipate: 3, numberOfPeople: 5, diff --git a/SodaLive/Sources/Live/Reservation/All/LiveReservationAllItemView.swift b/SodaLive/Sources/Live/Reservation/All/LiveReservationAllItemView.swift index 2b53c86..fc95d66 100644 --- a/SodaLive/Sources/Live/Reservation/All/LiveReservationAllItemView.swift +++ b/SodaLive/Sources/Live/Reservation/All/LiveReservationAllItemView.swift @@ -33,7 +33,10 @@ struct LiveReservationAllItemView: View { HStack(alignment: .top, spacing: 0) { VStack(alignment: .leading, spacing: 0) { - Text(item.beginDateTime) + let beginDateText = item.beginDateTimeUtc + .parseUtcIsoDate()? + .convertDateFormat(dateFormat: "yyyy.MM.dd EEE hh:mm a") ?? item.beginDateTimeUtc + Text(beginDateText) .font(.custom(Font.medium.rawValue, size: 9.3)) .foregroundColor(Color(hex: "ffd300")) diff --git a/SodaLive/Sources/Live/Reservation/LiveReservationItemView.swift b/SodaLive/Sources/Live/Reservation/LiveReservationItemView.swift index b3d64ed..e10ebd3 100644 --- a/SodaLive/Sources/Live/Reservation/LiveReservationItemView.swift +++ b/SodaLive/Sources/Live/Reservation/LiveReservationItemView.swift @@ -126,7 +126,6 @@ struct LiveReservationItemView_Previews: PreviewProvider { roomId: 99, title: "test", content: "testtest", - beginDateTime: "2022.05.23 Mon 03:00 PM", beginDateTimeUtc: "2025-08-10T15:00:00", numberOfParticipate: 0, numberOfPeople: 5, diff --git a/SodaLive/Sources/Live/Reservation/MyLiveReservationItemView.swift b/SodaLive/Sources/Live/Reservation/MyLiveReservationItemView.swift index 1b1f705..fc7f859 100644 --- a/SodaLive/Sources/Live/Reservation/MyLiveReservationItemView.swift +++ b/SodaLive/Sources/Live/Reservation/MyLiveReservationItemView.swift @@ -185,7 +185,6 @@ struct MyLiveReservationItemView_Previews: PreviewProvider { roomId: 99, title: "test", content: "testtest", - beginDateTime: "2022.05.23 Mon 03:00 PM", beginDateTimeUtc: "2025-08-10T15:00:00", numberOfParticipate: 0, numberOfPeople: 5, diff --git a/SodaLive/Sources/Live/Room/Detail/GetRoomDetailResponse.swift b/SodaLive/Sources/Live/Room/Detail/GetRoomDetailResponse.swift index fc8889e..08348f4 100644 --- a/SodaLive/Sources/Live/Room/Detail/GetRoomDetailResponse.swift +++ b/SodaLive/Sources/Live/Room/Detail/GetRoomDetailResponse.swift @@ -18,7 +18,6 @@ struct GetRoomDetailResponse: Decodable { let password: String? let tags: [String] let channelName: String? - let beginDateTime: String let beginDateTimeUtc: String let numberOfParticipants: Int let numberOfParticipantsTotal: Int diff --git a/SodaLive/Sources/Live/Room/Detail/LiveDetailView.swift b/SodaLive/Sources/Live/Room/Detail/LiveDetailView.swift index 59ec5ad..d6d0a6f 100644 --- a/SodaLive/Sources/Live/Room/Detail/LiveDetailView.swift +++ b/SodaLive/Sources/Live/Room/Detail/LiveDetailView.swift @@ -94,7 +94,7 @@ struct LiveDetailView: View { .padding(.top, 6.7) HStack(spacing: 0) { - let beginDateText = room.beginDateTimeUtc.parseUtcIsoDate()?.localizedDateTimeString() ?? room.beginDateTime + let beginDateText = room.beginDateTimeUtc.parseUtcIsoDate()?.localizedDateTimeString() ?? room.beginDateTimeUtc Text(beginDateText) .font(.custom(Font.medium.rawValue, size: 12)) .foregroundColor(Color(hex: "bbbbbb")) diff --git a/SodaLive/Sources/Live/Room/Edit/LiveRoomEditViewModel.swift b/SodaLive/Sources/Live/Room/Edit/LiveRoomEditViewModel.swift index 7c823ed..5ca4aae 100644 --- a/SodaLive/Sources/Live/Room/Edit/LiveRoomEditViewModel.swift +++ b/SodaLive/Sources/Live/Room/Edit/LiveRoomEditViewModel.swift @@ -55,15 +55,6 @@ final class LiveRoomEditViewModel: ObservableObject { if let beginDate = room!.beginDateTimeUtc.parseUtcIsoDate() { reservationDate = beginDate reservationTime = beginDate - } else { - let fromFormatter = DateFormatter() - fromFormatter.dateFormat = "yyyy.MM.dd EEE hh:mm a" - fromFormatter.locale = Locale(identifier: "en_US_POSIX") - - if let legacyDate = fromFormatter.date(from: room!.beginDateTime) { - reservationDate = legacyDate - reservationTime = legacyDate - } } let beginDate = reservationDate.convertDateFormat(dateFormat: "yyyy-MM-dd") diff --git a/SodaLive/Sources/MyPage/ReservationStatus/Cancel/LiveReservationCancelView.swift b/SodaLive/Sources/MyPage/ReservationStatus/Cancel/LiveReservationCancelView.swift index ee94342..b75d0c6 100644 --- a/SodaLive/Sources/MyPage/ReservationStatus/Cancel/LiveReservationCancelView.swift +++ b/SodaLive/Sources/MyPage/ReservationStatus/Cancel/LiveReservationCancelView.swift @@ -85,7 +85,10 @@ struct LiveReservationCancelView: View { .cornerRadius(4.7) VStack(alignment: .leading, spacing: 0) { - Text(item.beginDateTime) + let beginDateText = item.beginDateTimeUtc + .parseUtcIsoDate()? + .convertDateFormat(dateFormat: "yyyy.MM.dd EEE hh:mm a") ?? item.beginDateTimeUtc + Text(beginDateText) .font(.custom(Font.medium.rawValue, size: 9.3)) .foregroundColor(Color(hex: "ffd300")) diff --git a/SodaLive/Sources/MyPage/ReservationStatus/GetLiveReservationResponse.swift b/SodaLive/Sources/MyPage/ReservationStatus/GetLiveReservationResponse.swift index 4886ea2..dd785d6 100644 --- a/SodaLive/Sources/MyPage/ReservationStatus/GetLiveReservationResponse.swift +++ b/SodaLive/Sources/MyPage/ReservationStatus/GetLiveReservationResponse.swift @@ -14,6 +14,6 @@ struct GetLiveReservationResponse: Decodable, Hashable { let coverImageUrl: String let price: Int let masterNickname: String - let beginDateTime: String + let beginDateTimeUtc: String let cancelable: Bool } diff --git a/SodaLive/Sources/MyPage/ReservationStatus/LiveReservationStatusItemView.swift b/SodaLive/Sources/MyPage/ReservationStatus/LiveReservationStatusItemView.swift index 8cebd1f..d25ef65 100644 --- a/SodaLive/Sources/MyPage/ReservationStatus/LiveReservationStatusItemView.swift +++ b/SodaLive/Sources/MyPage/ReservationStatus/LiveReservationStatusItemView.swift @@ -29,7 +29,10 @@ struct LiveReservationStatusItemView: View { .cornerRadius(4.7) VStack(alignment: .leading, spacing: 0) { - Text(item.beginDateTime) + let beginDateText = item.beginDateTimeUtc + .parseUtcIsoDate()? + .convertDateFormat(dateFormat: "yyyy.MM.dd EEE hh:mm a") ?? item.beginDateTimeUtc + Text(beginDateText) .font(.custom(Font.medium.rawValue, size: 9.3)) .foregroundColor(Color(hex: "ffd300")) @@ -102,7 +105,7 @@ struct LiveReservationStatusItemView_Previews: PreviewProvider { coverImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png", price: 0, masterNickname: "사냥꾼1004", - beginDateTime: "2021.05.20 SUN 10p.m", + beginDateTimeUtc: "2021-05-20T22:00:00", cancelable: false ) )