diff --git a/app/build.gradle b/app/build.gradle index 1fd55d4e9..63d338d26 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' } \ No newline at end of file diff --git a/app/src/debug/playstore/google-services.json b/app/src/debug/playstore/google-services.json new file mode 100644 index 000000000..f035606c0 --- /dev/null +++ b/app/src/debug/playstore/google-services.json @@ -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" +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 59dfab897..9e7043247 100644 --- a/build.gradle +++ b/build.gradle @@ -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 }