mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化
This commit is contained in:
@@ -58,7 +58,7 @@ class App : MultiDexApplication() {
|
||||
2 -> ChineseUtils.s2t("初始化")
|
||||
}
|
||||
//同步阅读记录
|
||||
if (AppWebDav.isOk && AppConfig.syncBookProgress) {
|
||||
if (AppWebDav.syncBookProgress) {
|
||||
AppWebDav.downloadAllBookProgress()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,8 +282,6 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
val importKeepName get() = appCtx.getPrefBoolean(PreferKey.importKeepName)
|
||||
|
||||
val syncBookProgress get() = appCtx.getPrefBoolean(PreferKey.syncBookProgress, true)
|
||||
|
||||
var preDownloadNum
|
||||
get() = appCtx.getPrefInt(PreferKey.preDownloadNum, 10)
|
||||
set(value) {
|
||||
|
||||
@@ -29,6 +29,8 @@ object AppWebDav {
|
||||
private val bookProgressUrl = "${rootWebDavUrl}bookProgress/"
|
||||
private val zipFilePath = "${appCtx.externalFiles.absolutePath}${File.separator}backup.zip"
|
||||
|
||||
val syncBookProgress get() = appCtx.getPrefBoolean(PreferKey.syncBookProgress, true)
|
||||
|
||||
var isOk = false
|
||||
|
||||
init {
|
||||
@@ -167,7 +169,7 @@ object AppWebDav {
|
||||
|
||||
fun uploadBookProgress(book: Book) {
|
||||
if (!isOk) return
|
||||
if (!AppConfig.syncBookProgress) return
|
||||
if (!syncBookProgress) return
|
||||
if (!NetworkUtils.isAvailable()) return
|
||||
Coroutine.async {
|
||||
val bookProgress = BookProgress(book)
|
||||
|
||||
@@ -168,7 +168,7 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
|
||||
book: Book,
|
||||
alertSync: ((progress: BookProgress) -> Unit)? = null
|
||||
) {
|
||||
if (AppConfig.syncBookProgress)
|
||||
if (AppWebDav.syncBookProgress)
|
||||
execute {
|
||||
AppWebDav.getBookProgress(book)
|
||||
}.onSuccess {
|
||||
|
||||
Reference in New Issue
Block a user