sdi_share-link
The bundle provides a widget used to share the state of an app. In contrast to the map.apps share-link
bundle, where
all parameters for restoring the state of an app are encoded in the URL, the sdi_share-link
bundle saves the current
state of the app on the server. The only parameter in the link is an ID to the saved state.
Configuration
Tools
Tool ID | Component name | Description |
---|---|---|
sdi_copyAppStateLinkTool |
CopyAppStateLinkTool |
Copies a link to the clipboard. |
sdi_shareAppStateLinkTool |
ShareAppStateLinkTool |
Opens a sharing dialog to share a link through different networks and channels. See the Support for Web Share API section for details. |
sdi_sharelinkTool |
URLTool |
Opens a dialog with two buttons that provide the same functionality as the tools mentioned above combined. |
Configuring the sharing title and the sharing message
You can change the title and the message to include along with the link you are sharing.
"bundles": {
"sdi_share-link": {
"ShareAppStateLinkCommand": {
"shareTitle": "Cool App",
"shareMessage": "found it here"
}
}
}
Configuring the button icons in the dialog
The icons for the two buttons inside the sharing dialog can be changed as follows.
"bundles": {
"sdi_share-link": {
"DialogConfig": {
"shareIcon": "share",
"shareErrorIcon": "error",
"shareProgressIcon": "hourglass_top",
"copyIcon": "content_copy",
"copyErrorIcon": "error",
"copyDoneIcon": "done",
"copyProgressIcon": "hourglass_top"
}
}
}
The buttons have different phases they can run through. You can set custom icons for each of those phases.
The values to specify refer to the CSS classes that contain the respective icons. See the map.apps IconFont Gallery for a list of available icons.
Configuring the icons for the tools
Default icon
The default icons for the CopyAppStateLinkTool
and the ShareAppStateLinkTool
can be configured, as for any other tool, on the iconClass
property of the tool components.
"bundles": {
"sdi_share-link": {
"CopyAppStateLinkTool": {
"iconClass": "content_copy"
}
}
}
Phase icons
You can configure the icons for the different phases these tools can run through as well.
For the CopyToolPhaseController
tool:
"bundles": {
"sdi_share-link": {
"CopyToolPhaseController": {
"doneIconClass": "icon-checkbox-checkmark",
"errorIconClass": "icon-sign-error"
}
}
}
For the ShareToolPhaseController
tool:
"bundles": {
"sdi_share-link": {
"ShareToolPhaseController": {
"errorIconClass": "icon-sign-error"
}
}
}
Support for Web Share API
The Web Share API defines a simple way to share links through different channels and networks. Google Chrome and Microsoft Edge support this API out-of-the-box for websites served through HTTPS. The desktop version Mozilla Firefox does not support this API by default. Users have to explicitly enable it in their browser config.
As a replacement, you can include the share-link-shim bundle in your app.json
file to emulate a similar behaviour.