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

View File

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

View File

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

View File

@ -10,6 +10,7 @@ import SwiftUI
struct ContentDetailPurchaseButton: View { struct ContentDetailPurchaseButton: View {
let price: Int let price: Int
let isOnlyRental: Bool
var body: some View { var body: some View {
HStack(spacing: 0) { HStack(spacing: 0) {
@ -26,7 +27,7 @@ struct ContentDetailPurchaseButton: View {
.font(.custom(Font.light.rawValue, size: 12)) .font(.custom(Font.light.rawValue, size: 12))
.foregroundColor(.white) .foregroundColor(.white)
Text(" 구매하기") Text(isOnlyRental ? " 대여하기" : " 구매하기")
.font(.custom(Font.bold.rawValue, size: 14.7)) .font(.custom(Font.bold.rawValue, size: 14.7))
.foregroundColor(.white) .foregroundColor(.white)
} }

View File

@ -91,7 +91,7 @@ struct ContentDetailView: View {
!audioContent.existOrdered && !audioContent.existOrdered &&
audioContent.orderType == nil && audioContent.orderType == nil &&
audioContent.creator.creatorId != UserDefaults.int(forKey: .userId) { audioContent.creator.creatorId != UserDefaults.int(forKey: .userId) {
ContentDetailPurchaseButton(price: audioContent.price) ContentDetailPurchaseButton(price: audioContent.price, isOnlyRental: audioContent.isOnlyRental)
.contentShape(Rectangle()) .contentShape(Rectangle())
.padding(.horizontal, 13.3) .padding(.horizontal, 13.3)
.onTapGesture { isShowOrderView = true } .onTapGesture { isShowOrderView = true }
@ -161,6 +161,7 @@ struct ContentDetailView: View {
ContentOrderDialogView( ContentOrderDialogView(
isShowing: $isShowOrderView, isShowing: $isShowOrderView,
price: audioContent.price, price: audioContent.price,
isOnlyRental: audioContent.isOnlyRental,
onTapPurchase: { onTapPurchase: {
viewModel.orderType = $0 viewModel.orderType = $0
isShowOrderConfirmView = true isShowOrderConfirmView = true
@ -186,6 +187,7 @@ struct ContentDetailView: View {
isShowing: $isShowOrderConfirmView, isShowing: $isShowOrderConfirmView,
audioContent: audioContent, audioContent: audioContent,
orderType: orderType, orderType: orderType,
isOnlyRental: audioContent.isOnlyRental,
onClickConfirm: { onClickConfirm: {
viewModel.order(orderType: orderType) viewModel.order(orderType: orderType)
} }

View File

@ -298,7 +298,7 @@ final class ContentDetailViewModel: ObservableObject {
if decoded.success { if decoded.success {
self.orderType = nil self.orderType = nil
self.errorMessage = "구매가 완료되었습니다." self.errorMessage = orderType == .RENTAL ? "대여가 완료되었습니다." : "구매가 완료되었습니다."
self.isShowPopup = true self.isShowPopup = true
self.getAudioContentDetail() self.getAudioContentDetail()
ContentPlayManager.shared.conditionalStopAudio(contentId: contentId) ContentPlayManager.shared.conditionalStopAudio(contentId: contentId)

View File

@ -14,6 +14,7 @@ struct ContentOrderConfirmDialogView: View {
let audioContent: GetAudioContentDetailResponse let audioContent: GetAudioContentDetailResponse
let orderType: OrderType let orderType: OrderType
let isOnlyRental: Bool
let onClickConfirm: () -> Void let onClickConfirm: () -> Void
var body: some View { var body: some View {
@ -90,9 +91,15 @@ struct ContentOrderConfirmDialogView: View {
.resizable() .resizable()
.frame(width: 16.7, height: 16.7) .frame(width: 16.7, height: 16.7)
Text("\(orderType == .RENTAL ? Int(ceil(Double(audioContent.price) * 0.6)) : audioContent.price)") if orderType == .RENTAL {
.font(.custom(Font.bold.rawValue, size: 13.3)) Text("\(isOnlyRental ? audioContent.price : Int(ceil(Double(audioContent.price) * 0.6)))")
.foregroundColor(Color(hex: "eeeeee")) .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() Spacer()
} }

View File

@ -12,6 +12,7 @@ struct ContentOrderDialogView: View {
@Binding var isShowing: Bool @Binding var isShowing: Bool
let price: Int let price: Int
let isOnlyRental: Bool
let onTapPurchase: (OrderType) -> Void let onTapPurchase: (OrderType) -> Void
var body: some View { var body: some View {
@ -31,7 +32,7 @@ struct ContentOrderDialogView: View {
.font(.custom(Font.bold.rawValue, size: 13.3)) .font(.custom(Font.bold.rawValue, size: 13.3))
.foregroundColor(.white) .foregroundColor(.white)
Text("(이용기간 7일)") Text("(이용기간 15일)")
.font(.custom(Font.light.rawValue, size: 12)) .font(.custom(Font.light.rawValue, size: 12))
.foregroundColor(.white) .foregroundColor(.white)
} }
@ -43,7 +44,7 @@ struct ContentOrderDialogView: View {
.resizable() .resizable()
.frame(width: 16.7, height: 16.7) .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)) .font(.custom(Font.bold.rawValue, size: 13.3))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color(hex: "eeeeee"))
} }
@ -57,35 +58,37 @@ struct ContentOrderDialogView: View {
} }
} }
HStack(spacing: 0) { if !isOnlyRental {
VStack(alignment: .leading, spacing: 5.3) { HStack(spacing: 0) {
Text("소장") VStack(alignment: .leading, spacing: 5.3) {
.font(.custom(Font.bold.rawValue, size: 13.3)) Text("소장")
.foregroundColor(.white) .font(.custom(Font.bold.rawValue, size: 13.3))
.foregroundColor(.white)
Text("(서비스 종료시까지)")
.font(.custom(Font.light.rawValue, size: 12))
.foregroundColor(.white)
}
Text("(서비스 종료시까지)") Spacer()
.font(.custom(Font.light.rawValue, size: 12))
.foregroundColor(.white)
}
Spacer()
HStack(spacing: 8) {
Image("ic_can")
.resizable()
.frame(width: 16.7, height: 16.7)
Text("\(price)") HStack(spacing: 8) {
.font(.custom(Font.bold.rawValue, size: 13.3)) Image("ic_can")
.foregroundColor(Color(hex: "eeeeee")) .resizable()
} .frame(width: 16.7, height: 16.7)
.padding(.vertical, 8)
.padding(.horizontal, 13.3) Text("\(price)")
.background(Color(hex: "9970ff")) .font(.custom(Font.bold.rawValue, size: 13.3))
.cornerRadius(5.3) .foregroundColor(Color(hex: "eeeeee"))
.onTapGesture { }
onTapPurchase(.KEEP) .padding(.vertical, 8)
isShowing = false .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 duration: String
let isAdult: Bool let isAdult: Bool
let isMosaic: Bool let isMosaic: Bool
let isOnlyRental: Bool
let existOrdered: Bool let existOrdered: Bool
let orderType: OrderType? let orderType: OrderType?
let remainingTime: String? let remainingTime: String?

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -147,6 +147,33 @@ struct CanPgPaymentView: View {
.frame(width: screenSize().width - 26.7) .frame(width: screenSize().width - 26.7)
.padding(.top, 16.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) { HStack(spacing: 6.7) {
Image(viewModel.isTermsAgree ? "btn_select_checked" : "btn_select_normal") Image(viewModel.isTermsAgree ? "btn_select_checked" : "btn_select_normal")
.resizable() .resizable()

View File

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

View File

@ -33,6 +33,24 @@ struct OrderListAllView: View {
.frame(height: 50) .frame(height: 50)
.background(Color.black) .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 ScrollViewReader { reader in
ScrollView(.vertical, showsIndicators: false) { ScrollView(.vertical, showsIndicators: false) {
LazyVStack(spacing: 10.7) { LazyVStack(spacing: 10.7) {

View File

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