|
|
|
@ -31,14 +31,13 @@ object Backup { |
|
|
|
|
fun autoBack(context: Context) { |
|
|
|
|
val lastBackup = context.getPrefLong(PreferKey.lastBackup) |
|
|
|
|
if (lastBackup + TimeUnit.DAYS.toMillis(1) < System.currentTimeMillis()) { |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
Coroutine.async { |
|
|
|
|
context.getPrefString(PreferKey.backupPath)?.let { |
|
|
|
|
backup(context, it, true) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
suspend fun backup(context: Context, path: String, isAuto: Boolean = false) { |
|
|
|
|
context.putPrefLong(PreferKey.lastBackup, System.currentTimeMillis()) |
|
|
|
|