Update firebase

This commit is contained in:
Jobobby04 2020-08-23 21:57:06 -04:00
parent 1d70f0b1dd
commit b8836b9b6f
4 changed files with 25 additions and 13 deletions

View File

@ -66,7 +66,6 @@ android {
debug {
versionNameSuffix "-${getCommitCount()}"
applicationIdSuffix ".debug"
ext.enableCrashlytics = false
}
releaseTest {
applicationIdSuffix ".rt"
@ -310,7 +309,7 @@ dependencies {
// Debug tool; see https://fbflipper.com/
// debugImplementation 'com.facebook.flipper:flipper:0.50.0'
// debugImplementation 'com.facebook.soloader:soloader:0.9.0'
// Text distance (EH)
implementation 'info.debatty:java-string-similarity:1.2.1'
@ -318,7 +317,8 @@ dependencies {
implementation 'com.github.akarnokd:rxjava2-interop:0.13.7'
// Firebase (EH)
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.google.firebase:firebase-analytics-ktx:17.5.0'
implementation 'com.google.firebase:firebase-crashlytics-ktx:17.2.1'
// Better logging (EH)
implementation 'com.elvishew:xlog:1.6.1'
@ -335,7 +335,7 @@ dependencies {
releaseImplementation "com.ms-square:debugoverlay-no-op:$debug_overlay_version"
testImplementation "com.ms-square:debugoverlay-no-op:$debug_overlay_version"
// Humanize (EH)
// Humanize (EH) used for E-Hentai updater statistics
implementation 'com.github.mfornos:humanize-slim:1.2.2'
// RatingBar (SY)
@ -370,7 +370,7 @@ repositories {
// See https://kotlinlang.org/docs/reference/experimental.html#experimental-status-of-experimental-api-markers
tasks.withType(AbstractKotlinCompile).all {
kotlinOptions.freeCompilerArgs += ["-Xuse-experimental=kotlin.Experimental"]
kotlinOptions.freeCompilerArgs += ["-Xopt-in=kotlin.Experimental"]
}
// Duplicating Hebrew string assets due to some locale code issues on different devices
@ -382,8 +382,8 @@ task copyResources(type: Copy) {
preBuild.dependsOn(ktlintFormat, copyResources)
if (!getGradle().getStartParameter().getTaskRequests().toString().contains("Debug")) {
if (!getGradle().getStartParameter().getTaskRequests().toString().contains("Dev")) {
apply plugin: 'com.google.gms.google-services'
// Firebase (EH)
apply plugin: 'io.fabric'
// Firebase Crashlytics
apply plugin: 'com.google.firebase.crashlytics'
}

View File

@ -23,6 +23,9 @@ import com.elvishew.xlog.printer.file.naming.DateFileNameGenerator
import com.google.android.gms.common.GooglePlayServicesNotAvailableException
import com.google.android.gms.common.GooglePlayServicesRepairableException
import com.google.android.gms.security.ProviderInstaller
import com.google.firebase.analytics.FirebaseAnalytics
import com.google.firebase.analytics.ktx.analytics
import com.google.firebase.ktx.Firebase
import com.kizitonwose.time.days
import com.ms_square.debugoverlay.DebugOverlay
import com.ms_square.debugoverlay.modules.FpsModule
@ -53,10 +56,13 @@ import uy.kohesive.injekt.registry.default.DefaultRegistrar
open class App : Application(), LifecycleObserver {
private lateinit var firebaseAnalytics: FirebaseAnalytics
override fun onCreate() {
super.onCreate()
if (BuildConfig.DEBUG) Timber.plant(Timber.DebugTree())
setupExhLogging() // EXH logging
if (!BuildConfig.DEBUG) addAnalytics()
workaroundAndroid7BrokenSSL()
@ -119,6 +125,13 @@ open class App : Application(), LifecycleObserver {
}
}
private fun addAnalytics() {
firebaseAnalytics = Firebase.analytics
if (syDebugVersion != "0") {
firebaseAnalytics.setUserProperty("preview_version", syDebugVersion)
}
}
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
@Suppress("unused")
fun onAppBackgrounded() {

View File

@ -1,7 +1,7 @@
package exh.log
import com.crashlytics.android.Crashlytics
import com.elvishew.xlog.printer.Printer
import com.google.firebase.crashlytics.FirebaseCrashlytics
import eu.kanade.tachiyomi.BuildConfig
class CrashlyticsPrinter(private val logLevel: Int) : Printer {
@ -15,7 +15,7 @@ class CrashlyticsPrinter(private val logLevel: Int) : Printer {
override fun println(logLevel: Int, tag: String?, msg: String?) {
if (logLevel >= this.logLevel) {
try {
Crashlytics.log(logLevel, tag, msg)
FirebaseCrashlytics.getInstance().log("$logLevel/$tag: $msg")
} catch (t: Throwable) {
// Crash in debug if shit like this happens
if (BuildConfig.DEBUG) throw t

View File

@ -49,13 +49,12 @@ buildscript {
// SY for mangadex utils
classpath("org.jetbrains.kotlin:kotlin-serialization:${BuildPluginsVersion.KOTLIN}")
// Firebase (EH)
classpath("io.fabric.tools:gradle:1.31.0")
// Firebase Crashlytics
classpath("com.google.firebase:firebase-crashlytics-gradle:2.2.0")
}
repositories {
google()
jcenter()
maven { setUrl("https://maven.fabric.io/public") }
}
}