Fixed missing permission for rotate on external memory (#2236)

This commit is contained in:
Agnieszka C
2021-11-06 10:41:14 +01:00
parent e849c6f7c0
commit 57020626db

View File

@@ -308,11 +308,12 @@ class MediaAdapter(
} }
private fun rotateSelection(degrees: Int) { private fun rotateSelection(degrees: Int) {
activity.toast(R.string.saving)
ensureBackgroundThread {
val paths = getSelectedPaths().filter { it.isImageFast() } val paths = getSelectedPaths().filter { it.isImageFast() }
var fileCnt = paths.size var fileCnt = paths.size
rotatedImagePaths.clear() rotatedImagePaths.clear()
val handleRotate = {
activity.toast(R.string.saving)
ensureBackgroundThread {
paths.forEach { paths.forEach {
rotatedImagePaths.add(it) rotatedImagePaths.add(it)
activity.saveRotatedImageToFile(it, it, degrees, true) { activity.saveRotatedImageToFile(it, it, degrees, true) {
@@ -328,6 +329,17 @@ class MediaAdapter(
} }
} }
if (paths.any { activity.needsStupidWritePermissions(it) }) {
activity.handleSAFDialog(paths.first { activity.needsStupidWritePermissions(it) }) {
if (it) {
handleRotate()
}
}
} else {
handleRotate()
}
}
private fun moveFilesTo() { private fun moveFilesTo() {
activity.handleDeletePasswordProtection { activity.handleDeletePasswordProtection {
copyMoveTo(false) copyMoveTo(false)