라이브

- 메뉴판 UI 추가
This commit is contained in:
Yu Sung 2024-03-08 16:58:00 +09:00
parent aa4171b095
commit b6411c3ccb
13 changed files with 381 additions and 123 deletions

View File

@ -36,6 +36,7 @@ enum LiveApi {
case getDonationMessageList(roomId: Int) case getDonationMessageList(roomId: Int)
case deleteDonationMessage(roomId: Int, messageUUID: String) case deleteDonationMessage(roomId: Int, messageUUID: String)
case getUserProfile(roomId: Int, userId: Int) case getUserProfile(roomId: Int, userId: Int)
case getAllMenuPreset(creatorId: Int)
} }
extension LiveApi: TargetType { extension LiveApi: TargetType {
@ -125,12 +126,15 @@ extension LiveApi: TargetType {
case .getUserProfile(let roomId, let userId): case .getUserProfile(let roomId, let userId):
return "/live/room/\(roomId)/profile/\(userId)" return "/live/room/\(roomId)/profile/\(userId)"
case .getAllMenuPreset:
return "/live/room/menu/all"
} }
} }
var method: Moya.Method { var method: Moya.Method {
switch self { switch self {
case .roomList, .recentVisitRoomUsers, .getReservations, .getReservation, .getRoomDetail, .getTags, .getRecentRoomInfo, .getRoomInfo, .donationStatus, .donationTotal, .getDonationMessageList, .getUserProfile: case .roomList, .recentVisitRoomUsers, .getReservations, .getReservation, .getRoomDetail, .getTags, .getRecentRoomInfo, .getRoomInfo, .donationStatus, .donationTotal, .getDonationMessageList, .getUserProfile, .getAllMenuPreset:
return .get return .get
case .makeReservation, .enterRoom, .createRoom, .quitRoom, .donation, .refundDonation, .kickOut: case .makeReservation, .enterRoom, .createRoom, .quitRoom, .donation, .refundDonation, .kickOut:
@ -226,6 +230,9 @@ extension LiveApi: TargetType {
case .deleteDonationMessage(let roomId, let messageUUID): case .deleteDonationMessage(let roomId, let messageUUID):
return .requestJSONEncodable(DeleteLiveRoomDonationMessage(roomId: roomId, messageUUID: messageUUID)) return .requestJSONEncodable(DeleteLiveRoomDonationMessage(roomId: roomId, messageUUID: messageUUID))
case .getAllMenuPreset(let creatorId):
return .requestParameters(parameters: ["creatorId" : creatorId], encoding: URLEncoding.queryString)
} }
} }

View File

@ -116,4 +116,8 @@ final class LiveRepository {
func getUserProfile(roomId: Int, userId: Int) -> AnyPublisher<Response, MoyaError> { func getUserProfile(roomId: Int, userId: Int) -> AnyPublisher<Response, MoyaError> {
api.requestPublisher(.getUserProfile(roomId: roomId, userId: userId)) api.requestPublisher(.getUserProfile(roomId: roomId, userId: userId))
} }
func getAllMenuPreset(creatorId: Int) -> AnyPublisher<Response, MoyaError> {
api.requestPublisher(.getAllMenuPreset(creatorId: creatorId))
}
} }

View File

@ -19,4 +19,7 @@ struct CreateLiveRoomRequest: Encodable {
var password: String? = nil var password: String? = nil
let timezone: String = TimeZone.current.identifier let timezone: String = TimeZone.current.identifier
var beginDateTimeString: String? = nil var beginDateTimeString: String? = nil
var menuPanId: Int = 0
var menuPan: String = ""
var isActiveMenuPan: Bool = false
} }

View File

