pull/34/head
kunfei 5 years ago
parent d763cfe180
commit 170c7004b3
  1. 9
      app/src/main/java/io/legado/app/help/storage/Backup.kt
  2. 10
      app/src/main/java/io/legado/app/help/storage/WebDavHelp.kt

@ -1,6 +1,5 @@
package io.legado.app.help.storage
import androidx.appcompat.app.AppCompatActivity
import io.legado.app.App
import io.legado.app.R
import io.legado.app.help.FileHelp
@ -27,21 +26,21 @@ object Backup {
backupRssSource(path)
backupReplaceRule(path)
backupPreference(path)
WebDavHelp.backUpWebDav()
WebDavHelp.backUpWebDav(path)
uiThread {
App.INSTANCE.toast(R.string.backup_success)
}
}
}
fun autoBackup(activity: AppCompatActivity) {
fun autoBackup() {
doAsync {
val path = defaultPath
val path = defaultPath + File.separator + "autoBackup"
backupBookshelf(path)
backupBookSource(path)
backupRssSource(path)
backupReplaceRule(path)
WebDavHelp.backUpWebDav()
WebDavHelp.backUpWebDav(path)
}
}

@ -78,13 +78,13 @@ object WebDavHelp {
}
}
fun backUpWebDav() {
fun backUpWebDav(path: String) {
if (initWebDav()) {
val paths = arrayListOf<String>()
paths.add(Backup.defaultPath + File.separator + "bookshelf.json")
paths.add(Backup.defaultPath + File.separator + "bookSource.json")
paths.add(Backup.defaultPath + File.separator + "rssSource.json")
paths.add(Backup.defaultPath + File.separator + "replaceRule.json")
paths.add(path + File.separator + "bookshelf.json")
paths.add(path + File.separator + "bookSource.json")
paths.add(path + File.separator + "rssSource.json")
paths.add(path + File.separator + "replaceRule.json")
FileHelp.deleteFile(zipFilePath)
if (ZipUtils.zipFiles(paths, zipFilePath)) {
WebDav(getWebDavUrl() + "legado").makeAsDir()

Loading…
Cancel
Save