android-components / mozilla.components.feature.pwa / WebAppShortcutManager
WebAppShortcutManager
class WebAppShortcutManager
(source)
Helper to manage pinned shortcuts for websites.
Parameters
httpClient
- Fetch client used to load website icons.
storage
- Storage used to save web app manifests to disk.
supportWebApps
- If true, Progressive Web Apps will be pinnable.
If false, all web sites will be bookmark shortcuts even if they have a manifest.
Constructors
Name | Summary |
---|---|
<init> | WebAppShortcutManager(context: <ERROR CLASS>, httpClient: Client , storage: ManifestStorage , supportWebApps: Boolean = true) Helper to manage pinned shortcuts for websites. |
Functions
Name | Summary |
---|---|
buildBasicShortcut | fun buildBasicShortcut(context: <ERROR CLASS>, session: Session , overrideShortcutName: String ? = null): ShortcutInfoCompat Create a new basic pinned website shortcut using info from the session. Consuming SHORTCUT_CATEGORY in AndroidManifest is required for the package to be launched |
buildWebAppShortcut | suspend fun buildWebAppShortcut(context: <ERROR CLASS>, manifest: WebAppManifest ): ShortcutInfoCompat? Create a new Progressive Web App shortcut using a web app manifest. |
findShortcut | fun findShortcut(context: <ERROR CLASS>, startUrl: String ): Nothing ? Finds the shortcut associated with the given startUrl. This method can be used to check if a web app was added to the homescreen. |
requestPinShortcut | suspend fun requestPinShortcut(context: <ERROR CLASS>, session: Session , overrideShortcutName: String ? = null): Unit Request to create a new shortcut on the home screen. |
uninstallShortcuts | suspend fun uninstallShortcuts(context: <ERROR CLASS>, startUrls: List < String >, disabledMessage: String ? = null): Unit Uninstalls a set of PWAs from the user’s device by disabling their shortcuts and removing the associated manifest data. |
updateShortcuts | suspend fun updateShortcuts(context: <ERROR CLASS>, manifests: List < WebAppManifest >): Unit Update existing PWA shortcuts with the latest info from web app manifests. |
Extension Functions
Name | Summary |
---|---|
loadResourceAsString | fun Any .loadResourceAsString(path: String ): String Loads a file from the resources folder and returns its content as a string object. |