Add required user info keys to user activities.

This commit is contained in:
Maurice Parker 2019-10-19 18:21:58 -05:00
parent 575b875afa
commit ee3a767cf7
1 changed files with 9 additions and 3 deletions

View File

@ -68,7 +68,9 @@ class ActivityManager {
let title = NSString.localizedStringWithFormat(localizedText as NSString, folder.nameForDisplay) as String let title = NSString.localizedStringWithFormat(localizedText as NSString, folder.nameForDisplay) as String
selectingActivity = makeSelectingActivity(type: ActivityType.selectFolder, title: title, identifier: ActivityManager.identifer(for: folder)) selectingActivity = makeSelectingActivity(type: ActivityType.selectFolder, title: title, identifier: ActivityManager.identifer(for: folder))
selectingActivity!.userInfo = folder.deepLinkUserInfo let userInfo = folder.deepLinkUserInfo
selectingActivity!.userInfo = userInfo
selectingActivity!.requiredUserInfoKeys = Set(userInfo.keys.map { $0 as! String })
donate(selectingActivity!) donate(selectingActivity!)
} }
@ -79,7 +81,9 @@ class ActivityManager {
let title = NSString.localizedStringWithFormat(localizedText as NSString, feed.nameForDisplay) as String let title = NSString.localizedStringWithFormat(localizedText as NSString, feed.nameForDisplay) as String
selectingActivity = makeSelectingActivity(type: ActivityType.selectFeed, title: title, identifier: ActivityManager.identifer(for: feed)) selectingActivity = makeSelectingActivity(type: ActivityType.selectFeed, title: title, identifier: ActivityManager.identifer(for: feed))
selectingActivity!.userInfo = feed.deepLinkUserInfo let userInfo = feed.deepLinkUserInfo
selectingActivity!.userInfo = userInfo
selectingActivity!.requiredUserInfoKeys = Set(userInfo.keys.map { $0 as! String })
updateSelectingActivityFeedSearchAttributes(with: feed) updateSelectingActivityFeedSearchAttributes(with: feed)
donate(selectingActivity!) donate(selectingActivity!)
} }
@ -195,7 +199,9 @@ private extension ActivityManager {
func makeReadArticleActivity(_ article: Article) -> NSUserActivity { func makeReadArticleActivity(_ article: Article) -> NSUserActivity {
let activity = NSUserActivity(activityType: ActivityType.readArticle.rawValue) let activity = NSUserActivity(activityType: ActivityType.readArticle.rawValue)
activity.title = article.title activity.title = article.title
activity.userInfo = article.deepLinkUserInfo let userInfo = article.deepLinkUserInfo
activity.userInfo = userInfo
activity.requiredUserInfoKeys = Set(userInfo.keys.map { $0 as! String })
activity.isEligibleForHandoff = true activity.isEligibleForHandoff = true
#if os(iOS) #if os(iOS)