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