Compare commits

...

6 Commits

18 changed files with 201 additions and 111 deletions

View File

@ -194,7 +194,7 @@ struct ContentCreateView: View {
.padding(.top, 26.7)
VStack(spacing: 13.3) {
Text("가격설정")
Text("가격 설정")
.font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color(hex: "eeeeee"))
.frame(maxWidth: .infinity, alignment: .leading)
@ -214,8 +214,30 @@ struct ContentCreateView: View {
}
if !viewModel.isFree {
VStack(spacing: 13.3) {
Text("소장 설정")
.font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color(hex: "eeeeee"))
.frame(maxWidth: .infinity, alignment: .leading)
HStack(spacing: 13.3) {
SelectButtonView(title: "소장/대여", isChecked: !viewModel.isOnlyRental) {
if viewModel.isOnlyRental {
viewModel.isOnlyRental = false
}
}
SelectButtonView(title: "대여만", isChecked: viewModel.isOnlyRental) {
if !viewModel.isOnlyRental {
viewModel.isOnlyRental = true
}
}
}
}
.padding(.top, 13.3)
VStack(spacing: 0) {
Text("소장가격")
Text(viewModel.isOnlyRental ? "대여 가격" : "소장 가격")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "d2d2d2"))
.frame(maxWidth: .infinity, alignment: .leading)
@ -247,7 +269,7 @@ struct ContentCreateView: View {
.frame(height: 1)
.padding(.top, 11)
Text("※ 이용기간 대여 (7일) | 소장 (서비스종료시까지)")
Text("※ 이용기간 대여 (15일) | 소장 (서비스종료시까지)")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "777777"))
.frame(maxWidth: .infinity, alignment: .leading)
@ -321,60 +343,62 @@ struct ContentCreateView: View {
.padding(.top, 26.7)
.padding(.horizontal, 13.3)
VStack(spacing: 10) {
Text("미리듣기 시간 설정")
.font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color(hex: "eeeeee"))
.frame(maxWidth: .infinity, alignment: .leading)
Text("미리듣기 시간을 직접 설정하지 않으면 콘텐츠 앞부분 30초가 자동으로 설정됩니다. 미리듣기의 시간제한은 없습니다.")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "777777"))
.frame(maxWidth: .infinity, alignment: .leading)
HStack(spacing: 13.3) {
VStack(spacing: 5.3) {
Text("시작 시간")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "d2d2d2"))
.frame(maxWidth: .infinity, alignment: .leading)
TextField("00:00:00", text: $viewModel.previewStartTime)
.autocapitalization(.none)
.disableAutocorrection(true)
.font(.custom(Font.bold.rawValue, size: 14.6))
.foregroundColor(Color(hex: "777777"))
.padding(.vertical, 16.7)
.padding(.horizontal, 13.3)
.background(Color(hex: "222222"))
.cornerRadius(6.7)
.keyboardType(.default)
.multilineTextAlignment(.center)
}
if !viewModel.isFree {
VStack(spacing: 10) {
Text("미리듣기 시간 설정")
.font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color(hex: "eeeeee"))
.frame(maxWidth: .infinity, alignment: .leading)
VStack(spacing: 5.3) {
Text("종료 시간")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "d2d2d2"))
.frame(maxWidth: .infinity, alignment: .leading)
Text("미리듣기 시간을 직접 설정하지 않으면 콘텐츠 앞부분 30초가 자동으로 설정됩니다. 미리듣기의 시간제한은 없습니다.")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "777777"))
.frame(maxWidth: .infinity, alignment: .leading)
HStack(spacing: 13.3) {
VStack(spacing: 5.3) {
Text("시작 시간")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "d2d2d2"))
.frame(maxWidth: .infinity, alignment: .leading)
TextField("00:00:00", text: $viewModel.previewStartTime)
.autocapitalization(.none)
.disableAutocorrection(true)
.font(.custom(Font.bold.rawValue, size: 14.6))
.foregroundColor(Color(hex: "777777"))
.padding(.vertical, 16.7)
.padding(.horizontal, 13.3)
.background(Color(hex: "222222"))
.cornerRadius(6.7)
.keyboardType(.default)
.multilineTextAlignment(.center)
}
TextField("00:00:30", text: $viewModel.previewEndTime)
.autocapitalization(.none)
.disableAutocorrection(true)
.font(.custom(Font.bold.rawValue, size: 14.6))
.foregroundColor(Color(hex: "777777"))
.padding(.vertical, 16.7)
.padding(.horizontal, 13.3)
.background(Color(hex: "222222"))
.cornerRadius(6.7)
.keyboardType(.default)
.multilineTextAlignment(.center)
VStack(spacing: 5.3) {
Text("종료 시간")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "d2d2d2"))
.frame(maxWidth: .infinity, alignment: .leading)
TextField("00:00:30", text: $viewModel.previewEndTime)
.autocapitalization(.none)
.disableAutocorrection(true)
.font(.custom(Font.bold.rawValue, size: 14.6))
.foregroundColor(Color(hex: "777777"))
.padding(.vertical, 16.7)
.padding(.horizontal, 13.3)
.background(Color(hex: "222222"))
.cornerRadius(6.7)
.keyboardType(.default)
.multilineTextAlignment(.center)
}
}
.padding(.top, 3.3)
}
.padding(.top, 3.3)
.padding(.top, 26.7)
.padding(.horizontal, 13.3)
}
.padding(.top, 26.7)
.padding(.horizontal, 13.3)
VStack(spacing: 0) {
HStack(alignment: .top, spacing: 0) {

View File

@ -54,10 +54,13 @@ final class ContentCreateViewModel: ObservableObject {
didSet {
if isFree {
priceString = "0"
isOnlyRental = false
}
}
}
@Published var isOnlyRental = false
@Published var previewStartTime: String = ""
@Published var previewEndTime: String = ""
@ -74,6 +77,7 @@ final class ContentCreateViewModel: ObservableObject {
price: price,
themeId: theme!.id,
isAdult: isAdult,
isOnlyRental: isOnlyRental,
isCommentAvailable: isAvailableComment,
previewStartTime: previewStartTime.trimmingCharacters(in: .whitespacesAndNewlines).count > 0 ? previewStartTime : nil,
previewEndTime: previewEndTime.trimmingCharacters(in: .whitespacesAndNewlines).count > 0 ? previewEndTime : nil

View File

@ -14,6 +14,7 @@ struct CreateAudioContentRequest: Encodable {
let price: Int
let themeId: Int
let isAdult: Bool
let isOnlyRental: Bool
let isCommentAvailable: Bool
let previewStartTime: String?
let previewEndTime: String?

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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)

View File

@ -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()
}

View File

@ -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
}
}
}
}

