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