pull/36/head
kunfei 5 years ago
parent a083bf31b4
commit d6832a91ec
  1. 4
      app/src/main/java/io/legado/app/help/coroutine/Coroutine.kt
  2. 2
      app/src/main/java/io/legado/app/ui/book/info/BookInfoViewModel.kt

@ -1,5 +1,6 @@
package io.legado.app.help.coroutine package io.legado.app.help.coroutine
import io.legado.app.BuildConfig
import kotlinx.coroutines.* import kotlinx.coroutines.*
import kotlin.coroutines.CoroutineContext import kotlin.coroutines.CoroutineContext
@ -119,6 +120,9 @@ class Coroutine<T>(
val value = executeBlock(context, timeMillis ?: 0L, block) val value = executeBlock(context, timeMillis ?: 0L, block)
success?.let { dispatchCallback(this, value, it) } success?.let { dispatchCallback(this, value, it) }
} catch (e: Throwable) { } catch (e: Throwable) {
if (BuildConfig.DEBUG) {
e.printStackTrace()
}
val consume: Boolean = errorReturn?.value?.let { value -> val consume: Boolean = errorReturn?.value?.let { value ->
success?.let { dispatchCallback(this, value, it) } success?.let { dispatchCallback(this, value, it) }
true true

@ -134,8 +134,6 @@ class BookInfoViewModel(application: Application) : BaseViewModel(application) {
App.db.bookChapterDao().insert(*chapters.toTypedArray()) App.db.bookChapterDao().insert(*chapters.toTypedArray())
bookData.postValue(book) bookData.postValue(book)
chapterListData.postValue(chapters) chapterListData.postValue(chapters)
}.onError {
it.printStackTrace()
} }
} }

Loading…
Cancel
Save