mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
fix: Don't use runBlocking
This commit is contained in:
parent
54a26bf7d0
commit
2218804d58
2 changed files with 5 additions and 6 deletions
|
@ -1298,7 +1298,7 @@ class LibraryPresenter(
|
|||
presenterScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
mangaList.forEach { list ->
|
||||
val chapters = runBlocking { getChapters.await(list) }.filter { !it.read }
|
||||
val chapters = getChapters.await(list).filter { !it.read }
|
||||
downloadManager.downloadChapters(list, chapters)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ import kotlinx.coroutines.flow.drop
|
|||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.withContext
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
|
@ -455,13 +454,13 @@ class RecentsPresenter(
|
|||
return Triple(sortedChapters, firstChapter, extraCount)
|
||||
}
|
||||
|
||||
private fun getNextChapter(manga: Manga): Chapter? {
|
||||
val chapters = runBlocking { getChapters.await(manga) }
|
||||
private suspend fun getNextChapter(manga: Manga): Chapter? {
|
||||
val chapters = getChapters.await(manga)
|
||||
return ChapterSort(manga, chapterFilter, preferences).getNextUnreadChapter(chapters, false)
|
||||
}
|
||||
|
||||
private fun getFirstUpdatedChapter(manga: Manga, chapter: Chapter): Chapter? {
|
||||
val chapters = runBlocking { getChapters.await(manga) }
|
||||
private suspend fun getFirstUpdatedChapter(manga: Manga, chapter: Chapter): Chapter? {
|
||||
val chapters = getChapters.await(manga)
|
||||
return chapters
|
||||
.sortedWith(ChapterSort(manga, chapterFilter, preferences).sortComparator(true)).find {
|
||||
!it.read && abs(it.date_fetch - chapter.date_fetch) <= TimeUnit.HOURS.toMillis(12)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue