From 4e0aa155510e10212bbbea3be6a3a87627d0d1e6 Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 6 Jan 2020 21:48:12 +0800 Subject: [PATCH] up --- .../legado/app/ui/config/WebDavConfigFragment.kt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/config/WebDavConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/WebDavConfigFragment.kt index 490b82e67..0f70be7ef 100644 --- a/app/src/main/java/io/legado/app/ui/config/WebDavConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/WebDavConfigFragment.kt @@ -130,7 +130,9 @@ class WebDavConfigFragment : PreferenceFragmentCompat(), val uri = Uri.parse(backupPath) val doc = DocumentFile.fromTreeUri(requireContext(), uri) if (doc?.canWrite() == true) { - Backup.backup(requireContext(), uri) + launch { + Backup.backup(requireContext(), uri) + } } else { selectBackupFolder() } @@ -146,7 +148,11 @@ class WebDavConfigFragment : PreferenceFragmentCompat(), PermissionsCompat.Builder(this) .addPermissions(*Permissions.Group.STORAGE) .rationale(R.string.tip_perm_request_storage) - .onGranted { Backup.backup(requireContext(), null) } + .onGranted { + launch { + Backup.backup(requireContext(), null) + } + } .request() } } @@ -300,7 +306,9 @@ class WebDavConfigFragment : PreferenceFragmentCompat(), Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION ) putPrefString(PreferKey.backupPath, uri.toString()) - Backup.backup(requireContext(), uri) + launch { + Backup.backup(requireContext(), uri) + } } } restoreSelectRequestCode -> if (resultCode == RESULT_OK) {