Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

431 Making joinChannel, leaveCurrentChannel and getCurrentChannel functions optional #512

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
* Updated copyright notices ([#467](https://github.com/finos/FDC3/pull/467))
* Adjusted wording in API spec and documentation to acknowledge the possibility of methods of intent resolution other than a resolver UI ([#461](https://github.com/finos/FDC3/pull/461))
* Moved the Icon type definition into the Types documentation page for consistency with other types. ([#493](https://github.com/finos/FDC3/pull/493)
* The `fdc3.joinChannel()`, `fdc3.getCurrentChannel()` and `fdc3.leaveCurrentChannel()` functions have been made optional for FDC3 API compliance, but are recommended through the application of the SHOULD keyword. ([#512](https://github.com/finos/FDC3/pull/512))

### Deprecated
### Fixed
Expand Down
11 changes: 8 additions & 3 deletions docs/api/ref/DesktopAgent.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ interface DesktopAgent {
// channels
getOrCreateChannel(channelId: string): Promise<Channel>;
getSystemChannels(): Promise<Array<Channel>>;
// optional channel management functions
joinChannel(channelId: string) : Promise<void>;
getCurrentChannel() : Promise<Channel | null>;
leaveCurrentChannel() : Promise<void>;
Expand Down Expand Up @@ -201,7 +202,9 @@ A promise resolving to all the intents, their metadata and metadata about the ap
getCurrentChannel() : Promise<Channel | null>;
```

Returns the `Channel` object for the current channel membership. Returns `null` if the app is not joined to a channel.
Optional function that returns the `Channel` object for the current channel membership. In most cases, an application's membership of channels SHOULD be managed via UX provided to the application by the desktop agent, rather than calling this function directly.

Returns `null` if the app is not joined to a channel.


#### Examples
Expand Down Expand Up @@ -289,7 +292,8 @@ const redChannel = systemChannels.find(c => c.id === 'red');
joinChannel(channelId: string) : Promise<void>;
```

Joins the app to the specified channel.
Optional function that joins the app to the specified channel. In most cases, applications SHOULD be joined to channels via UX provided to the application by the desktop agent, rather than calling this function directly.

If an app is joined to a channel, all `fdc3.broadcast` calls will go to the channel, and all listeners assigned via `fdc3.addContextListener` will listen on the channel.

If the channel already contains context that would be passed to context listeners added via `fdc3.addContextListener` then those listeners will be called immediately with that context.
Expand Down Expand Up @@ -321,8 +325,9 @@ fdc3.joinChannel(selectedChannel.id);
leaveCurrentChannel() : Promise<void>;
```

Removes the app from any channel membership. Context broadcast and listening through the top-level `fdc3.broadcast` and `fdc3.addContextListener` will be a no-op when the app is not joined to a channel.
Optional function that removes the app from any channel membership. In most cases, an application's membership of channels SHOULD be managed via UX provided to the application by the desktop agent, rather than calling this function directly.

Context broadcast and listening through the top-level `fdc3.broadcast` and `fdc3.addContextListener` will be a no-op when the app is not joined to a channel.

#### Examples

Expand Down
4 changes: 3 additions & 1 deletion docs/api/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ When an app joins a channel, or adds a context listener when already joined to a

It is possible that a call to join a channel could be rejected. If for example, the desktop agent wanted to implement controls around what data apps can access.

Joining channels in FDC3 is intended to be a behavior initiated by the end user. For example: by color linking or apps being grouped in the same workspace. Most of the time, it is expected that apps will be joined to a channel by mechanisms outside of the app. Always, there SHOULD be a clear UX indicator of what channel an app is joined to.
Joining channels in FDC3 is intended to be a behavior initiated by the end user. For example: by color linking or apps being grouped in the same workspace. Most of the time, it is expected that apps will be joined to a channel by mechanisms outside of the app. To support programmatic management of joined channels and the implementation of channel selector UIs other than those provided outside of the app, Desktop Agent implementations SHOULD provide [`fdc3.joinChannel()`](ref/DesktopAgent#joinchannel), [`fdc3.getCurrentChannel()](ref/DesktopAgent#getcurrentchannel) and [`fdc3.leaveCurrentChannel()`](ref/DesktopAgent#leavecurrentchannel) functions as defined in the [Desktop Agent API reference](ref/DesktopAgent).
kriswest marked this conversation as resolved.
Show resolved Hide resolved

Always, there SHOULD be a clear UX indicator of what channel an app is joined to.
kriswest marked this conversation as resolved.
Show resolved Hide resolved

### The 'global' Channel

Expand Down
9 changes: 6 additions & 3 deletions src/api/DesktopAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ export interface DesktopAgent {
getSystemChannels(): Promise<Array<Channel>>;

/**
* Joins the app to the specified channel.
* Option function that joins the app to the specified channel. In most cases, applications SHOULD be joined to channels via UX provided to the application by the desktop agent, rather than calling this function directly.
kriswest marked this conversation as resolved.
Show resolved Hide resolved
*
* If an app is joined to a channel, all `fdc3.broadcast` calls will go to the channel, and all listeners assigned via `fdc3.addContextListener` will listen on the channel.
* If the channel already contains context that would be passed to context listeners assed via `fdc3.addContextListener` then those listeners will be called immediately with that context.
* An app can only be joined to one channel at a time.
Expand All @@ -219,13 +220,15 @@ export interface DesktopAgent {
getOrCreateChannel(channelId: string): Promise<Channel>;

/**
* Returns the `Channel` object for the current channel membership.
* Optional function that returns the `Channel` object for the current channel membership. In most cases, an application's membership of channels SHOULD be managed via UX provided to the application by the desktop agent, rather than calling this function directly.
*
* Returns `null` if the app is not joined to a channel.
*/
getCurrentChannel(): Promise<Channel | null>;

/**
* Removes the app from any channel membership.
* Optional function that removes the app from any channel membership. In most cases, an application's membership of channels SHOULD be managed via UX provided to the application by the desktop agent, rather than calling this function directly.
*
* Context broadcast and listening through the top-level `fdc3.broadcast` and `fdc3.addContextListener` will be a no-op when the app is not on a channel.
* ```javascript
* //desktop-agent scope context listener
Expand Down