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 ]) } }