|
|
@ -3,6 +3,7 @@ package io.legado.app.ui.main |
|
|
|
import android.app.Application |
|
|
|
import android.app.Application |
|
|
|
import io.legado.app.App |
|
|
|
import io.legado.app.App |
|
|
|
import io.legado.app.base.BaseViewModel |
|
|
|
import io.legado.app.base.BaseViewModel |
|
|
|
|
|
|
|
import io.legado.app.constant.BookType |
|
|
|
import io.legado.app.constant.EventBus |
|
|
|
import io.legado.app.constant.EventBus |
|
|
|
import io.legado.app.data.entities.Book |
|
|
|
import io.legado.app.data.entities.Book |
|
|
|
import io.legado.app.data.entities.RssSource |
|
|
|
import io.legado.app.data.entities.RssSource |
|
|
@ -26,7 +27,9 @@ class MainViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
|
|
|
|
|
|
|
|
fun upChapterList(books: List<Book>) { |
|
|
|
fun upChapterList(books: List<Book>) { |
|
|
|
execute { |
|
|
|
execute { |
|
|
|
books.forEach { book -> |
|
|
|
books.filter { |
|
|
|
|
|
|
|
it.origin != BookType.local && it.canUpdate |
|
|
|
|
|
|
|
}.forEach { book -> |
|
|
|
if (!updateList.contains(book.bookUrl)) { |
|
|
|
if (!updateList.contains(book.bookUrl)) { |
|
|
|
App.db.bookSourceDao().getBookSource(book.origin)?.let { bookSource -> |
|
|
|
App.db.bookSourceDao().getBookSource(book.origin)?.let { bookSource -> |
|
|
|
synchronized(this) { |
|
|
|
synchronized(this) { |
|
|
|