Updated on 2026-08-14
This commit is contained in:
parent
e5d82031d2
commit
2f407448f0
7 changed files with 48 additions and 30 deletions
|
|
@ -1,8 +1,13 @@
|
|||
package com.tangem.util
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import androidx.core.os.bundleOf
|
||||
import com.google.firebase.analytics.FirebaseAnalytics
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
||||
import com.google.firebase.perf.FirebasePerformance
|
||||
import com.tangem.data.dp.PrefsManager
|
||||
import com.tangem.wallet.BuildConfig
|
||||
import com.tangem.wallet.R
|
||||
import com.tangem.wallet.TangemContext
|
||||
|
||||
|
|
@ -13,6 +18,7 @@ enum class AnalyticsEvent(val event: String) {
|
|||
READY_TO_SIGN("ready_to_sign"),
|
||||
SIGNED("signed"),
|
||||
ANALYTICS_TURNED_OFF("analytics_turned_off"),
|
||||
CARD_TAP_USER_TIMER("CardTapUserTimer"),
|
||||
;
|
||||
}
|
||||
|
||||
|
|
@ -36,5 +42,13 @@ class Analytics {
|
|||
fun isEnabled(): Boolean {
|
||||
return PrefsManager.getInstance().getSettingsBoolean(R.string.pref_analytics, true)
|
||||
}
|
||||
|
||||
fun setFirebaseEnabled(context: Context, enable: Boolean = isEnabled()) {
|
||||
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(enable)
|
||||
FirebaseAnalytics.getInstance(context).setAnalyticsCollectionEnabled(
|
||||
enable && !BuildConfig.DEBUG
|
||||
)
|
||||
FirebasePerformance.getInstance().isPerformanceCollectionEnabled = enable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue