|
|
@ -119,8 +119,7 @@ public class FilePickerController: NSObject {
|
|
|
|
extension FilePickerController: UIDocumentPickerDelegate {
|
|
|
|
extension FilePickerController: UIDocumentPickerDelegate {
|
|
|
|
public func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
|
|
|
|
public func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL]) {
|
|
|
|
do {
|
|
|
|
do {
|
|
|
|
let temporaryUrls = try urls.map { try saveTemporaryFile($0) }
|
|
|
|
self.plugin.onFilePickerEvent(.selected(urls))
|
|
|
|
self.plugin.onFilePickerEvent(.selected(temporaryUrls))
|
|
|
|
|
|
|
|
} catch {
|
|
|
|
} catch {
|
|
|
|
self.plugin.onFilePickerEvent(.error("Failed to create a temporary copy of the file"))
|
|
|
|
self.plugin.onFilePickerEvent(.error("Failed to create a temporary copy of the file"))
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -149,8 +148,7 @@ extension FilePickerController: UIImagePickerControllerDelegate, UINavigationCon
|
|
|
|
dismissViewController(picker) {
|
|
|
|
dismissViewController(picker) {
|
|
|
|
if let url = info[.mediaURL] as? URL {
|
|
|
|
if let url = info[.mediaURL] as? URL {
|
|
|
|
do {
|
|
|
|
do {
|
|
|
|
let temporaryUrl = try self.saveTemporaryFile(url)
|
|
|
|
self.plugin.onFilePickerEvent(.selected([url]))
|
|
|
|
self.plugin.onFilePickerEvent(.selected([temporaryUrl]))
|
|
|
|
|
|
|
|
} catch {
|
|
|
|
} catch {
|
|
|
|
self.plugin.onFilePickerEvent(.error("Failed to create a temporary copy of the file"))
|
|
|
|
self.plugin.onFilePickerEvent(.error("Failed to create a temporary copy of the file"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|