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 3e89dd2e2..f40091b0f 100644 --- a/app/src/main/java/io/legado/app/constant/PreferKey.kt +++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt @@ -33,7 +33,7 @@ object PreferKey { const val webDavAccount = "web_dav_account" const val webDavPassword = "web_dav_password" const val webDavCreateDir = "webDavCreateDir" - const val webDavExport = "webDavExport" + const val webDavCacheBackup = "webDavCacheBackup" const val changeSourceLoadToc = "changeSourceLoadToc" const val chineseConverterType = "chineseConverterType" const val launcherIcon = "launcherIcon" diff --git a/app/src/main/java/io/legado/app/help/storage/WebDavHelp.kt b/app/src/main/java/io/legado/app/help/storage/WebDavHelp.kt index 327ed5fda..407bcf2c5 100644 --- a/app/src/main/java/io/legado/app/help/storage/WebDavHelp.kt +++ b/app/src/main/java/io/legado/app/help/storage/WebDavHelp.kt @@ -125,13 +125,13 @@ object WebDavHelp { fun exportWebDav(path: String, fileName: String) { try { if (initWebDav()) { - //默认导出到legado文件夹下exports目录 + // 默认导出到legado文件夹下exports目录 val exportsWebDavUrl = rootWebDavUrl + EncoderUtils.escape("exports") + "/" - //在legado文件夹创建exports目录,如果不存在的话 + // 在legado文件夹创建exports目录,如果不存在的话 WebDav(exportsWebDavUrl).makeAsDir() val file = File("${path}${File.separator}${fileName}") - //如果导出的本地文件存在,开始上传 - if(file.exists()){ + // 如果导出的本地文件存在,开始上传 + if(file.exists()) { val putUrl = exportsWebDavUrl + fileName WebDav(putUrl).upload("${path}${File.separator}${fileName}") } diff --git a/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt b/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt index afc78bc37..52e26862c 100644 --- a/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt @@ -40,15 +40,14 @@ class CacheViewModel(application: Application) : BaseViewModel(application) { val content = getAllContents(book) DocumentUtils.createFileIfNotExist(doc, filename) ?.writeText(context, content) - if(App.INSTANCE.getPrefBoolean(PreferKey.webDavExport,false)) { - //写出文件到cache目录 + if(App.INSTANCE.getPrefBoolean(PreferKey.webDavCacheBackup,false)) { FileUtils.createFileIfNotExist( File(FileUtils.getCachePath()), filename - ).writeText(content) - //导出到webdav + ).writeText(content) // 写出文件到cache目录 + // 导出到webdav WebDavHelp.exportWebDav(FileUtils.getCachePath(), filename) - //上传完删除cache文件 + // 上传完删除cache文件 FileUtils.deleteFile("${FileUtils.getCachePath()}${File.separator}${filename}") } App.db.bookChapterDao().getChapterList(book.bookUrl).forEach { chapter -> @@ -79,8 +78,8 @@ class CacheViewModel(application: Application) : BaseViewModel(application) { val filename = "${book.name} by ${book.author}.txt" FileUtils.createFileIfNotExist(file, filename) .writeText(getAllContents(book)) - if(App.INSTANCE.getPrefBoolean(PreferKey.webDavExport,false)) { - WebDavHelp.exportWebDav(file.absolutePath, filename)//导出到webdav + if(App.INSTANCE.getPrefBoolean(PreferKey.webDavCacheBackup,false)) { + WebDavHelp.exportWebDav(file.absolutePath, filename) // 导出到webdav } App.db.bookChapterDao().getChapterList(book.bookUrl).forEach { chapter -> BookHelp.getContent(book, chapter).let { content -> diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index eac3f655b..8ad97bc38 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -10,8 +10,8 @@ 導入閲讀數據 創建子文件夾 創建 legado 文件夾作爲備份路徑 - 離線導出WebDav - 默認導出到legado文件夾下exports目錄 + 離線緩存書籍備份 + 導出本地同時備份到legado文件夾下exports目錄 備份路徑 導入舊版數據 導入 Github 數據 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 25fe6e740..d83bd8552 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -10,8 +10,8 @@ 匯入閱讀資料 建立子資料夾 建立legado資料夾作為備份資料夾 - 離線導出WebDav - 默認導出到legado文件夾下exports目錄 + 離線緩存書籍備份 + 導出本地同時備份到legado文件夾下exports目錄 備份路徑 匯入舊版資料 匯入Github資料 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 8981f1707..8f0068f33 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -10,8 +10,8 @@ 导入阅读数据 创建子文件夹 创建legado文件夹作为备份文件夹 - 离线导出WebDav - 默认导出到legado文件夹下exports目录 + 离线缓存书籍备份 + 导出本地同时备份到legado文件夹下exports目录 备份路径 请选择备份路径 导入旧版数据 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index be20fce1e..adbda6a61 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -10,8 +10,8 @@ Import Legado data Create a subfolder Create a folder named Legado as the backup folder. - Export Webdav - Default export to the exports directory under the legado folder + Offline cache book backup + Export to local and back up to the exports directory under the legado folder Backup to Please select a backup path. Import legacy data diff --git a/app/src/main/res/xml/pref_config_backup.xml b/app/src/main/res/xml/pref_config_backup.xml index 1d0ee0a9d..dc5ec4f37 100644 --- a/app/src/main/res/xml/pref_config_backup.xml +++ b/app/src/main/res/xml/pref_config_backup.xml @@ -39,8 +39,8 @@