From 6366e44af1032966c303acb63202ea438ca5ded4 Mon Sep 17 00:00:00 2001 From: tuancoltech Date: Sat, 14 Sep 2024 10:36:13 +0700 Subject: [PATCH] [feat] Replace Acra with Firebase Crashlytics for crash monitoring: https://app.asana.com/0/1207819682524134/1208211226661157 --- app/build.gradle | 9 ++-- app/google-services.json | 48 +++++++++++++++++++ .../main/java/dev/arkbuilders/arkmemo/App.kt | 30 ------------ build.gradle | 2 + 4 files changed, 56 insertions(+), 33 deletions(-) create mode 100644 app/google-services.json diff --git a/app/build.gradle b/app/build.gradle index 0e459e29..56be7022 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,6 +4,8 @@ plugins { id 'kotlin-kapt' id 'dagger.hilt.android.plugin' id 'kotlin-parcelize' + id 'com.google.gms.google-services' + id 'com.google.firebase.crashlytics' } android { @@ -100,11 +102,12 @@ dependencies { androidTestImplementation 'androidx.test.ext:junit:1.1.3' androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' - implementation 'ch.acra:acra-http:5.9.6' - implementation 'ch.acra:acra-dialog:5.9.6' - implementation 'com.airbnb.android:lottie:6.4.0' implementation 'com.github.androidmads:QRGenerator:1.0.1' implementation("io.coil-kt:coil:2.6.0") implementation("com.github.skydoves:balloon:1.6.4") + + implementation platform('com.google.firebase:firebase-bom:33.3.0') + implementation "com.google.firebase:firebase-crashlytics" + implementation "com.google.firebase:firebase-analytics" } diff --git a/app/google-services.json b/app/google-services.json new file mode 100644 index 00000000..50a7ec65 --- /dev/null +++ b/app/google-services.json @@ -0,0 +1,48 @@ +{ + "project_info": { + "project_number": "427728790868", + "project_id": "ark-builders-dev", + "storage_bucket": "ark-builders-dev.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:427728790868:android:4451fa5dfb4b4b8c3cd4c1", + "android_client_info": { + "package_name": "dev.arkbuilders.arkmemo" + } + }, + "oauth_client": [], + "api_key": [ + { + "current_key": "AIzaSyBb6Dgf2yzFgbGIRqYlsrcor8g2hetF_jk" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:427728790868:android:fdf7d8f94023954e3cd4c1", + "android_client_info": { + "package_name": "dev.arkbuilders.rate" + } + }, + "oauth_client": [], + "api_key": [ + { + "current_key": "AIzaSyBb6Dgf2yzFgbGIRqYlsrcor8g2hetF_jk" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/app/src/main/java/dev/arkbuilders/arkmemo/App.kt b/app/src/main/java/dev/arkbuilders/arkmemo/App.kt index 66eaff24..13be0d83 100644 --- a/app/src/main/java/dev/arkbuilders/arkmemo/App.kt +++ b/app/src/main/java/dev/arkbuilders/arkmemo/App.kt @@ -3,14 +3,6 @@ package dev.arkbuilders.arkmemo import android.app.Application import dagger.hilt.android.HiltAndroidApp import dev.arkbuilders.arklib.initArkLib -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.launch -import org.acra.config.dialog -import org.acra.config.httpSender -import org.acra.data.StringFormat -import org.acra.ktx.initAcra -import org.acra.sender.HttpSender import dev.arkbuilders.arkfilepicker.folders.FoldersRepo import dev.arkbuilders.arkmemo.preferences.MemoPreferences import javax.inject.Inject @@ -26,27 +18,5 @@ class App: Application() { System.loadLibrary("arklib") initArkLib() FoldersRepo.init(this) - initAcra() - } - - private fun initAcra() = CoroutineScope(Dispatchers.IO).launch { - val enabled = memoPreferences.getCrashReportEnabled() - if (!enabled) return@launch - - initAcra { - buildConfigClass = BuildConfig::class.java - reportFormat = StringFormat.JSON - dialog { - text = getString(R.string.crash_dialog_desc) - title = getString(R.string.crash_dialog_title) - commentPrompt = getString(R.string.crash_dialog_comment) - } - httpSender { - uri = BuildConfig.ACRA_URI - basicAuthLogin = BuildConfig.ACRA_LOGIN - basicAuthPassword = BuildConfig.ACRA_PASS - httpMethod = HttpSender.Method.POST - } - } } } diff --git a/build.gradle b/build.gradle index 712a69a6..e8c9a3e9 100644 --- a/build.gradle +++ b/build.gradle @@ -9,6 +9,8 @@ plugins { id 'com.android.application' version '8.3.0' apply false id 'org.jetbrains.kotlin.android' version '1.9.0' apply false id 'com.google.dagger.hilt.android' version '2.48' apply false + id 'com.google.gms.google-services' version '4.4.2' apply false + id 'com.google.firebase.crashlytics' version '3.0.2' apply false }