Skip to content

Commit

Permalink
fix: Simplify which apps may respond
Browse files Browse the repository at this point in the history
  • Loading branch information
jlacivita committed Jan 11, 2024
1 parent 161314e commit b21b03f
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions requirements/specifications/intents/user-interest.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ track of which apps are using them separately.
- [4. User Interest from a platform UX](#4-user-interest-from-a-platform-ux)
- [5. User Interest Bulk Updates](#5-user-interest-bulk-updates)
- [6. Core SDK APIs](#6-core-sdk-apis)
- [6.1. InterestType](#61-interesttype)
- [6.1. Discovery.interested](#61-discoveryinterested)
- [6.2. Discovery Interest Provider](#62-discovery-interest-provider)
- [6.3. InterestIntent](#63-interestintent)
Expand Down Expand Up @@ -140,27 +141,25 @@ EntityInfo, which is returned as the result to the pending

![](../../../requirements/images/specifications/intents/user-interest/media/image4.png)

A user\'s intention to express interest in something is handled by the
A user's intention to express interest in something is handled by the
`InterestIntent`. This intent happens *before* the platform knows which
content is displayed and/or selected by the foreground or background
apps. The `InterestIntent` may originate from a cloud system, e.g.
Voice, or from the RCU, or elsewhere. Origination of this intent is out
content is displayed and/or selected by the foreground app. The
`InterestIntent` may originate from a cloud system, e.g. Voice, or from the RCU, or elsewhere. Origination of this intent is out
of scope for this document. This intent includes the type of interest,
e.g. interest or disinterest.

To fire an `InterestIntent` to the current App, another app, typically
the Aggregated Experience, will call the `Content.interest()` method
of the Discovery SDK. This generates a new intent.
the Aggregated Experience, will call the `Content.interesting()` method
of the Discovery SDK.

When this intent occurs, any App in the foreground or background
Lifecycle state, that has registered a callback via the
`Discovery.interested` API **MUST** have that callback invoked with the
`InterestIntent` as the only parameter.
When `Content.interesting` is called, if the App in the foreground
Lifecycle state has registered a provider for the `xrn:firebolt:capability:discovery:interest` capability, then it **MUST** have that provider invoked with the values from the
`Content.interesting` call.

Once an App\'s callback is invoked, that app will have `interestTimeout`
Once an App's callback is invoked, that app will have `interestTimeout`
milliseconds to return a value or throw an error. Values returned after
that time **MUST** be ignored. The timeout value is stored in the
device\'s configuration manifest.
device's configuration manifest.

To be notified when a user expresses interest in the currently displayed
content, an App **MUST** provide the
Expand All @@ -173,11 +172,8 @@ App **MUST** return the currently displayed entity meta-data.
If there is no valid entity to return, then the method **MUST** throw an
exception.

If more than one App returns a valid `EntityInfo`, the value from the
App in the foreground **MUST** be used, and the others will be ignored.
If only one is returned, then it may come from the foreground or
background app. See
[Lifecycle](../lifecycle/) for more info on Lifecycle states.
If the foreground App returns a valid `EntityInfo` before the timeout,
then, the value from the **MUST** be used.

Once a single `EntityInfo` is selected the platform **MUST** dispatch a
`Content.onInterestedIn` notification to all Apps that have registered
Expand Down Expand Up @@ -205,6 +201,12 @@ in on a different platform, is not supported.
The following APIs are exposed by the Firebolt Core SDK as part of the
`Discovery` module.

### 6.1. InterestType
This is an enum with the following values:

- `"interest"`
- `"disinterest"`

### 6.1. Discovery.interested

This is a push API that allows Apps to push entities that the user has
Expand All @@ -224,7 +226,7 @@ provider:

```typescript
interface IDiscoveryInterestProvider {
function interested(type: InterestIntent): Promise<EntityInfo>
function interested(type: InterestType): Promise<EntityInfo>
}

Discovery.provide("xrn:firbolt:capability:discovery:interest", IDiscoveryInterestProvider)
Expand All @@ -247,15 +249,14 @@ type InterestIntent {
}
```
## 7. Manage SDK APIs
The following APIs are exposed by the Firebolt Core SDK as part of the
`Content` module.
### 7.1. Content.interesting
This method triggers the corresponding Discovery provider API for the
foreground and/or background app.
foreground app.
```typescript
Content.interesting(type: InterestType): Promise<EntityInfo>
Expand Down

0 comments on commit b21b03f

Please sign in to comment.