Update dependencies
This includes a migration to Firebase Crashlytics with Google Analytics instead of Fabric Crashlytics which has been deprecated and is on the way out.
This commit is contained in:
parent
f01909eb83
commit
551e1f1f57
6 changed files with 27 additions and 18 deletions
|
@ -3,6 +3,7 @@ apply plugin: 'kotlin-android-extensions'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
apply plugin: 'kotlin-kapt'
|
apply plugin: 'kotlin-kapt'
|
||||||
apply plugin: 'jacoco'
|
apply plugin: 'jacoco'
|
||||||
|
apply plugin: 'com.google.firebase.crashlytics'
|
||||||
|
|
||||||
def keystoreProperties = new Properties()
|
def keystoreProperties = new Properties()
|
||||||
try {
|
try {
|
||||||
|
@ -40,8 +41,8 @@ android {
|
||||||
applicationId "com.wbrawner.simplemarkdown"
|
applicationId "com.wbrawner.simplemarkdown"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 24
|
versionCode 25
|
||||||
versionName "0.8.2"
|
versionName "0.8.3"
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
buildConfigField "boolean", "ENABLE_CUSTOM_CSS", "false"
|
buildConfigField "boolean", "ENABLE_CUSTOM_CSS", "false"
|
||||||
}
|
}
|
||||||
|
@ -96,9 +97,10 @@ dependencies {
|
||||||
implementation 'com.google.android.material:material:1.1.0'
|
implementation 'com.google.android.material:material:1.1.0'
|
||||||
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
|
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
|
||||||
implementation 'com.commonsware.cwac:anddown:0.3.0'
|
implementation 'com.commonsware.cwac:anddown:0.3.0'
|
||||||
implementation 'com.google.firebase:firebase-core:17.3.0'
|
|
||||||
implementation 'com.android.billingclient:billing:2.2.0'
|
implementation 'com.android.billingclient:billing:2.2.0'
|
||||||
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
|
implementation 'com.google.firebase:firebase-core:17.3.0'
|
||||||
|
implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta04'
|
||||||
|
implementation 'com.google.firebase:firebase-analytics:17.3.0'
|
||||||
implementation "androidx.core:core-ktx:1.2.0"
|
implementation "androidx.core:core-ktx:1.2.0"
|
||||||
implementation 'androidx.browser:browser:1.2.0'
|
implementation 'androidx.browser:browser:1.2.0'
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
|
|
|
@ -14,12 +14,11 @@ class MarkdownApplication : Application() {
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
StrictMode.setThreadPolicy(StrictMode.ThreadPolicy.Builder()
|
StrictMode.setThreadPolicy(StrictMode.ThreadPolicy.Builder()
|
||||||
.detectAll()
|
.detectAll()
|
||||||
.penaltyDeath()
|
.penaltyLog()
|
||||||
.build())
|
.build())
|
||||||
StrictMode.setVmPolicy(StrictMode.VmPolicy.Builder()
|
StrictMode.setVmPolicy(StrictMode.VmPolicy.Builder()
|
||||||
.detectAll()
|
.detectAll()
|
||||||
.penaltyLog()
|
.penaltyLog()
|
||||||
.penaltyDeath()
|
|
||||||
.build())
|
.build())
|
||||||
}
|
}
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
|
|
|
@ -1,24 +1,19 @@
|
||||||
package com.wbrawner.simplemarkdown.utility
|
package com.wbrawner.simplemarkdown.utility
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import com.crashlytics.android.Crashlytics
|
import com.google.firebase.crashlytics.FirebaseCrashlytics
|
||||||
import com.wbrawner.simplemarkdown.BuildConfig
|
import com.wbrawner.simplemarkdown.BuildConfig
|
||||||
import io.fabric.sdk.android.Fabric
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
|
||||||
|
|
||||||
interface ErrorHandler {
|
interface ErrorHandler {
|
||||||
fun init(context: Context)
|
fun enable(enable: Boolean)
|
||||||
fun reportException(t: Throwable, message: String? = null)
|
fun reportException(t: Throwable, message: String? = null)
|
||||||
}
|
}
|
||||||
|
|
||||||
class CrashlyticsErrorHandler : ErrorHandler {
|
class CrashlyticsErrorHandler : ErrorHandler {
|
||||||
private val isInitialized = AtomicBoolean(false)
|
private val crashlytics = FirebaseCrashlytics.getInstance()
|
||||||
|
|
||||||
override fun init(context: Context) {
|
override fun enable(enable: Boolean) {
|
||||||
if (!isInitialized.getAndSet(true)) {
|
crashlytics.setCrashlyticsCollectionEnabled(enable)
|
||||||
Fabric.with(context, Crashlytics())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun reportException(t: Throwable, message: String?) {
|
override fun reportException(t: Throwable, message: String?) {
|
||||||
|
@ -27,7 +22,6 @@ class CrashlyticsErrorHandler : ErrorHandler {
|
||||||
Log.e("CrashlyticsErrorHandler", "Caught exception: $message", t)
|
Log.e("CrashlyticsErrorHandler", "Caught exception: $message", t)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!isInitialized.get()) return
|
crashlytics.recordException(t)
|
||||||
Crashlytics.logException(t)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -20,6 +20,7 @@ import androidx.core.app.ActivityCompat
|
||||||
import androidx.core.content.ContextCompat
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
|
import com.wbrawner.simplemarkdown.MarkdownApplication
|
||||||
import com.wbrawner.simplemarkdown.R
|
import com.wbrawner.simplemarkdown.R
|
||||||
import com.wbrawner.simplemarkdown.utility.hideKeyboard
|
import com.wbrawner.simplemarkdown.utility.hideKeyboard
|
||||||
import com.wbrawner.simplemarkdown.view.adapter.EditPagerAdapter
|
import com.wbrawner.simplemarkdown.view.adapter.EditPagerAdapter
|
||||||
|
@ -69,6 +70,17 @@ class MainActivity : AppCompatActivity(), ActivityCompat.OnRequestPermissionsRes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onStart() {
|
||||||
|
super.onStart()
|
||||||
|
launch {
|
||||||
|
withContext(Dispatchers.IO) {
|
||||||
|
val enableErrorReports = PreferenceManager.getDefaultSharedPreferences(this@MainActivity)
|
||||||
|
.getBoolean(getString(R.string.error_reports_enabled), true)
|
||||||
|
(application as MarkdownApplication).errorHandler.enable(enableErrorReports)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onUserLeaveHint() {
|
override fun onUserLeaveHint() {
|
||||||
super.onUserLeaveHint()
|
super.onUserLeaveHint()
|
||||||
launch {
|
launch {
|
||||||
|
|
|
@ -33,6 +33,7 @@ class SupportActivity : AppCompatActivity(), BillingClientStateListener, Purchas
|
||||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
billingClient = BillingClient.newBuilder(applicationContext)
|
billingClient = BillingClient.newBuilder(applicationContext)
|
||||||
.setListener(this)
|
.setListener(this)
|
||||||
|
.enablePendingPurchases()
|
||||||
.build()
|
.build()
|
||||||
billingClient.startConnection(this)
|
billingClient.startConnection(this)
|
||||||
githubButton.setOnClickListener {
|
githubButton.setOnClickListener {
|
||||||
|
|
|
@ -9,6 +9,7 @@ buildscript {
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.6.3'
|
classpath 'com.android.tools.build:gradle:3.6.3'
|
||||||
classpath 'com.google.gms:google-services:4.3.3'
|
classpath 'com.google.gms:google-services:4.3.3'
|
||||||
|
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0-beta04'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue