유료방 입장 팝업 - UI 수정, 알림 문구 수정

This commit is contained in:
Yu Sung
2024-01-22 19:19:47 +09:00
parent ac49b4e2ad
commit 31bd137f4d
6 changed files with 92 additions and 30 deletions

View File

@@ -212,13 +212,16 @@ struct UserProfileView: View {
ZStack {
if viewModel.isShowPaymentDialog {
SodaDialog(
LivePaymentDialog(
title: viewModel.paymentDialogTitle,
desc: viewModel.paymentDialogDesc,
desc2: viewModel.paymentDialogDesc2,
confirmButtonTitle: viewModel.paymentDialogConfirmTitle,
confirmButtonAction: viewModel.paymentDialogConfirmAction,
cancelButtonTitle: viewModel.paymentDialogCancelTitle,
cancelButtonAction: viewModel.hidePaymentPopup
cancelButtonAction: viewModel.hidePaymentPopup,
startDateTime: viewModel.liveStartDate,
nowDateTime: viewModel.nowDate
)
}

View File

@@ -24,6 +24,7 @@ final class UserProfileViewModel: ObservableObject {
@Published var paymentDialogTitle = ""
@Published var paymentDialogDesc = ""
@Published var paymentDialogDesc2 = ""
@Published var isShowPaymentDialog = false
@Published var paymentDialogConfirmAction = {}
@Published var paymentDialogConfirmTitle = ""
@@ -50,6 +51,9 @@ final class UserProfileViewModel: ObservableObject {
@Published var isShowCheersReportView = false
@Published var isShowCheersDeleteView = false
@Published var liveStartDate: String? = nil
@Published var nowDate: String? = nil
let paymentDialogCancelTitle = "취소"
func getCreatorProfile(userId: Int) {
@@ -201,8 +205,24 @@ final class UserProfileViewModel: ObservableObject {
}
self.isShowPasswordDialog = true
} else {
self.paymentDialogTitle = "\($0.price)캔으로 입장"
self.paymentDialogDesc = "'\($0.title)' 라이브에 참여하기 위해 결제합니다."
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분 이내에 라이브가 종료될 수도 있습니다."
}
self.paymentDialogTitle = "유료 라이브 입장"
self.paymentDialogDesc = "\($0.price)캔을 차감하고\n라이브에 입장 하시겠습니까?"
self.paymentDialogConfirmTitle = "결제 후 참여하기"
self.paymentDialogConfirmAction = { [unowned self] in
hidePaymentPopup()