|
|
|
@ -4,6 +4,7 @@ import android.app.Application |
|
|
|
|
import io.legado.app.App |
|
|
|
|
import io.legado.app.base.BaseViewModel |
|
|
|
|
import io.legado.app.data.entities.BookGroup |
|
|
|
|
import io.legado.app.service.help.Download |
|
|
|
|
|
|
|
|
|
class BookshelfViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
|
|
|
|
|
@ -34,8 +35,8 @@ class BookshelfViewModel(application: Application) : BaseViewModel(application) |
|
|
|
|
|
|
|
|
|
fun downloadAll() { |
|
|
|
|
execute { |
|
|
|
|
App.db.bookDao().allBooks.forEach { book -> |
|
|
|
|
|
|
|
|
|
App.db.bookDao().webBooks.forEach { book -> |
|
|
|
|
Download.start(context, book.bookUrl, book.durChapterIndex, book.totalChapterNum) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|