open class Consents: NSObject, Codable
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.
var description: String
@discardableResult public func grant(feature: Feature) -> FeatureConsent
User consents to evaluate a
@discardableResult public func deny(feature: Feature) -> FeatureConsent
User denies consent to evaluate a
public func hasBeenGranted(forFeature feature: Feature) -> Bool
if consent to a
Feature was given.
@discardableResult public func grant(campaign campaignId: String, _ campaign: Campaign) -> CampaignConsent
User consents to run a specific campaign.
The campaign ID.
@discardableResult public func deny(campaign campaignId: String) -> CampaignConsent
User denies consent to run a specific campaign.
public func isCampaignGranted(_ campaignId: String, forPeriod start: Date, _ end: Date) -> Bool
if consent to run a campaign was given and is valid for the given period.
public func isCampaignCurrentlyGranted(_ campaignId: String) -> Bool
if consent to run a campaign was given and is now valid.