라이브 - 방만들기 추가

This commit is contained in:
Yu Sung
2023-08-14 11:21:03 +09:00
parent cf0607334a
commit e0a5fb733d
18 changed files with 1529 additions and 10 deletions

View File

@@ -59,7 +59,9 @@ struct LiveView: View {
SectionLiveNowView(
items: viewModel.liveNowItems,
onClickParticipant: {_ in},
onTapCreateLive: {}
onTapCreateLive: {
AppState.shared.setAppStep(step: .createLive(timeSettingMode: .NOW, onSuccess: onCreateSuccess))
}
)
.padding(.top, 40)
}
@@ -80,7 +82,9 @@ struct LiveView: View {
onClickCancel: { viewModel.getSummary() },
onClickStart: {_ in},
onClickReservation: {_ in},
onTapCreateLive: {}
onTapCreateLive: {
AppState.shared.setAppStep(step: .createLive(timeSettingMode: .RESERVATION, onSuccess: onCreateSuccess))
}
)
}
}
@@ -90,10 +94,14 @@ struct LiveView: View {
viewModel.getSummary()
}
Image("btn_make_live")
.padding(.trailing, 16)
.padding(.bottom, 16)
.onTapGesture {}
if !appState.isShowPlayer {
Image("btn_make_live")
.padding(.trailing, 16)
.padding(.bottom, 16)
.onTapGesture {
AppState.shared.setAppStep(step: .createLive(timeSettingMode: .NOW, onSuccess: onCreateSuccess))
}
}
}
}
@@ -123,6 +131,36 @@ struct LiveView: View {
LoadingView()
}
}
.popup(isPresented: $viewModel.isShowPopup, type: .toast, position: .top, autohideIn: 2) {
GeometryReader { geo in
HStack {
Spacer()
Text(viewModel.errorMessage)
.padding(.vertical, 13.3)
.padding(.horizontal, 6.7)
.frame(width: geo.size.width - 66.7, alignment: .center)
.font(.custom(Font.medium.rawValue, size: 12))
.background(Color(hex: "9970ff"))
.foregroundColor(Color.white)
.multilineTextAlignment(.leading)
.fixedSize(horizontal: false, vertical: true)
.cornerRadius(20)
.padding(.top, 66.7)
Spacer()
}
}
}
}
private func onCreateSuccess(response: CreateLiveRoomResponse) {
viewModel.getSummary()
if let _ = response.channelName {
viewModel.enterRoom(roomId: response.id!)
}
}
private func processStart(roomId: Int) {
viewModel.startLive(roomId: roomId)
}
}