From 1ad2ddf9f31ec42ef61253ba3fa6432e81d492e5 Mon Sep 17 00:00:00 2001 From: Kevin Chiu Date: Sun, 24 Sep 2023 16:25:03 +0800 Subject: [PATCH] Append purchase error to analytics --- .../budgetplus/feature/unlock/premium/PremiumViewModel.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/feature/unlock-premium/src/main/kotlin/com/kevlina/budgetplus/feature/unlock/premium/PremiumViewModel.kt b/feature/unlock-premium/src/main/kotlin/com/kevlina/budgetplus/feature/unlock/premium/PremiumViewModel.kt index cf6c228b..a434b44f 100644 --- a/feature/unlock-premium/src/main/kotlin/com/kevlina/budgetplus/feature/unlock/premium/PremiumViewModel.kt +++ b/feature/unlock-premium/src/main/kotlin/com/kevlina/budgetplus/feature/unlock/premium/PremiumViewModel.kt @@ -8,6 +8,7 @@ import com.kevlina.budgetplus.core.billing.PurchaseState import com.kevlina.budgetplus.core.common.R import com.kevlina.budgetplus.core.common.Toaster import com.kevlina.budgetplus.core.common.Tracker +import com.kevlina.budgetplus.core.common.bundle import com.kevlina.budgetplus.core.data.AuthManager import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.Flow @@ -44,7 +45,10 @@ class PremiumViewModel @Inject constructor( } is PurchaseState.Fail -> { - tracker.logEvent("buy_premium_fail") + tracker.logEvent( + event = "buy_premium_fail", + params = bundle { putString("reason", state.error) } + ) toaster.showMessage(state.error) }