From 3720847ebb953b54fe3731ee815bbf1b30943cf7 Mon Sep 17 00:00:00 2001 From: HapeLee <1321903405@qq.com> Date: Sat, 29 Nov 2025 14:55:44 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E5=A4=8D]=20=E6=9F=90=E4=BA=9B?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B=EF=BC=8C=E5=8F=91=E7=8E=B0=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E6=95=B0=E6=8D=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/data/repository/ExploreRepository.kt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/data/repository/ExploreRepository.kt b/app/src/main/java/io/legado/app/data/repository/ExploreRepository.kt index 1d912ab2e..7f2be3ab5 100644 --- a/app/src/main/java/io/legado/app/data/repository/ExploreRepository.kt +++ b/app/src/main/java/io/legado/app/data/repository/ExploreRepository.kt @@ -5,8 +5,10 @@ import io.legado.app.data.entities.BookSource import io.legado.app.data.entities.SearchBook import io.legado.app.help.book.isNotShelf import io.legado.app.model.webBook.WebBook +import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map +import kotlinx.coroutines.withContext interface ExploreRepository { fun getBookshelfItems(): Flow> @@ -31,11 +33,14 @@ class ExploreRepositoryImpl( } override suspend fun exploreBook(source: BookSource, url: String, page: Int): Result> { - return try { - val books = WebBook.exploreBookSuspend(source, url, page) - Result.success(books) - } catch (e: Exception) { - Result.failure(e) + return withContext(Dispatchers.IO) { + try { + val books = WebBook.exploreBookSuspend(source, url, page) + Result.success(books) + } catch (e: Exception) { + e.printStackTrace() + Result.failure(e) + } } }