diff --git a/SodaLive/Sources/Content/Create/ContentCreateView.swift b/SodaLive/Sources/Content/Create/ContentCreateView.swift index 04d7f07..a7d46fb 100644 --- a/SodaLive/Sources/Content/Create/ContentCreateView.swift +++ b/SodaLive/Sources/Content/Create/ContentCreateView.swift @@ -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) { diff --git a/SodaLive/Sources/Content/Create/ContentCreateViewModel.swift b/SodaLive/Sources/Content/Create/ContentCreateViewModel.swift index e02627b..b6c831c 100644 --- a/SodaLive/Sources/Content/Create/ContentCreateViewModel.swift +++ b/SodaLive/Sources/Content/Create/ContentCreateViewModel.swift @@ -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 diff --git a/SodaLive/Sources/Content/Create/CreateAudioContentRequest.swift b/SodaLive/Sources/Content/Create/CreateAudioContentRequest.swift index a47b918..ca70646 100644 --- a/SodaLive/Sources/Content/Create/CreateAudioContentRequest.swift +++ b/SodaLive/Sources/Content/Create/CreateAudioContentRequest.swift @@ -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?