@ -41,7 +41,7 @@ struct LiveRoomCreateView: View {
Text("라이브 만들기") Text("라이브 만들기")
.font(.custom(Font.bold.rawValue, size: 18.3)) .font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color.grayee)
} }
Spacer() Spacer()
@ -49,13 +49,13 @@ struct LiveRoomCreateView: View {
if viewModel.isShowGetRecentInfoButton { if viewModel.isShowGetRecentInfoButton {
Text("최근 데이터 가져오기") Text("최근 데이터 가져오기")
.font(.custom(Font.medium.rawValue, size: 12)) .font(.custom(Font.medium.rawValue, size: 12))
.foregroundColor(Color(hex: "9970ff")) .foregroundColor(Color.button)
.padding(.vertical, 8) .padding(.vertical, 8)
.padding(.horizontal, 10.7) .padding(.horizontal, 10.7)
.overlay( .overlay(
RoundedRectangle(cornerRadius: 8) RoundedRectangle(cornerRadius: 8)
.stroke() .stroke()
.foregroundColor(Color(hex: "9970ff")) .foregroundColor(Color.button)
) )
.onTapGesture { .onTapGesture {
viewModel.getRecentInfo() viewModel.getRecentInfo()
@ -71,7 +71,7 @@ struct LiveRoomCreateView: View {
VStack(spacing: 0) { VStack(spacing: 0) {
Text("썸네일") Text("썸네일")
.font(.custom(Font.bold.rawValue, size: 16.7)) .font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color.grayee)
.padding(.horizontal, 13.3) .padding(.horizontal, 13.3)
.padding(.top, 13.3) .padding(.top, 13.3)
.frame(width: screenSize().width, alignment: .leading) .frame(width: screenSize().width, alignment: .leading)
@ -95,13 +95,13 @@ struct LiveRoomCreateView: View {
.resizable() .resizable()
.scaledToFit() .scaledToFit()
.frame(width: 80, height: 116.8) .frame(width: 80, height: 116.8)
.background(Color(hex: "3e3358")) .background(Color.bg)
.cornerRadius(10) .cornerRadius(10)
} }
Image("ic_camera") Image("ic_camera")
.padding(10) .padding(10)
.background(Color(hex: "9970ff")) .background(Color.button)
.cornerRadius(30) .cornerRadius(30)
.offset(x: 40, y: 40) .offset(x: 40, y: 40)
} }
@ -115,25 +115,32 @@ struct LiveRoomCreateView: View {
.frame(width: screenSize().width - 26.7) .frame(width: screenSize().width - 26.7)
.padding(.top, 33.3) .padding(.top, 33.3)
TagSelectView() ContentInputView()
.frame(width: screenSize().width - 26.7) .frame(width: screenSize().width - 26.7)
.padding(.top, 33.3) .padding(.top, 33.3)
} }
VStack(spacing: 0) { VStack(spacing: 33.3) {
ContentInputView() LiveRoomMenuSelectView(
.frame(width: screenSize().width - 26.7) menu: $viewModel.menu,
.padding(.top, 33.3) isActivate: $viewModel.isActivateMenu,
menuCount: viewModel.menuList.count,
selectedMenu: viewModel.selectedMenu ?? .MENU_1,
selectMenu: {
viewModel.selectMenuPreset(selectedMenuPreset: $0)
}
)
.frame(width: screenSize().width - 26.7)
if viewModel.roomType != .SECRET { TagSelectView()
TimeSettingView() .frame(width: screenSize().width - 26.7)
.padding(.top, 33.3)
} TimeSettingView()
NumberOfPeopleLimitView() NumberOfPeopleLimitView()
.frame(width: screenSize().width - 26.7) .frame(width: screenSize().width - 26.7)
.padding(.top, 33.3)
} }
.padding(.top, 33.3)
VStack(spacing: 0) { VStack(spacing: 0) {
RoomTypeSettingView() RoomTypeSettingView()
@ -146,11 +153,9 @@ struct LiveRoomCreateView: View {
.padding(.top, 33.3) .padding(.top, 33.3)
} }
if UserDefaults.string(forKey: .role) == MemberRole.CREATOR.rawValue { PriceSettingView()
PriceSettingView() .frame(width: screenSize().width - 26.7)
.frame(width: screenSize().width - 26.7) .padding(.top, 33.3)
.padding(.top, 33.3)
}
} }
HStack(alignment: .top, spacing: 0) { HStack(alignment: .top, spacing: 0) {
@ -167,23 +172,23 @@ struct LiveRoomCreateView: View {
.font(.custom(Font.bold.rawValue, size: 18.3)) .font(.custom(Font.bold.rawValue, size: 18.3))
.foregroundColor(Color.white) .foregroundColor(Color.white)
.frame(width: screenSize().width - 26.7, height: 50) .frame(width: screenSize().width - 26.7, height: 50)
.background(Color(hex: "9970ff")) .background(Color.button)
.cornerRadius(10) .cornerRadius(10)
.padding(.vertical, 13.3) .padding(.vertical, 13.3)
} }
} }
.frame(width: screenSize().width) .frame(width: screenSize().width)
.background(Color(hex: "222222")) .background(Color.gray22)
.cornerRadius(16.7, corners: [.topLeft, .topRight]) .cornerRadius(16.7, corners: [.topLeft, .topRight])
.padding(.top, 30) .padding(.top, 30)
Rectangle() Rectangle()
.foregroundColor(Color(hex: "222222")) .foregroundColor(Color.gray22)
.frame(width: screenSize().width, height: keyboardHandler.keyboardHeight) .frame(width: screenSize().width, height: keyboardHandler.keyboardHeight)
if proxy.safeAreaInsets.bottom > 0 { if proxy.safeAreaInsets.bottom > 0 {
Rectangle() Rectangle()
.foregroundColor(Color(hex: "222222")) .foregroundColor(Color.gray22)
.frame(width: screenSize().width, height: 15.3) .frame(width: screenSize().width, height: 15.3)
} }
} }
@ -234,7 +239,7 @@ struct LiveRoomCreateView: View {
.padding(.vertical, 13.3) .padding(.vertical, 13.3)
.frame(width: geo.size.width - 66.7, alignment: .center) .frame(width: geo.size.width - 66.7, alignment: .center)
.font(.custom(Font.medium.rawValue, size: 12)) .font(.custom(Font.medium.rawValue, size: 12))
.background(Color(hex: "9970ff")) .background(Color.button)
.foregroundColor(Color.white) .foregroundColor(Color.white)
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
.cornerRadius(20) .cornerRadius(20)
@ -245,6 +250,7 @@ struct LiveRoomCreateView: View {
} }
.onAppear { .onAppear {
viewModel.timeSettingMode = timeSettingMode viewModel.timeSettingMode = timeSettingMode
viewModel.getAllMenuPreset()
} }
} }
@ -253,7 +259,7 @@ struct LiveRoomCreateView: View {
VStack(spacing: 0) { VStack(spacing: 0) {
Text("제목") Text("제목")
.font(.custom(Font.bold.rawValue, size: 16.7)) .font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color.grayee)
.padding(.horizontal, 13.3) .padding(.horizontal, 13.3)
.frame(width: screenSize().width, alignment: .leading) .frame(width: screenSize().width, alignment: .leading)
@ -261,15 +267,15 @@ struct LiveRoomCreateView: View {
.autocapitalization(.none) .autocapitalization(.none)
.disableAutocorrection(true) .disableAutocorrection(true)
.font(.custom(Font.medium.rawValue, size: 13.3)) .font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color.grayee)
.accentColor(Color(hex: "3bb9f1")) .accentColor(Color.button)
.keyboardType(.default) .keyboardType(.default)
.padding(.top, 12) .padding(.top, 12)
.padding(.horizontal, 6.7) .padding(.horizontal, 6.7)
Rectangle() Rectangle()
.frame(height: 1) .frame(height: 1)
.foregroundColor(Color(hex: "909090").opacity(0.7)) .foregroundColor(Color.gray90.opacity(0.7))
.padding(.top, 8.3) .padding(.top, 8.3)
} }
} }
@ -279,7 +285,7 @@ struct LiveRoomCreateView: View {
VStack(alignment: .leading, spacing: 13.3) { VStack(alignment: .leading, spacing: 13.3) {
Text("관심사") Text("관심사")
.font(.custom(Font.bold.rawValue, size: 16.7)) .font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color.grayee)
Button(action: { Button(action: {
hideKeyboard() hideKeyboard()
@ -287,15 +293,15 @@ struct LiveRoomCreateView: View {
}) { }) {
Text("관심사 선택") Text("관심사 선택")
.font(.custom(Font.bold.rawValue, size: 16.7)) .font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color(hex: "9970ff")) .foregroundColor(Color.button)
.padding(.vertical, 13.7) .padding(.vertical, 13.7)
.frame(width: screenSize().width - 26.7) .frame(width: screenSize().width - 26.7)
.background(Color(hex: "9970ff").opacity(0.2)) .background(Color.button.opacity(0.2))
.cornerRadius(24.3) .cornerRadius(24.3)
.overlay( .overlay(
RoundedRectangle(cornerRadius: 24.3) RoundedRectangle(cornerRadius: 24.3)
.stroke() .stroke()
.foregroundColor(Color(hex: "9970ff")) .foregroundColor(Color.button)
) )
} }
@ -315,7 +321,7 @@ struct LiveRoomCreateView: View {
} }
} }
.padding(10) .padding(10)
.background(Color(hex: "9970ff")) .background(Color.button)
.cornerRadius(24.3) .cornerRadius(24.3)
} }
} }
@ -330,16 +336,16 @@ struct LiveRoomCreateView: View {
HStack(spacing: 0) { HStack(spacing: 0) {
Text("공지") Text("공지")
.font(.custom(Font.bold.rawValue, size: 16.7)) .font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color.grayee)
Spacer() Spacer()
Text("\(viewModel.content.count)") Text("\(viewModel.content.count)")
.font(.custom(Font.medium.rawValue, size: 13.3)) .font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "ff5c49")) + .foregroundColor(Color.mainRed) +
Text(" / 1000자") Text(" / 1000자")
.font(.custom(Font.medium.rawValue, size: 13.3)) .font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "777777")) .foregroundColor(Color.gray77)
} }
TextViewWrapper( TextViewWrapper(
@ -348,7 +354,7 @@ struct LiveRoomCreateView: View {
textColorHex: "eeeeee", textColorHex: "eeeeee",
backgroundColorHex: "222222" backgroundColorHex: "222222"
) )
.frame(width: screenSize().width - 26.7, height: 133.3) .frame(width: screenSize().width - 26.7, height: 200)
.cornerRadius(6.7) .cornerRadius(6.7)
.padding(.top, 13.3) .padding(.top, 13.3)
} }
@ -359,7 +365,7 @@ struct LiveRoomCreateView: View {
VStack(spacing: 0) { VStack(spacing: 0) {
Text("시간설정") Text("시간설정")
.font(.custom(Font.bold.rawValue, size: 16.7)) .font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color.grayee)
.frame(width: screenSize().width - 26.7, alignment: .leading) .frame(width: screenSize().width - 26.7, alignment: .leading)
HStack(spacing: 13.3) { HStack(spacing: 13.3) {
@ -400,15 +406,11 @@ struct LiveRoomCreateView: View {
.foregroundColor( .foregroundColor(
viewModel.timeSettingMode == timeSettingMode ? viewModel.timeSettingMode == timeSettingMode ?
.white : .white :
Color(hex: "9970ff") Color.button
) )
} }
.frame(width: buttonWidth, height: 48.7) .frame(width: buttonWidth, height: 48.7)
.background( .background(viewModel.timeSettingMode == timeSettingMode ? Color.button : Color.bg)
viewModel.timeSettingMode == timeSettingMode ?
Color(hex: "9970ff") :
Color(hex: "1f1734")
)
.cornerRadius(6.7) .cornerRadius(6.7)
.onTapGesture { .onTapGesture {
hideKeyboard() hideKeyboard()
@ -424,7 +426,7 @@ struct LiveRoomCreateView: View {
VStack(alignment: .leading, spacing: 6.7) { VStack(alignment: .leading, spacing: 6.7) {
Text("예약 날짜") Text("예약 날짜")
.font(.custom(Font.medium.rawValue, size: 13.3)) .font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color.grayee)
Button(action: { Button(action: {
hideKeyboard() hideKeyboard()
@ -432,11 +434,11 @@ struct LiveRoomCreateView: View {
}) { }) {
Text(viewModel.reservationDateString) Text(viewModel.reservationDateString)
.font(.custom(Font.medium.rawValue, size: 14.7)) .font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color.grayee)
.frame(width: buttonWidth, height: 48.7) .frame(width: buttonWidth, height: 48.7)
.overlay( .overlay(
RoundedRectangle(cornerRadius: 6.7) RoundedRectangle(cornerRadius: 6.7)
.stroke(Color(hex: "9970ff"), lineWidth: 1.3) .stroke(Color.button, lineWidth: 1.3)
) )
} }
} }
@ -444,7 +446,7 @@ struct LiveRoomCreateView: View {
VStack(alignment: .leading, spacing: 6.7) { VStack(alignment: .leading, spacing: 6.7) {
Text("예약 시간") Text("예약 시간")
.font(.custom(Font.medium.rawValue, size: 13.3)) .font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color.grayee)
Button(action: { Button(action: {
hideKeyboard() hideKeyboard()
@ -452,18 +454,18 @@ struct LiveRoomCreateView: View {
}) { }) {
Text(viewModel.reservationTimeString) Text(viewModel.reservationTimeString)
.font(.custom(Font.medium.rawValue, size: 14.7)) .font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color.grayee)
.frame(width: buttonWidth, height: 48.7) .frame(width: buttonWidth, height: 48.7)
.overlay( .overlay(
RoundedRectangle(cornerRadius: 6.7) RoundedRectangle(cornerRadius: 6.7)
.stroke(Color(hex: "9970ff"), lineWidth: 1.3) .stroke(Color.button, lineWidth: 1.3)
) )
} }
} }
} }
.frame(width: screenSize().width) .frame(width: screenSize().width)
.padding(.vertical, 13.3) .padding(.vertical, 13.3)
.background(Color(hex: "222222")) .background(Color.gray22)
} }
@ViewBuilder @ViewBuilder
@ -471,7 +473,7 @@ struct LiveRoomCreateView: View {
VStack(spacing: 13.3) { VStack(spacing: 13.3) {
Text("참여인원 설정") Text("참여인원 설정")
.font(.custom(Font.bold.rawValue, size: 16.7)) .font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color.grayee)
.frame(width: screenSize().width - 26.7, alignment: .leading) .frame(width: screenSize().width - 26.7, alignment: .leading)
TextField("최대 인원 999명", text: $viewModel.numberOfPeople) TextField("최대 인원 999명", text: $viewModel.numberOfPeople)
@ -479,12 +481,12 @@ struct LiveRoomCreateView: View {
.disableAutocorrection(true) .disableAutocorrection(true)
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
.font(.custom(Font.medium.rawValue, size: 14.7)) .font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color.grayee)
.accentColor(Color(hex: "3bb9f1")) .accentColor(Color.button)
.keyboardType(.numberPad) .keyboardType(.numberPad)
.padding(.vertical, 15.7) .padding(.vertical, 15.7)
.frame(width: screenSize().width - 26.7, alignment: .center) .frame(width: screenSize().width - 26.7, alignment: .center)
.background(Color(hex: "222222")) .background(Color.gray22)
.cornerRadius(6.7) .cornerRadius(6.7)
} }
} }
@ -508,12 +510,12 @@ struct LiveRoomCreateView: View {
Button(action: { self.isShowSelectDateView = false }) { Button(action: { self.isShowSelectDateView = false }) {
Text("확인") Text("확인")
.font(.system(size: 16)) .font(.system(size: 16))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color.grayee)
.padding(.vertical, 10) .padding(.vertical, 10)
.frame(width: proxy.size.width - 53.4) .frame(width: proxy.size.width - 53.4)
} }
} }
.background(Color(hex: "222222")) .background(Color.gray22)
.cornerRadius(6.7) .cornerRadius(6.7)
} }
.frame(width: proxy.size.width) .frame(width: proxy.size.width)
@ -539,12 +541,12 @@ struct LiveRoomCreateView: View {
Button(action: { self.isShowSelectTimeView = false }) { Button(action: { self.isShowSelectTimeView = false }) {
Text("확인") Text("확인")
.font(.system(size: 16)) .font(.system(size: 16))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color.grayee)
.padding(.vertical, 10) .padding(.vertical, 10)
.frame(width: proxy.size.width) .frame(width: proxy.size.width)
} }
} }
.background(Color(hex: "222222")) .background(Color.gray22)
.cornerRadius(6.7) .cornerRadius(6.7)
} }
.frame(width: proxy.size.width) .frame(width: proxy.size.width)
@ -556,7 +558,7 @@ struct LiveRoomCreateView: View {
VStack(spacing: 0) { VStack(spacing: 0) {
Text("공개 설정") Text("공개 설정")
.font(.custom(Font.bold.rawValue, size: 16.7)) .font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color.grayee)
.frame(width: screenSize().width - 26.7, alignment: .leading) .frame(width: screenSize().width - 26.7, alignment: .leading)
HStack(spacing: 13.3) { HStack(spacing: 13.3) {
@ -591,18 +593,10 @@ struct LiveRoomCreateView: View {
Text(title) Text(title)
.font(.custom(Font.bold.rawValue, size: 14.7)) .font(.custom(Font.bold.rawValue, size: 14.7))
.foregroundColor( .foregroundColor(viewModel.roomType == type ? .white : Color.button)
viewModel.roomType == type ?
.white :
Color(hex: "9970ff")
)
} }
.frame(width: buttonWidth, height: 48.7) .frame(width: buttonWidth, height: 48.7)
.background( .background(viewModel.roomType == type ? Color.button : Color.bg)
viewModel.roomType == type ?
Color(hex: "9970ff") :
Color(hex: "1f1734")
)
.cornerRadius(6.7) .cornerRadius(6.7)
.onTapGesture { .onTapGesture {
hideKeyboard() hideKeyboard()
@ -617,7 +611,7 @@ struct LiveRoomCreateView: View {
VStack(spacing: 13.3) { VStack(spacing: 13.3) {
Text("방 비밀번호 입력") Text("방 비밀번호 입력")
.font(.custom(Font.bold.rawValue, size: 16.7)) .font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color.grayee)
.frame(width: screenSize().width - 26.7, alignment: .leading) .frame(width: screenSize().width - 26.7, alignment: .leading)
TextField("방 입장 비밀번호 6자리를 입력해 주세요.", text: $viewModel.password) TextField("방 입장 비밀번호 6자리를 입력해 주세요.", text: $viewModel.password)
@ -625,12 +619,12 @@ struct LiveRoomCreateView: View {
.disableAutocorrection(true) .disableAutocorrection(true)
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
.font(.custom(Font.medium.rawValue, size: 14.7)) .font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color.grayee)
.accentColor(Color(hex: "3bb9f1")) .accentColor(Color.button)
.keyboardType(.numberPad) .keyboardType(.numberPad)
.padding(.vertical, 15.7) .padding(.vertical, 15.7)
.frame(width: screenSize().width - 26.7, alignment: .center) .frame(width: screenSize().width - 26.7, alignment: .center)
.background(Color(hex: "222222")) .background(Color.grayee)
.cornerRadius(6.7) .cornerRadius(6.7)
} }
} }
@ -640,7 +634,7 @@ struct LiveRoomCreateView: View {
VStack(spacing: 13.3) { VStack(spacing: 13.3) {
Text("연령 제한") Text("연령 제한")
.font(.custom(Font.bold.rawValue, size: 16.7)) .font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color.grayee)
.frame(width: screenSize().width - 26.7, alignment: .leading) .frame(width: screenSize().width - 26.7, alignment: .leading)
HStack(spacing: 13.3) { HStack(spacing: 13.3) {
@ -668,18 +662,10 @@ struct LiveRoomCreateView: View {
Text(title) Text(title)
.font(.custom(Font.bold.rawValue, size: 14.7)) .font(.custom(Font.bold.rawValue, size: 14.7))
.foregroundColor( .foregroundColor(viewModel.isAdult == isAdult ? .white : Color.button)
viewModel.isAdult == isAdult ?
.white :
Color(hex: "9970ff")
)
} }
.frame(width: buttonWidth, height: 48.7) .frame(width: buttonWidth, height: 48.7)
.background( .background(viewModel.isAdult == isAdult ? Color.button : Color.bg)
viewModel.isAdult == isAdult ?
Color(hex: "9970ff") :
Color(hex: "1f1734")
)
.cornerRadius(6.7) .cornerRadius(6.7)
.onTapGesture { .onTapGesture {
hideKeyboard() hideKeyboard()
@ -694,7 +680,7 @@ struct LiveRoomCreateView: View {
VStack(spacing: 13.3) { VStack(spacing: 13.3) {
Text("티켓 가격") Text("티켓 가격")
.font(.custom(Font.bold.rawValue, size: 16.7)) .font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color(hex: "eeeeee")) .foregroundColor(Color.grayee)
.frame(width: screenSize().width - 26.7, alignment: .leading) .frame(width: screenSize().width - 26.7, alignment: .leading)
HStack(spacing: 13.3) { HStack(spacing: 13.3) {
@ -719,35 +705,23 @@ struct LiveRoomCreateView: View {
.disableAutocorrection(true) .disableAutocorrection(true)
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
.font(.custom(Font.bold.rawValue, size: 13.3)) .font(.custom(Font.bold.rawValue, size: 13.3))
.foregroundColor(Color(hex: "9970ff")) .foregroundColor(Color.button)
.accentColor(Color(hex: "3bb9f1")) .accentColor(Color.button)
.keyboardType(.numberPad) .keyboardType(.numberPad)
Spacer() Spacer()
Text("") Text("")
.font(.custom(Font.medium.rawValue, size: 14.7)) .font(.custom(Font.medium.rawValue, size: 14.7))
.foregroundColor( .foregroundColor(Color.button)
Color(hex: "9970ff")
)
} }
.padding(.horizontal, 13.3) .padding(.horizontal, 13.3)
.frame(width: screenSize().width - 26.7, height: 48.7) .frame(width: screenSize().width - 26.7, height: 48.7)
.overlay( .overlay(
RoundedRectangle(cornerRadius: 6.7) RoundedRectangle(cornerRadius: 6.7)
.stroke( .stroke(!viewModel.prices.contains(viewModel.price) ? Color.button : Color.gray77, lineWidth: 1)
Color(hex: !viewModel.prices.contains(viewModel.price) ?
"9970ff" :
"777777"
),
lineWidth: 1
)
)
.background(
!viewModel.prices.contains(viewModel.price) ?
Color(hex:"9970ff").opacity(0.3):
Color(hex: "232323")
) )
.background(!viewModel.prices.contains(viewModel.price) ? Color.button.opacity(0.3): Color.gray23)
} }
} }
@ -761,23 +735,17 @@ struct LiveRoomCreateView: View {
Font.medium.rawValue, Font.medium.rawValue,
size: 14.7 size: 14.7
)) ))
.foregroundColor( .foregroundColor(viewModel.price == price ? Color.button : Color.gray77)
Color(hex: viewModel.price == price ? "9970ff" : "777777")
)
} }
.frame(width: buttonWidth, height: 48.7) .frame(width: buttonWidth, height: 48.7)
.overlay( .overlay(
RoundedRectangle(cornerRadius: 6.7) RoundedRectangle(cornerRadius: 6.7)
.stroke( .stroke(
Color(hex: viewModel.price == price ? "9970ff" : "777777"), viewModel.price == price ? Color.button : Color.gray77,
lineWidth: 1 lineWidth: 1
) )
) )
.background( .background(viewModel.price == price ? Color.button.opacity(0.3) : Color.gray23)
viewModel.price == price ?
Color(hex:"9970ff").opacity(0.3):
Color(hex: "232323")
)
.cornerRadius(6.7) .cornerRadius(6.7)
.onTapGesture { .onTapGesture {
hideKeyboard() hideKeyboard()

View File

@ -9,13 +9,19 @@ import UIKit
import Moya import Moya
import Combine import Combine
enum SelectedMenu: Int {
case MENU_1 = 0
case MENU_2 = 1
case MENU_3 = 2
}
final class LiveRoomCreateViewModel: ObservableObject { final class LiveRoomCreateViewModel: ObservableObject {
enum TimeSettingMode: String { enum TimeSettingMode: String {
case NOW, RESERVATION case NOW, RESERVATION
} }
enum LiveRoomType: String, Codable { enum LiveRoomType: String, Codable {
case OPEN, PRIVATE, SECRET case OPEN, PRIVATE
} }
let prices = [0, 100, 300, 500, 1000, 2000] let prices = [0, 100, 300, 500, 1000, 2000]
@ -40,15 +46,12 @@ final class LiveRoomCreateViewModel: ObservableObject {
@Published var roomType: LiveRoomType = .OPEN { @Published var roomType: LiveRoomType = .OPEN {
didSet { didSet {
if roomType == .SECRET {
timeSettingMode = .NOW
}
if roomType != .PRIVATE { if roomType != .PRIVATE {
password = "" password = ""
} }
} }
} }
@Published var password = "" { @Published var password = "" {
didSet { didSet {
if password.count > 6 { if password.count > 6 {
@ -77,6 +80,14 @@ final class LiveRoomCreateViewModel: ObservableObject {
@Published var isShowPopup = false @Published var isShowPopup = false
@Published var isShowGetRecentInfoButton = true @Published var isShowGetRecentInfoButton = true
private var menuId = 0
@Published var menu = ""
@Published var menuList = [GetMenuPresetResponse]()
@Published var isActivateMenu = false
@Published var selectedMenu: SelectedMenu? = nil
private let repository = LiveRepository() private let repository = LiveRepository()
private var subscription = Set<AnyCancellable>() private var subscription = Set<AnyCancellable>()
@ -164,10 +175,13 @@ final class LiveRoomCreateViewModel: ObservableObject {
isAdult: isAdult, isAdult: isAdult,
price: price, price: price,
type: roomType, type: roomType,
password: (roomType == .PRIVATE && !password.trimmingCharacters(in: .whitespaces).isEmpty) ? password : nil password: (roomType == .PRIVATE && !password.trimmingCharacters(in: .whitespaces).isEmpty) ? password : nil,
menuPanId: isActivateMenu ? menuId : 0,
menuPan: isActivateMenu ? menu : "",
isActiveMenuPan: isActivateMenu
) )
if timeSettingMode == .RESERVATION && roomType != .SECRET { if timeSettingMode == .RESERVATION {
request.beginDateTimeString = "\(reservationDate.convertDateFormat(dateFormat: "yyyy-MM-dd")) \(reservationTime.convertDateFormat(dateFormat: "HH:mm"))" request.beginDateTimeString = "\(reservationDate.convertDateFormat(dateFormat: "yyyy-MM-dd")) \(reservationTime.convertDateFormat(dateFormat: "HH:mm"))"
} }
@ -233,6 +247,73 @@ final class LiveRoomCreateViewModel: ObservableObject {
} }
} }
func selectMenuPreset(selectedMenuPreset: SelectedMenu) {
if menuList.isEmpty && (selectedMenuPreset == .MENU_2 || selectedMenuPreset == .MENU_3) {
errorMessage = "메뉴 1을 먼저 설정하세요"
isShowPopup = true
return
}
if menuList.count == 1 && selectedMenuPreset == .MENU_3 {
errorMessage = "메뉴 1과 메뉴 2를 먼저 설정하세요"
isShowPopup = true
return
}
if self.selectedMenu != selectedMenuPreset {
self.selectedMenu = selectedMenuPreset
if menuList.count > selectedMenuPreset.rawValue {
let menu = menuList[selectedMenuPreset.rawValue]
self.menu = menu.menu
self.menuId = menu.id
} else {
self.menu = ""
self.menuId = 0
}
}
}
func getAllMenuPreset() {
isLoading = true
repository.getAllMenuPreset(creatorId: UserDefaults.int(forKey: .userId))
.sink { result in
switch result {
case .finished:
DEBUG_LOG("finish")
case .failure(let error):
ERROR_LOG(error.localizedDescription)
}
} receiveValue: { [unowned self] response in
self.isLoading = false
let responseData = response.data
do {
let jsonDecoder = JSONDecoder()
let decoded = try jsonDecoder.decode(ApiResponse<[GetMenuPresetResponse]>.self, from: responseData)
if let data = decoded.data, decoded.success {
self.menuList.removeAll()
self.menuList.append(contentsOf: data)
self.selectMenuPreset(selectedMenuPreset: .MENU_1)
} else {
if let message = decoded.message {
self.errorMessage = message
} else {
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
}
self.isShowPopup = true
}
} catch {
self.errorMessage = "다시 시도해 주세요.\n계속 같은 문제가 발생할 경우 고객센터로 문의 주시기 바랍니다."
self.isShowPopup = true
}
}
.store(in: &subscription)
}
private func validate() -> Bool { private func validate() -> Bool {
if coverImage == nil && coverImagePath == nil { if coverImage == nil && coverImagePath == nil {
self.errorMessage = "커버이미지를 선택해주세요." self.errorMessage = "커버이미지를 선택해주세요."

View File

@ -24,6 +24,7 @@ struct GetRoomInfoResponse: Decodable {
let listenerList: [LiveRoomMember] let listenerList: [LiveRoomMember]
let managerList: [LiveRoomMember] let managerList: [LiveRoomMember]
let donationRankingTop3UserIds: [Int] let donationRankingTop3UserIds: [Int]
let menuPan: String
let isActiveRoulette: Bool let isActiveRoulette: Bool
let isPrivateRoom: Bool let isPrivateRoom: Bool
let password: String? let password: String?

View File

@ -67,7 +67,21 @@ final class LiveRoomViewModel: NSObject, ObservableObject {
} }
@Published var selectedProfile: LiveRoomMember? @Published var selectedProfile: LiveRoomMember?
@Published var isShowNotice = false @Published var isShowNotice = false {
didSet {
if isShowNotice {
isShowMenuPan = false
}
}
}
@Published var isShowMenuPan = false {
didSet {
if isShowMenuPan {
isShowNotice = false
}
}
}
@Published var isShowDonationPopup = false @Published var isShowDonationPopup = false

View File

@ -0,0 +1,12 @@
//
// GetMenuPresetResponse.swift
// SodaLive
//
// Created by klaus on 3/8/24.
//
struct GetMenuPresetResponse: Decodable {
let id: Int
let menu: String
let isActive: Bool
}

View File

@ -0,0 +1,93 @@
//
// LiveRoomMenuSelectView.swift
// SodaLive
//
// Created by klaus on 3/8/24.
//
import SwiftUI
struct LiveRoomMenuSelectView: View {
@Binding var menu: String
@Binding var isActivate: Bool
let menuCount: Int
let selectedMenu: SelectedMenu
let selectMenu: (SelectedMenu) -> Void
var body: some View {
VStack(alignment: .leading, spacing: 0) {
Text("메뉴")
.font(.custom(Font.bold.rawValue, size: 16.7))
.foregroundColor(Color(hex: "eeeeee"))
HStack(spacing: 0) {
Text("메뉴를 활성화 하시겠습니까?")
.font(.custom(Font.medium.rawValue, size: 13.3))
.foregroundColor(Color(hex: "eeeeee"))
Spacer()
Image(isActivate ? "btn_toggle_on_big" : "btn_toggle_off_big")
.resizable()
.frame(width: 33.3, height: 20)
.onTapGesture { isActivate.toggle() }
}
.padding(.top, 8)
if isActivate {
VStack(spacing: 13.3) {
HStack(spacing: 13.3) {
SelectedButtonView(
title: "메뉴 1",
isActive: true,
isSelected: selectedMenu == .MENU_1
)
.onTapGesture {
selectMenu(.MENU_1)
}
SelectedButtonView(
title: "메뉴 2",
isActive: menuCount > 0,
isSelected: selectedMenu == .MENU_2
)
.onTapGesture {
selectMenu(.MENU_2)
}
SelectedButtonView(
title: "메뉴 3",
isActive: menuCount > 1,
isSelected: selectedMenu == .MENU_3
)
.onTapGesture {
selectMenu(.MENU_3)
}
}
TextViewWrapper(
text: $menu,
placeholder: "메뉴판을 작성해주세요.",
textColorHex: "eeeeee",
backgroundColorHex: "222222"
)
.frame(height: 200)
.cornerRadius(6.7)
}
.padding(.top, 13.3)
}
}
}
}
#Preview {
LiveRoomMenuSelectView(
menu: .constant("메뉴 1 입니다\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n테스트"),
isActivate: .constant(true),
menuCount: 2,
selectedMenu: .MENU_1,
selectMenu: { _ in }
)
}

View File

@ -14,6 +14,8 @@ struct LiveRoomInfoGuestView: View {
let isOnBg: Bool let isOnBg: Bool
let isOnNotice: Bool let isOnNotice: Bool
let isOnMenuPan: Bool
let isShowMenuPanButton: Bool
let creatorId: Int let creatorId: Int
let creatorNickname: String let creatorNickname: String
@ -31,6 +33,7 @@ struct LiveRoomInfoGuestView: View {
let onClickFollow: (Bool) -> Void let onClickFollow: (Bool) -> Void
let onClickProfile: (Int) -> Void let onClickProfile: (Int) -> Void
let onClickNotice: () -> Void let onClickNotice: () -> Void
let onClickMenuPan: () -> Void
let onClickTotalDonation: () -> Void let onClickTotalDonation: () -> Void
var body: some View { var body: some View {
@ -113,6 +116,21 @@ struct LiveRoomInfoGuestView: View {
onClick: { onClickNotice() } onClick: { onClickNotice() }
) )
if isShowMenuPanButton {
LiveRoomOverlayStrokeTextToggleButton(
isOn: isOnMenuPan,
onText: "메뉴판",
onTextColor: .button,
onStrokeColor: .button,
offText: nil,
offTextColor: .graybb,
offStrokeColor: .graybb,
strokeWidth: 1,
strokeCornerRadius: 5.3,
onClick: { onClickMenuPan() }
)
}
Spacer() Spacer()
HStack(spacing: 2.7) { HStack(spacing: 2.7) {
@ -151,6 +169,8 @@ struct LiveRoomInfoGuestView_Previews: PreviewProvider {
totalDonationCan: 123456, totalDonationCan: 123456,
isOnBg: true, isOnBg: true,
isOnNotice: false, isOnNotice: false,
isOnMenuPan: false,
isShowMenuPanButton: false,
creatorId: 1, creatorId: 1,
creatorNickname: "도화", creatorNickname: "도화",
creatorProfileUrl: "https://cf.sodalive.net/profile/26/26-profile-ddf78b4d-0300-4c50-9c84-5d8a95fd5fe2-4892-1705256364320", creatorProfileUrl: "https://cf.sodalive.net/profile/26/26-profile-ddf78b4d-0300-4c50-9c84-5d8a95fd5fe2-4892-1705256364320",
@ -184,6 +204,7 @@ struct LiveRoomInfoGuestView_Previews: PreviewProvider {
onClickFollow: { _ in }, onClickFollow: { _ in },
onClickProfile: { _ in }, onClickProfile: { _ in },
onClickNotice: {}, onClickNotice: {},
onClickMenuPan: {},
onClickTotalDonation: {} onClickTotalDonation: {}
) )
} }

View File

@ -16,6 +16,8 @@ struct LiveRoomInfoHostView: View {
let isOnBg: Bool let isOnBg: Bool
let isOnNotice: Bool let isOnNotice: Bool
let isOnMenuPan: Bool
let isShowMenuPanButton: Bool
let creatorId: Int let creatorId: Int
let creatorNickname: String let creatorNickname: String
@ -32,6 +34,7 @@ struct LiveRoomInfoHostView: View {
let onClickEdit: () -> Void let onClickEdit: () -> Void
let onClickProfile: (Int) -> Void let onClickProfile: (Int) -> Void
let onClickNotice: () -> Void let onClickNotice: () -> Void
let onClickMenuPan: () -> Void
let onClickTotalDonation: () -> Void let onClickTotalDonation: () -> Void
let onClickParticipants: () -> Void let onClickParticipants: () -> Void
@ -122,6 +125,21 @@ struct LiveRoomInfoHostView: View {
onClick: { onClickNotice() } onClick: { onClickNotice() }
) )
if isShowMenuPanButton {
LiveRoomOverlayStrokeTextToggleButton(
isOn: isOnMenuPan,
onText: "메뉴판",
onTextColor: .button,
onStrokeColor: .button,
offText: nil,
offTextColor: .graybb,
offStrokeColor: .graybb,
strokeWidth: 1,
strokeCornerRadius: 5.3,
onClick: { onClickMenuPan() }
)
}
Spacer() Spacer()
HStack(spacing: 2.7) { HStack(spacing: 2.7) {
@ -178,6 +196,8 @@ struct LiveRoomInfoHostView_Previews: PreviewProvider {
participantsCount: 18, participantsCount: 18,
isOnBg: true, isOnBg: true,
isOnNotice: true, isOnNotice: true,
isOnMenuPan: false,
isShowMenuPanButton: false,
creatorId: 1, creatorId: 1,
creatorNickname: "도화", creatorNickname: "도화",
creatorProfileUrl: "https://cf.sodalive.net/profile/26/26-profile-ddf78b4d-0300-4c50-9c84-5d8a95fd5fe2-4892-1705256364320", creatorProfileUrl: "https://cf.sodalive.net/profile/26/26-profile-ddf78b4d-0300-4c50-9c84-5d8a95fd5fe2-4892-1705256364320",
@ -210,6 +230,7 @@ struct LiveRoomInfoHostView_Previews: PreviewProvider {
onClickEdit: {}, onClickEdit: {},
onClickProfile: { _ in }, onClickProfile: { _ in },
onClickNotice: {}, onClickNotice: {},
onClickMenuPan: {},
onClickTotalDonation: {}, onClickTotalDonation: {},
onClickParticipants: {} onClickParticipants: {}
) )

View File

@ -29,6 +29,8 @@ struct LiveRoomViewV2: View {
participantsCount: liveRoomInfo.participantsCount, participantsCount: liveRoomInfo.participantsCount,
isOnBg: viewModel.isBgOn, isOnBg: viewModel.isBgOn,
isOnNotice: viewModel.isShowNotice, isOnNotice: viewModel.isShowNotice,
isOnMenuPan: viewModel.isShowMenuPan,
isShowMenuPanButton: !liveRoomInfo.menuPan.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty,
creatorId: liveRoomInfo.creatorId, creatorId: liveRoomInfo.creatorId,
creatorNickname: liveRoomInfo.creatorNickname, creatorNickname: liveRoomInfo.creatorNickname,
creatorProfileUrl: liveRoomInfo.creatorProfileUrl, creatorProfileUrl: liveRoomInfo.creatorProfileUrl,
@ -56,6 +58,9 @@ struct LiveRoomViewV2: View {
onClickNotice: { onClickNotice: {
viewModel.isShowNotice.toggle() viewModel.isShowNotice.toggle()
}, },
onClickMenuPan: {
viewModel.isShowMenuPan.toggle()
},
onClickTotalDonation: { onClickTotalDonation: {
viewModel.isShowDonationRankingPopup = true viewModel.isShowDonationRankingPopup = true
}, },
@ -69,6 +74,8 @@ struct LiveRoomViewV2: View {
totalDonationCan: viewModel.totalDonationCan, totalDonationCan: viewModel.totalDonationCan,
isOnBg: viewModel.isBgOn, isOnBg: viewModel.isBgOn,
isOnNotice: viewModel.isShowNotice, isOnNotice: viewModel.isShowNotice,
isOnMenuPan: viewModel.isShowMenuPan,
isShowMenuPanButton: !liveRoomInfo.menuPan.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty,
creatorId: liveRoomInfo.creatorId, creatorId: liveRoomInfo.creatorId,
creatorNickname: liveRoomInfo.creatorNickname, creatorNickname: liveRoomInfo.creatorNickname,
creatorProfileUrl: liveRoomInfo.creatorProfileUrl, creatorProfileUrl: liveRoomInfo.creatorProfileUrl,
@ -101,6 +108,9 @@ struct LiveRoomViewV2: View {
onClickNotice: { onClickNotice: {
viewModel.isShowNotice.toggle() viewModel.isShowNotice.toggle()
}, },
onClickMenuPan: {
viewModel.isShowMenuPan.toggle()
},
onClickTotalDonation: { onClickTotalDonation: {
viewModel.isShowDonationRankingPopup = true viewModel.isShowDonationRankingPopup = true
} }
@ -293,6 +303,28 @@ struct LiveRoomViewV2: View {
.padding(.bottom, 120) .padding(.bottom, 120)
} }
} }
if viewModel.isShowMenuPan {
VStack(alignment: .leading, spacing: 0) {
Image("ic_notice_triangle")
.padding(.leading, 60)
VStack(alignment: .leading, spacing: 8) {
Text("[메뉴판]")
.font(.custom(Font.bold.rawValue, size: 11.3))
.foregroundColor(.white)
Text(liveRoomInfo.menuPan)
.font(.custom(Font.light.rawValue, size: 11.3))
.foregroundColor(.white)
.lineSpacing(4)
}
.padding(8)
.background(Color.gray33)
.padding(.horizontal, 60)
.padding(.bottom, 120)
}
}
} }
} }
} }

View File

@ -15,6 +15,7 @@ extension Color {
static let bg = Color(hex: "13181B") static let bg = Color(hex: "13181B")
static let gray11 = Color(hex: "111111") static let gray11 = Color(hex: "111111")
static let gray22 = Color(hex: "222222") static let gray22 = Color(hex: "222222")
static let gray23 = Color(hex: "232323")
static let gray30 = Color(hex: "303030") static let gray30 = Color(hex: "303030")
static let gray33 = Color(hex: "333333") static let gray33 = Color(hex: "333333")
static let gray52 = Color(hex: "525252") static let gray52 = Color(hex: "525252")