UserSettingsAnalyticsReporter
A class in Root.Township, Alta.Analytics.UserSettingsAnalytics.
Sends a one-off report of the player's settings after login, if the addressable config's end date has not passed and this report title was not already sent. Client side; built by VContainer.
- Listed in Console, logging and analytics
- Inherits or implements
IInitializable,IIsolate - Attributes
Preserve,UsedImplicitly
Constructors
| Member | What it is |
|---|---|
UserSettingsAnalyticsReporter(IAnalyticsService analyticsService) | Built by the game's dependency injection (VContainer), which passes the services in. |
Fields
6 private and internal fields
| Member | What it is |
|---|---|
private IAnalyticsService analyticsService | The injected analytics service. |
private UserSettingsAnalyticsReporterConfiguration config | The loaded configuration (end date and report title). |
private const string ConfigAddressableName | Addressable key of the reporter's configuration asset. |
private AsyncOperationHandle<UserSettingsAnalyticsReporterConfiguration> configHandle | Addressables handle for the config, kept so it can be released. |
private static Logger logger | NLog logger for this class. |
private const string PlayerPrefsPrefix | PlayerPrefs key prefix for the completion flag; the report title follows it. |
Methods
| Member | What it is |
|---|---|
void Initialize() | Subscribes OnLoggedIn to LoginManager.LoggedIn. |
void Release() | Releases the loaded config asset. |
7 private and internal methods
| Member | What it is |
|---|---|
private DateTime? GetEndDate() | Parses the config's EndDate (yyyy-MM-dd), or null if it does not parse. |
private bool HasReportBeenCompleted() | Checks PlayerPrefs for the completion flag of this report title. |
private bool IsCurrentlyBeforeEndDate() | True when now is before the end date. False if there is no valid end date. |
private bool IsValidReportParticipant() | True when before the end date and the report has not been sent. |
private async Task LoadConfig() | Loads the configuration asset from Addressables. |
private async void OnLoggedIn() | Runs once after the first login: loads the config and sends the report if this player qualifies. |
private async Task Report() | Posts a UserSettingsReport and on success saves the completion flag and releases the config. |