pull/68/head^2
kunfei 5 years ago
parent 4e0aa15551
commit 61345f3b67
  1. 12
      app/src/main/java/io/legado/app/ui/config/WebDavConfigFragment.kt
  2. 12
      app/src/main/java/io/legado/app/ui/main/MainActivity.kt

@ -124,9 +124,7 @@ class WebDavConfigFragment : PreferenceFragmentCompat(),
private 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(requireContext(), uri)
if (doc?.canWrite() == true) {
@ -136,6 +134,8 @@ class WebDavConfigFragment : PreferenceFragmentCompat(),
} else {
selectBackupFolder()
}
} else {
selectBackupFolder()
}
}
@ -161,9 +161,7 @@ class WebDavConfigFragment : PreferenceFragmentCompat(),
launch {
if (!WebDavHelp.showRestoreDialog(requireContext())) {
val backupPath = getPrefString(PreferKey.backupPath)
if (backupPath?.isEmpty() == true) {
selectRestoreFolder()
} else {
if (backupPath?.isNotEmpty() == true) {
val uri = Uri.parse(backupPath)
val doc = DocumentFile.fromTreeUri(requireContext(), uri)
if (doc?.canWrite() == true) {
@ -172,6 +170,8 @@ class WebDavConfigFragment : PreferenceFragmentCompat(),
} else {
selectBackupFolder()
}
} else {
selectRestoreFolder()
}
}
}

@ -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()
}
}
}

Loading…
Cancel
Save