|
|
@ -130,7 +130,9 @@ class WebDavConfigFragment : PreferenceFragmentCompat(), |
|
|
|
val uri = Uri.parse(backupPath) |
|
|
|
val uri = Uri.parse(backupPath) |
|
|
|
val doc = DocumentFile.fromTreeUri(requireContext(), uri) |
|
|
|
val doc = DocumentFile.fromTreeUri(requireContext(), uri) |
|
|
|
if (doc?.canWrite() == true) { |
|
|
|
if (doc?.canWrite() == true) { |
|
|
|
|
|
|
|
launch { |
|
|
|
Backup.backup(requireContext(), uri) |
|
|
|
Backup.backup(requireContext(), uri) |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
selectBackupFolder() |
|
|
|
selectBackupFolder() |
|
|
|
} |
|
|
|
} |
|
|
@ -146,7 +148,11 @@ class WebDavConfigFragment : PreferenceFragmentCompat(), |
|
|
|
PermissionsCompat.Builder(this) |
|
|
|
PermissionsCompat.Builder(this) |
|
|
|
.addPermissions(*Permissions.Group.STORAGE) |
|
|
|
.addPermissions(*Permissions.Group.STORAGE) |
|
|
|
.rationale(R.string.tip_perm_request_storage) |
|
|
|
.rationale(R.string.tip_perm_request_storage) |
|
|
|
.onGranted { Backup.backup(requireContext(), null) } |
|
|
|
.onGranted { |
|
|
|
|
|
|
|
launch { |
|
|
|
|
|
|
|
Backup.backup(requireContext(), null) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
.request() |
|
|
|
.request() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -300,9 +306,11 @@ class WebDavConfigFragment : PreferenceFragmentCompat(), |
|
|
|
Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION |
|
|
|
Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION |
|
|
|
) |
|
|
|
) |
|
|
|
putPrefString(PreferKey.backupPath, uri.toString()) |
|
|
|
putPrefString(PreferKey.backupPath, uri.toString()) |
|
|
|
|
|
|
|
launch { |
|
|
|
Backup.backup(requireContext(), uri) |
|
|
|
Backup.backup(requireContext(), uri) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
restoreSelectRequestCode -> if (resultCode == RESULT_OK) { |
|
|
|
restoreSelectRequestCode -> if (resultCode == RESULT_OK) { |
|
|
|
data?.data?.let { uri -> |
|
|
|
data?.data?.let { uri -> |
|
|
|
requireContext().contentResolver.takePersistableUriPermission( |
|
|
|
requireContext().contentResolver.takePersistableUriPermission( |
|
|
|