-
public final class ConsentManagerCanonical GDPR/CCPA consent category model. Parity port of libs/web-sdk/src/utils/consent.ts.
Four categories:
necessary(always true),functional(default true),analytics(default false),marketing(default false). Pinned by libs/mobile-sdk/tests/drift/consent-default-state.json.On iOS, ATT denial maps onto
marketing=false. Android has no ATT equivalent, but a runtimePOST_NOTIFICATIONSdenial could be used as a marketing-bucket signal — that's tracked under Phase 4.5.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumConsentManager.Categorypublic final classConsentManager.ConsentPreferencespublic classConsentManager.Companion
-
Constructor Summary
Constructors Constructor Description ConsentManager(Context context, ConsentManager.ConsentPreferences defaultConsent, Boolean waitForConsent)
-
Method Summary
Modifier and Type Method Description final ConsentManager.ConsentPreferencescurrent()Current consent preferences. final BooleanhasUserDecision()True when consent has been ACTIVELY set by the user (not just default). final BooleanshouldBuffer()True when waitForConsent is set AND no user decision yet. final UnitsetConsent(Map<ConsentManager.Category, Boolean> partial)Update consent. final Booleanhas(ConsentManager.Category category)Check whether a category is granted. final BooleanshouldEmit(String eventName)Decide whether a given event name should be emitted under the current consent. final Function0<Unit>onChange(Function1<ConsentManager.ConsentPreferences, Unit> listener)-
-
Constructor Detail
-
ConsentManager
ConsentManager(Context context, ConsentManager.ConsentPreferences defaultConsent, Boolean waitForConsent)
-
-
Method Detail
-
current
final ConsentManager.ConsentPreferences current()
Current consent preferences. Necessary is always true.
-
hasUserDecision
final Boolean hasUserDecision()
True when consent has been ACTIVELY set by the user (not just default).
-
shouldBuffer
final Boolean shouldBuffer()
True when waitForConsent is set AND no user decision yet.
-
setConsent
final Unit setConsent(Map<ConsentManager.Category, Boolean> partial)
Update consent. Partial map — only the categories you pass are changed. Necessary cannot be revoked (any false is ignored per drift contract).
-
has
final Boolean has(ConsentManager.Category category)
Check whether a category is granted. Necessary always returns true.
-
shouldEmit
final Boolean shouldEmit(String eventName)
Decide whether a given event name should be emitted under the current consent. Mapping mirrors the drift fixture's
event_category_mapping.
-
onChange
final Function0<Unit> onChange(Function1<ConsentManager.ConsentPreferences, Unit> listener)
-
-
-
-