|
|
@ -155,9 +155,7 @@ class MainActivity : VMBaseActivity<MainViewModel>(R.layout.activity_main), |
|
|
|
|
|
|
|
|
|
|
|
fun backup() { |
|
|
|
fun backup() { |
|
|
|
val backupPath = getPrefString(PreferKey.backupPath) |
|
|
|
val backupPath = getPrefString(PreferKey.backupPath) |
|
|
|
if (backupPath?.isEmpty() == true) { |
|
|
|
if (backupPath?.isNotEmpty() == true) { |
|
|
|
selectBackupFolder() |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
val uri = Uri.parse(backupPath) |
|
|
|
val uri = Uri.parse(backupPath) |
|
|
|
val doc = DocumentFile.fromTreeUri(this, uri) |
|
|
|
val doc = DocumentFile.fromTreeUri(this, uri) |
|
|
|
if (doc?.canWrite() == true) { |
|
|
|
if (doc?.canWrite() == true) { |
|
|
@ -167,6 +165,8 @@ class MainActivity : VMBaseActivity<MainViewModel>(R.layout.activity_main), |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
selectBackupFolder() |
|
|
|
selectBackupFolder() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
selectBackupFolder() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -174,9 +174,7 @@ class MainActivity : VMBaseActivity<MainViewModel>(R.layout.activity_main), |
|
|
|
launch { |
|
|
|
launch { |
|
|
|
if (!WebDavHelp.showRestoreDialog(this@MainActivity)) { |
|
|
|
if (!WebDavHelp.showRestoreDialog(this@MainActivity)) { |
|
|
|
val backupPath = getPrefString(PreferKey.backupPath) |
|
|
|
val backupPath = getPrefString(PreferKey.backupPath) |
|
|
|
if (backupPath?.isEmpty() == true) { |
|
|
|
if (backupPath?.isNotEmpty() == true) { |
|
|
|
selectRestoreFolder() |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
val uri = Uri.parse(backupPath) |
|
|
|
val uri = Uri.parse(backupPath) |
|
|
|
val doc = DocumentFile.fromTreeUri(this@MainActivity, uri) |
|
|
|
val doc = DocumentFile.fromTreeUri(this@MainActivity, uri) |
|
|
|
if (doc?.canWrite() == true) { |
|
|
|
if (doc?.canWrite() == true) { |
|
|
@ -185,6 +183,8 @@ class MainActivity : VMBaseActivity<MainViewModel>(R.layout.activity_main), |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
selectBackupFolder() |
|
|
|
selectBackupFolder() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
selectRestoreFolder() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|