40 lines
952 B
C#
40 lines
952 B
C#
namespace Services.Website;
|
|
|
|
public class DataCollectionKeys
|
|
{
|
|
// Inputs people are using in the build calculator
|
|
public static string BuildCalcInput = "buildcalc-input";
|
|
public static string PageInitialized = "page-initialized";
|
|
public static string FirstPage = "first-page";
|
|
}
|
|
|
|
public class DataCollectionService : IDataCollectionService, IDisposable
|
|
{
|
|
private readonly IStorageService _storageService;
|
|
|
|
private bool _isEnabled;
|
|
|
|
public DataCollectionService(IStorageService storageService)
|
|
{
|
|
_storageService = storageService;
|
|
|
|
_storageService.Subscribe(Refresh);
|
|
|
|
Refresh();
|
|
}
|
|
|
|
public void SendEvent<T>(string eventName, T eventData)
|
|
{
|
|
// No-op
|
|
}
|
|
|
|
void IDisposable.Dispose()
|
|
{
|
|
_storageService.Unsubscribe(Refresh);
|
|
}
|
|
|
|
private void Refresh()
|
|
{
|
|
_isEnabled = _storageService.GetValue<bool>(StorageKeys.EnabledDataCollection);
|
|
}
|
|
} |