This commit is contained in:
kunfei
2022-10-20 10:20:00 +08:00
parent b6c0b44516
commit 234c011758
@@ -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()
} }
} }