File tree Expand file tree Collapse file tree
src/main/java/info/hannes/logcat/sample Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,8 +47,22 @@ static def getTag() {
4747 return process. text. toString(). trim()
4848}
4949
50+ @SuppressWarnings (' unused' )
51+ static def useFirebase () {
52+ def process = " grep DUMMYKEY sample/google-services.json -R | wc -c" . execute()
53+ def grepResult = process. text. toString(). split(" :" )[1 ]. toInteger()
54+ if (grepResult == 1 ) {
55+ println (" Firebase=false $grepResult " )
56+ return " false"
57+ }
58+ else {
59+ println (" Firebase=true $grepResult " )
60+ return " true"
61+ }
62+ }
63+
5064@SuppressWarnings (' unused' )
5165static def getGitCommitCount () {
52- def process = " git rev-list HEAD --count " . execute()
53- return process. text. toInteger ()
66+ def process = " git describe --tags --abbrev=0 " . execute()
67+ return process. text. toString() . trim ()
5468}
Original file line number Diff line number Diff line change 11plugins {
22 id ' com.android.application'
33 id ' kotlin-android'
4- id ' com.google.gms.google-services'
5- id ' com.google.firebase.crashlytics'
4+ // id 'com.google.gms.google-services'
5+ // id 'com.google.firebase.crashlytics'
6+ }
7+
8+ if (useFirebase() == " true" ) {
9+ apply plugin : ' com.google.gms.google-services'
10+ apply plugin : ' com.google.firebase.crashlytics'
611}
712
813android {
@@ -16,6 +21,8 @@ android {
1621 minSdkVersion 16
1722 targetSdkVersion 33
1823
24+ buildConfigField " boolean" , ' WITH_FIREBASE' , useFirebase()
25+
1926 testInstrumentationRunner " androidx.test.runner.AndroidJUnitRunner"
2027 testInstrumentationRunnerArguments useTestStorageService : ' true'
2128 }
Original file line number Diff line number Diff line change 11{
22 "project_info" : {
3- "project_number" : " 1234 " ,
3+ "project_number" : " DUMMYKEY " ,
44 "firebase_url" : " https://liveedgedetection.firebaseio.com" ,
55 "project_id" : " liveedgedetection" ,
66 "storage_bucket" : " liveedgedetection.appspot.com"
Original file line number Diff line number Diff line change @@ -36,8 +36,12 @@ class CrashlyticApplication : LoggingApplication() {
3636 }
3737 }
3838
39- FirebaseCrashlytics .getInstance().setCustomKey(" VERSION_NAME" , info.hannes.logcat.ui.BuildConfig .VERSIONNAME )
40- Timber .plant(CrashlyticsTree (Settings .Secure .getString(applicationContext.contentResolver, Settings .Secure .ANDROID_ID )))
39+ if (BuildConfig .WITH_FIREBASE ) {
40+ Timber .i(" I use Firebase" )
41+ FirebaseCrashlytics .getInstance().setCustomKey(" VERSION_NAME" , info.hannes.logcat.ui.BuildConfig .VERSIONNAME )
42+ Timber .plant(CrashlyticsTree (Settings .Secure .getString(applicationContext.contentResolver, Settings .Secure .ANDROID_ID )))
43+ } else
44+ Timber .w(" No valid Firebase key was given" )
4145
4246 Timber .d(" Debug test" )
4347 Timber .i(" Info test" )
You can’t perform that action at this time.
0 commit comments