Remove arca in favor of crashlytics

This commit is contained in:
Jays2Kings 2023-03-21 16:03:13 -04:00
parent a15c4d60eb
commit cd699a17dc
4 changed files with 16 additions and 31 deletions

View file

@ -8,6 +8,7 @@ plugins {
id(Plugins.kotlinSerialization)
id("com.google.android.gms.oss-licenses-plugin")
id(Plugins.googleServices) apply false
id("com.google.firebase.crashlytics")
}
if (gradle.startParameter.taskRequests.toString().contains("Standard")) {
@ -166,8 +167,10 @@ dependencies {
implementation("androidx.multidex:multidex:2.0.1")
implementation("com.google.firebase:firebase-core:21.1.0")
implementation("com.google.firebase:firebase-analytics-ktx:21.1.0")
implementation(platform("com.google.firebase:firebase-bom:31.2.3"))
implementation("com.google.firebase:firebase-analytics-ktx")
implementation("com.google.firebase:firebase-crashlytics-ktx")
val lifecycleVersion = "2.5.1"
kapt("androidx.lifecycle:lifecycle-compiler:$lifecycleVersion")
@ -284,9 +287,6 @@ dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines")
// Crash reports
implementation("ch.acra:acra-http:5.9.3")
// Text distance
implementation("info.debatty:java-string-similarity:2.0.0")

View file

@ -32,10 +32,6 @@ import eu.kanade.tachiyomi.util.system.localeContext
import eu.kanade.tachiyomi.util.system.notification
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import org.acra.ACRA
import org.acra.config.httpSender
import org.acra.data.StringFormat
import org.acra.ktx.initAcra
import org.conscrypt.Conscrypt
import timber.log.Timber
import uy.kohesive.injekt.Injekt
@ -44,13 +40,6 @@ import uy.kohesive.injekt.injectLazy
import uy.kohesive.injekt.registry.default.DefaultRegistrar
import java.security.Security
// @ReportsCrashes(
// formUri = "https://collector.tracepot.com/e90773ff",
// reportType = org.acra.sender.HttpSender.Type.JSON,
// httpMethod = org.acra.sender.HttpSender.Method.PUT,
// buildConfigClass = BuildConfig::class,
// excludeMatchingSharedPreferencesKeys = [".*username.*", ".*password.*", ".*token.*"]
// )
open class App : Application(), DefaultLifecycleObserver {
val preferences: PreferencesHelper by injectLazy()
@ -77,7 +66,6 @@ open class App : Application(), DefaultLifecycleObserver {
Injekt.importModule(AppModule(this))
CoilSetup(this)
setupAcra()
setupNotificationChannels()
ProcessLifecycleOwner.get().lifecycle.addObserver(this)
@ -140,19 +128,6 @@ open class App : Application(), DefaultLifecycleObserver {
SourcePresenter.onLowMemory()
}
protected open fun setupAcra() {
initAcra {
reportFormat = StringFormat.JSON
buildConfigClass = BuildConfig::class.java
excludeMatchingSharedPreferencesKeys = listOf(".*username.*", ".*password.*", ".*token.*")
httpSender {
uri = "https://collector.tracepot.com/e90773ff"
httpMethod = org.acra.sender.HttpSender.Method.PUT
}
}
ACRA.init(this)
}
protected open fun setupNotificationChannels() {
Notifications.createChannels(this)
}

View file

@ -15,6 +15,8 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.core.net.toUri
import androidx.lifecycle.lifecycleScope
import androidx.preference.PreferenceScreen
import com.google.firebase.crashlytics.ktx.crashlytics
import com.google.firebase.ktx.Firebase
import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.cache.ChapterCache
@ -86,6 +88,13 @@ class SettingsAdvancedController : SettingsController() {
titleRes = R.string.send_crash_report
summaryRes = R.string.helps_fix_bugs
defaultValue = true
onChange {
try {
Firebase.crashlytics.setCrashlyticsCollectionEnabled(it as Boolean)
} catch (_: Exception) {
}
true
}
}
preference {
@ -138,7 +147,7 @@ class SettingsAdvancedController : SettingsController() {
onChange {
it as Boolean
if ((!it && BuildConfig.BETA) || (it && !BuildConfig.BETA)) {
if (it != BuildConfig.BETA) {
activity!!.materialAlertDialog()
.setTitle(R.string.warning)
.setMessage(if (it) R.string.warning_enroll_into_beta else R.string.warning_unenroll_from_beta)

View file

@ -30,6 +30,7 @@ buildscript {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${AndroidVersions.kotlin}")
classpath("com.google.android.gms:oss-licenses-plugin:0.10.6")
classpath("org.jetbrains.kotlin:kotlin-serialization:${AndroidVersions.kotlin}")
classpath("com.google.firebase:firebase-crashlytics-gradle:2.9.4")
}
repositories {
gradlePluginPortal()