콘텐츠 상세

- 소장만, 대여만 가능시 구매하기 버튼 배경색 변경
- 소장만, 대여만 가능시 구매하기 버튼을 터치하면 바로 구매확인 다이얼로그 표시
This commit is contained in:
Yu Sung
2024-11-08 21:06:24 +09:00
parent 696aed5c00
commit f6ae14d614
5 changed files with 87 additions and 80 deletions

View File

@@ -123,13 +123,23 @@ struct ContentDetailView: View {
.padding(.top, 18.3)
.padding(.horizontal, 13.3)
} else {
ContentDetailPurchaseButton(price: audioContent.price, isOnlyRental: audioContent.isOnlyRental)
ContentDetailPurchaseButton(
price: audioContent.price,
title: audioContent.purchaseOption == .RENT_ONLY ? " 대여하기" :
audioContent.purchaseOption == .BUY_ONLY ? " 소장하기" : " 구매하기",
backgroundColor: audioContent.purchaseOption == .RENT_ONLY ? Color(hex: "548f7d") :
audioContent.purchaseOption == .BUY_ONLY ? Color(hex: "59548f") :
Color.button
)
.contentShape(Rectangle())
.padding(.horizontal, 13.3)
.onTapGesture {
if let _ = audioContent.totalContentCount, let _ = audioContent.remainingContentCount {
if audioContent.purchaseOption == .BUY_ONLY || (audioContent.totalContentCount != nil && audioContent.remainingContentCount != nil) {
viewModel.orderType = .KEEP
isShowOrderConfirmView = true
} else if audioContent.purchaseOption == .RENT_ONLY {
viewModel.orderType = .RENTAL
isShowOrderConfirmView = true
} else {
isShowOrderView = true
}
@@ -204,7 +214,6 @@ struct ContentDetailView: View {
ContentOrderDialogView(
isShowing: $isShowOrderView,
price: audioContent.price,
isOnlyRental: audioContent.isOnlyRental,
onTapPurchase: {
viewModel.orderType = $0
isShowOrderConfirmView = true
@@ -228,9 +237,14 @@ struct ContentDetailView: View {
VStack(spacing: 0) {
ContentOrderConfirmDialogView(
isShowing: $isShowOrderConfirmView,
audioContent: audioContent,
title: audioContent.title,
price: audioContent.purchaseOption == .BOTH && orderType == .RENTAL ? Int(ceil(Double(audioContent.price) * 0.7)) : audioContent.price,
duration: audioContent.duration,
themeStr: audioContent.themeStr,
coverImageUrl: audioContent.coverImageUrl,
creatorNickname: audioContent.creator.nickname,
creatorProfileImageUrl: audioContent.creator.profileImageUrl,
orderType: orderType,
isOnlyRental: audioContent.isOnlyRental,
onClickConfirm: {
if UserDefaults.int(forKey: .userId) == 17958 {
AppState.shared
@@ -239,7 +253,8 @@ struct ContentDetailView: View {
orderType: orderType,
contentId: audioContent.contentId,
title: audioContent.title,
can: !audioContent.isOnlyRental && orderType == .RENTAL ? Int(ceil(Double(audioContent.price) * 0.7)) : audioContent.price
can: audioContent.purchaseOption == .BOTH && orderType == .RENTAL ? Int(ceil(Double(audioContent.price) * 0.7)) :
audioContent.price
)
)
} else {