From 995c6adab79ed37ea651098c4422ade0ca8b719c Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Sun, 22 Oct 2023 17:41:56 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BD=98=ED=85=90=EC=B8=A0=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20-=20=EB=8C=80=EC=97=AC=EB=A7=8C=20=EA=B0=80?= =?UTF-8?q?=EB=8A=A5=ED=95=9C=20=EC=BD=98=ED=85=90=EC=B8=A0=EC=9D=98=20?= =?UTF-8?q?=EA=B2=BD=EC=9A=B0=20=EC=86=8C=EC=9E=A5=20=EB=B2=84=ED=8A=BC?= =?UTF-8?q?=EC=9D=B4=20=EB=B3=B4=EC=9D=B4=EC=A7=80=20=EC=95=8A=EA=B3=A0=20?= =?UTF-8?q?=EA=B0=80=EA=B2=A9=EC=9D=98=20100%=EA=B0=80=20=EB=B3=B4?= =?UTF-8?q?=EC=9D=B4=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail/ContentDetailPurchaseButton.swift | 3 +- .../Content/Detail/ContentDetailView.swift | 4 +- .../Detail/ContentDetailViewModel.swift | 2 +- .../ContentOrderConfirmDialogView.swift | 13 +++- .../Detail/ContentOrderDialogView.swift | 61 ++++++++++--------- .../GetAudioContentDetailResponse.swift | 1 + 6 files changed, 49 insertions(+), 35 deletions(-) diff --git a/SodaLive/Sources/Content/Detail/ContentDetailPurchaseButton.swift b/SodaLive/Sources/Content/Detail/ContentDetailPurchaseButton.swift index 815eade..4937f8e 100644 --- a/SodaLive/Sources/Content/Detail/ContentDetailPurchaseButton.swift +++ b/SodaLive/Sources/Content/Detail/ContentDetailPurchaseButton.swift @@ -10,6 +10,7 @@ import SwiftUI struct ContentDetailPurchaseButton: View { let price: Int + let isOnlyRental: Bool var body: some View { HStack(spacing: 0) { @@ -26,7 +27,7 @@ struct ContentDetailPurchaseButton: View { .font(.custom(Font.light.rawValue, size: 12)) .foregroundColor(.white) - Text(" 구매하기") + Text(isOnlyRental ? " 대여하기" : " 구매하기") .font(.custom(Font.bold.rawValue, size: 14.7)) .foregroundColor(.white) } diff --git a/SodaLive/Sources/Content/Detail/ContentDetailView.swift b/SodaLive/Sources/Content/Detail/ContentDetailView.swift index dd3b05b..d84e272 100644 --- a/SodaLive/Sources/Content/Detail/ContentDetailView.swift +++ b/SodaLive/Sources/Content/Detail/ContentDetailView.swift @@ -91,7 +91,7 @@ struct ContentDetailView: View { !audioContent.existOrdered && audioContent.orderType == nil && audioContent.creator.creatorId != UserDefaults.int(forKey: .userId) { - ContentDetailPurchaseButton(price: audioContent.price) + ContentDetailPurchaseButton(price: audioContent.price, isOnlyRental: audioContent.isOnlyRental) .contentShape(Rectangle()) .padding(.horizontal, 13.3) .onTapGesture { isShowOrderView = true } @@ -161,6 +161,7 @@ struct ContentDetailView: View { ContentOrderDialogView( isShowing: $isShowOrderView, price: audioContent.price, + isOnlyRental: audioContent.isOnlyRental, onTapPurchase: { viewModel.orderType = $0 isShowOrderConfirmView = true @@ -186,6 +187,7 @@ struct ContentDetailView: View { isShowing: $isShowOrderConfirmView, audioContent: audioContent, orderType: orderType, + isOnlyRental: audioContent.isOnlyRental, onClickConfirm: { viewModel.order(orderType: orderType) } diff --git a/SodaLive/Sources/Content/Detail/ContentDetailViewModel.swift b/SodaLive/Sources/Content/Detail/ContentDetailViewModel.swift index cec4c06..dbcc720 100644 --- a/SodaLive/Sources/Content/Detail/ContentDetailViewModel.swift +++ b/SodaLive/Sources/Content/Detail/ContentDetailViewModel.swift @@ -298,7 +298,7 @@ final class ContentDetailViewModel: ObservableObject { if decoded.success { self.orderType = nil - self.errorMessage = "구매가 완료되었습니다." + self.errorMessage = orderType == .RENTAL ? "대여가 완료되었습니다." : "구매가 완료되었습니다." self.isShowPopup = true self.getAudioContentDetail() ContentPlayManager.shared.conditionalStopAudio(contentId: contentId) diff --git a/SodaLive/Sources/Content/Detail/ContentOrderConfirmDialogView.swift b/SodaLive/Sources/Content/Detail/ContentOrderConfirmDialogView.swift index f8f4e63..2b53d54 100644 --- a/SodaLive/Sources/Content/Detail/ContentOrderConfirmDialogView.swift +++ b/SodaLive/Sources/Content/Detail/ContentOrderConfirmDialogView.swift @@ -14,6 +14,7 @@ struct ContentOrderConfirmDialogView: View { let audioContent: GetAudioContentDetailResponse let orderType: OrderType + let isOnlyRental: Bool let onClickConfirm: () -> Void var body: some View { @@ -90,9 +91,15 @@ struct ContentOrderConfirmDialogView: View { .resizable() .frame(width: 16.7, height: 16.7) - Text("\(orderType == .RENTAL ? Int(ceil(Double(audioContent.price) * 0.6)) : audioContent.price)") - .font(.custom(Font.bold.rawValue, size: 13.3)) - .foregroundColor(Color(hex: "eeeeee")) + if orderType == .RENTAL { + Text("\(isOnlyRental ? audioContent.price : Int(ceil(Double(audioContent.price) * 0.6)))") + .font(.custom(Font.bold.rawValue, size: 13.3)) + .foregroundColor(Color(hex: "eeeeee")) + } else { + Text("\(audioContent.price)") + .font(.custom(Font.bold.rawValue, size: 13.3)) + .foregroundColor(Color(hex: "eeeeee")) + } Spacer() } diff --git a/SodaLive/Sources/Content/Detail/ContentOrderDialogView.swift b/SodaLive/Sources/Content/Detail/ContentOrderDialogView.swift index 9abc6e7..0b72b3c 100644 --- a/SodaLive/Sources/Content/Detail/ContentOrderDialogView.swift +++ b/SodaLive/Sources/Content/Detail/ContentOrderDialogView.swift @@ -12,6 +12,7 @@ struct ContentOrderDialogView: View { @Binding var isShowing: Bool let price: Int + let isOnlyRental: Bool let onTapPurchase: (OrderType) -> Void var body: some View { @@ -31,7 +32,7 @@ struct ContentOrderDialogView: View { .font(.custom(Font.bold.rawValue, size: 13.3)) .foregroundColor(.white) - Text("(이용기간 7일)") + Text("(이용기간 15일)") .font(.custom(Font.light.rawValue, size: 12)) .foregroundColor(.white) } @@ -43,7 +44,7 @@ struct ContentOrderDialogView: View { .resizable() .frame(width: 16.7, height: 16.7) - Text("\(Int(ceil(Double(price) * 0.6)))") + Text(isOnlyRental ? "\(price)" : "\(Int(ceil(Double(price) * 0.6)))") .font(.custom(Font.bold.rawValue, size: 13.3)) .foregroundColor(Color(hex: "eeeeee")) } @@ -57,35 +58,37 @@ struct ContentOrderDialogView: View { } } - HStack(spacing: 0) { - VStack(alignment: .leading, spacing: 5.3) { - Text("소장") - .font(.custom(Font.bold.rawValue, size: 13.3)) - .foregroundColor(.white) + if !isOnlyRental { + HStack(spacing: 0) { + VStack(alignment: .leading, spacing: 5.3) { + Text("소장") + .font(.custom(Font.bold.rawValue, size: 13.3)) + .foregroundColor(.white) + + Text("(서비스 종료시까지)") + .font(.custom(Font.light.rawValue, size: 12)) + .foregroundColor(.white) + } - Text("(서비스 종료시까지)") - .font(.custom(Font.light.rawValue, size: 12)) - .foregroundColor(.white) - } - - Spacer() - - HStack(spacing: 8) { - Image("ic_can") - .resizable() - .frame(width: 16.7, height: 16.7) + Spacer() - Text("\(price)") - .font(.custom(Font.bold.rawValue, size: 13.3)) - .foregroundColor(Color(hex: "eeeeee")) - } - .padding(.vertical, 8) - .padding(.horizontal, 13.3) - .background(Color(hex: "9970ff")) - .cornerRadius(5.3) - .onTapGesture { - onTapPurchase(.KEEP) - isShowing = false + HStack(spacing: 8) { + Image("ic_can") + .resizable() + .frame(width: 16.7, height: 16.7) + + Text("\(price)") + .font(.custom(Font.bold.rawValue, size: 13.3)) + .foregroundColor(Color(hex: "eeeeee")) + } + .padding(.vertical, 8) + .padding(.horizontal, 13.3) + .background(Color(hex: "9970ff")) + .cornerRadius(5.3) + .onTapGesture { + onTapPurchase(.KEEP) + isShowing = false + } } } } diff --git a/SodaLive/Sources/Content/Detail/GetAudioContentDetailResponse.swift b/SodaLive/Sources/Content/Detail/GetAudioContentDetailResponse.swift index 3ba61fe..2681927 100644 --- a/SodaLive/Sources/Content/Detail/GetAudioContentDetailResponse.swift +++ b/SodaLive/Sources/Content/Detail/GetAudioContentDetailResponse.swift @@ -19,6 +19,7 @@ struct GetAudioContentDetailResponse: Decodable { let duration: String let isAdult: Bool let isMosaic: Bool + let isOnlyRental: Bool let existOrdered: Bool let orderType: OrderType? let remainingTime: String?