pull/1649/head
kunfei 3 years ago
parent d7140e9b3b
commit 4f70c33168
  1. 5
      app/src/main/java/io/legado/app/ui/book/changecover/ChangeCoverViewModel.kt

@ -17,7 +17,6 @@ import kotlinx.coroutines.Dispatchers.IO
import kotlinx.coroutines.ExecutorCoroutineDispatcher import kotlinx.coroutines.ExecutorCoroutineDispatcher
import kotlinx.coroutines.asCoroutineDispatcher import kotlinx.coroutines.asCoroutineDispatcher
import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.channels.trySendBlocking
import kotlinx.coroutines.flow.callbackFlow import kotlinx.coroutines.flow.callbackFlow
import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.flowOn
import java.util.concurrent.Executors import java.util.concurrent.Executors
@ -38,13 +37,13 @@ class ChangeCoverViewModel(application: Application) : BaseViewModel(application
searchSuccess = { searchSuccess = {
if (!searchBooks.contains(it)) { if (!searchBooks.contains(it)) {
searchBooks.add(it) searchBooks.add(it)
trySendBlocking(searchBooks) trySend(searchBooks)
} }
} }
appDb.searchBookDao.getEnableHasCover(name, author).let { appDb.searchBookDao.getEnableHasCover(name, author).let {
searchBooks.addAll(it) searchBooks.addAll(it)
trySendBlocking(searchBooks) trySend(searchBooks)
} }
if (searchBooks.size <= 1) { if (searchBooks.size <= 1) {

Loading…
Cancel
Save