in FilePicker.swift. Because the async function result.itemProvider.loadFileRepresentation(forTypeIdentifier: UTType.image.identifier, completionHandler: {
is randomly finished - means one image could have a longer time etc.
Fix:
// for-in with index:
for (index, result) in results.enumerated() {
// set count:
var temporaryUrls = Array<URL?>(repeating: nil, count: results.count)
...
// add index at the right position:
let temporaryUrl = try self.saveTemporaryFile(url)
temporaryUrls[index] = temporaryUrl
// set the final right sorted urls
let finalUrls = temporaryUrls.compactMap { $0 }
self.plugin?.handleDocumentPickerResult(urls: finalUrls, error: nil)
Plugin(s)
Version
5.0.0
Platform(s)
Current behavior
if i execute pickImages the end selection is not correct. If i use the ordered param - the selection is always random.
Expected behavior
if i select the images without ordered - it should be sorted by date, if i select with .ordered param, it should have the exact order
Reproduction
-
Steps to reproduce
Other information
The problem is following:
temporaryUrls.append(temporaryUrl)
in FilePicker.swift. Because the async function
result.itemProvider.loadFileRepresentation(forTypeIdentifier: UTType.image.identifier, completionHandler: {
is randomly finished - means one image could have a longer time etc.Fix:
Capacitor doctor
-
Before submitting