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

Icons spec #319

Merged
merged 8 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from 5 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
7 changes: 4 additions & 3 deletions docs/api/ref/AppMetadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface AppMetadata {
title?: string;
tooltip?: string;
description?: string;
icons?: Array<string>;
icons?: Array<Icon>;
images?: Array<string>;
}
```
Expand All @@ -24,9 +24,10 @@ App metadata is provided by the FDC3 App Directory that the desktop agent connec
It always includes at least a `name` property, which can be used with [`open`](DesktopAgent#open) and [`raiseIntent`](DesktopAgent#raiseIntent).

Optionally, extra information from the app directory can be returned, to aid in rendering UI elements, e.g. a context menu.
This includes a title, description, tooltip and icon and image URLs.
This includes a title, description, tooltip, icons and image URLs.

In situations where a desktop agent connects to multiple app directories or multiple versions of the same app exists in a single app directory, it may be neccessary to specify appId and version to target applications that share the same name.

#### See also
* [`AppIntent.apps`](AppIntent)
* [`AppIntent.apps`](AppIntent)
* [`Icon`](Icon)
55 changes: 55 additions & 0 deletions docs/api/ref/Icon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
id: Icon
sidebar_label: Icon
title: Icon
hide_title: true
---
# `Icon`

```typescript
interface Icon {
src: string;
size: string;
type: string;
}
```

App Metadata icon's description.

Various properties may be used by the Desktop Agent to decide which icon is the most suitable to be used considering the application chooser UI, device DPI and formats supported by the system.

#### Example

```js
"icons": [
{
"src": "https://app.foo.icon/app_icons/lowres.webp",
"size": "48x48",
"type": "image/webp"
},
{
"src": "https://app.foo.icon/app_icons/hd_hi.svg",
"size": "72x72"
}
]
```

## Properties

### `src`

The fully qualified url to the icon.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that in the PWA manifest spec the url may be relative. However in the context of FDC3 I couldn't find where a Desktop agent may retrieve the base url of an application so that when given a relative url it could construct the fully qualified url.
That is the reason why only fully qualified url are allowed here.


### `size`

The dimension of the icon using formatted as "<height>x<width>"

### `type`

The media type of the icon. If not provided the Desktop agent may refer to the src file extension.



#### See also
* [`AppMetadata`](AppMetadata)

4 changes: 3 additions & 1 deletion src/api/AppMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright 2019 FINOS FDC3 contributors - see NOTICE file
*/

import { Icon } from './Icon';

/**
* App definition as provided by the application directory
*/
Expand All @@ -26,7 +28,7 @@ export interface AppMetadata {
readonly description?: string;

/** A list of icon URLs for the application that can be used to render UI elements */
readonly icons?: Array<string>;
readonly icons?: Array<Icon>;

/** A list of image URLs for the application that can be used to render UI elements */
readonly images?: Array<string>;
Expand Down
15 changes: 15 additions & 0 deletions src/api/Icon.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/**
* SPDX-License-Identifier: Apache-2.0
* Copyright 2019 FINOS FDC3 contributors - see NOTICE file
*/

export interface Icon {
/** The icon url */
readonly src: string;

/** The icon dimension */
readonly size?: string;

/** The icon media type */
readonly type?: string;
}
8 changes: 7 additions & 1 deletion src/app-directory/specification/appd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,15 @@ components:
Icon:
description: Icon holder
properties:
icon:
src:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change. Considering that this is meant to be part of the "2.0" release I thought that it would be I acceptable.
If not, I suggest to either

  • not introduce src and use the icon property as image url
  • deprecate icon in favour of a newly added src property. In that case Desktop Agent may treat icon as it would treat src

type: string
description: Icon URL
size:
type: string
description: Icon dimension formatted as "<height>x<width>"
type:
type: string
description: Image media type. If not present the Desktop Agent may use the src file extension
AppImage:
description: App Image holder
properties:
Expand Down