Compare commits
2 Commits
c17cf460d7
...
a12afb8dc2
Author | SHA1 | Date |
---|---|---|
Shadowfacts | a12afb8dc2 | |
Shadowfacts | de1a97d357 |
|
@ -7,7 +7,14 @@
|
||||||
<key>NSExtensionAttributes</key>
|
<key>NSExtensionAttributes</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSExtensionActivationRule</key>
|
<key>NSExtensionActivationRule</key>
|
||||||
<string>TRUEPREDICATE</string>
|
<dict>
|
||||||
|
<key>NSExtensionActivationSupportsImageWithMaxCount</key>
|
||||||
|
<integer>4</integer>
|
||||||
|
<key>NSExtensionActivationSupportsMovieWithMaxCount</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<key>NSExtensionMainStoryboard</key>
|
<key>NSExtensionMainStoryboard</key>
|
||||||
<string>MainInterface</string>
|
<string>MainInterface</string>
|
||||||
|
|
|
@ -84,12 +84,23 @@ class ShareViewController: UIViewController {
|
||||||
}
|
}
|
||||||
} else if let text: NSString = await getObject(from: itemProvider) {
|
} else if let text: NSString = await getObject(from: itemProvider) {
|
||||||
return ("\n\n\(text)", [])
|
return ("\n\n\(text)", [])
|
||||||
} else if let attachment: DraftAttachment = await getObject(from: itemProvider) {
|
|
||||||
return ("", [attachment])
|
|
||||||
} else if let attributedContent = inputItem.attributedContentText {
|
} else if let attributedContent = inputItem.attributedContentText {
|
||||||
return ("\n\n\(attributedContent.string)", [])
|
return ("\n\n\(attributedContent.string)", [])
|
||||||
} else {
|
} else {
|
||||||
return ("", [])
|
let attachments = await withTaskGroup(of: DraftAttachment?.self, returning: [DraftAttachment].self) { group in
|
||||||
|
for provider in inputItem.attachments! {
|
||||||
|
group.addTask { @MainActor in
|
||||||
|
await self.getObject(from: provider)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return await group.reduce(into: [], { partialResult, result in
|
||||||
|
if let result {
|
||||||
|
partialResult.append(result)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return ("", attachments)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue