upgrade fabric to firebase
This commit is contained in:
parent
b9806d0ea9
commit
31b3177561
6 changed files with 13 additions and 68 deletions
|
@ -1,13 +1,10 @@
|
|||
buildscript {
|
||||
repositories {
|
||||
maven { url 'https://maven.fabric.io/public' }
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'io.fabric.tools:gradle:1.+'
|
||||
classpath 'com.dicedmelon.gradle:jacoco-android:0.1.4'
|
||||
classpath 'de.undercouch:gradle-download-task:3.4.3'
|
||||
}
|
||||
}
|
||||
apply plugin: 'com.android.application'
|
||||
|
@ -15,10 +12,8 @@ apply plugin: 'kotlin-android'
|
|||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: 'com.google.gms.google-services'
|
||||
apply plugin: 'io.fabric'
|
||||
apply plugin: 'jacoco-android'
|
||||
apply plugin: 'de.undercouch.download'
|
||||
|
||||
apply plugin: 'com.google.firebase.crashlytics'
|
||||
|
||||
jacoco {
|
||||
toolVersion = "0.8.3"
|
||||
|
@ -33,7 +28,6 @@ ext {
|
|||
|
||||
|
||||
repositories {
|
||||
maven { url 'https://maven.fabric.io/public' }
|
||||
jcenter { url "https://jcenter.bintray.com/" }
|
||||
mavenCentral()
|
||||
}
|
||||
|
@ -249,12 +243,9 @@ dependencies {
|
|||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation 'com.google.android.gms:play-services-wearable:17.0.0'
|
||||
implementation "com.google.android.gms:play-services-location:17.0.0"
|
||||
implementation 'com.google.firebase:firebase-core:17.4.0'
|
||||
implementation 'com.google.firebase:firebase-core:17.4.2'
|
||||
implementation 'com.google.firebase:firebase-auth:19.3.1'
|
||||
implementation 'com.google.firebase:firebase-database:19.3.0'
|
||||
implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') {
|
||||
transitive = true;
|
||||
}
|
||||
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
|
||||
|
|
|
@ -69,7 +69,7 @@ public class MainApp extends DaggerApplication {
|
|||
sResources = getResources();
|
||||
LocaleHelper.INSTANCE.update(this);
|
||||
sDatabaseHelper = OpenHelperManager.getHelper(sInstance, DatabaseHelper.class);
|
||||
|
||||
/*
|
||||
Thread.setDefaultUncaughtExceptionHandler((thread, ex) -> {
|
||||
if (ex instanceof InternalError) {
|
||||
// usually the app trying to spawn a thread while being killed
|
||||
|
@ -77,7 +77,7 @@ public class MainApp extends DaggerApplication {
|
|||
}
|
||||
aapsLogger.error("Uncaught exception crashing app", ex);
|
||||
});
|
||||
|
||||
*/
|
||||
registerActivityLifecycleCallbacks(activityMonitor);
|
||||
|
||||
JodaTimeAndroid.init(this);
|
||||
|
|
|
@ -17,12 +17,11 @@ buildscript {
|
|||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
maven { url 'https://maven.fabric.io/public' }
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.6.3'
|
||||
classpath 'com.google.gms:google-services:4.3.3'
|
||||
classpath 'io.fabric.tools:gradle:1.31.2'
|
||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
|
|
@ -58,10 +58,9 @@ dependencies {
|
|||
//Logger
|
||||
implementation 'org.slf4j:slf4j-api:1.7.30'
|
||||
//Fabric
|
||||
implementation 'com.google.firebase:firebase-core:17.4.0'
|
||||
implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') {
|
||||
transitive = true;
|
||||
}
|
||||
implementation 'com.google.firebase:firebase-analytics-ktx:17.4.2'
|
||||
implementation 'com.google.firebase:firebase-crashlytics:17.0.0'
|
||||
|
||||
//RxBus
|
||||
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
|
||||
implementation 'org.apache.commons:commons-lang3:3.10'
|
||||
|
|
|
@ -82,7 +82,7 @@ public class Profile {
|
|||
if (units != null)
|
||||
this.units = units;
|
||||
else {
|
||||
fabricPrivacy.log("Profile failover failed too");
|
||||
fabricPrivacy.logCustom("Profile failover failed too");
|
||||
this.units = Constants.MGDL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,13 +2,12 @@ package info.nightscout.androidaps.utils
|
|||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import com.crashlytics.android.Crashlytics
|
||||
import com.google.firebase.analytics.FirebaseAnalytics
|
||||
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
||||
import info.nightscout.androidaps.core.R
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.LTag
|
||||
import info.nightscout.androidaps.utils.sharedPreferences.SP
|
||||
import io.fabric.sdk.android.Fabric
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
||||
|
@ -27,21 +26,9 @@ class FabricPrivacy @Inject constructor(
|
|||
var firebaseAnalytics: FirebaseAnalytics
|
||||
|
||||
init {
|
||||
instance = this
|
||||
firebaseAnalytics = FirebaseAnalytics.getInstance(context)
|
||||
firebaseAnalytics.setAnalyticsCollectionEnabled(!java.lang.Boolean.getBoolean("disableFirebase") && fabricEnabled())
|
||||
|
||||
if (fabricEnabled()) {
|
||||
Fabric.with(context, Crashlytics())
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private lateinit var instance: FabricPrivacy
|
||||
|
||||
@JvmStatic
|
||||
@Deprecated("Use Dagger")
|
||||
fun getInstance(): FabricPrivacy = instance
|
||||
FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(!java.lang.Boolean.getBoolean("disableFirebase") && fabricEnabled())
|
||||
}
|
||||
|
||||
// Analytics logCustom
|
||||
|
@ -76,39 +63,8 @@ class FabricPrivacy @Inject constructor(
|
|||
|
||||
// Crashlytics logException
|
||||
fun logException(throwable: Throwable) {
|
||||
try {
|
||||
val crashlytics = Crashlytics.getInstance()
|
||||
crashlytics.core.logException(throwable)
|
||||
aapsLogger.debug(LTag.CORE, "Exception: ", throwable)
|
||||
} catch (e: NullPointerException) {
|
||||
aapsLogger.debug(LTag.CORE, "Ignoring opted out non-initialized log: $throwable")
|
||||
} catch (e: IllegalStateException) {
|
||||
aapsLogger.debug(LTag.CORE, "Ignoring opted out non-initialized log: $throwable")
|
||||
}
|
||||
}
|
||||
|
||||
// Crashlytics log
|
||||
fun log(msg: String) {
|
||||
try {
|
||||
val crashlytics = Crashlytics.getInstance()
|
||||
crashlytics.core.log(msg)
|
||||
} catch (e: NullPointerException) {
|
||||
aapsLogger.debug(LTag.CORE, "Ignoring opted out non-initialized log: $msg")
|
||||
} catch (e: IllegalStateException) {
|
||||
aapsLogger.debug(LTag.CORE, "Ignoring opted out non-initialized log: $msg")
|
||||
}
|
||||
}
|
||||
|
||||
// Crashlytics log
|
||||
fun log(priority: Int, tag: String?, msg: String) {
|
||||
try {
|
||||
val crashlytics = Crashlytics.getInstance()
|
||||
crashlytics.core.log(priority, tag, msg)
|
||||
} catch (e: NullPointerException) {
|
||||
aapsLogger.debug(LTag.CORE, "Ignoring opted out non-initialized log: $msg")
|
||||
} catch (e: IllegalStateException) {
|
||||
aapsLogger.debug(LTag.CORE, "Ignoring opted out non-initialized log: $msg")
|
||||
}
|
||||
FirebaseCrashlytics.getInstance().recordException(throwable)
|
||||
aapsLogger.debug(LTag.CORE, "Exception: ", throwable)
|
||||
}
|
||||
|
||||
fun fabricEnabled(): Boolean {
|
||||
|
|
Loading…
Reference in a new issue