Files
letro-android/plugins/src/main/kotlin/ModulesConfig.kt
Benoit Marty cd65d121f8 Push gateway config (#4608)
* Read PushProvidersConfig parameter from BuildTimeConfig

* Update submodule link.
2025-04-22 13:58:12 +02:00

42 lines
1.4 KiB
Kotlin

/*
* Copyright 2024 New Vector Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
* Please see LICENSE files in the repository root for full details.
*/
import config.AnalyticsConfig
import config.BuildTimeConfig
import config.PushProvidersConfig
object ModulesConfig {
val pushProvidersConfig = PushProvidersConfig(
includeFirebase = BuildTimeConfig.PUSH_CONFIG_INCLUDE_FIREBASE,
includeUnifiedPush = BuildTimeConfig.PUSH_CONFIG_INCLUDE_UNIFIED_PUSH,
)
val analyticsConfig: AnalyticsConfig = if (isEnterpriseBuild) {
// Is Posthog configuration available?
val withPosthog = BuildTimeConfig.SERVICES_POSTHOG_APIKEY.isNullOrEmpty().not() &&
BuildTimeConfig.SERVICES_POSTHOG_HOST.isNullOrEmpty().not()
// Is Sentry configuration available?
val withSentry = BuildTimeConfig.SERVICES_SENTRY_DSN.isNullOrEmpty().not()
if (withPosthog || withSentry) {
println("Analytics enabled with Posthog: $withPosthog, Sentry: $withSentry")
AnalyticsConfig.Enabled(
withPosthog = withPosthog,
withSentry = withSentry,
)
} else {
println("Analytics disabled")
AnalyticsConfig.Disabled
}
} else {
println("Analytics enabled with Posthog and Sentry")
AnalyticsConfig.Enabled(
withPosthog = true,
withSentry = true,
)
}
}