라이브 성별 제한 옵션 추가
라이브 생성과 수정 요청에 성별 제한 값을 포함한다. 라이브 정보 조회 응답에 성별 제한 값을 제공한다.
This commit is contained in:
@@ -14,6 +14,7 @@ struct CreateLiveRoomRequest: Encodable {
|
||||
let tags: [String]
|
||||
let numberOfPeople: Int
|
||||
var isAdult: Bool = false
|
||||
var genderRestriction: LiveRoomCreateViewModel.GenderRestriction = .ALL
|
||||
var price = 0
|
||||
var type: LiveRoomCreateViewModel.LiveRoomType = .OPEN
|
||||
var password: String? = nil
|
||||
|
||||
@@ -13,4 +13,5 @@ struct GetRecentRoomInfoResponse: Decodable {
|
||||
let coverImageUrl: String
|
||||
let coverImagePath: String
|
||||
let numberOfPeople: Int
|
||||
let genderRestriction: LiveRoomCreateViewModel.GenderRestriction
|
||||
}
|
||||
|
||||
@@ -175,6 +175,10 @@ struct LiveRoomCreateView: View {
|
||||
AdultSettingView()
|
||||
.frame(width: screenSize().width - 26.7)
|
||||
.padding(.top, 33.3)
|
||||
|
||||
GenderRestrictionView()
|
||||
.frame(width: screenSize().width - 26.7)
|
||||
.padding(.top, 33.3)
|
||||
}
|
||||
|
||||
PriceSettingView()
|
||||
@@ -698,6 +702,56 @@ struct LiveRoomCreateView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
func GenderRestrictionView() -> some View {
|
||||
VStack(spacing: 13.3) {
|
||||
Text(I18n.CreateLive.genderRestrictionTitle)
|
||||
.appFont(size: 16.7, weight: .bold)
|
||||
.foregroundColor(Color.grayee)
|
||||
.frame(width: screenSize().width - 26.7, alignment: .leading)
|
||||
|
||||
HStack(spacing: 13.3) {
|
||||
GenderRestrictionSelectButton(
|
||||
title: I18n.CreateLive.genderAll,
|
||||
restriction: .ALL,
|
||||
buttonWidth: (screenSize().width - 53) / 3
|
||||
)
|
||||
|
||||
GenderRestrictionSelectButton(
|
||||
title: I18n.CreateLive.genderMaleOnly,
|
||||
restriction: .MALE_ONLY,
|
||||
buttonWidth: (screenSize().width - 53) / 3
|
||||
)
|
||||
|
||||
GenderRestrictionSelectButton(
|
||||
title: I18n.CreateLive.genderFemaleOnly,
|
||||
restriction: .FEMALE_ONLY,
|
||||
buttonWidth: (screenSize().width - 53) / 3
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
func GenderRestrictionSelectButton(
|
||||
title: String,
|
||||
restriction: LiveRoomCreateViewModel.GenderRestriction,
|
||||
buttonWidth: CGFloat
|
||||
) -> some View {
|
||||
SelectedButtonView(
|
||||
title: title,
|
||||
isActive: true,
|
||||
isSelected: viewModel.genderRestriction == restriction
|
||||
)
|
||||
.frame(width: buttonWidth)
|
||||
.onTapGesture {
|
||||
hideKeyboard()
|
||||
if viewModel.genderRestriction != restriction {
|
||||
viewModel.genderRestriction = restriction
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
func PriceSettingView() -> some View {
|
||||
|
||||
@@ -23,6 +23,10 @@ final class LiveRoomCreateViewModel: ObservableObject {
|
||||
enum LiveRoomType: String, Codable {
|
||||
case OPEN, PRIVATE
|
||||
}
|
||||
|
||||
enum GenderRestriction: String, Codable {
|
||||
case ALL, MALE_ONLY, FEMALE_ONLY
|
||||
}
|
||||
|
||||
let prices = [0, 100, 300, 500, 1000, 2000]
|
||||
|
||||
@@ -61,6 +65,7 @@ final class LiveRoomCreateViewModel: ObservableObject {
|
||||
}
|
||||
|
||||
@Published var isAdult = false
|
||||
@Published var genderRestriction: GenderRestriction = .ALL
|
||||
@Published var priceString = "0" {
|
||||
didSet {
|
||||
if priceString.count > 5 {
|
||||
@@ -134,6 +139,7 @@ final class LiveRoomCreateViewModel: ObservableObject {
|
||||
self.coverImageUrl = data.coverImageUrl
|
||||
self.coverImagePath = data.coverImagePath
|
||||
self.numberOfPeople = String(data.numberOfPeople)
|
||||
self.genderRestriction = data.genderRestriction
|
||||
|
||||
self.errorMessage = I18n.CreateLive.recentDataLoaded
|
||||
self.isShowPopup = true
|
||||
@@ -173,6 +179,7 @@ final class LiveRoomCreateViewModel: ObservableObject {
|
||||
tags: tags,
|
||||
numberOfPeople: Int(numberOfPeople)!,
|
||||
isAdult: isAdult,
|
||||
genderRestriction: genderRestriction,
|
||||
price: price,
|
||||
type: roomType,
|
||||
password: (roomType == .PRIVATE && !password.trimmingCharacters(in: .whitespaces).isEmpty) ? password : nil,
|
||||
|
||||
Reference in New Issue
Block a user