diff options
author | Allan Wang <me@allanwang.ca> | 2019-01-22 23:41:14 -0500 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2019-01-22 23:41:14 -0500 |
commit | bc623f740eaf74a16eaed241448b802ff26b4197 (patch) | |
tree | d90b1b78d7e3ff2acca65c99518cb6b3412cda68 /app/src/main/kotlin/com/pitchedapps/frost/views | |
parent | fa7c7280715c88e5d59a2151573c5bc35cf3f230 (diff) | |
download | frost-bc623f740eaf74a16eaed241448b802ff26b4197.tar.gz frost-bc623f740eaf74a16eaed241448b802ff26b4197.tar.bz2 frost-bc623f740eaf74a16eaed241448b802ff26b4197.zip |
Catch crashes, but things will still break
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/views')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt index 860bf36c..9e0b70b2 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostRecyclerView.kt @@ -27,9 +27,12 @@ import com.pitchedapps.frost.contracts.FrostContentContainer import com.pitchedapps.frost.contracts.FrostContentCore import com.pitchedapps.frost.contracts.FrostContentParent import com.pitchedapps.frost.fragments.RecyclerContentContract +import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.Prefs import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.launch +import kotlinx.coroutines.supervisorScope /** * Created by Allan Wang on 2017-05-29. @@ -74,7 +77,14 @@ class FrostRecyclerView @JvmOverloads constructor( if (Prefs.animate) fadeOut(onFinish = onReloadClear) scope.launch { parent.refreshChannel.offer(true) - val loaded = recyclerContract.reload { parent.progressChannel.offer(it) } + // TODO figure out how to avoid cancelling parent + try { + supervisorScope { + recyclerContract.reload { parent.progressChannel.offer(it) } + } + } catch (e: Exception) { + + } parent.progressChannel.offer(100) parent.refreshChannel.offer(false) if (Prefs.animate) circularReveal() |