Class ConsentRepository

    • Method Detail

      • addTokenChangeCallback

         final Unit addTokenChangeCallback(Function0<Unit> callback)

        Add Shared preferences listener for the consent token

        Parameters:
        callback - as ()-> Unit
      • loadConsentToken

         final ConsentToken loadConsentToken(Integer tcfVersion, Date ignoreConsentBefore, Long consentDurationInSeconds, Long deniedConsentDurationInSeconds)

        Load the consent token from the shared preferences

        Parameters:
        tcfVersion - Version of the TCF to load
        ignoreConsentBefore - If token was updated before this date, it will not be loaded
        consentDurationInSeconds - If token update date is older than this duration, it will not be loaded
      • numberOfDaysHasExceeded

         final Boolean numberOfDaysHasExceeded()

        Determine if the number of days given by the client on the configuration before we could display the banner again if we need new consents has been exceeded:

      • setUserStatusFromObjects

        @Synchronized() final Boolean setUserStatusFromObjects(Set<InternalPurpose> enabledConsentPurposes, Set<InternalPurpose> disabledConsentPurposes, Set<InternalPurpose> enabledLIPurposes, Set<InternalPurpose> disabledLIPurposes, Set<InternalVendor> enabledConsentVendors, Set<InternalVendor> disabledConsentVendors, Set<InternalVendor> enabledLIVendors, Set<InternalVendor> disabledLIVendors, Boolean sendAPIEvent, String eventAction, ApiEventsRepository apiEventsRepository, EventsRepository eventsRepository)

        Set the user status with Purpose/Vendor objects

        This function is also responsible for triggering the app and API events so all consent changes have to go through it.

        Parameters:
        enabledConsentPurposes - Consent purposes to enable
        disabledConsentPurposes - Consent purposes to disable
        enabledLIPurposes - Legitimate interest purposes to enable
        disabledLIPurposes - Legitimate interest purposes to disable
        enabledConsentVendors - Consent vendors to enable
        disabledConsentVendors - Consent vendors to disable
        enabledLIVendors - Legitimate interest vendors to enable
        disabledLIVendors - Legitimate interest vendors do disable
        sendAPIEvent - Whether to send an event to the API to report a user choice
        eventAction - Action associated to the API event (should be "click" or "external")
        apiEventsRepository - The API events repository
        eventsRepository - The events repository
      • fireConsentChangedEvents

         final Unit fireConsentChangedEvents(Set<String> previouslyEnabledPurposeIds, Set<String> previouslyDisabledPurposeIds, Set<String> previouslyEnabledLegitimatePurposeIds, Set<String> previouslyDisabledLegitimatePurposeIds, Set<String> previouslyEnabledVendorIds, Set<String> previouslyDisabledVendorIds, Set<String> previouslyEnabledLegIntVendorIds, Set<String> previouslyDisabledLegIntVendorIds, Boolean sendAPIEvent, String eventAction, EventsRepository eventsRepository, ApiEventsRepository apiEventsRepository)

        Fire SDK event and API event corresponding to a change of consent, with the updated token values

        Parameters:
        previouslyEnabledPurposeIds - Previously enabled consent purpose ids
        previouslyDisabledPurposeIds - Previously disabled consent purpose ids
        previouslyEnabledLegitimatePurposeIds - Previously enabled LI purpose ids
        previouslyDisabledLegitimatePurposeIds - Previously disabled LI purpose ids
        previouslyEnabledVendorIds - Previously enabled consent vendor ids
        previouslyDisabledVendorIds - Previously disabled consent vendor ids
        previouslyEnabledLegIntVendorIds - Previously enabled LI vendor ids
        previouslyDisabledLegIntVendorIds - Previously disabled LI vendor ids
        sendAPIEvent - Whether to send an event to the API to report a user choice
        eventAction - Action associated to the API event (should be "click" or "external")
        eventsRepository - The events repository
        apiEventsRepository - The API events repository
      • setUserStatus

         final Boolean setUserStatus(Boolean purposesConsentStatus, Boolean purposesLIStatus, Boolean vendorsConsentStatus, Boolean vendorsLIStatus, String eventAction, ApiEventsRepository apiEventsRepository, EventsRepository eventsRepository)

        Set the user status globally

        Parameters:
        purposesConsentStatus - true if purposes on a consent basis should be enabled, false if they should be disabled
        purposesLIStatus - true if purposes on a legitimate interest basis should be enabled, false if they should be disabled
        vendorsConsentStatus - true if vendors on a consent basis should be enabled, false if they should be disabled
        vendorsLIStatus - true if vendors on a legitimate interest basis should be enabled, false if they should be disabled
        eventAction - Action associated to the API event (should be "click" or "external")
      • saveLIInTCFStatusIfRequired

         final Unit saveLIInTCFStatusIfRequired()

        Enable all LI purposes and vendors respecting what has already been disabled (if applies).

      • shouldUserStatusBeCollected

         final Boolean shouldUserStatusBeCollected()

        Determine if the User Status (consent) should be collected or not. User Status should be collected if:

        • Regulation is different from NONE and

        • User status is partial and

        • The number of days before displaying the notice again has exceeded the limit specified on the Console or no User Status has been saved