Browse Source

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

pull/3130/head
Benoit Marty 3 months ago
parent
commit
c25cdafff8
  1. 2
      libraries/pushproviders/firebase/README.md
  2. 39
      libraries/pushproviders/firebase/build.gradle.kts
  3. 4
      libraries/pushproviders/firebase/src/debug/res/values/firebase.xml
  4. 4
      libraries/pushproviders/firebase/src/nightly/res/values/firebase.xml
  5. 4
      libraries/pushproviders/firebase/src/release/res/values/firebase.xml

2
libraries/pushproviders/firebase/README.md

@ -4,4 +4,4 @@ @@ -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.

39
libraries/pushproviders/firebase/build.gradle.kts

@ -13,6 +13,9 @@ @@ -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 { @@ -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"
}
)
}
}
}

4
libraries/pushproviders/firebase/src/debug/res/values/firebase.xml

@ -1,4 +0,0 @@ @@ -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>

4
libraries/pushproviders/firebase/src/nightly/res/values/firebase.xml

@ -1,4 +0,0 @@ @@ -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>

4
libraries/pushproviders/firebase/src/release/res/values/firebase.xml

@ -1,4 +0,0 @@ @@ -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>
Loading…
Cancel
Save