|
|
@ -6,7 +6,6 @@ import androidx.lifecycle.MutableLiveData |
|
|
|
import io.legado.app.base.BaseViewModel |
|
|
|
import io.legado.app.base.BaseViewModel |
|
|
|
import io.legado.app.data.appDb |
|
|
|
import io.legado.app.data.appDb |
|
|
|
import io.legado.app.data.entities.Book |
|
|
|
import io.legado.app.data.entities.Book |
|
|
|
import io.legado.app.model.ReadBook |
|
|
|
|
|
|
|
import io.legado.app.model.localBook.LocalBook |
|
|
|
import io.legado.app.model.localBook.LocalBook |
|
|
|
|
|
|
|
|
|
|
|
class TocViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
class TocViewModel(application: Application) : BaseViewModel(application) { |
|
|
@ -34,9 +33,6 @@ class TocViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
appDb.bookChapterDao.delByBook(book.bookUrl) |
|
|
|
appDb.bookChapterDao.delByBook(book.bookUrl) |
|
|
|
appDb.bookChapterDao.insert(*it.toTypedArray()) |
|
|
|
appDb.bookChapterDao.insert(*it.toTypedArray()) |
|
|
|
appDb.bookDao.update(book) |
|
|
|
appDb.bookDao.update(book) |
|
|
|
ReadBook.chapterSize = it.size |
|
|
|
|
|
|
|
ReadBook.upMsg(null) |
|
|
|
|
|
|
|
ReadBook.loadContent(resetPageOffset = true) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}.onFinally { |
|
|
|
}.onFinally { |
|
|
|