Skip to content

Commit

Permalink
WIP prediction activity eligibility
Browse files Browse the repository at this point in the history
  • Loading branch information
marcpalmer committed Jun 5, 2018
1 parent afcbc40 commit 9261653
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion FlintCore/Activities/ActivityEligibility.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ public enum ActivityEligibility {
case handoff

/// Specify this to also register for Spotlight search when the activity is published.
/// - note: This is unusual. Normally you will index items for spotlight using Spotlight APIs.
/// - note: Normally you will index items for spotlight using Spotlight APIs.
case search

/// Specify this if the activity refers to publicly accessible content that should be indexed.
/// - note: This requires a public web URL is set on the activity
case publicIndexing

/// Allow the activity to qualify for Siri prediction
case prediction
}
6 changes: 6 additions & 0 deletions FlintCore/Activities/PublishCurrentActionActivityAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ final class PublishCurrentActionActivityAction: Action {
activity.isEligibleForHandoff = activityTypes.contains(.handoff)
activity.isEligibleForPublicIndexing = activityTypes.contains(.publicIndexing)

#if os(iOS) || os(watchOS)
if #available(iOS 12, watchOS 5, *) {
activity.isEligibleForPrediction = activityTypes.contains(.prediction)
}
#endif

// If the action provides some extra data, use this. Note that the prepareFunction has already been
// essentially "curried" to capture the original `input` of the action being published.
guard let preparedActivity = context.input.prepareFunction(activity) else {
Expand Down

0 comments on commit 9261653

Please sign in to comment.