diff --git a/app/src/main/java/io/legado/app/constant/PreferKey.kt b/app/src/main/java/io/legado/app/constant/PreferKey.kt index a69fd3368..9f055e498 100644 --- a/app/src/main/java/io/legado/app/constant/PreferKey.kt +++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt @@ -63,6 +63,7 @@ object PreferKey { const val autoChangeSource = "autoChangeSource" const val importKeepName = "importKeepName" const val screenDirection = "screenDirection" + const val syncBookProgress = "syncBookProgress" const val cPrimary = "colorPrimary" const val cAccent = "colorAccent" diff --git a/app/src/main/java/io/legado/app/help/AppConfig.kt b/app/src/main/java/io/legado/app/help/AppConfig.kt index 2efcd482c..b96344abc 100644 --- a/app/src/main/java/io/legado/app/help/AppConfig.kt +++ b/app/src/main/java/io/legado/app/help/AppConfig.kt @@ -147,6 +147,8 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener { val importKeepName get() = context.getPrefBoolean(PreferKey.importKeepName) + val syncBookProgress get() = context.getPrefBoolean(PreferKey.syncBookProgress, true) + private fun getPrefUserAgent(): String { val ua = context.getPrefString(PreferKey.userAgent) if (ua.isNullOrBlank()) { diff --git a/app/src/main/java/io/legado/app/service/help/ReadBook.kt b/app/src/main/java/io/legado/app/service/help/ReadBook.kt index b4bf0e7e9..dd68512fd 100644 --- a/app/src/main/java/io/legado/app/service/help/ReadBook.kt +++ b/app/src/main/java/io/legado/app/service/help/ReadBook.kt @@ -91,6 +91,7 @@ object ReadBook { } fun uploadProgress() { + if (!AppConfig.syncBookProgress) return book?.let { BookWebDav.uploadBookProgress(it) } 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 088fe98e1..b7801ae09 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 @@ -163,17 +163,18 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { } fun syncBookProgress(book: Book) { - execute { - BookWebDav.getBookProgress(book)?.let { progress -> - if (progress.durChapterIndex < book.durChapterIndex || - (progress.durChapterIndex == book.durChapterIndex && progress.durChapterPos < book.durChapterPos) - ) { - processLiveData.postValue(progress) - } else { - ReadBook.setProgress(progress) + if (!AppConfig.syncBookProgress) + execute { + BookWebDav.getBookProgress(book)?.let { progress -> + if (progress.durChapterIndex < book.durChapterIndex || + (progress.durChapterIndex == book.durChapterIndex && progress.durChapterPos < book.durChapterPos) + ) { + processLiveData.postValue(progress) + } else { + ReadBook.setProgress(progress) + } } } - } } fun changeTo(newBook: Book) { diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 44d480018..9055d82d3 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -790,5 +790,7 @@ 添加大佬们提供的规则导入地址\n添加后点击可导入规则 拉取云端进度 当前进度超过云端进度,是否同步? + 同步阅读进度 + 进入退出阅读界面时同步阅读进度 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 71781981d..844c81fbd 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -791,5 +791,7 @@ 添加大佬们提供的规则导入地址\n添加后点击可导入规则 拉取云端进度 当前进度超过云端进度,是否同步? + 同步阅读进度 + 进入退出阅读界面时同步阅读进度 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 4baf18b05..4ce861774 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -794,5 +794,7 @@ 添加大佬们提供的规则导入地址\n添加后点击可导入规则 拉取云端进度 当前进度超过云端进度,是否同步? + 同步阅读进度 + 进入退出阅读界面时同步阅读进度 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b28807641..e02fd21f0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -797,5 +797,7 @@ 添加大佬们提供的规则导入地址\n添加后点击可导入规则 拉取云端进度 当前进度超过云端进度,是否同步? + 同步阅读进度 + 进入退出阅读界面时同步阅读进度 diff --git a/app/src/main/res/xml/pref_config_backup.xml b/app/src/main/res/xml/pref_config_backup.xml index bc0c8adc7..fe51a816a 100644 --- a/app/src/main/res/xml/pref_config_backup.xml +++ b/app/src/main/res/xml/pref_config_backup.xml @@ -36,6 +36,15 @@ app:allowDividerBelow="false" app:iconSpaceReserved="false" /> + +