Skip to content

Commit

Permalink
Remove arca in favor of crashlytics
Browse files Browse the repository at this point in the history
  • Loading branch information
Jays2Kings committed Mar 21, 2023
1 parent a15c4d6 commit cd699a1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 31 deletions.
10 changes: 5 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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")

Expand Down
25 changes: 0 additions & 25 deletions app/src/main/java/eu/kanade/tachiyomi/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -77,7 +66,6 @@ open class App : Application(), DefaultLifecycleObserver {
Injekt.importModule(AppModule(this))

CoilSetup(this)
setupAcra()
setupNotificationChannels()

ProcessLifecycleOwner.get().lifecycle.addObserver(this)
Expand Down Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit cd699a1

Please sign in to comment.