pull/2459/head
kunfei 3 years ago
parent b6c0b44516
commit 234c011758
  1. 2
      app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt

@ -58,6 +58,7 @@ class CacheViewModel(application: Application) : BaseViewModel(application) {
loadChapterCoroutine?.cancel() loadChapterCoroutine?.cancel()
loadChapterCoroutine = execute { loadChapterCoroutine = execute {
books.forEach { book -> books.forEach { book ->
if (!cacheChapters.contains(book.bookUrl)) {
val chapterCaches = hashSetOf<String>() val chapterCaches = hashSetOf<String>()
val cacheNames = BookHelp.getChapterFiles(book) val cacheNames = BookHelp.getChapterFiles(book)
if (cacheNames.isNotEmpty()) { if (cacheNames.isNotEmpty()) {
@ -69,6 +70,7 @@ class CacheViewModel(application: Application) : BaseViewModel(application) {
} }
cacheChapters[book.bookUrl] = chapterCaches cacheChapters[book.bookUrl] = chapterCaches
upAdapterLiveData.postValue(book.bookUrl) upAdapterLiveData.postValue(book.bookUrl)
}
ensureActive() ensureActive()
} }
} }

Loading…
Cancel
Save