|
|
@ -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) { |
|
|
|