콘텐츠 업로드
- 소장만 가능한 콘텐츠 업로드 기능 추가
This commit is contained in:
		| @@ -229,16 +229,22 @@ struct ContentCreateView: View { | ||||
|                                             .foregroundColor(Color.grayee) | ||||
|                                             .frame(maxWidth: .infinity, alignment: .leading) | ||||
|                                          | ||||
|                                         HStack(spacing: 13.3) { | ||||
|                                             SelectButtonView(title: "소장/대여", isChecked: !viewModel.isOnlyRental) { | ||||
|                                                 if viewModel.isOnlyRental { | ||||
|                                                     viewModel.isOnlyRental = false | ||||
|                                         HStack(spacing: 6.7) { | ||||
|                                             SelectButtonView(title: "소장/대여", isChecked: viewModel.purchaseOption == .BOTH) { | ||||
|                                                 if viewModel.purchaseOption != .BOTH { | ||||
|                                                     viewModel.purchaseOption = .BOTH | ||||
|                                                 } | ||||
|                                             } | ||||
|                                              | ||||
|                                             SelectButtonView(title: "대여만", isChecked: viewModel.isOnlyRental) { | ||||
|                                                 if !viewModel.isOnlyRental { | ||||
|                                                     viewModel.isOnlyRental = true | ||||
|                                             SelectButtonView(title: "소장만", isChecked: viewModel.purchaseOption == .BUY_ONLY) { | ||||
|                                                 if viewModel.purchaseOption != .BUY_ONLY { | ||||
|                                                     viewModel.purchaseOption = .BUY_ONLY | ||||
|                                                 } | ||||
|                                             } | ||||
|                                              | ||||
|                                             SelectButtonView(title: "대여만", isChecked: viewModel.purchaseOption == .RENT_ONLY) { | ||||
|                                                 if viewModel.purchaseOption != .RENT_ONLY { | ||||
|                                                     viewModel.purchaseOption = .RENT_ONLY | ||||
|                                                 } | ||||
|                                             } | ||||
|                                         } | ||||
| @@ -246,7 +252,7 @@ struct ContentCreateView: View { | ||||
|                                     .padding(.top, 13.3) | ||||
|                                      | ||||
|                                     VStack(spacing: 0) { | ||||
|                                         Text(viewModel.isOnlyRental ? "대여 가격" : "소장 가격") | ||||
|                                         Text(viewModel.purchaseOption == .RENT_ONLY ? "대여 가격" : "소장 가격") | ||||
|                                             .font(.custom(Font.medium.rawValue, size: 13.3)) | ||||
|                                             .foregroundColor(Color.grayd2) | ||||
|                                             .frame(maxWidth: .infinity, alignment: .leading) | ||||
| @@ -296,7 +302,7 @@ struct ContentCreateView: View { | ||||
|                                     } | ||||
|                                     .padding(.top, 26.7) | ||||
|                                      | ||||
|                                     if viewModel.price > 0 && !viewModel.isOnlyRental { | ||||
|                                     if viewModel.price > 0 && viewModel.purchaseOption != .RENT_ONLY { | ||||
|                                         VStack(spacing: 13.3) { | ||||
|                                             Text("한정판 설정") | ||||
|                                                 .font(.custom(Font.bold.rawValue, size: 16.7)) | ||||
|   | ||||
| @@ -56,15 +56,15 @@ final class ContentCreateViewModel: ObservableObject { | ||||
|             if isFree { | ||||
|                 priceString = "0" | ||||
|                 isLimited = false | ||||
|                 isOnlyRental = false | ||||
|                 isGeneratePreview = true | ||||
|                 purchaseOption = PurchaseOption.BOTH | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|      | ||||
|     @Published var isOnlyRental = false { | ||||
|     @Published var purchaseOption = PurchaseOption.BOTH { | ||||
|         didSet { | ||||
|             if isOnlyRental { | ||||
|             if purchaseOption == .RENT_ONLY { | ||||
|                 isLimited = false | ||||
|             } | ||||
|         } | ||||
| @@ -125,12 +125,12 @@ final class ContentCreateViewModel: ObservableObject { | ||||
|                 detail: detail, | ||||
|                 tags: hashtags, | ||||
|                 price: price, | ||||
|                 purchaseOption: purchaseOption, | ||||
|                 limited: limited, | ||||
|                 releaseDate: isActiveReservation ? "\(releaseDate.convertDateFormat(dateFormat: "yyyy-MM-dd")) \(releaseTime.convertDateFormat(dateFormat: "HH:mm"))" : nil, | ||||
|                 timezone: TimeZone.current.identifier, | ||||
|                 themeId: theme!.id, | ||||
|                 isAdult: isAdult, | ||||
|                 isOnlyRental: isOnlyRental,  | ||||
|                 isGeneratePreview: isGeneratePreview, | ||||
|                 isCommentAvailable: isAvailableComment, | ||||
|                 previewStartTime: isGeneratePreview && previewStartTime.trimmingCharacters(in: .whitespacesAndNewlines).count > 0 ? previewStartTime : nil, | ||||
|   | ||||
| @@ -12,12 +12,12 @@ struct CreateAudioContentRequest: Encodable { | ||||
|     let detail: String | ||||
|     let tags: String | ||||
|     let price: Int | ||||
|     let purchaseOption: PurchaseOption | ||||
|     let limited: Int? | ||||
|     let releaseDate: String? | ||||
|     let timezone: String | ||||
|     let themeId: Int | ||||
|     let isAdult: Bool | ||||
|     let isOnlyRental: Bool | ||||
|     let isGeneratePreview: Bool | ||||
|     let isCommentAvailable: Bool | ||||
|     let previewStartTime: String? | ||||
|   | ||||
							
								
								
									
										10
									
								
								SodaLive/Sources/Content/PurchaseOption.swift
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								SodaLive/Sources/Content/PurchaseOption.swift
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,10 @@ | ||||
| // | ||||
| //  PurchaseOption.swift | ||||
| //  SodaLive | ||||
| // | ||||
| //  Created by klaus on 11/8/24. | ||||
| // | ||||
|  | ||||
| enum PurchaseOption: String, Codable { | ||||
|     case BOTH, BUY_ONLY, RENT_ONLY | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Yu Sung
					Yu Sung