From 34f2348aa0f0ce9dfe1adf78146d6b269564b4d8 Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Fri, 26 Jan 2024 10:57:57 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BD=98=ED=85=90=EC=B8=A0=20=EC=97=85?= =?UTF-8?q?=EB=A1=9C=EB=93=9C=20-=20=EB=AF=B8=EB=A6=AC=EB=93=A3=EA=B8=B0?= =?UTF-8?q?=20=EC=97=AC=EB=B6=80=20=EC=84=A0=ED=83=9D=20=EB=B2=84=ED=8A=BC?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Content/Create/ContentCreateView.swift | 112 +++++++++++------- .../Create/ContentCreateViewModel.swift | 9 +- .../Create/CreateAudioContentRequest.swift | 1 + .../GetAudioContentDetailResponse.swift | 1 + 4 files changed, 75 insertions(+), 48 deletions(-) diff --git a/SodaLive/Sources/Content/Create/ContentCreateView.swift b/SodaLive/Sources/Content/Create/ContentCreateView.swift index 3daea4d..6edb497 100644 --- a/SodaLive/Sources/Content/Create/ContentCreateView.swift +++ b/SodaLive/Sources/Content/Create/ContentCreateView.swift @@ -288,62 +288,84 @@ struct ContentCreateView: View { .frame(maxWidth: .infinity, alignment: .leading) } .padding(.top, 26.7) - } - - if !viewModel.isFree { - VStack(spacing: 10) { - Text("미리듣기 시간 설정") + + VStack(spacing: 13.3) { + 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) + SelectButtonView(title: "생성", isChecked: viewModel.isGeneratePreview) { + if !viewModel.isGeneratePreview { + viewModel.isGeneratePreview = true + } } - 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) + SelectButtonView(title: "생성 안 함", isChecked: !viewModel.isGeneratePreview) { + if viewModel.isGeneratePreview { + viewModel.isGeneratePreview = false + } } } - .padding(.top, 3.3) } .padding(.top, 26.7) + + if viewModel.isGeneratePreview { + 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) + } + + 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, 26.7) + } } } .padding(.top, 26.7) diff --git a/SodaLive/Sources/Content/Create/ContentCreateViewModel.swift b/SodaLive/Sources/Content/Create/ContentCreateViewModel.swift index b010fc7..9684ee0 100644 --- a/SodaLive/Sources/Content/Create/ContentCreateViewModel.swift +++ b/SodaLive/Sources/Content/Create/ContentCreateViewModel.swift @@ -56,11 +56,13 @@ final class ContentCreateViewModel: ObservableObject { if isFree { priceString = "0" isOnlyRental = false + isGeneratePreview = true } } } @Published var isOnlyRental = false + @Published var isGeneratePreview = true @Published var previewStartTime: String = "" @Published var previewEndTime: String = "" @@ -94,10 +96,11 @@ final class ContentCreateViewModel: ObservableObject { timezone: TimeZone.current.identifier, themeId: theme!.id, isAdult: isAdult, - isOnlyRental: isOnlyRental, + isOnlyRental: isOnlyRental, + isGeneratePreview: isGeneratePreview, isCommentAvailable: isAvailableComment, - previewStartTime: previewStartTime.trimmingCharacters(in: .whitespacesAndNewlines).count > 0 ? previewStartTime : nil, - previewEndTime: previewEndTime.trimmingCharacters(in: .whitespacesAndNewlines).count > 0 ? previewEndTime : nil + previewStartTime: isGeneratePreview && previewStartTime.trimmingCharacters(in: .whitespacesAndNewlines).count > 0 ? previewStartTime : nil, + previewEndTime: isGeneratePreview && previewEndTime.trimmingCharacters(in: .whitespacesAndNewlines).count > 0 ? previewEndTime : nil ) var multipartData = [MultipartFormData]() diff --git a/SodaLive/Sources/Content/Create/CreateAudioContentRequest.swift b/SodaLive/Sources/Content/Create/CreateAudioContentRequest.swift index ccd5712..e33c490 100644 --- a/SodaLive/Sources/Content/Create/CreateAudioContentRequest.swift +++ b/SodaLive/Sources/Content/Create/CreateAudioContentRequest.swift @@ -17,6 +17,7 @@ struct CreateAudioContentRequest: Encodable { let themeId: Int let isAdult: Bool let isOnlyRental: Bool + let isGeneratePreview: Bool let isCommentAvailable: Bool let previewStartTime: String? let previewEndTime: String? diff --git a/SodaLive/Sources/Content/Detail/GetAudioContentDetailResponse.swift b/SodaLive/Sources/Content/Detail/GetAudioContentDetailResponse.swift index a0381b8..f84d032 100644 --- a/SodaLive/Sources/Content/Detail/GetAudioContentDetailResponse.swift +++ b/SodaLive/Sources/Content/Detail/GetAudioContentDetailResponse.swift @@ -18,6 +18,7 @@ struct GetAudioContentDetailResponse: Decodable { let price: Int let duration: String let releaseDate: String? + let isActivePreview: Bool let isAdult: Bool let isMosaic: Bool let isOnlyRental: Bool