|
|
|
@ -32,9 +32,7 @@ object Backup { |
|
|
|
|
val lastBackup = context.getPrefLong(PreferKey.lastBackup) |
|
|
|
|
if (lastBackup + TimeUnit.DAYS.toMillis(1) < System.currentTimeMillis()) { |
|
|
|
|
Coroutine.async { |
|
|
|
|
context.getPrefString(PreferKey.backupPath)?.let { |
|
|
|
|
backup(context, it, true) |
|
|
|
|
} |
|
|
|
|
backup(context, context.getPrefString(PreferKey.backupPath) ?: "", true) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -70,12 +68,16 @@ object Backup { |
|
|
|
|
WebDavHelp.backUpWebDav(backupPath) |
|
|
|
|
if (path.isContentPath()) { |
|
|
|
|
copyBackup(context, Uri.parse(path), isAuto) |
|
|
|
|
} else { |
|
|
|
|
if (path.isEmpty()) { |
|
|
|
|
copyBackup(context.getExternalFilesDir(null)!!, false) |
|
|
|
|
} else { |
|
|
|
|
copyBackup(File(path), isAuto) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun writeListToJson(list: List<Any>, fileName: String, path: String) { |
|
|
|
|
if (list.isNotEmpty()) { |
|
|
|
|