Skip to main content

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.

Constructors​

MemberWhat it is
UserSettingsAnalyticsReporter(IAnalyticsService analyticsService)Built by the game's dependency injection (VContainer), which passes the services in.

Fields​

6 private and internal fields
MemberWhat it is
private IAnalyticsService analyticsServiceThe injected analytics service.
private UserSettingsAnalyticsReporterConfiguration configThe loaded configuration (end date and report title).
private const string ConfigAddressableNameAddressable key of the reporter's configuration asset.
private AsyncOperationHandle<UserSettingsAnalyticsReporterConfiguration> configHandleAddressables handle for the config, kept so it can be released.
private static Logger loggerNLog logger for this class.
private const string PlayerPrefsPrefixPlayerPrefs key prefix for the completion flag; the report title follows it.

Methods​

MemberWhat it is
void Initialize()Subscribes OnLoggedIn to LoginManager.LoggedIn.
void Release()Releases the loaded config asset.
7 private and internal methods
MemberWhat 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.