From 58868f613a6f49387b97ed5d9169ad22c8dd235f Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Wed, 13 Sep 2023 11:45:41 +0900 Subject: [PATCH] =?UTF-8?q?=ED=91=B8=EC=8B=9C=20=ED=84=B0=EC=B9=98=20?= =?UTF-8?q?=EC=95=A1=EC=85=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SodaLive/Sources/Main/Home/HomeView.swift | 14 +-------- SodaLive/Sources/Splash/SplashView.swift | 36 +++++++++++++++++++---- 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/SodaLive/Sources/Main/Home/HomeView.swift b/SodaLive/Sources/Main/Home/HomeView.swift index 71986ad..b1c7767 100644 --- a/SodaLive/Sources/Main/Home/HomeView.swift +++ b/SodaLive/Sources/Main/Home/HomeView.swift @@ -199,19 +199,7 @@ struct HomeView: View { } } .onAppear { - if appState.pushRoomId > 0 { - DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) { - liveViewModel.enterLiveRoom(roomId: appState.pushRoomId) - } - } else if appState.pushChannelId > 0 { - DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) { - appState.setAppStep(step: .creatorDetail(userId: appState.pushChannelId)) - } - } else if appState.pushAudioContentId > 0 { - DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) { - appState.setAppStep(step: .contentDetail(contentId: appState.pushAudioContentId)) - } - } else if appState.pushMessageId > 0 { + if appState.pushMessageId > 0 { viewModel.currentTab = .message } } diff --git a/SodaLive/Sources/Splash/SplashView.swift b/SodaLive/Sources/Splash/SplashView.swift index 2b02528..3b51d4a 100644 --- a/SodaLive/Sources/Splash/SplashView.swift +++ b/SodaLive/Sources/Splash/SplashView.swift @@ -13,6 +13,8 @@ struct SplashView: View { @State private var isShowForcedUpdatePopup = false @State private var isShowUpdatePopup = false + @StateObject var liveViewModel = LiveViewModel() + var body: some View { ZStack(alignment: .top) { LinearGradient( @@ -54,9 +56,17 @@ struct SplashView: View { checkAppVersion(latestVersion: remoteConfig["ios_latest_version"].stringValue) } } else { - withAnimation { - DispatchQueue.main.asyncAfter(deadline: .now() + 2.5) { - AppState.shared.setAppStep(step: .main) + DispatchQueue.main.asyncAfter(deadline: .now() + 2.5) { + withAnimation { + if AppState.shared.pushRoomId > 0 { + liveViewModel.enterLiveRoom(roomId: AppState.shared.pushRoomId) + } else if AppState.shared.pushChannelId > 0 { + AppState.shared.setAppStep(step: .creatorDetail(userId: AppState.shared.pushChannelId)) + } else if AppState.shared.pushAudioContentId > 0 { + AppState.shared.setAppStep(step: .contentDetail(contentId: AppState.shared.pushAudioContentId)) + } else { + AppState.shared.setAppStep(step: .main) + } } } } @@ -85,14 +95,30 @@ struct SplashView: View { } else { DispatchQueue.main.asyncAfter(deadline: .now() + 1) { withAnimation { - AppState.shared.setAppStep(step: .main) + if AppState.shared.pushRoomId > 0 { + liveViewModel.enterLiveRoom(roomId: AppState.shared.pushRoomId) + } else if AppState.shared.pushChannelId > 0 { + AppState.shared.setAppStep(step: .creatorDetail(userId: AppState.shared.pushChannelId)) + } else if AppState.shared.pushAudioContentId > 0 { + AppState.shared.setAppStep(step: .contentDetail(contentId: AppState.shared.pushAudioContentId)) + } else { + AppState.shared.setAppStep(step: .main) + } } } } } else { DispatchQueue.main.asyncAfter(deadline: .now() + 1) { withAnimation { - AppState.shared.setAppStep(step: .main) + if AppState.shared.pushRoomId > 0 { + liveViewModel.enterLiveRoom(roomId: AppState.shared.pushRoomId) + } else if AppState.shared.pushChannelId > 0 { + AppState.shared.setAppStep(step: .creatorDetail(userId: AppState.shared.pushChannelId)) + } else if AppState.shared.pushAudioContentId > 0 { + AppState.shared.setAppStep(step: .contentDetail(contentId: AppState.shared.pushAudioContentId)) + } else { + AppState.shared.setAppStep(step: .main) + } } } }