From 4f200ec3bb1a8160764a1024f699097770fbb251 Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 3 Mar 2020 22:35:21 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/help/storage/SyncBookProgress.kt | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) 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 + ) + } } } }