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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,4 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Model.Entity.Data;
|
||||
using Model.Website;
|
||||
|
||||
namespace Services.Website;
|
||||
|
||||
@@ -18,11 +15,7 @@ public class DialogService : IDialogService
|
||||
{
|
||||
private DialogContents _dialogContents;
|
||||
|
||||
public DialogService()
|
||||
{
|
||||
}
|
||||
|
||||
public bool IsVisible { get; set; }
|
||||
public bool IsVisible { get; set; }
|
||||
|
||||
public void Subscribe(Action action)
|
||||
{
|
||||
@@ -38,7 +31,7 @@ public class DialogService : IDialogService
|
||||
{
|
||||
_dialogContents = dialogContents;
|
||||
IsVisible = true;
|
||||
|
||||
|
||||
NotifyDataChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ namespace Services.Website;
|
||||
|
||||
public class PermissionService : IPermissionService, IDisposable
|
||||
{
|
||||
private IJSRuntime _jsRuntime;
|
||||
private readonly IStorageService _storageService;
|
||||
private IJSRuntime _jsRuntime;
|
||||
private IToastService _toastService;
|
||||
private bool isLoaded;
|
||||
private bool isStorageEnabled = false;
|
||||
@@ -15,7 +15,7 @@ public class PermissionService : IPermissionService, IDisposable
|
||||
_jsRuntime = jsRuntime;
|
||||
_toastService = toastService;
|
||||
_storageService = storageService;
|
||||
|
||||
|
||||
_storageService.Subscribe(NotifyDataChanged);
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ public class SearchService : ISearchService
|
||||
{
|
||||
Title = webPage.Name,
|
||||
PointType = "WebPage",
|
||||
Summary = $"{webPage.Description}",
|
||||
Summary = $"{webPage.Description}",
|
||||
Href = webPage.Href
|
||||
});
|
||||
|
||||
@@ -73,7 +73,7 @@ public class SearchService : ISearchService
|
||||
SearchPoints.Add(new SearchPointModel
|
||||
{
|
||||
Title = note.Name,
|
||||
PointType = "Note",
|
||||
PointType = "Note",
|
||||
Href = note.GetNoteLink(),
|
||||
Summary = note.Description
|
||||
});
|
||||
@@ -84,13 +84,13 @@ public class SearchService : ISearchService
|
||||
|
||||
foreach (var entity in DATA.Get().Values)
|
||||
{
|
||||
var summary =
|
||||
var summary =
|
||||
entity.Info().Description.Length > 35
|
||||
? entity.Info().Description.Substring(0, 30).Trim() + "..."
|
||||
: entity.Info().Description.Length > 0
|
||||
? entity.Info().Description
|
||||
: "";
|
||||
|
||||
|
||||
SearchPoints.Add(new SearchPointModel
|
||||
{
|
||||
Title = entity.Info().Name,
|
||||
|
||||
@@ -93,6 +93,7 @@ public class StorageService : IStorageService
|
||||
}
|
||||
|
||||
private event Action OnChange = null!;
|
||||
|
||||
private void NotifyDataChanged()
|
||||
{
|
||||
OnChange();
|
||||
|
||||
Reference in New Issue
Block a user