pull/1744/head
kunfei 3 years ago
parent e02f253252
commit 3f7bea8d4e
  1. 14
      app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt

@ -168,20 +168,24 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
book: Book,
alertSync: ((progress: BookProgress) -> Unit)? = null
) {
if (AppWebDav.syncBookProgress)
execute {
if (AppWebDav.syncBookProgress) {
AppWebDav.getBookProgress(book)
}.onSuccess {
it?.let { progress ->
?: throw NoStackTraceException("没有进度")
} else {
throw NoStackTraceException("进度同步未启用")
}
}.onSuccess { progress ->
if (progress.durChapterIndex < book.durChapterIndex ||
(progress.durChapterIndex == book.durChapterIndex && progress.durChapterPos < book.durChapterPos)
(progress.durChapterIndex == book.durChapterIndex
&& progress.durChapterPos < book.durChapterPos)
) {
alertSync?.invoke(progress)
} else {
ReadBook.setProgress(progress)
}
}
}
}
/**

Loading…
Cancel
Save