Fix not being able to share images from Shortcuts actions that have public.image and public.file-url representations
Closes #420
This commit is contained in:
parent
0eb000224e
commit
7f12479514
|
@ -79,7 +79,14 @@ class ShareViewController: UIViewController {
|
|||
var attachments: [DraftAttachment] = []
|
||||
|
||||
for itemProvider in inputItem.attachments ?? [] {
|
||||
if let attached: NSURL = await getObject(from: itemProvider) {
|
||||
// attachments have the highest priority, but only given this heuristic
|
||||
// otherwise attachment decoding ends up being overzealous
|
||||
let likelyAttachment = [UTType.image, .movie].contains(where: { itemProvider.hasItemConformingToTypeIdentifier($0.identifier) })
|
||||
|
||||
if likelyAttachment,
|
||||
let attachment: DraftAttachment = await getObject(from: itemProvider) {
|
||||
attachments.append(attachment)
|
||||
} else if let attached: NSURL = await getObject(from: itemProvider) {
|
||||
if url == nil {
|
||||
url = attached as URL
|
||||
}
|
||||
|
@ -87,8 +94,6 @@ class ShareViewController: UIViewController {
|
|||
if text.isEmpty {
|
||||
text = s as String
|
||||
}
|
||||
} else if let attachment: DraftAttachment = await getObject(from: itemProvider) {
|
||||
attachments.append(attachment)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue