|
|
|
@ -11,6 +11,7 @@ import io.legado.app.data.appDb |
|
|
|
|
import io.legado.app.data.entities.Book |
|
|
|
|
import io.legado.app.data.entities.BookSource |
|
|
|
|
import io.legado.app.help.AppWebDav |
|
|
|
|
import io.legado.app.help.BookHelp |
|
|
|
|
import io.legado.app.help.DefaultData |
|
|
|
|
import io.legado.app.help.config.AppConfig |
|
|
|
|
import io.legado.app.help.config.LocalConfig |
|
|
|
@ -116,6 +117,7 @@ class MainViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
|
waitUpTocBooks.remove(bookUrl) |
|
|
|
|
upTocAdd(bookUrl) |
|
|
|
|
execute(context = upTocPool) { |
|
|
|
|
val oldBook = book.copy() |
|
|
|
|
val preUpdateJs = source.ruleToc?.preUpdateJs |
|
|
|
|
if (!preUpdateJs.isNullOrBlank()) { |
|
|
|
|
AnalyzeRule(book, source).evalJS(preUpdateJs) |
|
|
|
@ -129,8 +131,9 @@ class MainViewModel(application: Application) : BaseViewModel(application) { |
|
|
|
|
} else { |
|
|
|
|
upTocAdd(book.bookUrl) |
|
|
|
|
appDb.bookDao.insert(book) |
|
|
|
|
BookHelp.updateCacheFolder(oldBook, book) |
|
|
|
|
} |
|
|
|
|
appDb.bookChapterDao.delByBook(book.bookUrl) |
|
|
|
|
appDb.bookChapterDao.delByBook(bookUrl) |
|
|
|
|
appDb.bookChapterDao.insert(*toc.toTypedArray()) |
|
|
|
|
addDownload(source, book) |
|
|
|
|
}.onError(upTocPool) { |
|
|
|
|