Adds more logging when a crash occurs

blinds
Laurent 5 years ago
parent 5f675d9f67
commit 6c6cf9a60f
  1. 21
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/editor/EditorFragment.kt
  2. 5
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/EditorViewModel.kt

@ -33,6 +33,7 @@ import net.pokeranalytics.android.ui.modules.handhistory.model.*
import net.pokeranalytics.android.ui.modules.handhistory.views.KeyboardListener import net.pokeranalytics.android.ui.modules.handhistory.views.KeyboardListener
import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.SmoothScrollLinearLayoutManager import net.pokeranalytics.android.ui.view.SmoothScrollLinearLayoutManager
import net.pokeranalytics.android.util.CrashLogging
import net.pokeranalytics.android.util.extensions.findById import net.pokeranalytics.android.util.extensions.findById
import timber.log.Timber import timber.log.Timber
@ -160,14 +161,22 @@ class EditorFragment : RealmFragment(), RowRepresentableDelegate, KeyboardListen
// At first, the selection is defined before the holder is bound, // At first, the selection is defined before the holder is bound,
// so we retrieve the editText inputConnection once the recycler view has been rendered // so we retrieve the editText inputConnection once the recycler view has been rendered
this.binding.recyclerView.viewTreeObserver.addOnGlobalLayoutListener { this.binding.recyclerView.viewTreeObserver.addOnGlobalLayoutListener {
when (this.model.currentKeyboard) {
HHKeyboard.AMOUNT -> { try {
val selection = this.model.currentSelection when (this.model.currentKeyboard) {
retrieveEditTextInputConnection(selection) HHKeyboard.AMOUNT -> {
} val selection = this.model.currentSelection
else -> { retrieveEditTextInputConnection(selection)
}
else -> {
}
} }
} catch (e: Exception) {
val actions = this.model.actionListLogs
CrashLogging.log(actions)
throw e
} }
} }
initKeyboardDefaultHeight() initKeyboardDefaultHeight()

@ -557,8 +557,7 @@ class EditorViewModel : ViewModel(), RowRepresentableDataSource, CardCentralizer
else -> {} else -> {}
} }
} catch (e: Exception) { } catch (e: Exception) {
val actions = this.sortedActions.joinToString("\n") { it.logRepresentation } CrashLogging.log(this.actionListLogs)
CrashLogging.log(actions)
throw e throw e
} }
@ -1058,4 +1057,6 @@ class EditorViewModel : ViewModel(), RowRepresentableDataSource, CardCentralizer
this.createRowRepresentation() this.createRowRepresentation()
} }
val actionListLogs: String = this.sortedActions.joinToString("\n") { it.logRepresentation }
} }
Loading…
Cancel
Save