From 09580efc807a26024b53dc21499c48885464f26b Mon Sep 17 00:00:00 2001 From: Xwite <82232510+Xwite@users.noreply.github.com> Date: Mon, 14 Nov 2022 11:41:18 +0800 Subject: [PATCH] Update ReadBookViewModel.kt --- .../io/legado/app/ui/book/read/ReadBookViewModel.kt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt index 654998725..9b761b6fb 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt @@ -186,13 +186,10 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { book: Book, alertSync: ((progress: BookProgress) -> Unit)? = null ) { + if (!AppWebDav.syncBookProgress) return execute { - if (AppWebDav.syncBookProgress) { - AppWebDav.getBookProgress(book) - ?: throw NoStackTraceException("没有进度") - } else { - throw NoStackTraceException("进度同步未启用") - } + AppWebDav.getBookProgress(book) + ?: throw NoStackTraceException("没有进度") }.onError { AppLog.put("拉取阅读进度失败", it) }.onSuccess { progress -> @@ -494,4 +491,4 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { } } -} \ No newline at end of file +}