android-components / mozilla.components.feature.pwa / ManifestStorage

ManifestStorage

class ManifestStorage (source)

Disk storage for WebAppManifest. Other components use this class to reload a saved manifest.

Parameters

context - the application context this storage is associated with

usedAtTimeout - a timeout in milliseconds after which the storage will consider a manifest as unused. By default this is 30 days.

Constructors

Name Summary
<init> ManifestStorage(context: <ERROR CLASS>, usedAtTimeout: Long = DEFAULT_TIMEOUT)
Disk storage for WebAppManifest. Other components use this class to reload a saved manifest.

Functions

Name Summary
hasRecentManifest suspend fun hasRecentManifest(url: String, currentTime: Long): Boolean
Checks whether there is a currently used manifest with a scope that matches the url.
loadManifest suspend fun loadManifest(startUrl: String): WebAppManifest?
Load a Web App Manifest for the given URL from disk. If no manifest is found, null is returned.
loadManifestsByScope suspend fun loadManifestsByScope(url: String): List<WebAppManifest>
Load all Web App Manifests with a matching scope for the given URL from disk. If no manifest is found, an empty list is returned.
removeManifests suspend fun removeManifests(startUrls: List<String>): <ERROR CLASS>
Delete all manifests associated with the list of URLs.
saveManifest suspend fun saveManifest(manifest: WebAppManifest): <ERROR CLASS>
Save a Web App Manifest to disk.
updateManifest suspend fun updateManifest(manifest: WebAppManifest): <ERROR CLASS>
Update an existing Web App Manifest on disk.
updateManifestUsedAt suspend fun updateManifestUsedAt(manifest: WebAppManifest): <ERROR CLASS>
Update the last time a web app was used.

Companion Object Properties

Name Summary
DEFAULT_TIMEOUT const val DEFAULT_TIMEOUT: Long
MILLISECONDS_IN_A_DAY const val MILLISECONDS_IN_A_DAY: Long

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.