라이브 생성 푸시 - 예약중인 라이브의 경우 상세 페이지가 나오도록 수정
This commit is contained in:
parent
f08d72745e
commit
05f5a4fe82
|
@ -404,6 +404,56 @@ final class LiveViewModel: ObservableObject {
|
|||
}
|
||||
}
|
||||
|
||||
func enterLiveRoom(roomId: Int) {
|
||||
getRoomDetail(roomId: roomId) {
|
||||
if let _ = $0.channelName {
|
||||
if $0.manager.id == UserDefaults.int(forKey: .userId) {
|
||||
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.3) {
|
||||
self.enterRoom(roomId: roomId)
|
||||
}
|
||||
} else if ($0.price == 0 || $0.isPaid) {
|
||||
if $0.isPrivateRoom {
|
||||
self.passwordDialogConfirmAction = { password in
|
||||
self.enterRoom(roomId: roomId, password: password)
|
||||
}
|
||||
self.isShowPasswordDialog = true
|
||||
} else {
|
||||
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.3) {
|
||||
self.enterRoom(roomId: roomId)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if $0.isPrivateRoom {
|
||||
self.secretOrPasswordDialogCan = $0.price
|
||||
self.passwordDialogConfirmAction = { password in
|
||||
self.enterRoom(roomId: roomId, password: password)
|
||||
}
|
||||
self.isShowPasswordDialog = true
|
||||
} else {
|
||||
self.paymentDialogTitle = "\($0.price)캔으로 입장"
|
||||
self.paymentDialogDesc = "'\($0.title)' 라이브에 참여하기 위해 결제합니다."
|
||||
self.paymentDialogConfirmTitle = "결제 후 참여하기"
|
||||
self.paymentDialogConfirmAction = { [unowned self] in
|
||||
hidePopup()
|
||||
self.enterRoom(roomId: roomId)
|
||||
}
|
||||
self.isShowPaymentDialog = true
|
||||
}
|
||||
}
|
||||
} else {
|
||||
AppState.shared.setAppStep(
|
||||
step: .liveDetail(
|
||||
roomId: roomId,
|
||||
onClickParticipant: {},
|
||||
onClickReservation: { self.reservationLiveRoom(roomId: roomId) },
|
||||
onClickStart: { self.startLive(roomId: roomId) },
|
||||
onClickCancel: { self.getSummary() }
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func getRoomDetail(roomId: Int, onSuccess: @escaping (GetRoomDetailResponse) -> Void) {
|
||||
isLoading = true
|
||||
repository.getRoomDetail(roomId: roomId)
|
||||
|
|
|
@ -124,6 +124,25 @@ struct HomeView: View {
|
|||
NotificationSettingsDialog()
|
||||
}
|
||||
|
||||
if liveViewModel.isShowPaymentDialog {
|
||||
SodaDialog(
|
||||
title: liveViewModel.paymentDialogTitle,
|
||||
desc: liveViewModel.paymentDialogDesc,
|
||||
confirmButtonTitle: liveViewModel.paymentDialogConfirmTitle,
|
||||
confirmButtonAction: liveViewModel.paymentDialogConfirmAction,
|
||||
cancelButtonTitle: liveViewModel.paymentDialogCancelTitle,
|
||||
cancelButtonAction: liveViewModel.hidePopup
|
||||
)
|
||||
}
|
||||
|
||||
if liveViewModel.isShowPasswordDialog {
|
||||
LiveRoomPasswordDialog(
|
||||
isShowing: $liveViewModel.isShowPasswordDialog,
|
||||
can: liveViewModel.secretOrPasswordDialogCan,
|
||||
confirmAction: liveViewModel.passwordDialogConfirmAction
|
||||
)
|
||||
}
|
||||
|
||||
if let eventItem = appState.eventPopup {
|
||||
VStack(spacing: 0) {
|
||||
Spacer()
|
||||
|
@ -148,7 +167,7 @@ struct HomeView: View {
|
|||
appState.setAppStep(step: .main)
|
||||
|
||||
if value > 0 {
|
||||
liveViewModel.enterRoom(roomId: value)
|
||||
liveViewModel.enterLiveRoom(roomId: value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -182,7 +201,7 @@ struct HomeView: View {
|
|||
.onAppear {
|
||||
if appState.pushRoomId > 0 {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
|
||||
liveViewModel.enterRoom(roomId: appState.pushRoomId)
|
||||
liveViewModel.enterLiveRoom(roomId: appState.pushRoomId)
|
||||
}
|
||||
} else if appState.pushChannelId > 0 {
|
||||
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
|
||||
|
|
Loading…
Reference in New Issue