Move google_app_id from resource file to build.gradle.kts file and use different values for enterprise build.

This commit is contained in:
Benoit Marty
2024-07-02 15:27:31 +02:00
parent dc8d3dc7fe
commit 04fbe6831c
5 changed files with 39 additions and 14 deletions

View File

@@ -4,4 +4,4 @@
In order to make this module only know about Firebase, the plugin `com.google.gms.google-services` has been disabled from the `app` module.
To be able to change the values in the file `firebase.xml` from this module, you should enable the plugin `com.google.gms.google-services` again, copy the file `google-services.json` to the folder `/app/src/main`, build the project, and check the generated file `app/build/generated/res/google-services/<buildtype>/values/values.xml` to import the generated values into the `firebase.xml` files.
To be able to change the values set to `google_app_id` in the file `build.gradle.kts` of this module, you should enable the plugin `com.google.gms.google-services` again, copy the file `google-services.json` to the folder `/app/src/main`, build the project, and check the generated file `app/build/generated/res/google-services/<buildtype>/values/values.xml` to import the generated values into the `build.gradle.kts` files.

View File

@@ -13,6 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:Suppress("UnstableApiUsage")
plugins {
id("io.element.android-library")
alias(libs.plugins.anvil)
@@ -22,9 +25,43 @@ android {
namespace = "io.element.android.libraries.pushproviders.firebase"
buildTypes {
release {
getByName("release") {
isMinifyEnabled = true
consumerProguardFiles("consumer-proguard-rules.pro")
resValue(
type = "string",
name = "google_app_id",
value = if (isEnterpriseBuild) {
"1:912726360885:android:d273c2077ec3291500427c"
} else {
"1:912726360885:android:d097de99a4c23d2700427c"
}
)
}
getByName("debug") {
resValue(
type = "string",
name = "google_app_id",
value = if (isEnterpriseBuild) {
"1:912726360885:android:f8de9126a94143d300427c"
} else {
"1:912726360885:android:def0a4e454042e9b00427c"
}
)
}
register("nightly") {
isMinifyEnabled = true
consumerProguardFiles("consumer-proguard-rules.pro")
matchingFallbacks += listOf("release")
resValue(
type = "string",
name = "google_app_id",
value = if (isEnterpriseBuild) {
"1:912726360885:android:3f7e1fe644d99d5a00427c"
} else {
"1:912726360885:android:e17435e0beb0303000427c"
}
)
}
}
}

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="google_app_id" translatable="false">1:912726360885:android:def0a4e454042e9b00427c</string>
</resources>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="google_app_id" translatable="false">1:912726360885:android:e17435e0beb0303000427c</string>
</resources>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="google_app_id" translatable="false">1:912726360885:android:d097de99a4c23d2700427c</string>
</resources>