pull/2424/merge
nashaofu 4 months ago committed by GitHub
commit 0b2d61388b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,6 @@
---
"dialog": patch
"dialog-js": patch
---
Set `save` dialog mime type from the `filters` extensions on Android.

@ -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"))
} }

Loading…
Cancel
Save