Consents

class Consents

This class keeps track of all granted or denied consents of a user.

There are two different types of consents:

  • Consents for common features like if we're allowed to evaluate the locale or a user agent.

  • Consents per measurement campaign.

The time of the consent is recorded along with it's state: If it was actually granted or denied.

Consents for common features are given indefinitely, since they are only ever recorded along with running campaigns.

Consents for campaigns only last for a certain amount of days.

Constructors

Link copied to clipboard
fun Consents()

Functions

Link copied to clipboard
fun consent(campaignId: String): CampaignConsent?

Checks the consent state for a campaign.

fun consent(feature: Feature): FeatureConsent?

Returns the consent for a given feature, if any available.

Link copied to clipboard
fun deny(campaignId: String): CampaignConsent

User denies consent to run a specific campaign.

fun deny(feature: Feature): FeatureConsent

User denies consent to evaluate a Feature.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
fun grant(feature: Feature): FeatureConsent

User consents to evaluate a Feature.

fun grant(campaignId: String, campaign: Campaign): CampaignConsent

User consents to run a specific campaign.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun state(campaignId: String): Consent.State

Checks the consent state of a campaign.

fun state(feature: Feature): Consent.State

Checks the consent state for a feature.

Link copied to clipboard
open override fun toString(): String

Properties

Link copied to clipboard
var campaigns: LinkedHashMap<String, Consent>
Link copied to clipboard
var features: LinkedHashMap<Feature, Consent>