Skip to content

Commit

Permalink
Update to snap 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
johnman committed Dec 20, 2024
1 parent 21ea559 commit a43b912
Show file tree
Hide file tree
Showing 12 changed files with 1,428 additions and 2,761 deletions.
2 changes: 1 addition & 1 deletion how-to/integrate-with-snap-basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"author": "[email protected]",
"license": "SEE LICENSE IN LICENSE.MD",
"dependencies": {
"@openfin/snap-sdk": "1.0.0",
"@openfin/snap-sdk": "1.1.0",
"@openfin/workspace": "20.1.5",
"@openfin/workspace-platform": "20.1.5"
},
Expand Down
20 changes: 1 addition & 19 deletions how-to/integrate-with-snap-basic/public/manifest.fin.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,7 @@
"preventQuitOnLastWindowClosed": true,
"permissions": {
"System": {
"launchExternalProcess": {
"enabled": true,
"assets": {
"enabled": true
},
"downloads": {
"enabled": false
},
"executables": {
"enabled": true
}
},
"launchExternalProcess": true,
"downloadAsset": true
}
}
Expand All @@ -43,13 +32,6 @@
"forwardErrorReports": true
},
"appAssets": [
{
"src": "https://cdn.openfin.co/release/snap/1.0.0/snap.zip",
"alias": "openfin-snap",
"version": "1.0.0",
"target": "OpenFinSnap.exe",
"mandatory": true
},
{
"src": "http://localhost:8080/apps/snap-native-test-app.zip",
"alias": "snap-native-test-app",
Expand Down
15 changes: 11 additions & 4 deletions how-to/integrate-with-snap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ If you want the debug version with the debug window automatically showing then y

#### Permissions

These permissions need to be added at the platform or startup_app level depending on the type of application you are building. We are using the restrictive permission model so we are only allowing launch external process for an app asset that comes from a particular url.
These permissions need to be added at the platform or startup_app level depending on the type of application you are building. The example below is using the restrictive permission model so it only allows launch external process for an app asset that comes from a particular url.

```json
"permissions": {
Expand Down Expand Up @@ -205,19 +205,26 @@ These permissions need to be added at the platform or startup_app level dependin

#### App Asset

Your manifest will need to include the following app asset information:
If you are using a version of Snap earlier than 1.1.0 or you wish to self host the Snap app asset then your manifest will need to include the following app asset information:

```json
"appAssets": [
{
"src": "https://cdn.openfin.co/release/snap/0.5.0/snap.zip",
"src": "https://cdn.openfin.co/release/snap/1.1.0/snap.zip",
"alias": "openfin-snap",
"version": "0.5.0",
"version": "1.1.0",
"target": "OpenFinSnap.exe"
}
]
```

If you are on 1.1.0 or above then you don't need to specify the Snap app asset. Snap will fetch the app asset for you from our CDN.

```json
"appAssets": [
]
```

#### Customizing Snap Settings through a manifest

The main example and the preload scripts check the currently running manifest to see if there are settings that should be applied to the snap server (the debug preload will always show the snap debug window regardless of manifest settings)
Expand Down
2 changes: 1 addition & 1 deletion how-to/integrate-with-snap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"author": "[email protected]",
"license": "SEE LICENSE IN LICENSE.MD",
"dependencies": {
"@openfin/snap-sdk": "1.0.0",
"@openfin/snap-sdk": "1.1.0",
"@openfin/workspace": "20.1.5",
"@openfin/workspace-platform": "20.1.5"
},
Expand Down
23 changes: 2 additions & 21 deletions how-to/integrate-with-snap/public/manifest.fin.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,7 @@
"preventQuitOnLastWindowClosed": true,
"permissions": {
"System": {
"launchExternalProcess": {
"enabled": true,
"assets": {
"enabled": true
},
"downloads": {
"enabled": false
},
"executables": {
"enabled": true
}
},
"launchExternalProcess": true,
"downloadAsset": true
}
},
Expand All @@ -43,15 +32,7 @@
"email": "[email protected]",
"forwardErrorReports": true
},
"appAssets": [
{
"src": "https://cdn.openfin.co/release/snap/1.0.0/snap.zip",
"alias": "openfin-snap",
"version": "1.0.0",
"target": "OpenFinSnap.exe",
"mandatory": true
}
],
"appAssets": [],
"customSettings": {
"snapProvider": {
"showDebugWindow": false,
Expand Down
23 changes: 2 additions & 21 deletions how-to/integrate-with-snap/public/second.manifest.fin.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,7 @@
"preloadScripts": [{ "url": "http://localhost:8080/js/snap.preload.bundle.js" }],
"permissions": {
"System": {
"launchExternalProcess": {
"enabled": true,
"assets": {
"enabled": true
},
"downloads": {
"enabled": false
},
"executables": {
"enabled": true
}
},
"launchExternalProcess": true,
"downloadAsset": true
}
}
Expand All @@ -48,15 +37,7 @@
"email": "[email protected]",
"forwardErrorReports": true
},
"appAssets": [
{
"src": "https://cdn.openfin.co/release/snap/1.0.0/snap.zip",
"alias": "openfin-snap",
"version": "1.0.0",
"target": "OpenFinSnap.exe",
"mandatory": true
}
],
"appAssets": [],
"customSettings": {
"snapProvider": {
"showDebugWindow": false,
Expand Down
1 change: 1 addition & 0 deletions how-to/workspace-platform-starter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Feature: Added new getInfoOptions setting to platformProvider.interop that lets you specify two things: includeAllAppMetadataInfo (will use the appId if valid to get the AppMetadata to return to the app) & includeAppInteropInfo (will return the app's interop config as a part of the instanceMetadata of the appMetadata property). Both options default to false. Configured includeAppInteropInfo to true in the [public/manifest.fin.json](./public/manifest.fin.json) as it can be useful for an app to be able to confirm what the platform believes the application supports.
- Added an [AuthClient](./client/src/framework/shapes/auth-shapes.ts) that is optionally passed to modules (it will be passed but is passed as an optional in case you ever want to restrict it) through a getAuthClient function. If the getAuthClient function is available then an authClient will be returned if configured (otherwise a warning and undefined is returned). This can be used if you want to create your own log out buttons or if you want to retrieve the current user info without using the lifecycle event.
- Added a new browserProvider option to have a different strategy when a window is requested to be brought to front. The default (existing approach) is that the window has [setAsForeground](https://developer.openfin.co/docs/javascript/stable/classes/OpenFin.Window.html#setAsForeground) called against it. The alternative strategies are [bringToFront](https://developer.openfin.co/docs/javascript/stable/classes/OpenFin.Window.html#bringToFront) and bringToFrontAndFocus which calls [bringToFront](https://developer.openfin.co/docs/javascript/stable/classes/OpenFin.Window.html#bringToFront) followed by [focus](https://developer.openfin.co/docs/javascript/stable/classes/OpenFin.Window.html#focus). The new setting is browserProvider.bringToFrontStrategy.
- Upgraded to Snap 1.1.0 and removed the serverAssetInfo from the manifest as Snap now fetches the app asset if it isn't specified. See [how to configure snap](./docs/how-to-configure-snap.md).

## v20.0.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,8 @@ export async function init(options: SnapProviderOptions | undefined): Promise<vo

await platformSplashProvider.updateProgress("Snap");

if (!isStringValue(options.serverOptions.executablePath)) {
const serverAssetInfo = options?.serverAssetInfo;

if (isEmpty(serverAssetInfo)) {
logger.error("Cannot initialize Snap without the SnapProvider.serverAssetInfo");
return;
}
if (!isStringValue(options.serverOptions.executablePath) && !isEmpty(options?.serverAssetInfo)) {
const serverAssetInfo = options.serverAssetInfo;

const src = serverAssetInfo.src;
if (isEmpty(src)) {
Expand Down
28 changes: 26 additions & 2 deletions how-to/workspace-platform-starter/docs/how-to-configure-snap.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,30 @@ For more detailed information see [OpenFin Snap SDK](https://developers.openfin.

To enable snap support in your platform you can add the following in your manifest.fin.json.

From Snap 1.1.0 onwards snap will automatically fetch the Snap app asset if you have not specified it in the app assets array and you haven't specified it as a serverAssetInfo. The reason for specifying this would be if you want to self-host the snap app asset.

```json
{
"customSettings": {
...
"snapProvider": {
"enabled": true,
"id": "workspace-platform-starter",
"enableAutoWindowRegistration": true,
"serverOptions": {
"showDebug": false,
"keyToStick": true,
"disableBlurDropPreview": false,
"disableGPUAcceleratedDragging": false,
"disableUserUnstick": false
}
}
}
}
```

If you want to self host the snap app asset then you can specify the serverAssetInfo as below:

```json
{
"customSettings": {
Expand All @@ -18,9 +42,9 @@ To enable snap support in your platform you can add the following in your manife
"id": "workspace-platform-starter",
"enableAutoWindowRegistration": true,
"serverAssetInfo": {
"src": "https://cdn.openfin.co/release/snap/0.5.0/snap.zip",
"src": "https://cdn.openfin.co/release/snap/1.1.0/snap.zip",
"alias": "openfin-snap",
"version": "0.5.0",
"version": "1.1.0",
"target": "OpenFinSnap.exe"
},
"serverOptions": {
Expand Down
2 changes: 1 addition & 1 deletion how-to/workspace-platform-starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"@finos/fdc3": "^2.0.3",
"@openfin/cloud-interop": "0.40.32",
"@openfin/openid-connect": "^1.0.0",
"@openfin/snap-sdk": "1.0.0",
"@openfin/snap-sdk": "1.1.0",
"@openfin/workspace": "20.1.5",
"@openfin/workspace-platform": "20.1.5",
"csstype": "^3.1.3"
Expand Down
6 changes: 0 additions & 6 deletions how-to/workspace-platform-starter/public/manifest.fin.json
Original file line number Diff line number Diff line change
Expand Up @@ -1824,12 +1824,6 @@
"enabled": false,
"id": "workspace-platform-starter",
"enableAutoWindowRegistration": true,
"serverAssetInfo": {
"src": "https://cdn.openfin.co/release/snap/1.0.0/snap.zip",
"alias": "openfin-snap",
"version": "1.0.0",
"target": "OpenFinSnap.exe"
},
"serverOptions": {
"showDebug": false,
"keyToStick": true,
Expand Down
Loading

0 comments on commit a43b912

Please sign in to comment.