From 2c99ceeeec68f69ea2227564a7514522966193e5 Mon Sep 17 00:00:00 2001 From: mtgriego Date: Tue, 1 Oct 2024 14:16:44 -0700 Subject: [PATCH] only send event for rewards carousel if the currentProjectData is available (#2139) --- .../viewmodels/projectpage/RewardsSelectionViewModel.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/kickstarter/viewmodels/projectpage/RewardsSelectionViewModel.kt b/app/src/main/java/com/kickstarter/viewmodels/projectpage/RewardsSelectionViewModel.kt index 8a82ad7b9e..e069323e88 100644 --- a/app/src/main/java/com/kickstarter/viewmodels/projectpage/RewardsSelectionViewModel.kt +++ b/app/src/main/java/com/kickstarter/viewmodels/projectpage/RewardsSelectionViewModel.kt @@ -149,7 +149,11 @@ class RewardsSelectionViewModel(private val environment: Environment, private va if (expanded && currentPage == 0) { projectData?.let { analytics.trackRewardsCarouselViewed(projectData = projectData) - } ?: analytics.trackRewardsCarouselViewed(projectData = currentProjectData) + } ?: { + if (::currentProjectData.isInitialized) { + analytics.trackRewardsCarouselViewed(projectData = currentProjectData) + } + } } }