Auto formatting

This commit is contained in:
2022-05-02 02:04:40 -04:00
parent f103dc7bed
commit b2516fc80a
64 changed files with 683 additions and 548 deletions
+10 -15
View File
@@ -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);
}
}
}