라이브 성별 제한 옵션 추가

라이브 생성과 수정 요청에 성별 제한 값을 포함한다.
라이브 정보 조회 응답에 성별 제한 값을 제공한다.
This commit is contained in:
Yu Sung
2026-02-02 18:20:26 +09:00
parent b985af4497
commit 5159debf7f
9 changed files with 135 additions and 6 deletions

View File

@@ -17,4 +17,5 @@ struct EditLiveRoomInfoRequest: Encodable {
var menuPan: String = ""
var isActiveMenuPan: Bool? = nil
var isAdult: Bool? = nil
var genderRestriction: LiveRoomCreateViewModel.GenderRestriction? = nil
}

View File

@@ -45,13 +45,17 @@ struct LiveRoomEditView: View {
NumberOfPeopleLimitView()
.frame(width: screenSize().width - 26.7)
.padding(.top, 33.3)
GenderRestrictionView()
.frame(width: screenSize().width - 26.7)
.padding(.top, 33.3)
if !viewModel.isLoading {
Text("라이브 수정")
.appFont(size: 18.3, weight: .bold)
.foregroundColor(Color.white)
.frame(width: screenSize().width - 26.7, height: 50)
.background(Color(hex: "9970ff"))
.background(Color.button)
.cornerRadius(10)
.padding(.top, 30)
.onTapGesture {
@@ -87,7 +91,7 @@ struct LiveRoomEditView: View {
.padding(.vertical, 13.3)
.frame(width: geo.size.width - 66.7, alignment: .center)
.appFont(size: 12, weight: .medium)
.background(Color(hex: "9970ff"))
.background(Color.button)
.foregroundColor(Color.white)
.multilineTextAlignment(.center)
.cornerRadius(20)
@@ -175,7 +179,7 @@ struct LiveRoomEditView: View {
.frame(width: buttonWidth, height: 48.7)
.overlay(
RoundedRectangle(cornerRadius: 6.7)
.stroke(Color(hex: "9970ff"), lineWidth: 1.3)
.stroke(Color.button, lineWidth: 1.3)
)
}
}
@@ -195,7 +199,7 @@ struct LiveRoomEditView: View {
.frame(width: buttonWidth, height: 48.7)
.overlay(
RoundedRectangle(cornerRadius: 6.7)
.stroke(Color(hex: "9970ff"), lineWidth: 1.3)
.stroke(Color.button, lineWidth: 1.3)
)
}
}
@@ -227,6 +231,56 @@ struct LiveRoomEditView: View {
.cornerRadius(6.7)
}
}
@ViewBuilder
func GenderRestrictionView() -> some View {
VStack(spacing: 13.3) {
Text(I18n.CreateLive.genderRestrictionTitle)
.appFont(size: 16.7, weight: .bold)
.foregroundColor(Color(hex: "eeeeee"))
.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 SelectDateView() -> some View {

View File

@@ -24,6 +24,7 @@ final class LiveRoomEditViewModel: ObservableObject {
@Published var numberOfPeople = ""
@Published var reservationDateString: String = ""
@Published var reservationTimeString: String = ""
@Published var genderRestriction: LiveRoomCreateViewModel.GenderRestriction = .ALL
@Published var errorMessage = ""
@Published var isShowPopup = false
@@ -51,6 +52,7 @@ final class LiveRoomEditViewModel: ObservableObject {
title = room!.title
notice = room!.notice
numberOfPeople = String(room!.numberOfParticipantsTotal)
genderRestriction = room!.genderRestriction ?? .ALL
if let beginDate = room!.beginDateTimeUtc.parseUtcIsoDate() {
reservationDate = beginDate
@@ -80,14 +82,16 @@ final class LiveRoomEditViewModel: ObservableObject {
notice: room.notice != notice ? notice : nil,
numberOfPeople: room.numberOfParticipantsTotal != Int(numberOfPeople)! ? Int(numberOfPeople)! : nil,
beginDateTimeString: beginDateTimeStr != beginDateTime ? beginDateTime : nil,
timezone: TimeZone.current.identifier
timezone: TimeZone.current.identifier,
genderRestriction: (room.genderRestriction ?? .ALL) != genderRestriction ? genderRestriction : nil
)
if (
request.title == nil &&
request.notice == nil &&
request.numberOfPeople == nil &&
request.beginDateTimeString == nil
request.beginDateTimeString == nil &&
request.genderRestriction == nil
) {
self.errorMessage = "변경사항이 없습니다."
self.isShowPopup = true