Upgrade to the Firebase Crashlytics SDK.

This commit is contained in:
Severiano Jaramillo 2020-12-25 15:40:25 -08:00
parent ba6b9ab642
commit 255821238a
22 changed files with 84 additions and 77 deletions

View file

@ -3,8 +3,8 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt' apply plugin: 'kotlin-kapt'
apply plugin: "androidx.navigation.safeargs.kotlin" apply plugin: "androidx.navigation.safeargs.kotlin"
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services' apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
// Needed for Kotlin's @Parcelize annotation // Needed for Kotlin's @Parcelize annotation
androidExtensions { androidExtensions {
@ -32,17 +32,14 @@ android {
} }
} }
buildTypes { buildTypes {
debug {
minifyEnabled false
resValue("string", "PORT_NUMBER", "8082")
}
release { release {
minifyEnabled true minifyEnabled true
shrinkResources true shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// enable crashlytics
ext.enableCrashlytics = true
}
debug {
resValue("string", "PORT_NUMBER", "8082")
// disable crashlytics
ext.enableCrashlytics = false
} }
} }
android.packagingOptions { android.packagingOptions {
@ -109,8 +106,8 @@ dependencies {
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.0' implementation 'com.squareup.okhttp3:logging-interceptor:4.2.0'
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0' implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
//Firebase //Firebase
implementation 'com.google.firebase:firebase-core:17.2.1' implementation 'com.google.firebase:firebase-analytics:18.0.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1' implementation 'com.google.firebase:firebase-crashlytics:17.3.0'
// CSV generation // CSV generation
implementation 'com.opencsv:opencsv:3.7' implementation 'com.opencsv:opencsv:3.7'
// Others // Others

View file

@ -132,9 +132,8 @@
##--------------- proguard configuration for Crashlytics ---------- ##--------------- proguard configuration for Crashlytics ----------
# source https://firebase.google.com/docs/crashlytics/get-deobfuscated-reports?platform=android # source https://firebase.google.com/docs/crashlytics/get-deobfuscated-reports?platform=android
-keepattributes *Annotation* # Keep Crashlytics annotations -keepattributes SourceFile,LineNumberTable # Keep file names and line numbers.
-keepattributes SourceFile,LineNumberTable # Keep file names/line numbers -keep public class * extends java.lang.Exception # Optional: Keep custom exceptions.
-keep public class * extends java.lang.Exception # Keep custom exceptions (opt)
##--------------- proguard configuration for Coroutines ---------- ##--------------- proguard configuration for Coroutines ----------

View file

@ -11,9 +11,7 @@ import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.pm.PackageInfoCompat import androidx.core.content.pm.PackageInfoCompat
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders import androidx.lifecycle.ViewModelProviders
import com.crashlytics.android.Crashlytics import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.crashlytics.android.core.CrashlyticsCore
import cy.agorise.bitsybitshareswallet.BuildConfig
import cy.agorise.bitsybitshareswallet.database.entities.Balance import cy.agorise.bitsybitshareswallet.database.entities.Balance
import cy.agorise.bitsybitshareswallet.database.entities.Transfer import cy.agorise.bitsybitshareswallet.database.entities.Transfer
import cy.agorise.bitsybitshareswallet.processors.TransfersLoader import cy.agorise.bitsybitshareswallet.processors.TransfersLoader
@ -26,6 +24,7 @@ import cy.agorise.bitsybitshareswallet.viewmodels.TransferViewModel
import cy.agorise.bitsybitshareswallet.viewmodels.UserAccountViewModel import cy.agorise.bitsybitshareswallet.viewmodels.UserAccountViewModel
import cy.agorise.graphenej.Asset import cy.agorise.graphenej.Asset
import cy.agorise.graphenej.AssetAmount import cy.agorise.graphenej.AssetAmount
import cy.agorise.graphenej.BuildConfig
import cy.agorise.graphenej.UserAccount import cy.agorise.graphenej.UserAccount
import cy.agorise.graphenej.api.ApiAccess import cy.agorise.graphenej.api.ApiAccess
import cy.agorise.graphenej.api.ConnectionStatusUpdate import cy.agorise.graphenej.api.ConnectionStatusUpdate
@ -34,7 +33,6 @@ import cy.agorise.graphenej.api.android.RxBus
import cy.agorise.graphenej.api.calls.* import cy.agorise.graphenej.api.calls.*
import cy.agorise.graphenej.models.* import cy.agorise.graphenej.models.*
import cy.agorise.graphenej.network.FullNode import cy.agorise.graphenej.network.FullNode
import io.fabric.sdk.android.Fabric
import io.reactivex.Observable import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable import io.reactivex.disposables.CompositeDisposable
@ -109,10 +107,7 @@ abstract class ConnectedActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
val crashlytics = Crashlytics.Builder() FirebaseCrashlytics.getInstance().setCrashlyticsCollectionEnabled(!BuildConfig.DEBUG)
.core(CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build())
.build()
Fabric.with(this, crashlytics)
getUserAccount() getUserAccount()
@ -198,7 +193,8 @@ abstract class ConnectedActivity : AppCompatActivity() {
mCurrentAccount = UserAccount(userId) mCurrentAccount = UserAccount(userId)
// Make sure crashlytics reports contains the account ID // Make sure crashlytics reports contains the account ID
Crashlytics.setString(Constants.CRASHLYTICS_KEY_ACCOUNT_ID, userId) val crashlytics = FirebaseCrashlytics.getInstance()
crashlytics.setCustomKey(Constants.CRASHLYTICS_KEY_ACCOUNT_ID, userId)
} }
/** /**
@ -211,7 +207,8 @@ abstract class ConnectedActivity : AppCompatActivity() {
for (e in stack) { for (e in stack) {
Log.e(TAG, String.format("%s#%s:%d", e.className, e.methodName, e.lineNumber)) Log.e(TAG, String.format("%s#%s:%d", e.className, e.methodName, e.lineNumber))
} }
Crashlytics.log(Log.ERROR, TAG, "ConnectedActivity reporting error. Msg: ${throwable.message}") val crashlytics = FirebaseCrashlytics.getInstance()
crashlytics.log("E/$TAG: ConnectedActivity reporting error. Msg: ${throwable.message}")
} }
private fun handleIncomingMessage(message: Any?) { private fun handleIncomingMessage(message: Any?) {
@ -253,8 +250,9 @@ abstract class ConnectedActivity : AppCompatActivity() {
} else if (message is ConnectionStatusUpdate) { } else if (message is ConnectionStatusUpdate) {
if (message.updateCode == ConnectionStatusUpdate.CONNECTED) { if (message.updateCode == ConnectionStatusUpdate.CONNECTED) {
// Make sure the Crashlytics report contains the currently selected node // Make sure the Crashlytics report contains the currently selected node
val selectedNode = mNetworkService?.selectedNode val selectedNodeUrl = mNetworkService?.selectedNode?.url ?: ""
Crashlytics.log(selectedNode?.url) val crashlytics = FirebaseCrashlytics.getInstance()
crashlytics.setCustomKey(Constants.CRASHLYTICS_KEY_CURRENT_NODE, selectedNodeUrl)
} else if (message.updateCode == ConnectionStatusUpdate.DISCONNECTED) { } else if (message.updateCode == ConnectionStatusUpdate.DISCONNECTED) {
// If we got a disconnection notification, we should clear our response map, since // If we got a disconnection notification, we should clear our response map, since
// all its stored request ids will now be reset // all its stored request ids will now be reset

View file

@ -1,11 +1,10 @@
package cy.agorise.bitsybitshareswallet.fragments package cy.agorise.bitsybitshareswallet.fragments
import android.os.Bundle import android.os.Bundle
import android.util.Log
import android.view.View import android.view.View
import androidx.core.os.ConfigurationCompat import androidx.core.os.ConfigurationCompat
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import com.crashlytics.android.Crashlytics import com.google.firebase.crashlytics.FirebaseCrashlytics
import cy.agorise.bitsybitshareswallet.utils.Constants import cy.agorise.bitsybitshareswallet.utils.Constants
import cy.agorise.graphenej.api.ConnectionStatusUpdate import cy.agorise.graphenej.api.ConnectionStatusUpdate
import cy.agorise.graphenej.api.android.NetworkService import cy.agorise.graphenej.api.android.NetworkService
@ -34,7 +33,8 @@ abstract class ConnectedFragment : Fragment() {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
val locale = ConfigurationCompat.getLocales(resources.configuration)[0] val locale = ConfigurationCompat.getLocales(resources.configuration)[0]
Crashlytics.setString(Constants.CRASHLYTICS_KEY_LANGUAGE, locale.displayName) val crashlytics = FirebaseCrashlytics.getInstance()
crashlytics.setCustomKey(Constants.CRASHLYTICS_KEY_LANGUAGE, locale.displayName)
// Connect to the RxBus, which receives events from the NetworkService // Connect to the RxBus, which receives events from the NetworkService
mDisposables.add( mDisposables.add(
@ -43,7 +43,7 @@ abstract class ConnectedFragment : Fragment() {
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe( .subscribe(
{ handleIncomingMessage(it) } , { handleIncomingMessage(it) } ,
{ Crashlytics.log(Log.DEBUG, TAG, it.message) } { crashlytics.log("D/$TAG: ${it.message}") }
) )
) )
} }

View file

@ -30,7 +30,7 @@ import java.io.IOException
import java.io.InputStreamReader import java.io.InputStreamReader
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
import com.crashlytics.android.Crashlytics import com.google.firebase.crashlytics.FirebaseCrashlytics
import cy.agorise.bitsybitshareswallet.models.FaucetRequest import cy.agorise.bitsybitshareswallet.models.FaucetRequest
import cy.agorise.bitsybitshareswallet.models.FaucetResponse import cy.agorise.bitsybitshareswallet.models.FaucetResponse
import cy.agorise.bitsybitshareswallet.network.ServiceGenerator import cy.agorise.bitsybitshareswallet.network.ServiceGenerator
@ -72,7 +72,8 @@ class CreateAccountFragment : BaseAccountFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
Crashlytics.setString(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG) val crashlytics = FirebaseCrashlytics.getInstance()
crashlytics.setCustomKey(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG)
// Use RxJava Debounce to check the validity and availability of the user's proposed account name // Use RxJava Debounce to check the validity and availability of the user's proposed account name
mDisposables.add( mDisposables.add(
@ -82,7 +83,7 @@ class CreateAccountFragment : BaseAccountFragment() {
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe( .subscribe(
{ validateAccountName(it.toString()) }, { validateAccountName(it.toString()) },
{ Crashlytics.log(Log.DEBUG, TAG, it.message) } { crashlytics.log("D/$TAG: ${it.message}") }
) )
) )
@ -94,7 +95,7 @@ class CreateAccountFragment : BaseAccountFragment() {
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe( .subscribe(
{ validatePIN() }, { validatePIN() },
{ Crashlytics.log(Log.DEBUG, TAG, it.message) } { crashlytics.log("D/$TAG: ${it.message}") }
) )
) )
@ -106,7 +107,7 @@ class CreateAccountFragment : BaseAccountFragment() {
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe( .subscribe(
{ validatePINConfirmation() }, { validatePINConfirmation() },
{ Crashlytics.log(Log.DEBUG, TAG, it.message) } { crashlytics.log("D/$TAG: ${it.message}") }
) )
) )
@ -353,7 +354,8 @@ class CreateAccountFragment : BaseAccountFragment() {
context?.toast(getString(R.string.error__read_dict_file)) context?.toast(getString(R.string.error__read_dict_file))
findNavController().navigateUp() findNavController().navigateUp()
} catch (e: IllegalArgumentException) { } catch (e: IllegalArgumentException) {
Crashlytics.logException(e) val crashlytics = FirebaseCrashlytics.getInstance()
crashlytics.recordException(e)
// TODO if this does happen to real devices, use a proper error message // TODO if this does happen to real devices, use a proper error message
context?.toast(getString(R.string.error__try_again)) context?.toast(getString(R.string.error__try_again))
findNavController().navigateUp() findNavController().navigateUp()

View file

@ -15,7 +15,7 @@ import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders import androidx.lifecycle.ViewModelProviders
import androidx.navigation.fragment.navArgs import androidx.navigation.fragment.navArgs
import com.crashlytics.android.Crashlytics import com.google.firebase.crashlytics.FirebaseCrashlytics
import cy.agorise.bitsybitshareswallet.R import cy.agorise.bitsybitshareswallet.R
import cy.agorise.bitsybitshareswallet.database.joins.TransferDetail import cy.agorise.bitsybitshareswallet.database.joins.TransferDetail
@ -53,7 +53,8 @@ class EReceiptFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
Crashlytics.setString(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG) val crashlytics = FirebaseCrashlytics.getInstance()
crashlytics.setCustomKey(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG)
mLocale = ConfigurationCompat.getLocales(resources.configuration)[0] mLocale = ConfigurationCompat.getLocales(resources.configuration)[0]

View file

@ -12,7 +12,7 @@ import androidx.core.os.ConfigurationCompat
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProviders import androidx.lifecycle.ViewModelProviders
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import com.crashlytics.android.Crashlytics import com.google.firebase.crashlytics.FirebaseCrashlytics
import cy.agorise.bitsybitshareswallet.R import cy.agorise.bitsybitshareswallet.R
import cy.agorise.bitsybitshareswallet.adapters.BalancesDetailsAdapter import cy.agorise.bitsybitshareswallet.adapters.BalancesDetailsAdapter
import cy.agorise.bitsybitshareswallet.database.joins.BalanceDetail import cy.agorise.bitsybitshareswallet.database.joins.BalanceDetail
@ -105,7 +105,8 @@ class FilterOptionsDialog : DialogFragment(), DatePickerFragment.OnDateSetListen
onAttachToParentFragment(parentFragment!!) onAttachToParentFragment(parentFragment!!)
Crashlytics.setString(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG) val crashlytics = FirebaseCrashlytics.getInstance()
crashlytics.setCustomKey(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG)
mFilterOptions = arguments?.getParcelable(KEY_FILTER_OPTIONS)!! mFilterOptions = arguments?.getParcelable(KEY_FILTER_OPTIONS)!!

View file

@ -19,7 +19,7 @@ import cy.agorise.bitsybitshareswallet.utils.Constants
import cy.agorise.bitsybitshareswallet.viewmodels.UserAccountViewModel import cy.agorise.bitsybitshareswallet.viewmodels.UserAccountViewModel
import kotlinx.android.synthetic.main.fragment_home.* import kotlinx.android.synthetic.main.fragment_home.*
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import com.crashlytics.android.Crashlytics import com.google.firebase.crashlytics.FirebaseCrashlytics
class HomeFragment : Fragment() { class HomeFragment : Fragment() {
@ -64,7 +64,8 @@ class HomeFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
Crashlytics.setString(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG) val crashlytics = FirebaseCrashlytics.getInstance()
crashlytics.setCustomKey(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG)
// Get version number of the last agreed license version // Get version number of the last agreed license version
val agreedLicenseVersion = PreferenceManager.getDefaultSharedPreferences(context) val agreedLicenseVersion = PreferenceManager.getDefaultSharedPreferences(context)

View file

@ -14,7 +14,7 @@ import com.afollestad.materialdialogs.callbacks.onDismiss
import com.afollestad.materialdialogs.list.customListAdapter import com.afollestad.materialdialogs.list.customListAdapter
import com.afollestad.materialdialogs.list.getRecyclerView import com.afollestad.materialdialogs.list.getRecyclerView
import com.afollestad.materialdialogs.list.listItemsSingleChoice import com.afollestad.materialdialogs.list.listItemsSingleChoice
import com.crashlytics.android.Crashlytics import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.jakewharton.rxbinding3.widget.textChanges import com.jakewharton.rxbinding3.widget.textChanges
import cy.agorise.bitsybitshareswallet.BuildConfig import cy.agorise.bitsybitshareswallet.BuildConfig
import cy.agorise.bitsybitshareswallet.R import cy.agorise.bitsybitshareswallet.R
@ -83,7 +83,8 @@ class ImportBrainkeyFragment : BaseAccountFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
Crashlytics.setString(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG) val crashlytics = FirebaseCrashlytics.getInstance()
crashlytics.setCustomKey(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG)
// Use RxJava Debounce to update the PIN error only after the user stops writing for > 500 ms // Use RxJava Debounce to update the PIN error only after the user stops writing for > 500 ms
mDisposables.add( mDisposables.add(
@ -93,7 +94,7 @@ class ImportBrainkeyFragment : BaseAccountFragment() {
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe( .subscribe(
{ validatePIN() }, { validatePIN() },
{ Crashlytics.log(Log.DEBUG, TAG, it.message) } { crashlytics.log("D/$TAG: ${it.message}") }
) )
) )
@ -105,7 +106,7 @@ class ImportBrainkeyFragment : BaseAccountFragment() {
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe( .subscribe(
{ validatePINConfirmation() }, { validatePINConfirmation() },
{ Crashlytics.log(Log.DEBUG, TAG, it.message) } { crashlytics.log("D/$TAG: ${it.message}") }
) )
) )
@ -118,7 +119,7 @@ class ImportBrainkeyFragment : BaseAccountFragment() {
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe( .subscribe(
{ validateBrainKey(it) }, { validateBrainKey(it) },
{ Crashlytics.log(Log.DEBUG, TAG, it.message) } { crashlytics.log("D/$TAG: ${it.message}") }
) )
) )

View file

@ -8,7 +8,7 @@ import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar import androidx.appcompat.widget.Toolbar
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.navigation.fragment.findNavController import androidx.navigation.fragment.findNavController
import com.crashlytics.android.Crashlytics import com.google.firebase.crashlytics.FirebaseCrashlytics
import cy.agorise.bitsybitshareswallet.R import cy.agorise.bitsybitshareswallet.R
import cy.agorise.bitsybitshareswallet.utils.Constants import cy.agorise.bitsybitshareswallet.utils.Constants
import kotlinx.android.synthetic.main.fragment_license.* import kotlinx.android.synthetic.main.fragment_license.*
@ -30,7 +30,8 @@ class LicenseFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
Crashlytics.setString(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG) val crashlytics = FirebaseCrashlytics.getInstance()
crashlytics.setCustomKey(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG)
// Get version number of the last agreed license version // Get version number of the last agreed license version
val agreedLicenseVersion = PreferenceManager.getDefaultSharedPreferences(context) val agreedLicenseVersion = PreferenceManager.getDefaultSharedPreferences(context)

View file

@ -22,7 +22,6 @@ import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders import androidx.lifecycle.ViewModelProviders
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.customview.customView import com.afollestad.materialdialogs.customview.customView
import com.crashlytics.android.Crashlytics
import com.google.android.gms.maps.CameraUpdateFactory import com.google.android.gms.maps.CameraUpdateFactory
import com.google.android.gms.maps.GoogleMap import com.google.android.gms.maps.GoogleMap
import com.google.android.gms.maps.OnMapReadyCallback import com.google.android.gms.maps.OnMapReadyCallback
@ -31,6 +30,7 @@ import com.google.android.gms.maps.model.LatLng
import com.google.android.gms.maps.model.LatLngBounds import com.google.android.gms.maps.model.LatLngBounds
import com.google.android.gms.maps.model.MapStyleOptions import com.google.android.gms.maps.model.MapStyleOptions
import com.google.android.gms.maps.model.Marker import com.google.android.gms.maps.model.Marker
import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.google.maps.android.MarkerManager import com.google.maps.android.MarkerManager
import com.google.maps.android.clustering.Cluster import com.google.maps.android.clustering.Cluster
import com.google.maps.android.clustering.ClusterItem import com.google.maps.android.clustering.ClusterItem
@ -124,7 +124,8 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback, SearchView.OnSuggestio
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
Crashlytics.setString(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG) val crashlytics = FirebaseCrashlytics.getInstance()
crashlytics.setCustomKey(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG)
// Dynamically obtain status bar and navigation bar heights, and account for the status bar height to add // Dynamically obtain status bar and navigation bar heights, and account for the status bar height to add
// the correct top margin to the Toolbar and place it just below the status bar // the correct top margin to the Toolbar and place it just below the status bar

View file

@ -7,7 +7,7 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.view.WindowManager import android.view.WindowManager
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import com.crashlytics.android.Crashlytics import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.jakewharton.rxbinding3.widget.textChanges import com.jakewharton.rxbinding3.widget.textChanges
import cy.agorise.bitsybitshareswallet.R import cy.agorise.bitsybitshareswallet.R
import cy.agorise.bitsybitshareswallet.utils.Constants import cy.agorise.bitsybitshareswallet.utils.Constants
@ -35,7 +35,8 @@ class PINSecurityLockDialog : BaseSecurityLockDialog() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
Crashlytics.setString(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG) val crashlytics = FirebaseCrashlytics.getInstance()
crashlytics.setCustomKey(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG)
// Request focus to the PIN EditText and automatically show the keyboard when the dialog appears. // Request focus to the PIN EditText and automatically show the keyboard when the dialog appears.
tietPIN.requestFocus() tietPIN.requestFocus()

View file

@ -9,7 +9,7 @@ import cy.agorise.bitsybitshareswallet.R
import kotlinx.android.synthetic.main.dialog_pattern_security_lock.* import kotlinx.android.synthetic.main.dialog_pattern_security_lock.*
import com.andrognito.patternlockview.PatternLockView import com.andrognito.patternlockview.PatternLockView
import com.andrognito.patternlockview.listener.PatternLockViewListener import com.andrognito.patternlockview.listener.PatternLockViewListener
import com.crashlytics.android.Crashlytics import com.google.firebase.crashlytics.FirebaseCrashlytics
import cy.agorise.bitsybitshareswallet.utils.Constants import cy.agorise.bitsybitshareswallet.utils.Constants
import cy.agorise.bitsybitshareswallet.utils.CryptoUtils import cy.agorise.bitsybitshareswallet.utils.CryptoUtils
@ -33,7 +33,8 @@ class PatternSecurityLockDialog : BaseSecurityLockDialog() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
Crashlytics.setString(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG) val crashlytics = FirebaseCrashlytics.getInstance()
crashlytics.setCustomKey(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG)
setupScreen() setupScreen()

View file

@ -13,8 +13,8 @@ import androidx.collection.LongSparseArray
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.lifecycle.Observer import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders import androidx.lifecycle.ViewModelProviders
import com.crashlytics.android.Crashlytics
import com.google.common.primitives.UnsignedLong import com.google.common.primitives.UnsignedLong
import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.jakewharton.rxbinding3.widget.textChanges import com.jakewharton.rxbinding3.widget.textChanges
import cy.agorise.bitsybitshareswallet.R import cy.agorise.bitsybitshareswallet.R
import cy.agorise.bitsybitshareswallet.adapters.AssetsAdapter import cy.agorise.bitsybitshareswallet.adapters.AssetsAdapter
@ -100,7 +100,8 @@ class ReceiveTransactionFragment : ConnectedFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
Crashlytics.setString(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG) val crashlytics = FirebaseCrashlytics.getInstance()
crashlytics.setCustomKey(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG)
// Configure ViewModel // Configure ViewModel
mViewModel = ViewModelProviders.of(this).get(ReceiveTransactionViewModel::class.java) mViewModel = ViewModelProviders.of(this).get(ReceiveTransactionViewModel::class.java)
@ -286,7 +287,7 @@ class ReceiveTransactionFragment : ConnectedFragment() {
updateAmountAddressUI(amount, asset.symbol, asset.precision, mUserAccount!!.name) updateAmountAddressUI(amount, asset.symbol, asset.precision, mUserAccount!!.name)
} catch (e: NullPointerException) { } catch (e: NullPointerException) {
Log.e(TAG, "NullPointerException. Msg: " + e.message) Log.e(TAG, "NullPointerException. Msg: " + e.message)
Crashlytics.logException(e) FirebaseCrashlytics.getInstance().recordException(e)
} }
} }

View file

@ -18,9 +18,9 @@ import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs import androidx.navigation.fragment.navArgs
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.customview.customView import com.afollestad.materialdialogs.customview.customView
import com.crashlytics.android.Crashlytics
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import com.google.common.primitives.UnsignedLong import com.google.common.primitives.UnsignedLong
import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.google.zxing.BarcodeFormat import com.google.zxing.BarcodeFormat
import com.google.zxing.Result import com.google.zxing.Result
import com.jakewharton.rxbinding3.widget.textChanges import com.jakewharton.rxbinding3.widget.textChanges
@ -137,7 +137,8 @@ class SendTransactionFragment : ConnectedFragment(), ZXingScannerView.ResultHand
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
Crashlytics.setString(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG) val crashlytics = FirebaseCrashlytics.getInstance()
crashlytics.setCustomKey(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG)
val userId = PreferenceManager.getDefaultSharedPreferences(context) val userId = PreferenceManager.getDefaultSharedPreferences(context)
.getString(Constants.KEY_CURRENT_ACCOUNT_ID, "") ?: "" .getString(Constants.KEY_CURRENT_ACCOUNT_ID, "") ?: ""
@ -154,7 +155,7 @@ class SendTransactionFragment : ConnectedFragment(), ZXingScannerView.ResultHand
try { try {
wifKey = CryptoUtils.decrypt(it, encryptedWIF) wifKey = CryptoUtils.decrypt(it, encryptedWIF)
} catch (e: Exception) { } catch (e: Exception) {
Crashlytics.logException(e) crashlytics.recordException(e)
} }
} }
}) })

View file

@ -17,8 +17,8 @@ import com.afollestad.materialdialogs.callbacks.onDismiss
import com.afollestad.materialdialogs.customview.customView import com.afollestad.materialdialogs.customview.customView
import com.afollestad.materialdialogs.list.customListAdapter import com.afollestad.materialdialogs.list.customListAdapter
import com.afollestad.materialdialogs.list.listItemsSingleChoice import com.afollestad.materialdialogs.list.listItemsSingleChoice
import com.crashlytics.android.Crashlytics
import com.google.common.primitives.UnsignedLong import com.google.common.primitives.UnsignedLong
import com.google.firebase.crashlytics.FirebaseCrashlytics
import cy.agorise.bitsybitshareswallet.BuildConfig import cy.agorise.bitsybitshareswallet.BuildConfig
import cy.agorise.bitsybitshareswallet.R import cy.agorise.bitsybitshareswallet.R
import cy.agorise.bitsybitshareswallet.adapters.FullNodesAdapter import cy.agorise.bitsybitshareswallet.adapters.FullNodesAdapter
@ -98,7 +98,8 @@ class SettingsFragment : ConnectedFragment(), BaseSecurityLockDialog.OnPINPatter
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
Crashlytics.setString(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG) val crashlytics = FirebaseCrashlytics.getInstance()
crashlytics.setCustomKey(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG)
val userId = PreferenceManager.getDefaultSharedPreferences(context) val userId = PreferenceManager.getDefaultSharedPreferences(context)
.getString(Constants.KEY_CURRENT_ACCOUNT_ID, "") ?: "" .getString(Constants.KEY_CURRENT_ACCOUNT_ID, "") ?: ""
@ -122,7 +123,7 @@ class SettingsFragment : ConnectedFragment(), BaseSecurityLockDialog.OnPINPatter
} catch (e: AEADBadTagException) { } catch (e: AEADBadTagException) {
Log.e(TAG, "AEADBadTagException. Class: " + e.javaClass + ", Msg: " + e.message) Log.e(TAG, "AEADBadTagException. Class: " + e.javaClass + ", Msg: " + e.message)
} catch (e: IllegalStateException) { } catch (e: IllegalStateException) {
Crashlytics.logException(e) crashlytics.recordException(e)
} }
} }
}) })

View file

@ -16,7 +16,7 @@ import androidx.lifecycle.ViewModelProviders
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.materialdialogs.list.listItemsMultiChoice import com.afollestad.materialdialogs.list.listItemsMultiChoice
import com.crashlytics.android.Crashlytics import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.jakewharton.rxbinding3.appcompat.queryTextChangeEvents import com.jakewharton.rxbinding3.appcompat.queryTextChangeEvents
import cy.agorise.bitsybitshareswallet.R import cy.agorise.bitsybitshareswallet.R
import cy.agorise.bitsybitshareswallet.adapters.TransfersDetailsAdapter import cy.agorise.bitsybitshareswallet.adapters.TransfersDetailsAdapter
@ -55,7 +55,8 @@ class TransactionsFragment : Fragment(), FilterOptionsDialog.OnFilterOptionsSele
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
Crashlytics.setString(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG) val crashlytics = FirebaseCrashlytics.getInstance()
crashlytics.setCustomKey(Constants.CRASHLYTICS_KEY_LAST_SCREEN, TAG)
val userId = PreferenceManager.getDefaultSharedPreferences(context) val userId = PreferenceManager.getDefaultSharedPreferences(context)
.getString(Constants.KEY_CURRENT_ACCOUNT_ID, "") ?: "" .getString(Constants.KEY_CURRENT_ACCOUNT_ID, "") ?: ""

View file

@ -2,7 +2,7 @@ package cy.agorise.bitsybitshareswallet.repositories
import android.os.AsyncTask import android.os.AsyncTask
import android.util.Log import android.util.Log
import com.crashlytics.android.Crashlytics import com.google.firebase.crashlytics.FirebaseCrashlytics
import cy.agorise.bitsybitshareswallet.database.daos.NodeDao import cy.agorise.bitsybitshareswallet.database.daos.NodeDao
import cy.agorise.bitsybitshareswallet.database.entities.Node import cy.agorise.bitsybitshareswallet.database.entities.Node
import cy.agorise.bitsybitshareswallet.network.BitsyWebservice import cy.agorise.bitsybitshareswallet.network.BitsyWebservice
@ -100,7 +100,7 @@ class NodeRepository(private val nodeDao: NodeDao) {
} }
} catch (e: Exception) { } catch (e: Exception) {
// Generic exception handling // Generic exception handling
Crashlytics.logException(e) FirebaseCrashlytics.getInstance().recordException(e)
} }
} }
} }

View file

@ -2,7 +2,7 @@ package cy.agorise.bitsybitshareswallet.utils
import android.app.Application import android.app.Application
import android.util.Log import android.util.Log
import com.crashlytics.android.Crashlytics import com.google.firebase.crashlytics.FirebaseCrashlytics
import cy.agorise.bitsybitshareswallet.database.BitsyDatabase import cy.agorise.bitsybitshareswallet.database.BitsyDatabase
import cy.agorise.bitsybitshareswallet.network.NetworkServiceManager import cy.agorise.bitsybitshareswallet.network.NetworkServiceManager
import cy.agorise.bitsybitshareswallet.repositories.NodeRepository import cy.agorise.bitsybitshareswallet.repositories.NodeRepository
@ -34,7 +34,7 @@ class BitsyApplication : Application() {
// exception to Crashlytics so that we can fix the issues // exception to Crashlytics so that we can fix the issues
RxJavaPlugins.setErrorHandler { throwable -> RxJavaPlugins.setErrorHandler { throwable ->
Log.e("RxJava Error", throwable.message) Log.e("RxJava Error", throwable.message)
Crashlytics.logException(throwable) FirebaseCrashlytics.getInstance().recordException(throwable)
} }
appScope = CoroutineScope(Dispatchers.Main + applicationJob) appScope = CoroutineScope(Dispatchers.Main + applicationJob)

View file

@ -158,6 +158,9 @@ object Constants {
/** Key used to add the account ID to the Crashlytics report*/ /** Key used to add the account ID to the Crashlytics report*/
const val CRASHLYTICS_KEY_ACCOUNT_ID = "crashlytics_key_account_id" const val CRASHLYTICS_KEY_ACCOUNT_ID = "crashlytics_key_account_id"
/** Key used to add the current node the app is connected to to the Crashlytics report*/
const val CRASHLYTICS_KEY_CURRENT_NODE = "crashlytics_key_current_node"
/** Definition of the system core (BTS) asset id */ /** Definition of the system core (BTS) asset id */
const val CORE_ASSET = "1.3.0" const val CORE_ASSET = "1.3.0"
} }

View file

@ -11,17 +11,13 @@ buildscript {
repositories { repositories {
google() google()
jcenter() jcenter()
maven {
url 'https://maven.fabric.io/public'
}
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:3.5.3' classpath 'com.android.tools.build:gradle:3.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version" classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
classpath 'com.google.gms:google-services:4.3.3' classpath 'com.google.gms:google-services:4.3.4'
classpath 'io.fabric.tools:gradle:1.29.0' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files