From 49739549e948d8d40f4c9cdc509cf1e642704c2e Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 24 Feb 2022 22:16:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/ui/book/search/SearchViewModel.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt b/app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt index 8fd2c4077..b2fb9cc84 100644 --- a/app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/search/SearchViewModel.kt @@ -8,8 +8,10 @@ import io.legado.app.data.appDb import io.legado.app.data.entities.SearchBook import io.legado.app.data.entities.SearchKeyword import io.legado.app.model.webBook.SearchModel +import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.flow.callbackFlow +import kotlinx.coroutines.flow.flowOn class SearchViewModel(application: Application) : BaseViewModel(application) { private val searchModel = SearchModel(viewModelScope) @@ -47,7 +49,7 @@ class SearchViewModel(application: Application) : BaseViewModel(application) { awaitClose { searchModel.unRegisterCallback() } - } + }.flowOn(IO) /** * 开始搜索