콘텐츠 등록 - 대여만 가능한 콘텐츠 등록 기능 추가

This commit is contained in:
Yu Sung 2023-10-22 17:57:31 +09:00
parent 995c6adab7
commit cdad53ae7b
3 changed files with 81 additions and 52 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?