Share string with subject and URL instead of plain URL for Omnifocus and Things

This commit is contained in:
Martin Hartl 2020-01-05 07:36:30 +01:00
parent a405951f6d
commit 12731c2e39
1 changed files with 12 additions and 1 deletions

View File

@ -23,9 +23,20 @@ class ArticleActivityItemSource: NSObject, UIActivityItemSource {
} }
func activityViewController(_ activityViewController: UIActivityViewController, itemForActivityType activityType: UIActivity.ActivityType?) -> Any? { func activityViewController(_ activityViewController: UIActivityViewController, itemForActivityType activityType: UIActivity.ActivityType?) -> Any? {
guard let activityType = activityType,
let subject = subject else {
return url return url
} }
switch activityType.rawValue {
case "com.omnigroup.OmniFocus3.iOS.QuickEntry",
"com.culturedcode.ThingsiPhone.ShareExtension":
return "\(subject)\n\(url)"
default:
return url
}
}
func activityViewController(_ activityViewController: UIActivityViewController, subjectForActivityType activityType: UIActivity.ActivityType?) -> String { func activityViewController(_ activityViewController: UIActivityViewController, subjectForActivityType activityType: UIActivity.ActivityType?) -> String {
return subject ?? "" return subject ?? ""
} }