콘텐츠 상세, 콘텐츠 구매

- pg 테스트 계정의 경우 캔이 아닌 원으로 표시되도록 하고 콘텐츠 구매시 바로 결제 후 구매 되도록 수정
This commit is contained in:
Yu Sung
2024-05-21 00:11:06 +09:00
parent fd2230dbe1
commit 568d7f2284
13 changed files with 637 additions and 99 deletions

View File

@@ -23,7 +23,7 @@ struct ContentDetailCreatorProfileView: View {
Text(creator.nickname)
.font(.custom(Font.medium.rawValue, size: 12))
.foregroundColor(Color(hex: "777777"))
.foregroundColor(Color.gray77)
.padding(.horizontal, 5.3)
Spacer()

View File

@@ -14,16 +14,18 @@ struct ContentDetailPurchaseButton: View {
var body: some View {
HStack(spacing: 0) {
Image("ic_can")
.resizable()
.frame(width: 16.7, height: 16.7)
if UserDefaults.int(forKey: .userId) != 17958 {
Image("ic_can")
.resizable()
.frame(width: 16.7, height: 16.7)
}
Text("\(price)")
Text(UserDefaults.int(forKey: .userId) == 17958 ? "\(price * 110)" : "\(price)")
.font(.custom(Font.bold.rawValue, size: 14.7))
.foregroundColor(.white)
.padding(.leading, 5.3)
Text("캔으로")
Text(UserDefaults.int(forKey: .userId) == 17958 ? "원으로": "캔으로")
.font(.custom(Font.light.rawValue, size: 12))
.foregroundColor(.white)

View File

@@ -38,7 +38,7 @@ struct ContentDetailView: View {
Text("콘텐츠 상세")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(Color(hex: "eeeeee"))
.foregroundColor(Color.grayee)
}
Spacer()
@@ -99,7 +99,7 @@ struct ContentDetailView: View {
.foregroundColor(.white)
.frame(maxWidth: .infinity)
.frame(height: 48.7)
.background(Color(hex: "525252"))
.background(Color.gray52)
.cornerRadius(5.3)
.padding(.top, 18.3)
.padding(.horizontal, 13.3)
@@ -113,7 +113,7 @@ struct ContentDetailView: View {
.foregroundColor(.white)
.frame(maxWidth: .infinity)
.frame(height: 48.7)
.background(Color(hex: "525252"))
.background(Color.gray52)
.cornerRadius(5.3)
.padding(.top, 18.3)
.padding(.horizontal, 13.3)
@@ -162,7 +162,7 @@ struct ContentDetailView: View {
.padding(.horizontal, 13.3)
Rectangle()
.foregroundColor(Color(hex: "232323"))
.foregroundColor(Color.gray23)
.frame(height: 6.7)
.padding(.top, 24)
@@ -207,7 +207,7 @@ struct ContentDetailView: View {
if proxy.safeAreaInsets.bottom > 0 {
Rectangle()
.foregroundColor(Color(hex: "222222"))
.foregroundColor(Color.gray22)
.frame(width: proxy.size.width, height: 15.3)
}
}
@@ -226,7 +226,20 @@ struct ContentDetailView: View {
orderType: orderType,
isOnlyRental: audioContent.isOnlyRental,
onClickConfirm: {
viewModel.order(orderType: orderType)
if UserDefaults.int(forKey: .userId) == 17958 {
AppState.shared
.setAppStep(
step: .tempCanPayment(
title: audioContent.title,
can: orderType == .RENTAL ? Int(ceil(Double(audioContent.price) * 0.6)) : audioContent.price,
onSuccess: {
viewModel.order(orderType: orderType)
}
)
)
} else {
viewModel.order(orderType: orderType)
}
}
)
}
@@ -272,7 +285,7 @@ struct ContentDetailView: View {
if proxy.safeAreaInsets.bottom > 0 {
Rectangle()
.foregroundColor(Color(hex: "222222"))
.foregroundColor(Color.gray22)
.frame(width: proxy.size.width, height: 15.3)
}
}

View File

@@ -27,7 +27,7 @@ struct ContentOrderConfirmDialogView: View {
VStack(spacing: 0) {
Text("구매확인")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(Color(hex: "eeeeee"))
.foregroundColor(Color.grayee)
HStack(spacing: 11) {
ZStack(alignment: .topLeading) {
@@ -48,7 +48,7 @@ struct ContentOrderConfirmDialogView: View {
Text(audioContent.title)
.font(.custom(Font.bold.rawValue, size: 11.3))
.foregroundColor(Color(hex: "d2d2d2"))
.foregroundColor(Color.grayd2)
.padding(.top, 2)
HStack(spacing: 4.3) {
@@ -60,13 +60,13 @@ struct ContentOrderConfirmDialogView: View {
Text(audioContent.creator.nickname)
.font(.custom(Font.medium.rawValue, size: 10))
.foregroundColor(Color(hex: "777777"))
.foregroundColor(Color.gray77)
}
.padding(.top, 6.7)
Text(audioContent.duration)
.font(.custom(Font.medium.rawValue, size: 11))
.foregroundColor(Color(hex: "777777"))
.foregroundColor(Color.gray77)
.padding(.top, 6.7)
}
@@ -77,52 +77,74 @@ struct ContentOrderConfirmDialogView: View {
.cornerRadius(5.3)
.padding(.top, 21.3)
Text("콘텐츠를 \(orderType == .RENTAL ? "대여" : "소장")하시겠습니까?\n아래 캔이 차감됩니다.")
Text("콘텐츠를 \(orderType == .RENTAL ? "대여" : "소장")하시겠습니까?")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "eeeeee"))
.foregroundColor(Color.grayee)
.fixedSize(horizontal: false, vertical: true)
.multilineTextAlignment(.center)
.padding(.top, 13.3)
if UserDefaults.int(forKey: .userId) != 17958 {
Text("아래 캔이 차감됩니다.")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color.grayee)
.fixedSize(horizontal: false, vertical: true)
.multilineTextAlignment(.center)
.padding(.top, 13.3)
}
HStack(spacing: 2.7) {
Spacer()
Image("ic_can")
.resizable()
.frame(width: 16.7, height: 16.7)
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"))
if UserDefaults.int(forKey: .userId) != 17958 {
Image("ic_can")
.resizable()
.frame(width: 16.7, height: 16.7)
if orderType == .RENTAL {
Text("\(isOnlyRental ? audioContent.price : Int(ceil(Double(audioContent.price) * 0.6)))")
.font(.custom(Font.bold.rawValue, size: 13.3))
.foregroundColor(Color.grayee)
} else {
Text("\(audioContent.price)")
.font(.custom(Font.bold.rawValue, size: 13.3))
.foregroundColor(Color.grayee)
}
} else {
Text("\(audioContent.price)")
.font(.custom(Font.bold.rawValue, size: 13.3))
.foregroundColor(Color(hex: "eeeeee"))
if orderType == .RENTAL {
Text("\(isOnlyRental ? audioContent.price * 110 : Int(ceil(Double(audioContent.price) * 0.6)) * 110)")
.font(.custom(Font.bold.rawValue, size: 13.3))
.foregroundColor(Color.grayee)
} else {
Text("\(audioContent.price * 110)")
.font(.custom(Font.bold.rawValue, size: 13.3))
.foregroundColor(Color.grayee)
}
}
Spacer()
}
.padding(.vertical, 13.3)
.background(Color(hex: "333333"))
.background(Color.gray33)
.cornerRadius(6.7)
.overlay(
RoundedRectangle(cornerRadius: CGFloat(6.7))
.stroke(lineWidth: 1)
.foregroundColor(Color(hex: "979797"))
.foregroundColor(Color.gray97)
)
.padding(.top, 13.3)
HStack(spacing: 12) {
Text("취소")
.font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(Color(hex: "9970ff"))
.foregroundColor(Color.button)
.padding(.vertical, 15.7)
.frame(maxWidth: .infinity)
.contentShape(Rectangle())
.overlay(
RoundedRectangle(cornerRadius: CGFloat(10))
.stroke(lineWidth: 1)
.foregroundColor(Color(hex: "9970ff"))
.foregroundColor(Color.button)
)
.onTapGesture { isShowing = false }
@@ -131,7 +153,8 @@ struct ContentOrderConfirmDialogView: View {
.foregroundColor(.white)
.padding(.vertical, 15.7)
.frame(maxWidth: .infinity)
.background(Color(hex: "9970ff"))
.contentShape(Rectangle())
.background(Color.button)
.cornerRadius(10)
.onTapGesture {
onClickConfirm()
@@ -143,7 +166,7 @@ struct ContentOrderConfirmDialogView: View {
.padding(.horizontal, 13.3)
.padding(.top, 26.7)
.padding(.bottom, 16.7)
.background(Color(hex: "222222"))
.background(Color.gray22)
.cornerRadius(10)
.padding(.horizontal, 20)
}

View File

@@ -40,17 +40,25 @@ struct ContentOrderDialogView: View {
Spacer()
HStack(spacing: 8) {
Image("ic_can")
.resizable()
.frame(width: 16.7, height: 16.7)
if UserDefaults.int(forKey: .userId) != 17958 {
Image("ic_can")
.resizable()
.frame(width: 16.7, height: 16.7)
}
Text(isOnlyRental ? "\(price)" : "\(Int(ceil(Double(price) * 0.6)))")
Text(isOnlyRental ? "\(price * 110)" : "\(Int(ceil(Double(price) * 0.6)) * 110)")
.font(.custom(Font.bold.rawValue, size: 13.3))
.foregroundColor(Color(hex: "eeeeee"))
.foregroundColor(Color.grayee)
if UserDefaults.int(forKey: .userId) == 17958 {
Text("")
.font(.custom(Font.bold.rawValue, size: 13.3))
.foregroundColor(Color.grayee)
}
}
.padding(.vertical, 8)
.padding(.horizontal, 13.3)
.background(Color(hex: "9970ff"))
.background(Color.button)
.cornerRadius(5.3)
.onTapGesture {
onTapPurchase(.RENTAL)
@@ -73,17 +81,25 @@ struct ContentOrderDialogView: View {
Spacer()
HStack(spacing: 8) {
Image("ic_can")
.resizable()
.frame(width: 16.7, height: 16.7)
if UserDefaults.int(forKey: .userId) != 17958 {
Image("ic_can")
.resizable()
.frame(width: 16.7, height: 16.7)
}
Text("\(price)")
Text("\(price * 110)")
.font(.custom(Font.bold.rawValue, size: 13.3))
.foregroundColor(Color(hex: "eeeeee"))
.foregroundColor(Color.grayee)
if UserDefaults.int(forKey: .userId) == 17958 {
Text("")
.font(.custom(Font.bold.rawValue, size: 13.3))
.foregroundColor(Color.grayee)
}
}
.padding(.vertical, 8)
.padding(.horizontal, 13.3)
.background(Color(hex: "9970ff"))
.background(Color.button)
.cornerRadius(5.3)
.onTapGesture {
onTapPurchase(.KEEP)
@@ -93,7 +109,7 @@ struct ContentOrderDialogView: View {
}
}
.padding(24)
.background(Color(hex: "222222"))
.background(Color.gray22)
}
}
}