Use ModulesConfig for push provider modules.

This commit is contained in:
Benoit Marty 2024-09-24 12:31:18 +02:00
parent d57e3b7ec9
commit 1a979cd142
3 changed files with 32 additions and 5 deletions

View file

@ -250,10 +250,12 @@ dependencies {
implementation(projects.libraries.uiStrings)
anvil(projects.anvilcodegen)
// Comment to not include firebase in the project
"gplayImplementation"(projects.libraries.pushproviders.firebase)
// Comment to not include unified push in the project
implementation(projects.libraries.pushproviders.unifiedpush)
if (ModulesConfig.pushProvidersConfig.includeFirebase) {
"gplayImplementation"(projects.libraries.pushproviders.firebase)
}
if (ModulesConfig.pushProvidersConfig.includeFirebase) {
implementation(projects.libraries.pushproviders.unifiedpush)
}
implementation(libs.appyx.core)
implementation(libs.androidx.splash)

View file

@ -6,10 +6,16 @@
*/
import config.AnalyticsConfig
import config.PushProvidersConfig
object ModulesConfig {
val pushProvidersConfig = PushProvidersConfig(
includeFirebase = true,
includeUnifiedPush = true,
)
val analyticsConfig: AnalyticsConfig = AnalyticsConfig.Enabled(
withPosthog = true,
withSentry = true
withSentry = true,
)
}

View file

@ -0,0 +1,19 @@
/*
* Copyright 2024 New Vector Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only
* Please see LICENSE in the repository root for full details.
*/
package config
data class PushProvidersConfig(
val includeFirebase: Boolean,
val includeUnifiedPush: Boolean,
) {
init {
require(includeFirebase || includeUnifiedPush) {
"At least one push provider must be included"
}
}
}