pull/1649/head
kunfei 3 years ago
parent abd8bc046c
commit 32aad5aecd
  1. 4
      app/src/main/assets/updateLog.md
  2. 18
      app/src/main/java/io/legado/app/help/storage/Backup.kt

@ -11,6 +11,10 @@
* 正文出现缺字漏字、内容缺失、排版错乱等情况,有可能是净化规则或简繁转换出现问题。
* 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源!
**2022/02/26**
* 自动备份检测到webDav已有备份时不会重复备份
**2022/02/25**
* 修复排版导入不能导入背景图片的bug

@ -52,7 +52,9 @@ object Backup : BackupRestore() {
if (lastBackup + TimeUnit.DAYS.toMillis(1) < System.currentTimeMillis()) {
Coroutine.async {
if (!AppWebDav.hasBackUp()) {
backup(context, context.getPrefString(PreferKey.backupPath) ?: "", true)
backup(context, context.getPrefString(PreferKey.backupPath), true)
} else {
context.putPrefLong(PreferKey.lastBackup, System.currentTimeMillis())
}
}.onError {
AppLog.put("备份出错\n${it.localizedMessage}", it)
@ -61,7 +63,7 @@ object Backup : BackupRestore() {
}
}
suspend fun backup(context: Context, path: String, isAuto: Boolean = false) {
suspend fun backup(context: Context, path: String?, isAuto: Boolean = false) {
context.putPrefLong(PreferKey.lastBackup, System.currentTimeMillis())
withContext(IO) {
FileUtils.deleteFile(backupPath)
@ -105,12 +107,14 @@ object Backup : BackupRestore() {
edit.commit()
}
AppWebDav.backUpWebDav(backupPath)
if (path.isContentScheme()) {
copyBackup(context, Uri.parse(path), isAuto)
} else {
if (path.isEmpty()) {
when {
path.isNullOrBlank() -> {
copyBackup(context.getExternalFilesDir(null)!!, false)
} else {
}
path.isContentScheme() -> {
copyBackup(context, Uri.parse(path), isAuto)
}
else -> {
copyBackup(File(path), isAuto)
}
}

Loading…
Cancel
Save