diff --git a/app/src/main/java/io/legado/app/help/storage/SyncBookProgress.kt b/app/src/main/java/io/legado/app/help/storage/SyncBookProgress.kt index ee8bba384..b95344144 100644 --- a/app/src/main/java/io/legado/app/help/storage/SyncBookProgress.kt +++ b/app/src/main/java/io/legado/app/help/storage/SyncBookProgress.kt @@ -30,16 +30,18 @@ object SyncBookProgress { fun downloadBookProgress() { Coroutine.async { - WebDav(webDavUrl).downloadTo(file.absolutePath, true) - if (file.exists()) { - val json = file.readText() - GSON.fromJsonArray(json)?.forEach { - App.db.bookDao().upBookProgress( - it.bookUrl, - it.durChapterIndex, - it.durChapterPos, - it.durChapterTime - ) + if (WebDavHelp.initWebDav()) { + WebDav(webDavUrl).downloadTo(file.absolutePath, true) + if (file.exists()) { + val json = file.readText() + GSON.fromJsonArray(json)?.forEach { + App.db.bookDao().upBookProgress( + it.bookUrl, + it.durChapterIndex, + it.durChapterPos, + it.durChapterTime + ) + } } } }