From 5a771f14bdf580f6eef3314cfc0b891b907f5392 Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Sat, 19 Aug 2023 22:57:10 +0900 Subject: [PATCH] =?UTF-8?q?=ED=91=B8=EC=8B=9C=20=ED=98=B9=EC=9D=80=20?= =?UTF-8?q?=EA=B3=B5=EC=9C=A0=EB=A7=81=ED=81=AC=EB=A5=BC=20=ED=83=80?= =?UTF-8?q?=EA=B3=A0=20=EC=95=B1=EC=9D=84=20=EC=8B=A4=ED=96=89=ED=96=88?= =?UTF-8?q?=EC=9D=84=20=EB=95=8C=20=EC=B2=98=EB=A6=AC=EB=90=98=EB=8A=94=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SodaLive/Sources/App/AppDelegate.swift | 2 +- SodaLive/Sources/Live/LiveView.swift | 38 +++++++++++++++++++ .../LiveReservationStatusView.swift | 2 +- .../LiveReservationStatusViewModel.swift | 2 +- 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/SodaLive/Sources/App/AppDelegate.swift b/SodaLive/Sources/App/AppDelegate.swift index e04318b..c2fac8f 100644 --- a/SodaLive/Sources/App/AppDelegate.swift +++ b/SodaLive/Sources/App/AppDelegate.swift @@ -94,7 +94,7 @@ extension AppDelegate : UNUserNotificationCenterDelegate { // With swizzling disabled you must let Messaging know about the message, for Analytics Messaging.messaging().appDidReceiveMessage(userInfo) - let roomIdString = userInfo["suda_room_id"] as? String + let roomIdString = userInfo["room_id"] as? String let audioContentIdString = userInfo["audio_content_id"] as? String if let roomIdString = roomIdString, let roomId = Int(roomIdString), roomId > 0 { diff --git a/SodaLive/Sources/Live/LiveView.swift b/SodaLive/Sources/Live/LiveView.swift index cf10c74..5c9416b 100644 --- a/SodaLive/Sources/Live/LiveView.swift +++ b/SodaLive/Sources/Live/LiveView.swift @@ -155,6 +155,44 @@ struct LiveView: View { } } } + .valueChanged(value: appState.pushRoomId) { value in + DispatchQueue.main.async { + appState.setAppStep(step: .main) + + if value > 0 { + viewModel.enterRoom(roomId: value) + } + } + } + .valueChanged(value: appState.pushChannelId) { value in + DispatchQueue.main.async { + appState.setAppStep(step: .main) + + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { + if value > 0 { + appState.setAppStep(step: .creatorDetail(userId: value)) + } + } + } + } + .valueChanged(value: appState.pushAudioContentId) { value in + appState.setAppStep(step: .main) + + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { + if value > 0 { + appState.setAppStep(step: .contentDetail(contentId: value)) + } + } + } + .onAppear { + if appState.pushRoomId > 0 { + viewModel.enterRoom(roomId: appState.pushRoomId) + } else if appState.pushChannelId > 0 { + appState.setAppStep(step: .creatorDetail(userId: appState.pushChannelId)) + } else if appState.pushAudioContentId > 0 { + appState.setAppStep(step: .contentDetail(contentId: appState.pushAudioContentId)) + } + } } private func onCreateSuccess(response: CreateLiveRoomResponse) { diff --git a/SodaLive/Sources/MyPage/ReservationStatus/LiveReservationStatusView.swift b/SodaLive/Sources/MyPage/ReservationStatus/LiveReservationStatusView.swift index 89a4667..254464b 100644 --- a/SodaLive/Sources/MyPage/ReservationStatus/LiveReservationStatusView.swift +++ b/SodaLive/Sources/MyPage/ReservationStatus/LiveReservationStatusView.swift @@ -52,7 +52,7 @@ struct LiveReservationStatusView: View { } } .onAppear { - viewModel.getSudaReservationStatus() + viewModel.getLiveReservationStatus() } } } diff --git a/SodaLive/Sources/MyPage/ReservationStatus/LiveReservationStatusViewModel.swift b/SodaLive/Sources/MyPage/ReservationStatus/LiveReservationStatusViewModel.swift index f6a2ab1..306aff9 100644 --- a/SodaLive/Sources/MyPage/ReservationStatus/LiveReservationStatusViewModel.swift +++ b/SodaLive/Sources/MyPage/ReservationStatus/LiveReservationStatusViewModel.swift @@ -26,7 +26,7 @@ final class LiveReservationStatusViewModel: ObservableObject { @Published var isCancelComplete = false - func getSudaReservationStatus() { + func getLiveReservationStatus() { isLoading = true repository.getReservations(isActive: true)