24 lines
739 B
Dart
24 lines
739 B
Dart
/// Broad age groups used only to choose advertising settings.
|
|
///
|
|
/// Only this choice is stored locally; no birth date is collected. Players who
|
|
/// choose [under13] or [unknown] play without advertising, and the ad SDK is
|
|
/// never initialized for them.
|
|
enum AdAudience {
|
|
unknown,
|
|
under13,
|
|
teen,
|
|
adult;
|
|
|
|
/// The only age information the app persists.
|
|
static const storageKey = 'ad_age_group_v1';
|
|
|
|
bool get allowsAds => this == teen || this == adult;
|
|
|
|
/// Teens, under-13s and unknown-age players never receive standard adult
|
|
/// advertising treatment.
|
|
bool get restricted => this != adult;
|
|
|
|
static AdAudience fromStored(String value) =>
|
|
values.where((group) => group.name == value).firstOrNull ?? unknown;
|
|
}
|