pull/1894/head^2
kunfei 3 years ago
parent df8e902df4
commit bbbc8e9f48
  1. 5
      app/src/main/java/io/legado/app/api/controller/BookController.kt

@ -215,10 +215,13 @@ object BookController {
*/ */
fun saveBookProgress(postData: String?): ReturnData { fun saveBookProgress(postData: String?): ReturnData {
val returnData = ReturnData() val returnData = ReturnData()
GSON.fromJsonObject<BookProgress>(postData).getOrNull()?.let { bookProgress -> GSON.fromJsonObject<BookProgress>(postData)
.onFailure { it.printOnDebug() }
.getOrNull()?.let { bookProgress ->
appDb.bookDao.getBook(bookProgress.name, bookProgress.author)?.let { book -> appDb.bookDao.getBook(bookProgress.name, bookProgress.author)?.let { book ->
book.durChapterIndex = bookProgress.durChapterIndex book.durChapterIndex = bookProgress.durChapterIndex
book.durChapterPos = bookProgress.durChapterPos book.durChapterPos = bookProgress.durChapterPos
book.durChapterTitle = bookProgress.durChapterTitle
appDb.bookDao.update(book) appDb.bookDao.update(book)
AppWebDav.uploadBookProgress(bookProgress) AppWebDav.uploadBookProgress(bookProgress)
if (ReadBook.book?.bookUrl == book.bookUrl) { if (ReadBook.book?.bookUrl == book.bookUrl) {

Loading…
Cancel
Save