diff --git a/buildSrc/src/main/kotlin/scripts/variants.gradle.kts b/buildSrc/src/main/kotlin/scripts/variants.gradle.kts index 14be9224ad9..79dffb708d3 100644 --- a/buildSrc/src/main/kotlin/scripts/variants.gradle.kts +++ b/buildSrc/src/main/kotlin/scripts/variants.gradle.kts @@ -50,6 +50,7 @@ object Default { fun NamedDomainObjectContainer.createAppFlavour( flavorApplicationId: String, + sharedUserId: String, flavour: ProductFlavors ) { create(flavour.buildName) { @@ -57,9 +58,7 @@ fun NamedDomainObjectContainer.createAppFlavour( applicationId = flavorApplicationId versionNameSuffix = "-${flavour.buildName}" resValue("string", "app_name", flavour.appName) - manifestPlaceholders.apply { - put("sharedUserId", flavour.shareduserId) - } + manifestPlaceholders["sharedUserId"] = sharedUserId } } @@ -100,7 +99,7 @@ android { isMinifyEnabled = false applicationIdSuffix = ".${BuildTypes.DEBUG}" isDebuggable = true -// Just in case a developer is trying to debug some prod crashes by turning on minify + // Just in case a developer is trying to debug some prod crashes by turning on minify if (isMinifyEnabled) proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") if (enableSigning) signingConfig = signingConfigs.getByName("debug") @@ -148,7 +147,13 @@ android { requireNotNull(flavorApplicationId) { "Missing application ID definition for the flavor '$flavorName'" } - createAppFlavour(flavorApplicationId, flavor) + // prefer value from FeatureConfigs if defined, otherwise fallback to in-code flavor value. + val userId: String = (flavorSpecificMap[FeatureConfigs.USER_ID.value] as? String) ?: flavor.shareduserId + createAppFlavour( + flavorApplicationId = flavorApplicationId, + sharedUserId = userId, + flavour = flavor + ) } ProductFlavors.all.forEach(::createFlavor) } @@ -157,7 +162,6 @@ android { overrideResourcesForAllFlavors(it) } - /** * Process feature flags and if the feature is not included in a product flavor, * a default value of "false" or "deactivated" is used. @@ -194,7 +198,6 @@ android { } } - fun buildStringConfig(productFlavour: ProductFlavor, type: String, name: String, value: String?) { productFlavour.buildConfigField( type,