Fix push notifications for Google release

This commit is contained in:
Thomas 2022-09-10 18:30:51 +02:00
parent 882c1bf6cd
commit 399be26280
3 changed files with 100 additions and 1 deletions

View File

@ -1,3 +1,6 @@
import java.util.regex.Matcher
import java.util.regex.Pattern
plugins {
id 'com.android.application'
id 'kotlin-android'
@ -135,4 +138,31 @@ dependencies {
// debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.8.1'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
}
def getCurrentFlavor() {
Gradle gradle = getGradle()
String tskReqStr = gradle.getStartParameter().getTaskRequests().toString()
println("tskReqStr:" +tskReqStr)
Pattern pattern
if( tskReqStr.contains( "assemble" ) ) // to run ./gradlew assembleRelease to build APK
pattern = Pattern.compile("assemble(\\w+)(Release|Debug)")
else if( tskReqStr.contains( "bundle" ) ) // to run ./gradlew bundleRelease to build .aab
pattern = Pattern.compile("assemble(\\w+)(Release|Debug)")
else
pattern = Pattern.compile("generate(\\w+)(Release|Debug)")
Matcher matcher = pattern.matcher( tskReqStr )
println(tskReqStr)
if( matcher.find() )
return matcher.group(1).toLowerCase()
else
{
println "NO MATCH FOUND"
return ""
}
}
println("Flavor: ${getCurrentFlavor()}")
if ( getCurrentFlavor() == "playstore" ){
apply plugin: 'com.google.gms.google-services'
}

View File

@ -0,0 +1,68 @@
{
"project_info": {
"project_number": "479837431022",
"project_id": "pc-api-4835782490875392372-140",
"storage_bucket": "pc-api-4835782490875392372-140.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:479837431022:android:1102a97a55202beb547fff",
"android_client_info": {
"package_name": "app.fedilab.android"
}
},
"oauth_client": [
{
"client_id": "479837431022-mettpakdcso72c35djvikfc57l4i7n53.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCklTEEgLUxy__0Vzcr5_H179kYPXGjmGo"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "479837431022-mettpakdcso72c35djvikfc57l4i7n53.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:479837431022:android:529536f519b8f4ce547fff",
"android_client_info": {
"package_name": "app.fedilab.android.debug"
}
},
"oauth_client": [
{
"client_id": "479837431022-mettpakdcso72c35djvikfc57l4i7n53.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCklTEEgLUxy__0Vzcr5_H179kYPXGjmGo"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "479837431022-mettpakdcso72c35djvikfc57l4i7n53.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}

View File

@ -3,12 +3,13 @@ buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.5.1"
classpath 'com.google.gms:google-services:4.3.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}