feat(analytics): disable analytics unless credentials are configured

Removes the onboarding opt-in screen, the Analytics settings entry and
the unused Posthog and Sentry SDKs.
This commit is contained in:
2026-08-03 15:33:55 +02:00
committed by Sedat Qaja
parent 55ea61bf5a
commit 345a6bb8ec
+6 -7
View File
@@ -16,7 +16,12 @@ object ModulesConfig {
includeUnifiedPush = BuildTimeConfig.PUSH_CONFIG_INCLUDE_UNIFIED_PUSH,
)
val analyticsConfig: AnalyticsConfig = if (isEnterpriseBuild) {
// Analytics is enabled only when credentials are actually configured in BuildTimeConfig.
// Upstream applies this rule to enterprise builds only and hardcodes both providers on for
// FOSS builds; HealthChat ships no Posthog or Sentry credentials, so that hardcoding meant
// shipping both SDKs, prompting every new user with the analytics opt-in screen during the
// FTUE, and showing an Analytics settings entry — all while collecting nothing.
val analyticsConfig: AnalyticsConfig = run {
// Is Posthog configuration available?
val withPosthog = BuildTimeConfig.SERVICES_POSTHOG_APIKEY.isNullOrEmpty().not() &&
BuildTimeConfig.SERVICES_POSTHOG_HOST.isNullOrEmpty().not()
@@ -32,11 +37,5 @@ object ModulesConfig {
println("Analytics disabled")
AnalyticsConfig.Disabled
}
} else {
println("Analytics enabled with Posthog and Sentry")
AnalyticsConfig.Enabled(
withPosthog = true,
withSentry = true,
)
}
}