FilePicker: Fix error when multiple images are returned from Documents based picker (#6033)

* FilePicker: Correctly handle Documents result

* Empty commit to re-trigger CI checks
This commit is contained in:
Tanmay Gupta 2024-12-15 17:51:30 +05:30 committed by GitHub
parent a933b92efa
commit e8970ab7f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -263,17 +263,8 @@ object FilePicker : Constants {
) { ) {
if (result.resultCode == Activity.RESULT_OK && !isPhoto(result.data)) { if (result.resultCode == Activity.RESULT_OK && !isPhoto(result.data)) {
try { try {
val photoPath = result.data?.data val files = getFilesFromGalleryPictures(result.data, activity)
val photoFile = PickedFiles.pickedExistingPicture(activity, photoPath!!) callbacks.onImagesPicked(files, ImageSource.DOCUMENTS, restoreType(activity))
callbacks.onImagesPicked(
singleFileList(photoFile),
ImageSource.DOCUMENTS,
restoreType(activity)
)
if (configuration(activity).shouldCopyPickedImagesToPublicGalleryAppFolder()) {
PickedFiles.copyFilesInSeparateThread(activity, singleFileList(photoFile))
}
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
callbacks.onImagePickerError(e, ImageSource.DOCUMENTS, restoreType(activity)) callbacks.onImagePickerError(e, ImageSource.DOCUMENTS, restoreType(activity))