Auto formatting
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
using Blazor.Analytics;
|
||||
using Blazored.LocalStorage;
|
||||
using Model.Feedback;
|
||||
|
||||
namespace Services.Website;
|
||||
|
||||
@@ -14,37 +12,34 @@ public class DataCollectionKeys
|
||||
|
||||
public class DataCollectionService : IDataCollectionService, IDisposable
|
||||
{
|
||||
private readonly IAnalytics _globalTracking;
|
||||
private readonly IStorageService _storageService;
|
||||
|
||||
private bool _isEnabled = false;
|
||||
private readonly IAnalytics _globalTracking;
|
||||
private bool _isEnabled;
|
||||
|
||||
public DataCollectionService(IAnalytics globalTracking,
|
||||
IStorageService storageService)
|
||||
{
|
||||
_globalTracking = globalTracking;
|
||||
_storageService = storageService;
|
||||
|
||||
|
||||
_storageService.Subscribe(Refresh);
|
||||
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
public void SendEvent<T>(string eventName, T eventData)
|
||||
{
|
||||
if (_isEnabled) _globalTracking.TrackEvent(eventName, eventData);
|
||||
}
|
||||
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
_storageService.Unsubscribe(Refresh);
|
||||
}
|
||||
|
||||
|
||||
private void Refresh()
|
||||
{
|
||||
_isEnabled = _storageService.GetValue<bool>(StorageKeys.EnabledDataCollection);
|
||||
}
|
||||
|
||||
public void SendEvent<T>(string eventName, T eventData)
|
||||
{
|
||||
if (_isEnabled)
|
||||
{
|
||||
_globalTracking.TrackEvent(eventName, eventData);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user