android-components / mozilla.components.feature.addons / Addon

Addon

data class Addon (source)

Represents an add-on based on the AMO store: https://addons.mozilla.org/en-US/firefox/

Types

Name Summary
Author data class Author
Represents an add-on author.
InstalledState data class InstalledState
Returns a list of id resources per each item on the Addon.permissions list. Holds the state of the installed web extension of this add-on.
Rating data class Rating
Holds all the rating information of this add-on.

Constructors

Name Summary
<init> Addon(id: String, authors: List<Author> = emptyList(), categories: List<String> = emptyList(), downloadUrl: String = "", version: String = "", permissions: List<String> = emptyList(), translatableName: Map<String, String> = emptyMap(), translatableDescription: Map<String, String> = emptyMap(), translatableSummary: Map<String, String> = emptyMap(), iconUrl: String = "", siteUrl: String = "", rating: Rating? = null, createdAt: String = "", updatedAt: String = "", installedState: InstalledState? = null)
Represents an add-on based on the AMO store: https://addons.mozilla.org/en-US/firefox/

Properties

Name Summary
authors val authors: List<Author>
List holding information about the add-on authors.
categories val categories: List<String>
List of categories the add-on belongs to.
createdAt val createdAt: String
The date the add-on was created.
downloadUrl val downloadUrl: String
The (absolute) URL to download the add-on file (eg xpi).
iconUrl val iconUrl: String
The URL to icon for the add-on.
id val id: String
The unique ID of this add-on.
installedState val installedState: InstalledState?
Holds the state of the installed web extension for this add-on. Null, if the Addon is not installed.
permissions val permissions: List<String>
List of the add-on permissions for this File.
rating val rating: Rating?
The rating information of this add-on.
siteUrl val siteUrl: String
The (absolute) add-on detail URL.
translatableDescription val translatableDescription: Map<String, String>
A map containing the different translations for the add-on description, where the key is the language and the value is the actual translated text.
translatableName val translatableName: Map<String, String>
A map containing the different translations for the add-on name, where the key is the language and the value is the actual translated text.
translatableSummary val translatableSummary: Map<String, String>
A map containing the different translations for the add-on name, where the key is the language and the value is the actual translated text.
updatedAt val updatedAt: String
The date of the last time the add-on was updated by its developer(s).
version val version: String
The add-on version e.g “1.23.0”.

Functions

Name Summary
filterTranslations fun filterTranslations(locales: List<String>): Addon
Returns a copy of this Addon containing only translations (description, name, summary) of the provided locales. All other translations will be removed.
isDisabledAsUnsupported fun isDisabledAsUnsupported(): Boolean
Returns whether or not this Addon is currently disabled because it is not supported. This is based on the installed extension state in the engine. An addon can be disabled as unsupported and later become supported, so both isSupported and isDisabledAsUnsupported can be true.
isEnabled fun isEnabled(): Boolean
Returns whether or not this Addon is currently enabled.
isInstalled fun isInstalled(): Boolean
Returns whether or not this Addon is currently installed.
isSupported fun isSupported(): Boolean
Returns whether or not this Addon is currently supported by the browser.
translatePermissions fun translatePermissions(): List<Int>
Returns a list of id resources per each item on the permissions list.

Companion Object Properties

Name Summary
permissionToTranslation val permissionToTranslation: <ERROR CLASS>
A map of permissions to translation string ids.

Companion Object Functions

Name Summary
localizePermissions fun localizePermissions(permissions: List<String>): List<Int>
Takes a list of permissions and returns a list of id resources per each item.

Extension Properties

Name Summary
translatedName val Addon.translatedName: String
A shortcut to get the localized name of an add-on.

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.