From 2626245e6d990e57f6a8ad85708c9846326d23ac Mon Sep 17 00:00:00 2001 From: Yu Sung Date: Tue, 11 Mar 2025 23:43:56 +0900 Subject: [PATCH] =?UTF-8?q?UTM=20Campaign=20=ED=8C=8C=EB=9D=BC=EB=AF=B8?= =?UTF-8?q?=ED=84=B0=EB=A5=BC=20Analytics=EC=97=90=20=EC=84=A4=EC=A0=95?= =?UTF-8?q?=EB=90=9C=20=ED=8C=8C=EB=9D=BC=EB=AF=B8=ED=84=B0=20=EC=83=81?= =?UTF-8?q?=EC=88=98=EA=B0=92=20=EC=82=AC=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SodaLive/Sources/Splash/SplashView.swift | 62 +++++++------------ .../Sources/Tracking/FirebaseTracking.swift | 8 +-- 2 files changed, 27 insertions(+), 43 deletions(-) diff --git a/SodaLive/Sources/Splash/SplashView.swift b/SodaLive/Sources/Splash/SplashView.swift index eb841af..795a832 100644 --- a/SodaLive/Sources/Splash/SplashView.swift +++ b/SodaLive/Sources/Splash/SplashView.swift @@ -94,20 +94,28 @@ struct SplashView: View { } } } else { - DispatchQueue.main.asyncAfter(deadline: .now() + 0.7) { - 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 if AppState.shared.pushSeriesId > 0 { - AppState.shared.setAppStep(step: .seriesDetail(seriesId: AppState.shared.pushSeriesId)) - } else { - AppState.shared.setAppStep(step: .main) - } + nextAppStep() + } + } + } + + private func nextAppStep() { + DispatchQueue.main.asyncAfter(deadline: .now() + 0.7) { + withAnimation { + if !UserDefaults.string(forKey: UserDefaultsKey.token).trimmingCharacters(in: .whitespacesAndNewlines).isEmpty { + 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 if AppState.shared.pushSeriesId > 0 { + AppState.shared.setAppStep(step: .seriesDetail(seriesId: AppState.shared.pushSeriesId)) + } else { + AppState.shared.setAppStep(step: .main) } + } else { + AppState.shared.setAppStep(step: .main) } } } @@ -133,34 +141,10 @@ struct SplashView: View { } else if latestMajor == major && latestMinor == minor && latestPatch > patch { self.isShowUpdatePopup = true } else { - DispatchQueue.main.asyncAfter(deadline: .now() + 0.7) { - 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) - } - } - } + nextAppStep() } } else { - DispatchQueue.main.asyncAfter(deadline: .now() + 0.7) { - 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) - } - } - } + nextAppStep() } } } diff --git a/SodaLive/Sources/Tracking/FirebaseTracking.swift b/SodaLive/Sources/Tracking/FirebaseTracking.swift index 35d5f0a..b96d8cd 100644 --- a/SodaLive/Sources/Tracking/FirebaseTracking.swift +++ b/SodaLive/Sources/Tracking/FirebaseTracking.swift @@ -24,10 +24,10 @@ class FirebaseTracking { let utmCampaign = AppState.shared.marketingUtmCampaign.trimmingCharacters(in: .whitespacesAndNewlines) if !utmSource.isEmpty && !utmMedium.isEmpty && !utmCampaign.isEmpty { - Analytics.logEvent("campaign_utm", parameters: [ - "utm_source": utmSource, - "utm_medium": utmMedium, - "utm_campaign": utmCampaign + Analytics.logEvent(AnalyticsEventCampaignDetails, parameters: [ + AnalyticsParameterSource: utmSource, + AnalyticsParameterMedium: utmMedium, + AnalyticsParameterCampaign: utmCampaign ]) } }