View File

@ -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?

View File

@ -57,7 +57,6 @@ struct ContentMainItemView_Previews: PreviewProvider {
contentId: 2,
coverImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
title: "ㅓ처랴햐햫햐햐",
isAdult: true,
creatorId: 8,
creatorProfileImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
creatorNickname: "유저2"

View File

@ -48,7 +48,6 @@ struct ContentMainMyStashView_Previews: PreviewProvider {
contentId: 1,
coverImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
title: "테스트",
isAdult: false,
creatorId: 7,
creatorProfileImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
creatorNickname: "유저1"

View File

@ -55,7 +55,6 @@ struct ContentMainNewContentView_Previews: PreviewProvider {
contentId: 1,
coverImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
title: "테스트",
isAdult: false,
creatorId: 7,
creatorProfileImageUrl: "https://test-cf.sodalive.net/profile/default-profile.png",
creatorNickname: "유저1"

View File

@ -44,7 +44,6 @@ struct GetAudioContentMainItem: Decodable {
let contentId: Int
let coverImageUrl: String
let title: String
let isAdult: Bool
let creatorId: Int
let creatorProfileImageUrl: String
let creatorNickname: String

View File

@ -784,26 +784,28 @@ struct LiveRoomView: View {
viewModel.isShowDonationRankingPopup = true
}
HStack(spacing: 0) {
Text("참여자")
.font(.custom(Font.medium.rawValue, size: 12))
.foregroundColor(Color(hex: "bbbbbb"))
Text("\(liveRoomInfo.participantsCount)")
.font(.custom(Font.medium.rawValue, size: 12))
.foregroundColor(Color(hex: "9970ff"))
.padding(.leading, 6.7)
}
.padding(.horizontal, 11.5)
.padding(.vertical, 7.3)
.overlay(
RoundedRectangle(cornerRadius: 12.8)
.strokeBorder(lineWidth: 1)
.foregroundColor(Color(hex: "eeeeee"))
)
.contentShape(Rectangle())
.onTapGesture {
viewModel.isShowProfileList = true
if liveRoomInfo.creatorId == UserDefaults.int(forKey: .userId) {
HStack(spacing: 0) {
Text("참여자")
.font(.custom(Font.medium.rawValue, size: 12))
.foregroundColor(Color(hex: "bbbbbb"))
Text("\(liveRoomInfo.participantsCount)")
.font(.custom(Font.medium.rawValue, size: 12))
.foregroundColor(Color(hex: "9970ff"))
.padding(.leading, 6.7)
}
.padding(.horizontal, 11.5)
.padding(.vertical, 7.3)
.overlay(
RoundedRectangle(cornerRadius: 12.8)
.strokeBorder(lineWidth: 1)
.foregroundColor(Color(hex: "eeeeee"))
)
.contentShape(Rectangle())
.onTapGesture {
viewModel.isShowProfileList = true
}
}
}
.padding(.top, 13.3)

View File

@ -147,6 +147,33 @@ struct CanPgPaymentView: View {
.frame(width: screenSize().width - 26.7)
.padding(.top, 16.7)
HStack(spacing: 13.3) {
Text("휴대폰 결제")
.font(.custom( viewModel.paymentMethod == .phone ? Font.bold.rawValue : Font.medium.rawValue, size: 16.7))
.foregroundColor(Color(hex: viewModel.paymentMethod == .phone ? "9970ff" : "eeeeee"))
.frame(width: (screenSize().width - 40) / 2)
.padding(.vertical, 16.7)
.background(
Color(hex: viewModel.paymentMethod == .phone ? "9970ff" : "232323")
.opacity(viewModel.paymentMethod == .phone ? 0.3 : 1)
)
.cornerRadius(10)
.overlay(
RoundedRectangle(cornerRadius: 10)
.stroke(lineWidth: 1)
.foregroundColor(Color(hex: viewModel.paymentMethod == .phone ? "9970ff" : "777777"))
)
.onTapGesture {
if viewModel.paymentMethod != .phone {
viewModel.paymentMethod = .phone
}
}
Spacer()
}
.frame(width: screenSize().width - 26.7)
.padding(.top, 16.7)
HStack(spacing: 6.7) {
Image(viewModel.isTermsAgree ? "btn_select_checked" : "btn_select_normal")
.resizable()

View File

@ -13,6 +13,7 @@ import Bootpay
enum PaymentMethod: String {
case card = "디지털카드"
case bank = "디지털계좌이체"
case phone = "휴대폰"
}
final class CanPgPaymentViewModel: ObservableObject {

View File

@ -33,6 +33,24 @@ struct OrderListAllView: View {
.frame(height: 50)
.background(Color.black)
HStack(spacing: 0) {
Text("")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "eeeeee"))
Text("\(viewModel.totalCount)")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "dd4500"))
Text("")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "eeeeee"))
Spacer()
}
.padding(.horizontal, 13.3)
.padding(.top, 13.3)
ScrollViewReader { reader in
ScrollView(.vertical, showsIndicators: false) {
LazyVStack(spacing: 10.7) {

View File

@ -18,6 +18,7 @@ final class OrderListAllViewModel: ObservableObject {
@Published var isLoading = false
@Published var orderList = [GetAudioContentOrderListItem]()
@Published var totalCount = 0
@Published var scrollToTop = false
var page = 1
@ -49,6 +50,8 @@ final class OrderListAllViewModel: ObservableObject {
self.scrollToTop.toggle()
}
self.totalCount = data.totalCount
if !data.items.isEmpty {
page += 1
self.orderList.append(contentsOf: data.items)