|
|
@ -4,6 +4,7 @@ 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.EventBus |
|
|
|
import io.legado.app.constant.EventBus |
|
|
|
|
|
|
|
import io.legado.app.data.entities.Book |
|
|
|
import io.legado.app.data.entities.RssSource |
|
|
|
import io.legado.app.data.entities.RssSource |
|
|
|
import io.legado.app.help.http.HttpHelper |
|
|
|
import io.legado.app.help.http.HttpHelper |
|
|
|
import io.legado.app.help.storage.Restore |
|
|
|
import io.legado.app.help.storage.Restore |
|
|
@ -17,9 +18,9 @@ import kotlinx.coroutines.delay |
|
|
|
class MainViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
class MainViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
val updateList = hashSetOf<String>() |
|
|
|
val updateList = hashSetOf<String>() |
|
|
|
|
|
|
|
|
|
|
|
fun upChapterList() { |
|
|
|
fun upChapterList(books: List<Book>) { |
|
|
|
execute { |
|
|
|
execute { |
|
|
|
App.db.bookDao().hasUpdateBooks.forEach { book -> |
|
|
|
books.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) { |
|
|
|