DROID-1911 App | Tech | FIx crashes during navigation + clean up sentry logs (#782)

This commit is contained in:
Evgenii Kozlov 2024-01-18 16:26:02 +01:00 committed by konstantiniiv
parent 04af82dc74
commit be1a703ebe
2 changed files with 16 additions and 4 deletions

View File

@ -24,6 +24,7 @@ import kotlinx.coroutines.flow.cancellable
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
import timber.log.Timber
abstract class BaseFragment<T : ViewBinding>(
@ -101,7 +102,18 @@ abstract class BaseFragment<T : ViewBinding>(
protected fun DialogFragment.showChildFragment(tag: String? = null) {
jobs += this@BaseFragment.lifecycleScope.launch {
throttleFlow.emit { show(this@BaseFragment.childFragmentManager, tag) }
throttleFlow.emit {
runCatching {
show(this@BaseFragment.childFragmentManager, tag)
}.fold(
onSuccess = {
// Do nothing.
},
onFailure = {
Timber.e(it, "Error while navifation")
}
)
}
}
}

View File

@ -373,7 +373,7 @@ fun List<BlockView>.enterSAM(
)
else -> view.also {
if(view !is BlockView.Permission) {
Timber.e("Attempts to enter SAM for block which does not support read / write mode")
Timber.w("Attempts to enter SAM for block which does not support read / write mode")
}
}
}
@ -726,7 +726,7 @@ fun List<BlockView>.highlight(
else -> {
view.also { v ->
if (v is BlockView.Searchable) {
Timber.e("Ignoring search field for block type: ${v.getViewType()}")
Timber.w("Ignoring search field for block type: ${v.getViewType()}")
}
}
}
@ -1080,7 +1080,7 @@ fun BlockView.updateSelection(newSelection: Boolean) = when (this) {
is BlockView.DataView.Default -> copy(isSelected = newSelection)
else -> this.also {
if (this is BlockView.Selectable)
Timber.e("Error when change selection for Selectable BlockView $this")
Timber.w("Error when change selection for Selectable BlockView $this")
}
}