라이브 정보 수정

- 연령 제한 설정 추가
This commit is contained in:
Yu Sung
2024-09-11 14:58:55 +09:00
parent 8aa69f02fc
commit 3db59e6236
5 changed files with 85 additions and 29 deletions

View File

@@ -15,6 +15,7 @@ struct LiveRoomInfoEditDialog: View {
@State private var title = ""
@State private var notice = ""
@State private var isAdult = false
let placeholder = "라이브 공지를 입력하세요"
@@ -23,24 +24,26 @@ struct LiveRoomInfoEditDialog: View {
let isLoading: Bool
let coverImageUrl: String?
let coverImage: UIImage?
var confirmAction: (String, String) -> Void
var confirmAction: (String, String, Bool) -> Void
init(
isShowing: Binding<Bool>,
isShowPhotoPicker: Binding<Bool>,
viewModel: LiveRoomViewModel,
isAdult: Bool,
isLoading: Bool,
currentTitle: String,
currentNotice: String,
coverImageUrl: String,
coverImage: UIImage?,
confirmAction: @escaping (String, String) -> Void
confirmAction: @escaping (String, String, Bool) -> Void
) {
self._isShowing = isShowing
self._isShowPhotoPicker = isShowPhotoPicker
self._viewModel = StateObject(wrappedValue: viewModel)
self.isLoading = isLoading
self.isAdult = isAdult
self.title = currentTitle
self.notice = currentNotice
@@ -116,6 +119,30 @@ struct LiveRoomInfoEditDialog: View {
ContentInputView()
.padding(.top, 33.3)
if UserDefaults.bool(forKey: .auth) {
VStack(alignment: .leading, spacing: 8) {
Text("연령제한")
.font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color.grayee)
HStack(spacing: 0) {
Text("19세 이상")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color.grayee)
Spacer()
Image(isAdult ? "btn_toggle_on_big" : "btn_toggle_off_big")
.resizable()
.frame(width: 33.3, height: 20)
.onTapGesture {
isAdult.toggle()
}
}
}
.padding(.top, 33.3)
}
LiveRoomMenuSelectView(
menu: $viewModel.menu,
isActivate: $viewModel.isActivateMenu,
@@ -152,7 +179,8 @@ struct LiveRoomInfoEditDialog: View {
.onTapGesture {
confirmAction(
title,
notice.trimmingCharacters(in: .whitespacesAndNewlines) != placeholder ? notice : ""
notice.trimmingCharacters(in: .whitespacesAndNewlines) != placeholder ? notice : "",
isAdult
)
isShowing = false
}
@@ -169,7 +197,7 @@ struct LiveRoomInfoEditDialog: View {
}
}
}
.background(Color(hex: "222222").edgesIgnoringSafeArea(.all))
.background(Color.gray22.edgesIgnoringSafeArea(.all))
if viewModel.isShowPopup {
LiveRoomDialogView(
@@ -198,7 +226,7 @@ struct LiveRoomInfoEditDialog: View {
VStack(alignment: .leading, spacing: 0) {
Text("제목")
.font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color(hex: "eeeeee"))
.foregroundColor(Color.grayee)
TextField("라이브 제목을 입력하세요", text: $title)
.autocapitalization(.none)