Table of Contents

Interface IAdConsentProvider

Namespace
VpnHood.AppLib.Abstractions.Ads
Assembly
VpnHood.AppLib.Abstractions.dll

Represents an ad network's consent, where a law wants a yes before ads use personal data.

public interface IAdConsentProvider

Remarks

The app asks for it before an ad's timed load, so the person reads the form for as long as they need; it also tells whether an ad may be preloaded without the form, and is the way back to the answer, in the app's privacy settings.

Properties

IsPrivacyOptionsRequired

Gets a value indicating whether the person was asked, so they must be able to change their answer.

bool IsPrivacyOptionsRequired { get; }

Property Value

bool

Methods

CanRequestAds(IUiContext, CancellationToken)

Gets whether ads may be asked for now, as the network says.

Task<bool> CanRequestAds(IUiContext uiContext, CancellationToken cancellationToken)

Parameters

uiContext IUiContext

The app's UI context.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task<bool>

A task whose result is true where the person has answered, or no answer is due where they are; where the network cannot be reached, its last answer stands.

Exceptions

OperationCanceledException

cancellationToken was canceled.

GatherConsent(IUiContext, CancellationToken)

Shows the network's form, where one is due and not answered yet.

Task GatherConsent(IUiContext uiContext, CancellationToken cancellationToken)

Parameters

uiContext IUiContext

The app's UI context.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task

A task that completes once the gathering has ended: the form answered, none due, or a failure.

Remarks

A failure is left to the ad's load, which refuses an ad without the answer.

Exceptions

OperationCanceledException

cancellationToken was canceled.

ShowPrivacyOptions(IUiContext, CancellationToken)

Shows the network's form again, for the person to change their answer.

Task ShowPrivacyOptions(IUiContext uiContext, CancellationToken cancellationToken)

Parameters

uiContext IUiContext

The app's UI context.

cancellationToken CancellationToken

The token to monitor for cancellation requests.

Returns

Task

A task that completes once the form is closed.

Exceptions

AdException

The network's form failed.

OperationCanceledException

cancellationToken was canceled.