Browse Source

feat(DataCollection) Added opt-in data collection

main
Jonathan McCaffrey 4 years ago
parent
commit
43d7391df2
  1. 1
      Components/Display/DevOnlyComponent.razor
  2. 1
      Components/Feedback/ToastComponent.razor
  3. 1
      Components/Form/FormCheckboxComponent.razor
  4. 1
      Components/Form/FormGuessComponent.razor
  5. 1
      Components/Form/FormTextAreaComponent.razor
  6. 1
      Components/Form/FormTextComponent.razor
  7. 9
      Components/Form/FormToggleComponent.razor
  8. 1
      Components/Inputs/ButtonGroupComponent.razor
  9. 1
      Components/Navigation/DesktopNavComponent.razor
  10. 10
      Components/Navigation/DesktopNavLinkComponent.razor
  11. 1
      Components/Shared/DisplayableRoute.razor
  12. 12
      IGP/App.razor
  13. BIN
      IGP/Database.db
  14. 114
      IGP/Dialog/ConfirmationDialogComponent.razor
  15. 1
      IGP/Dialog/EntityDialogComponent.razor
  16. 5
      IGP/Dialog/SearchDialogComponent.razor
  17. 1
      IGP/IGP.csproj
  18. 5
      IGP/Index.razor
  19. 52
      IGP/PageLayout.razor
  20. 5
      IGP/Pages/AboutPage.razor
  21. 19
      IGP/Pages/Agile/AgilePage.razor
  22. 38
      IGP/Pages/BasePage.razor
  23. 73
      IGP/Pages/BuildCalculator/BuildCalculatorPage.razor
  24. 1
      IGP/Pages/BuildCalculator/Parts/ArmyComponent.razor
  25. 1
      IGP/Pages/BuildCalculator/Parts/BankComponent.razor
  26. 1
      IGP/Pages/BuildCalculator/Parts/BuildChartComponent.razor
  27. 1
      IGP/Pages/BuildCalculator/Parts/BuildOrderComponent.razor
  28. 1
      IGP/Pages/BuildCalculator/Parts/EntityClickViewComponent.razor
  29. 1
      IGP/Pages/BuildCalculator/Parts/HighlightsComponent.razor
  30. 118
      IGP/Pages/BuildCalculator/Parts/HotkeyViewerComponent.razor
  31. 19
      IGP/Pages/BuildCalculator/Parts/InputPanelComponent.razor
  32. 1
      IGP/Pages/BuildCalculator/Parts/OptionsComponent.razor
  33. 1
      IGP/Pages/BuildCalculator/Parts/TimelineComponent.razor
  34. 1
      IGP/Pages/BuildCalculator/Parts/TimingComponent.razor
  35. 20
      IGP/Pages/ChangeLogPage.razor
  36. 4
      IGP/Pages/Comparision/ComparisionPage.razor
  37. 1
      IGP/Pages/Comparision/Parts/BuildLoaderComponent.razor
  38. 1
      IGP/Pages/Comparision/Parts/SandComponent.razor
  39. 3
      IGP/Pages/ContactPage.razor
  40. 3
      IGP/Pages/DataCollectionPage.razor
  41. 20
      IGP/Pages/Database/DatabasePage.razor
  42. 36
      IGP/Pages/Database/DatabaseSinglePage.razor
  43. 1
      IGP/Pages/Database/Entity/Parts/EntityWeaponsComponent.razor
  44. 1
      IGP/Pages/Database/Parts/EntityFilterComponent.razor
  45. 14
      IGP/Pages/Documentation/DocumentationIndexPage.razor
  46. 18
      IGP/Pages/Documentation/DocumentationPage.razor
  47. 3
      IGP/Pages/EconomyComparison/EconomyComparisonPage.razor
  48. 1
      IGP/Pages/EconomyComparison/Parts/ChartComponent.razor
  49. 1
      IGP/Pages/EconomyComparison/Parts/EconomyDifferenceComponent.razor
  50. 1
      IGP/Pages/EconomyComparison/Parts/EconomyInputComponent.razor
  51. 4
      IGP/Pages/HarassCalculatorPage.razor
  52. 2
      IGP/Pages/Home/HomePage.razor
  53. 4
      IGP/Pages/MakingOf/MakingOfPage.razor
  54. 2
      IGP/Pages/MemoryTester/MemoryTesterPage.razor
  55. 1
      IGP/Pages/MemoryTester/Parts/UnitMemory.razor
  56. 1
      IGP/Pages/MemoryTester/Parts/UnitMemoryManager.razor
  57. 17
      IGP/Pages/Notes/NotesIndexPage.razor
  58. 21
      IGP/Pages/Notes/NotesPage.razor
  59. 48
      IGP/Pages/PermissionsPage.razor
  60. 4
      IGP/Pages/RawDatabase.razor
  61. 4
      IGP/Pages/RoadMap/RoadMapPage.razor
  62. 4
      IGP/Pages/StoragePage.razor
  63. 2
      IGP/Pages/StreamsPage.razor
  64. 25
      IGP/Portals/ConfirmationDialogPortal.razor
  65. 1
      IGP/Portals/EntityDialogPortal.razor
  66. 21
      IGP/Portals/SearchPortal.razor
  67. 1
      IGP/Portals/ToastPortal.razor
  68. 68
      IGP/Program.cs
  69. 3
      IGP/_Imports.razor
  70. 2
      IGP/wwwroot/generated/AgileTaskModels.json
  71. 2
      IGP/wwwroot/generated/WebPageModels.json
  72. 1
      IGP/wwwroot/index.html
  73. 19
      Services/IServices.cs
  74. 11
      Services/Immortal/BuildOrderService.cs
  75. 1
      Services/Services.csproj
  76. 50
      Services/Website/DataCollectionService.cs
  77. 63
      Services/Website/DialogService.cs
  78. 14
      Services/Website/PermissionService.cs
  79. 16
      Services/Website/StorageService.cs

1
Components/Display/DevOnlyComponent.razor

@ -68,6 +68,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
isOnDev = NavigationManager.BaseUri.Contains("https://localhost"); isOnDev = NavigationManager.BaseUri.Contains("https://localhost");
} }

1
Components/Feedback/ToastComponent.razor

@ -76,6 +76,7 @@ else
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
toastService.Subscribe(OnUpdate); toastService.Subscribe(OnUpdate);
} }

1
Components/Form/FormCheckboxComponent.razor

@ -70,6 +70,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
labelId = Label.ToLower().Replace(" ", "_"); labelId = Label.ToLower().Replace(" ", "_");
} }

1
Components/Form/FormGuessComponent.razor

@ -96,6 +96,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
labelId = Label.ToLower().Replace(" ", "_") + MemoryQuestion.Id; labelId = Label.ToLower().Replace(" ", "_") + MemoryQuestion.Id;
MemoryTesterService.Subscribe(OnMemoryEvent); MemoryTesterService.Subscribe(OnMemoryEvent);

1
Components/Form/FormTextAreaComponent.razor

@ -87,6 +87,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
labelId = Label.ToLower().Replace(" ", "_"); labelId = Label.ToLower().Replace(" ", "_");
} }

1
Components/Form/FormTextComponent.razor

@ -85,6 +85,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
labelId = Label.ToLower().Replace(" ", "_"); labelId = Label.ToLower().Replace(" ", "_");
} }

9
Components/Form/FormToggleComponent.razor

@ -7,6 +7,7 @@
<input readonly="@ReadOnly" <input readonly="@ReadOnly"
type="checkbox" type="checkbox"
id="@labelId" id="@labelId"
class="@ClassStyle"
checked="@Value" checked="@Value"
@oninput="OnChange"/> @oninput="OnChange"/>
@ -83,11 +84,11 @@
border-radius: 50%; border-radius: 50%;
} }
input:checked + .slider { .checked + .slider {
background-color: #7838df; background-color: #7838df;
} }
input:checked + .slider:before { .checked + .slider:before {
-webkit-transform: translateX(26px); -webkit-transform: translateX(26px);
-ms-transform: translateX(26px); -ms-transform: translateX(26px);
transform: translateX(26px); transform: translateX(26px);
@ -114,9 +115,11 @@
private string labelId = ""; private string labelId = "";
private string ClassStyle => Value ? "checked" : "";
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
labelId = Label.ToLower().Replace(" ", "_"); labelId = Label.ToLower().Replace(" ", "_");
} }
} }

1
Components/Inputs/ButtonGroupComponent.razor

@ -81,6 +81,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
} }
void OnChangeChoice(string choice) void OnChangeChoice(string choice)

1
Components/Navigation/DesktopNavComponent.razor

@ -168,6 +168,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
navigationService.Subscribe(StateHasChanged); navigationService.Subscribe(StateHasChanged);
} }

10
Components/Navigation/DesktopNavLinkComponent.razor

@ -1,5 +1,5 @@
@inject INavigationService navigationService; @inject INavigationService NavigationService;
@inject NavigationManager navigationManager; @inject NavigationManager NavigationManager;
@if (isOnPage) @if (isOnPage)
{ {
@ -11,7 +11,7 @@
} }
else else
{ {
<NavLink @onclick="() => { navigationService.ChangeNavigationState(NavigationStateType.Default); navigationService.ChangeNavigationSectionId(-1); }" href="@Page.Href" class="desktopNavLink"> <NavLink @onclick="() => { NavigationService.ChangeNavigationState(NavigationStateType.Default); NavigationService.ChangeNavigationSectionId(-1); }" href="@Page.Href" class="desktopNavLink">
<div class="navName"> <div class="navName">
@Page.Name @Page.Name
</div> </div>
@ -71,7 +71,7 @@ else
protected override Task OnParametersSetAsync() protected override Task OnParametersSetAsync()
{ {
var uri = navigationManager.Uri.Remove(0, navigationManager.BaseUri.Count()).ToLower(); var uri = NavigationManager.Uri.Remove(0, NavigationManager.BaseUri.Count()).ToLower();
isOnPage = Page.Href.ToLower().Equals(uri); isOnPage = Page.Href.ToLower().Equals(uri);
return Task.CompletedTask; return Task.CompletedTask;
@ -85,7 +85,7 @@ else
void OnBack() void OnBack()
{ {
navigationService.Back(); NavigationService.Back();
} }
} }

1
Components/Shared/DisplayableRoute.razor

@ -21,6 +21,7 @@ else
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
var page = MyNavigationManager.Uri.Remove(0, MyNavigationManager.BaseUri.Length); var page = MyNavigationManager.Uri.Remove(0, MyNavigationManager.BaseUri.Length);
isDisplayable = WebDeploymentModel.Get().Contains(page); isDisplayable = WebDeploymentModel.Get().Contains(page);
} }

12
IGP/App.razor

@ -1,6 +1,6 @@
@using Microsoft.AspNetCore.Components.ProtectedBrowserStorage @inject IVariableService VariableService
@inject IVariableService VariableService
@inject IStorageService StorageService @inject IStorageService StorageService
@inject IPermissionService PermissionService
<Router AppAssembly="@typeof(App).Assembly"> <Router AppAssembly="@typeof(App).Assembly">
@ -22,6 +22,14 @@
<EntityDialogPortal/> <EntityDialogPortal/>
<ToastPortal/> <ToastPortal/>
<SearchPortal/> <SearchPortal/>
<ConfirmationDialogPortal/>
@if (PermissionService.GetIsDataCollectionEnabled())
{
<NavigationTracker />
}
<style> <style>

BIN
IGP/Database.db

Binary file not shown.

114
IGP/Dialog/ConfirmationDialogComponent.razor

@ -0,0 +1,114 @@
@implements IDisposable;
@inject IDialogService DialogService
@inject IJSRuntime JsRuntime
@inject NavigationManager NavigationManager
@if (DialogService.IsVisible)
{
<div class="confirmDialogBackground" onclick="@CloseDialog">
<div class="confirmDialogContainer"
@onclick:preventDefault="true"
@onclick:stopPropagation="true">
<div class="confirmDialogHeader">
@DialogService.GetDialogContents().Title
</div>
<div class="confirmDialogBody">
@DialogService.GetDialogContents().Message
</div>
<div class="confirmDialogFooter">
<ButtonComponent ButtonType="ButtonType.Secondary" OnClick="DialogService.GetDialogContents().OnCancel">
Cancel
</ButtonComponent>
<ButtonComponent ButtonType="ButtonType.Primary" OnClick="DialogService.GetDialogContents().OnConfirm">
@DialogService.GetDialogContents().ConfirmButtonLabel
</ButtonComponent>
</div>
</div>
</div>
<style>
.pageContents * {
filter: blur(2px);
}
.confirmDialogBackground {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
}
.confirmDialogContainer {
margin-left: auto;
margin-right: auto;
margin-top: 64px;
width: 800px;
height: 600px;
background-color: var(--background);
border-width: var(--dialog-border-width);
border-style: solid;
border-color: var(--dialog-border-color);
border-radius: var(--dialog-radius);
padding: 8px;
box-shadow: 1px 2px 2px black;
display: flex;
flex-direction: column;
}
.confirmDialogHeader {
font-size: 1.4em;
padding: 12px;
}
.confirmDialogBody {
padding: 12px;
flex-grow: 1;
}
.confirmDialogFooter {
display: flex;
gap: 12px;
justify-content: flex-end;
padding: 12px;
}
</style>
}
@code {
protected override void OnInitialized()
{
base.OnInitialized();
DialogService.Subscribe(StateHasChanged);
}
void IDisposable.Dispose()
{
DialogService.Unsubscribe(StateHasChanged);
}
public void CloseDialog()
{
DialogService.Hide();
}
}

1
IGP/Dialog/EntityDialogComponent.razor

@ -145,6 +145,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
entity = DATA.Get()[entityDialogService.GetEntityId() ?? string.Empty]; entity = DATA.Get()[entityDialogService.GetEntityId() ?? string.Empty];
entityDialogService.Subscribe(OnUpdate); entityDialogService.Subscribe(OnUpdate);

5
IGP/Dialog/SearchDialogComponent.razor

@ -50,7 +50,7 @@
filter: blur(2px); filter: blur(2px);
} }
.searchBackground { .confirmDialogBackground {
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
@ -84,7 +84,7 @@
} }
.searchContainer { .confirmDialogContainer {
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
margin-top: 64px; margin-top: 64px;
@ -120,6 +120,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
searchService.Subscribe(OnSearchChanged); searchService.Subscribe(OnSearchChanged);
timer = new Timer(200); timer = new Timer(200);

1
IGP/IGP.csproj

@ -20,6 +20,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Blazor-Analytics" Version="3.11.0" />
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0-preview.1" /> <PackageReference Include="Blazored.LocalStorage" Version="4.3.0-preview.1" />
<PackageReference Include="Markdig" Version="0.28.1" /> <PackageReference Include="Markdig" Version="0.28.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0-preview.2.22153.2" /> <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0-preview.2.22153.2" />

5
IGP/Index.razor

@ -1,9 +1,12 @@
@page "/" @page "/"
@inject ITrackingNavigationState TrackingNavigationState
@inject IAnalytics GlobalTracking
@layout PageLayout @layout PageLayout
<DevOnlyComponent> <DevOnlyComponent>
<StoragePage/> <PermissionsPage/>
</DevOnlyComponent> </DevOnlyComponent>
<HomePage/> <HomePage/>

52
IGP/PageLayout.razor

@ -1,13 +1,16 @@
@inherits LayoutComponentBase; @inherits LayoutComponentBase
@inject IJSRuntime jsRuntime @inject IJSRuntime JsRuntime
@inject ISearchService searchService @inject ISearchService SearchService
@inject IWebsiteService webService; @inject IWebsiteService WebService
@implements IDisposable; @inject IDataCollectionService DataCollectionService
@inject NavigationManager NavigationManager
@using Services.Website
@implements IDisposable
<div class="pageContents"> <div class="pageContents">
<div class="layoutContainer"> <div class="layoutContainer">
@if (!webService.IsLoaded()) @if (!WebService.IsLoaded())
{ {
<LoadingComponent/> <LoadingComponent/>
} }
@ -18,12 +21,12 @@
</div> </div>
<DesktopNavComponent WebSections=webService.WebSectionModels <DesktopNavComponent WebSections=WebService.WebSectionModels
WebPages=webService.WebPageModels/> WebPages=WebService.WebPageModels/>
<TabletNavComponent WebSections=webService.WebSectionModels <TabletNavComponent WebSections=WebService.WebSectionModels
WebPages=webService.WebPageModels/> WebPages=WebService.WebPageModels/>
<MobileNavComponent WebSections=webService.WebSectionModels <MobileNavComponent WebSections=WebService.WebSectionModels
WebPages=webService.WebPageModels/> WebPages=WebService.WebPageModels/>
} }
</div> </div>
@ -33,12 +36,29 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
webService.Subscribe(HasChanged); base.OnInitialized();
WebService.Subscribe(HasChanged);
CollectFirstPageLoaded();
}
private void CollectFirstPageLoaded()
{
var skipBaseUri = NavigationManager.Uri.Substring(NavigationManager.BaseUri.Length,
NavigationManager.Uri.Length - NavigationManager.BaseUri.Length);
var rootUrl = skipBaseUri.Split("/").First();
if (rootUrl.Trim().Equals(""))
{
rootUrl = "home";
}
DataCollectionService.SendEvent(DataCollectionKeys.FirstPage,
new Dictionary<string, string> { { "page", rootUrl } });
} }
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
await webService.Load(); await WebService.Load();
await Focus(); await Focus();
} }
@ -55,7 +75,7 @@
void IDisposable.Dispose() void IDisposable.Dispose()
{ {
webService.Unsubscribe(HasChanged); WebService.Unsubscribe(HasChanged);
} }
void HasChanged() void HasChanged()
@ -67,7 +87,7 @@
{ {
if ((keyboardEventArgs.CtrlKey || keyboardEventArgs.MetaKey) && keyboardEventArgs.Key.ToLower() == "k") if ((keyboardEventArgs.CtrlKey || keyboardEventArgs.MetaKey) && keyboardEventArgs.Key.ToLower() == "k")
{ {
searchService.Show(); SearchService.Show();
} }
} }

5
IGP/Pages/AboutPage.razor

@ -1,5 +1,10 @@
@layout PageLayout @layout PageLayout
@inherits BasePage
@inject IDataCollectionService DataCollectionService
@page "/about" @page "/about"
<LayoutMediumContentComponent> <LayoutMediumContentComponent>

19
IGP/Pages/Agile/AgilePage.razor

@ -1,11 +1,12 @@
@implements IDisposable; @implements IDisposable;
@inject IAgileService agileService; @inject IAgileService AgileService;
@layout PageLayout @layout PageLayout
@inherits BasePage
@page "/agile" @page "/agile"
@if (!agileService.IsLoaded()) @if (!AgileService.IsLoaded())
{ {
<LoadingComponent/> <LoadingComponent/>
} }
@ -14,7 +15,7 @@ else
<LayoutMediumContentComponent> <LayoutMediumContentComponent>
<WebsiteTitleComponent>Agile</WebsiteTitleComponent> <WebsiteTitleComponent>Agile</WebsiteTitleComponent>
<div class="agileViewContainer"> <div class="agileViewContainer">
@foreach (var sprint in agileService.AgileSprintModels! @foreach (var sprint in AgileService.AgileSprintModels!
.OrderBy(e => e.EndDate).Reverse()) .OrderBy(e => e.EndDate).Reverse())
{ {
<details class="sprintDisplayContainer @sprint.GetSprintType().ToLower()" <details class="sprintDisplayContainer @sprint.GetSprintType().ToLower()"
@ -80,22 +81,24 @@ else
protected override void OnInitialized() protected override void OnInitialized()
{ {
agileService.Subscribe(HasChanged); base.OnInitialized();
AgileService.Subscribe(HasChanged);
HasChanged(); HasChanged();
} }
void IDisposable.Dispose() void IDisposable.Dispose()
{ {
agileService.Unsubscribe(HasChanged); AgileService.Unsubscribe(HasChanged);
} }
void HasChanged() void HasChanged()
{ {
if (!agileService.IsLoaded()) return; if (!AgileService.IsLoaded()) return;
backlog.Clear(); backlog.Clear();
foreach (var task in agileService.AgileTaskModels!) foreach (var task in AgileService.AgileTaskModels!)
{ {
if (task.AgileSprintModelId == null) if (task.AgileSprintModelId == null)
{ {
@ -108,7 +111,7 @@ else
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
await agileService.Load(); await AgileService.Load();
} }
} }

38
IGP/Pages/BasePage.razor

@ -0,0 +1,38 @@
@using Services.Website
@inject IDataCollectionService DataCollectionService
@inject NavigationManager NavigationManager
@code {
protected override void OnInitialized()
{
base.OnInitialized();
CollectLoadedPage();
}
private void CollectLoadedPage()
{
var skipBaseUri = NavigationManager.Uri.Substring(NavigationManager.BaseUri.Length,
NavigationManager.Uri.Length - NavigationManager.BaseUri.Length);
var splitData = skipBaseUri.Split("/");
var rootUrl = splitData.First();
if (rootUrl.Trim().Equals(""))
{
rootUrl = "home";
}
var eventData = new Dictionary<string, string> { { "page", rootUrl }};
if (splitData.Length > 1)
{
eventData["inner-page"] = splitData.Last();
}
DataCollectionService.SendEvent(DataCollectionKeys.PageInitialized, eventData);
}
}

73
IGP/Pages/BuildCalculator/BuildCalculatorPage.razor

@ -1,16 +1,20 @@
@layout PageLayout @layout PageLayout
@inject IStringLocalizer<Localizations> locale @inherits BasePage
@inject IKeyService keyService @inject IStringLocalizer<Localizations> Locale
@inject IImmortalSelectionService filterService
@inject IBuildOrderService buildOrderService @inject IKeyService KeyService
@inject IEconomyService economyService @inject IImmortalSelectionService FilterService
@inject IToastService toastService @inject IBuildOrderService BuildOrderService
@inject ITimingService timingService @inject IEconomyService EconomyService
@inject IToastService ToastService
@inject ITimingService TimingService
@inject IDataCollectionService DataCollectionService
@page "/build-calculator" @page "/build-calculator"
@using Services.Website
@implements IDisposable @implements IDisposable
<LayoutLargeContentComponent> <LayoutLargeContentComponent>
@ -29,18 +33,18 @@
<div class="gridItem" style="grid-area: timing;"> <div class="gridItem" style="grid-area: timing;">
<ButtonComponent ButtonType="ButtonType.Secondary" OnClick="OnResetClicked">Clear Build Order</ButtonComponent> <ButtonComponent ButtonType="ButtonType.Secondary" OnClick="OnResetClicked">Clear Build Order</ButtonComponent>
<PanelComponent> <PanelComponent>
<InfoTooltipComponent InfoText="@locale["Tooltip Timing Info"]"> <InfoTooltipComponent InfoText="@Locale["Tooltip Timing Info"]">
<TimingComponent></TimingComponent> <TimingComponent></TimingComponent>
</InfoTooltipComponent> </InfoTooltipComponent>
</PanelComponent> </PanelComponent>
<PanelComponent> <PanelComponent>
<InfoTooltipComponent InfoText="@locale["Tooltip Filter Info"]"> <InfoTooltipComponent InfoText="@Locale["Tooltip Filter Info"]">
<FilterComponent></FilterComponent> <FilterComponent></FilterComponent>
</InfoTooltipComponent> </InfoTooltipComponent>
</PanelComponent> </PanelComponent>
<PanelComponent> <PanelComponent>
<InfoTooltipComponent InfoText="@locale["Tooltip Options Info"]"> <InfoTooltipComponent InfoText="@Locale["Tooltip Options Info"]">
<OptionsComponent></OptionsComponent> <OptionsComponent></OptionsComponent>
</InfoTooltipComponent> </InfoTooltipComponent>
</PanelComponent> </PanelComponent>
@ -49,7 +53,7 @@
<div class="gridItem" style="grid-area: chart;"> <div class="gridItem" style="grid-area: chart;">
<PanelComponent> <PanelComponent>
<InfoTooltipComponent InfoText="@locale["Tooltip Chart Info"]"> <InfoTooltipComponent InfoText="@Locale["Tooltip Chart Info"]">
<BuildChartComponent></BuildChartComponent> <BuildChartComponent></BuildChartComponent>
</InfoTooltipComponent> </InfoTooltipComponent>
</PanelComponent> </PanelComponent>
@ -57,7 +61,7 @@
<div class="gridItem" style="grid-area: view;"> <div class="gridItem" style="grid-area: view;">
<PanelComponent> <PanelComponent>
<InfoTooltipComponent InfoText="@locale["Tooltip Entity Info"]"> <InfoTooltipComponent InfoText="@Locale["Tooltip Entity Info"]">
<EntityClickViewComponent/> <EntityClickViewComponent/>
</InfoTooltipComponent> </InfoTooltipComponent>
@ -66,7 +70,7 @@
<div class="gridItem" style="grid-area: bank;"> <div class="gridItem" style="grid-area: bank;">
<PanelComponent> <PanelComponent>
<InfoTooltipComponent InfoText="@locale["Tooltip Bank Info"]"> <InfoTooltipComponent InfoText="@Locale["Tooltip Bank Info"]">
<BankComponent></BankComponent> <BankComponent></BankComponent>
</InfoTooltipComponent> </InfoTooltipComponent>
</PanelComponent> </PanelComponent>
@ -74,7 +78,7 @@
<div class="gridItem" style="grid-area: army;"> <div class="gridItem" style="grid-area: army;">
<PanelComponent> <PanelComponent>
<InfoTooltipComponent InfoText="@locale["Tooltip Army Info"]"> <InfoTooltipComponent InfoText="@Locale["Tooltip Army Info"]">
<ArmyComponent></ArmyComponent> <ArmyComponent></ArmyComponent>
</InfoTooltipComponent> </InfoTooltipComponent>
</PanelComponent> </PanelComponent>
@ -82,7 +86,7 @@
<div class="gridItem gridKeys"> <div class="gridItem gridKeys">
<PanelComponent> <PanelComponent>
<InfoTooltipComponent InfoText="@locale["Tooltip Hotkey Info"]"> <InfoTooltipComponent InfoText="@Locale["Tooltip Hotkey Info"]">
<HotkeyViewerComponent Size="80"></HotkeyViewerComponent> <HotkeyViewerComponent Size="80"></HotkeyViewerComponent>
</InfoTooltipComponent> </InfoTooltipComponent>
</PanelComponent> </PanelComponent>
@ -90,7 +94,7 @@
<div class="gridItem" style="grid-area: highlights;"> <div class="gridItem" style="grid-area: highlights;">
<PanelComponent> <PanelComponent>
<InfoTooltipComponent InfoText="@locale["Tooltip Highlights Info"]"> <InfoTooltipComponent InfoText="@Locale["Tooltip Highlights Info"]">
<HighlightsComponent></HighlightsComponent> <HighlightsComponent></HighlightsComponent>
</InfoTooltipComponent> </InfoTooltipComponent>
</PanelComponent> </PanelComponent>
@ -98,7 +102,7 @@
<div class="gridItem" style="grid-area: buildorder;"> <div class="gridItem" style="grid-area: buildorder;">
<PanelComponent> <PanelComponent>
<InfoTooltipComponent InfoText="@locale["Tooltip BuildOrder Info"]"> <InfoTooltipComponent InfoText="@Locale["Tooltip BuildOrder Info"]">
<BuildOrderComponent></BuildOrderComponent> <BuildOrderComponent></BuildOrderComponent>
</InfoTooltipComponent> </InfoTooltipComponent>
</PanelComponent> </PanelComponent>
@ -216,32 +220,39 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
economyService.Calculate(buildOrderService, timingService, 0); base.OnInitialized();
EconomyService.Calculate(BuildOrderService, TimingService, 0);
KeyService.Subscribe(HandleClick);
keyService.Subscribe(HandleClick); DataCollectionService.SendEvent(
DataCollectionKeys.PageInitialized,
new Dictionary<string, string> {{"page", "build-calculator"}}
);
} }
void IDisposable.Dispose() void IDisposable.Dispose()
{ {
keyService.Unsubscribe(HandleClick); KeyService.Unsubscribe(HandleClick);
} }
private void OnResetClicked() private void OnResetClicked()
{ {
toastService.AddToast(new ToastModel ToastService.AddToast(new ToastModel
{ {
SeverityType = SeverityType.Success, SeverityType = SeverityType.Success,
Message = "Build order has been cleared.", Message = "Build order has been cleared.",
Title = "Reset" Title = "Reset"
}); });
buildOrderService.Reset(); BuildOrderService.Reset();
} }
private void HandleClick() private void HandleClick()
{ {
var hotkey = keyService.GetHotkey(); var hotkey = KeyService.GetHotkey();
if (hotkey == "") if (hotkey == "")
{ {
@ -250,15 +261,15 @@
if (hotkey == "`") if (hotkey == "`")
{ {
buildOrderService.RemoveLast(); BuildOrderService.RemoveLast();
economyService.Calculate(buildOrderService, timingService, buildOrderService.GetLastRequestInterval()); EconomyService.Calculate(BuildOrderService, TimingService, BuildOrderService.GetLastRequestInterval());
return; return;
} }
var hotkeyGroup = keyService.GetHotkeyGroup(); var hotkeyGroup = KeyService.GetHotkeyGroup();
var isHoldSpace = keyService.IsHoldingSpace(); var isHoldSpace = KeyService.IsHoldingSpace();
var faction = filterService.GetFaction(); var faction = FilterService.GetFaction();
var immortal = filterService.GetImmortal(); var immortal = FilterService.GetImmortal();
var entity = EntityModel.GetFrom(hotkey!, hotkeyGroup, isHoldSpace, faction, immortal); var entity = EntityModel.GetFrom(hotkey!, hotkeyGroup, isHoldSpace, faction, immortal);
@ -267,9 +278,9 @@
return; return;
} }
if (buildOrderService.Add(entity, economyService)) if (BuildOrderService.Add(entity, EconomyService))
{ {
economyService.Calculate(buildOrderService, timingService, buildOrderService.GetLastRequestInterval()); EconomyService.Calculate(BuildOrderService, TimingService, BuildOrderService.GetLastRequestInterval());
} }
} }

1
IGP/Pages/BuildCalculator/Parts/ArmyComponent.razor

@ -67,6 +67,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
buildOrder.Subscribe(OnBuildOrderChanged); buildOrder.Subscribe(OnBuildOrderChanged);
timingService.Subscribe(StateHasChanged); timingService.Subscribe(StateHasChanged);
} }

1
IGP/Pages/BuildCalculator/Parts/BankComponent.razor

@ -75,6 +75,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
BuildOrderService.Subscribe(OnBuildOrderChanged); BuildOrderService.Subscribe(OnBuildOrderChanged);
} }

1
IGP/Pages/BuildCalculator/Parts/BuildChartComponent.razor

@ -81,6 +81,7 @@ else
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
buildOrderService.Subscribe(OnBuilderOrderChanged); buildOrderService.Subscribe(OnBuilderOrderChanged);
timingService.Subscribe(OnBuilderOrderChanged); timingService.Subscribe(OnBuilderOrderChanged);

1
IGP/Pages/BuildCalculator/Parts/BuildOrderComponent.razor

@ -15,6 +15,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
buildOrderService.Subscribe(StateHasChanged); buildOrderService.Subscribe(StateHasChanged);
} }

1
IGP/Pages/BuildCalculator/Parts/EntityClickViewComponent.razor

@ -29,6 +29,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
KeyService.Subscribe(HandleClick); KeyService.Subscribe(HandleClick);
StorageService.Subscribe(RefreshDefaults); StorageService.Subscribe(RefreshDefaults);

1
IGP/Pages/BuildCalculator/Parts/HighlightsComponent.razor

@ -60,6 +60,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
economyService.Subscribe(StateHasChanged); economyService.Subscribe(StateHasChanged);
buildOrderService.Subscribe(StateHasChanged); buildOrderService.Subscribe(StateHasChanged);
} }

118
IGP/Pages/BuildCalculator/Parts/HotkeyViewerComponent.razor

@ -1,12 +1,14 @@
@inject IJSRuntime jsRuntime; @inject IJSRuntime JsRuntime;
@using Services.Website
@implements IDisposable @implements IDisposable
@inject IKeyService keyService @inject IKeyService KeyService
@inject IBuildOrderService buildOrderService @inject IBuildOrderService BuildOrderService
@inject IImmortalSelectionService filterService @inject IImmortalSelectionService FilterService
@inject IEconomyService economyService @inject IEconomyService EconomyService
@inject ITimingService timingService @inject ITimingService TimingService
@inject IToastService toastService @inject IToastService ToastService
@inject IDataCollectionService DataCollectionService
<InputPanelComponent> <InputPanelComponent>
@ -18,7 +20,7 @@
continue; continue;
} }
var color = hotkey.KeyText.Equals("SPACE") && keyService.IsHoldingSpace() || keyService.GetAllPressedKeys().Contains(hotkey.KeyText) var color = hotkey.KeyText.Equals("SPACE") && KeyService.IsHoldingSpace() || KeyService.GetAllPressedKeys().Contains(hotkey.KeyText)
? "#0a0f12" : hotkey.GetColor(); ? "#0a0f12" : hotkey.GetColor();
var x = hotkey.PositionX * Size; var x = hotkey.PositionX * Size;
@ -34,7 +36,7 @@
border = "5px solid green"; border = "5px solid green";
} }
if (hotkey.KeyText.Equals("SPACE") && keyService.IsHoldingSpace()) if (hotkey.KeyText.Equals("SPACE") && KeyService.IsHoldingSpace())
{ {
border = "5px solid green"; border = "5px solid green";
} }
@ -46,7 +48,7 @@
width: 0px; width: 0px;
height: 0px;"> height: 0px;">
<div @onclick="x => { if (hotkey.KeyText.Equals(HotKeyType.SPACE.ToString())) { if (keyService.IsHoldingSpace()) { keyService.RemovePressedKey(hotkey.KeyText); } else { keyService.AddPressedKey(hotkey.KeyText); } } else { keyService.AddPressedKey(hotkey.KeyText); keyService.RemovePressedKey(hotkey.KeyText); }}" style="background-color:@color; <div @onclick="((e)=> ButtonClicked(e, hotkey))" style="background-color:@color;
border: @border; border: @border;
width: @Size.ToString()px; width: @Size.ToString()px;
height: @Size.ToString()px; height: @Size.ToString()px;
@ -73,7 +75,7 @@
var isVanguard = entity.VanguardAdded() != null; var isVanguard = entity.VanguardAdded() != null;
var style = isVanguard ? "font-weight: bold;" : ""; var style = isVanguard ? "font-weight: bold;" : "";
if (buildOrderService.WillMeetRequirements(entity) == null) if (BuildOrderService.WillMeetRequirements(entity) == null)
{ {
style += "color:gray; font-style: italic;"; style += "color:gray; font-style: italic;";
} }
@ -122,25 +124,25 @@
{ {
base.OnInitialized(); base.OnInitialized();
keyService.Subscribe(OnKeyPressed); KeyService.Subscribe(OnKeyPressed);
filterService.Subscribe(StateHasChanged); FilterService.Subscribe(StateHasChanged);
buildOrderService.Subscribe(OnBuilderOrderChanged); BuildOrderService.Subscribe(OnBuilderOrderChanged);
} }
void IDisposable.Dispose() void IDisposable.Dispose()
{ {
keyService.Unsubscribe(OnKeyPressed); KeyService.Unsubscribe(OnKeyPressed);
filterService.Unsubscribe(StateHasChanged); FilterService.Unsubscribe(StateHasChanged);
buildOrderService.Unsubscribe(OnBuilderOrderChanged); BuildOrderService.Unsubscribe(OnBuilderOrderChanged);
} }
int completedTimeCount = 0; int completedTimeCount = 0;
void OnBuilderOrderChanged() void OnBuilderOrderChanged()
{ {
if (buildOrderService.UniqueCompletedTimes.Count != completedTimeCount) if (BuildOrderService.UniqueCompletedTimes.Count != completedTimeCount)
{ {
completedTimeCount = buildOrderService.UniqueCompletedTimes.Count; completedTimeCount = BuildOrderService.UniqueCompletedTimes.Count;
StateHasChanged(); StateHasChanged();
} }
} }
@ -148,7 +150,7 @@
protected override bool ShouldRender() protected override bool ShouldRender()
{ {
#if DEBUG #if DEBUG
jsRuntime.InvokeVoidAsync("console.time", "HotKeyViewerComponent"); JsRuntime.InvokeVoidAsync("console.time", "HotKeyViewerComponent");
#endif #endif
return true; return true;
@ -157,14 +159,14 @@
protected override void OnAfterRender(bool firstRender) protected override void OnAfterRender(bool firstRender)
{ {
#if DEBUG #if DEBUG
jsRuntime.InvokeVoidAsync("console.timeEnd", "HotKeyViewerComponent"); JsRuntime.InvokeVoidAsync("console.timeEnd", "HotKeyViewerComponent");
#endif #endif
} }
// Move to Filter Service // Move to Filter Service
bool InvalidFaction(EntityModel entity) bool InvalidFaction(EntityModel entity)
{ {
if (entity.Faction() != null && entity.Faction()?.Faction != filterService.GetFaction() && filterService.GetFaction() != DataType.Any) if (entity.Faction() != null && entity.Faction()?.Faction != FilterService.GetFaction() && FilterService.GetFaction() != DataType.Any)
{ {
return true; return true;
} }
@ -176,8 +178,8 @@
bool InvalidVanguard(EntityModel entity) bool InvalidVanguard(EntityModel entity)
{ {
if (entity.VanguardAdded() != null if (entity.VanguardAdded() != null
&& entity.VanguardAdded()?.ImmortalId != filterService.GetImmortal() && entity.VanguardAdded()?.ImmortalId != FilterService.GetImmortal()
&& filterService.GetImmortal() != DataType.Any) && FilterService.GetImmortal() != DataType.Any)
{ {
return true; return true;
} }
@ -192,7 +194,7 @@
{ {
foreach (var replaced in entity.Replaceds()) foreach (var replaced in entity.Replaceds())
{ {
if (filterService.GetImmortal() == replaced.ImmortalId) if (FilterService.GetImmortal() == replaced.ImmortalId)
{ {
return true; return true;
} }
@ -241,7 +243,7 @@
bool InvalidHoldSpace(EntityModel entity) bool InvalidHoldSpace(EntityModel entity)
{ {
if (entity.Hotkey()?.HoldSpace == keyService.IsHoldingSpace()) if (entity.Hotkey()?.HoldSpace == KeyService.IsHoldingSpace())
{ {
return false; return false;
} }
@ -254,44 +256,44 @@
var keyWas = key; var keyWas = key;
if (keyService.GetAllPressedKeys().Contains("Z")) if (KeyService.GetAllPressedKeys().Contains("Z"))
{ {
controlGroup = "Z"; controlGroup = "Z";
} }
if (keyService.GetAllPressedKeys().Contains("TAB")) if (KeyService.GetAllPressedKeys().Contains("TAB"))
{ {
controlGroup = "TAB"; controlGroup = "TAB";
} }
if (keyService.GetAllPressedKeys().Contains("C")) if (KeyService.GetAllPressedKeys().Contains("C"))
{ {
controlGroup = "C"; controlGroup = "C";
} }
if (keyService.GetAllPressedKeys().Contains("D")) if (KeyService.GetAllPressedKeys().Contains("D"))
{ {
controlGroup = "D"; controlGroup = "D";
} }
if (keyService.GetAllPressedKeys().Contains("1")) if (KeyService.GetAllPressedKeys().Contains("1"))
{ {
controlGroup = "1"; controlGroup = "1";
} }
//TODO This could be better. Duplicated code //TODO This could be better. Duplicated code
if (keyService.GetAllPressedKeys().Contains("2")) if (KeyService.GetAllPressedKeys().Contains("2"))
{ {
controlGroup = "2"; controlGroup = "2";
} }
if (keyService.GetAllPressedKeys().Contains("SHIFT")) if (KeyService.GetAllPressedKeys().Contains("SHIFT"))
{ {
controlGroup = "SHIFT"; controlGroup = "SHIFT";
} }
if (keyService.GetAllPressedKeys().Contains("CONTROL")) if (KeyService.GetAllPressedKeys().Contains("CONTROL"))
{ {
controlGroup = "CONTROL"; controlGroup = "CONTROL";
} }
if (keyService.GetAllPressedKeys().Count > 0) if (KeyService.GetAllPressedKeys().Count > 0)
{ {
key = keyService.GetAllPressedKeys().First(); key = KeyService.GetAllPressedKeys().First();
} }
if (controlGroupWas != controlGroup || keyWas != key) if (controlGroupWas != controlGroup || keyWas != key)
@ -303,7 +305,7 @@
private void HandleClick() private void HandleClick()
{ {
var hotkey = keyService.GetHotkey(); var hotkey = KeyService.GetHotkey();
if (hotkey == "") if (hotkey == "")
{ {
@ -312,15 +314,15 @@
if (hotkey == "`") if (hotkey == "`")
{ {
buildOrderService.RemoveLast(); BuildOrderService.RemoveLast();
economyService.Calculate(buildOrderService, timingService, buildOrderService.GetLastRequestInterval()); EconomyService.Calculate(BuildOrderService, TimingService, BuildOrderService.GetLastRequestInterval());
return; return;
} }
var hotkeyGroup = keyService.GetHotkeyGroup(); var hotkeyGroup = KeyService.GetHotkeyGroup();
var isHoldSpace = keyService.IsHoldingSpace(); var isHoldSpace = KeyService.IsHoldingSpace();
var faction = filterService.GetFaction(); var faction = FilterService.GetFaction();
var immortal = filterService.GetImmortal(); var immortal = FilterService.GetImmortal();
var entity = EntityModel.GetFrom(hotkey!, hotkeyGroup, isHoldSpace, faction, immortal); var entity = EntityModel.GetFrom(hotkey!, hotkeyGroup, isHoldSpace, faction, immortal);
@ -329,9 +331,35 @@
return; return;
} }
if (buildOrderService.Add(entity, economyService)) if (BuildOrderService.Add(entity, EconomyService))
{ {
economyService.Calculate(buildOrderService, timingService, buildOrderService.GetLastRequestInterval()); EconomyService.Calculate(BuildOrderService, TimingService, BuildOrderService.GetLastRequestInterval());
}
}
private void ButtonClicked(MouseEventArgs mouseEventArgs, HotkeyModel hotkey)
{
DataCollectionService.SendEvent(
DataCollectionKeys.BuildCalcInput,
new Dictionary<string, string> {{"key", hotkey.KeyText.ToLower()}, {"input-source", "mouse"}}
);
if (hotkey.KeyText.Equals(HotKeyType.SPACE.ToString()))
{
if (KeyService.IsHoldingSpace())
{
KeyService.RemovePressedKey(hotkey.KeyText);
}
else
{
KeyService.AddPressedKey(hotkey.KeyText);
}
}
else
{
KeyService.AddPressedKey(hotkey.KeyText);
KeyService.RemovePressedKey(hotkey.KeyText);
} }
} }

19
IGP/Pages/BuildCalculator/Parts/InputPanelComponent.razor

@ -1,6 +1,8 @@
@inject IKeyService keyService @using Services.Website
@inject IKeyService KeyService
@inject IJSRuntime jsRuntime; @inject IDataCollectionService DataCollectionService
@inject IJSRuntime JsRuntime
<div tabindex="0" <div tabindex="0"
@ -19,18 +21,23 @@
private void HandleKeyDown(KeyboardEventArgs e) private void HandleKeyDown(KeyboardEventArgs e)
{ {
keyService.AddPressedKey(e.Key); DataCollectionService.SendEvent(
DataCollectionKeys.BuildCalcInput,
new Dictionary<string, string> {{"key", e.Key.ToLower()}, {"input-source", "keyboard"}}
);
KeyService.AddPressedKey(e.Key);
} }
private void HandleKeyUp(KeyboardEventArgs e) private void HandleKeyUp(KeyboardEventArgs e)
{ {
keyService.RemovePressedKey(e.Key); KeyService.RemovePressedKey(e.Key);
} }
protected override bool ShouldRender() protected override bool ShouldRender()
{ {
#if DEBUG #if DEBUG
jsRuntime.InvokeVoidAsync("console.time", "InputPanelComponent"); JsRuntime.InvokeVoidAsync("console.time", "InputPanelComponent");
#endif #endif
return true; return true;
@ -39,7 +46,7 @@
protected override void OnAfterRender(bool firstRender) protected override void OnAfterRender(bool firstRender)
{ {
#if DEBUG #if DEBUG
jsRuntime.InvokeVoidAsync("console.timeEnd", "InputPanelComponent"); JsRuntime.InvokeVoidAsync("console.timeEnd", "InputPanelComponent");
#endif #endif
} }

1
IGP/Pages/BuildCalculator/Parts/OptionsComponent.razor

@ -52,6 +52,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
TimingService.Subscribe(RefreshDefaults); TimingService.Subscribe(RefreshDefaults);
RefreshDefaults(); RefreshDefaults();

1
IGP/Pages/BuildCalculator/Parts/TimelineComponent.razor

@ -58,6 +58,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
economyService.Subscribe(StateHasChanged); economyService.Subscribe(StateHasChanged);
buildOrderService.Subscribe(StateHasChanged); buildOrderService.Subscribe(StateHasChanged);
} }

1
IGP/Pages/BuildCalculator/Parts/TimingComponent.razor

@ -33,6 +33,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
timingService.Subscribe(StateHasChanged); timingService.Subscribe(StateHasChanged);
} }

20
IGP/Pages/ChangeLogPage.razor

@ -1,11 +1,16 @@
@page "/changelog" @page "/changelog"
@implements IDisposable; @implements IDisposable;
@inject IGitService gitService; @inject IGitService GitService;
@inherits BasePage
@inject IDataCollectionService DataCollectionService
@layout PageLayout @layout PageLayout
@if (gitService.IsLoaded()) @if (GitService.IsLoaded())
{ {
<LayoutMediumContentComponent> <LayoutMediumContentComponent>
<WebsiteTitleComponent>Change Log</WebsiteTitleComponent> <WebsiteTitleComponent>Change Log</WebsiteTitleComponent>
@ -90,21 +95,22 @@ else
@code { @code {
private IEnumerable<GitPatchModel> Patches => gitService.GitPatchModels; private IEnumerable<GitPatchModel> Patches => GitService.GitPatchModels;
private List<GitChangeModel> Changes => gitService.GitChangeModels; private List<GitChangeModel> Changes => GitService.GitChangeModels;
private bool isViewImportant = true; private bool isViewImportant = true;
protected override void OnInitialized() protected override void OnInitialized()
{ {
gitService.Subscribe(HasChanged); base.OnInitialized();
GitService.Subscribe(HasChanged);
} }
void IDisposable.Dispose() void IDisposable.Dispose()
{ {
gitService.Unsubscribe(HasChanged); GitService.Unsubscribe(HasChanged);
} }
@ -121,7 +127,7 @@ else
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
await gitService.Load(); await GitService.Load();
} }
} }

4
IGP/Pages/Comparision/ComparisionPage.razor

@ -1,7 +1,8 @@
@layout PageLayout @layout PageLayout
@inherits BasePage
@implements IDisposable @implements IDisposable
@inject IToastService toastService @inject IToastService ToastService
<div style="display:grid; gap: 8px;padding: 16px; height: 94vh; width: 90vw; margin: auto; margin-top: 32px; <div style="display:grid; gap: 8px;padding: 16px; height: 94vh; width: 90vw; margin: auto; margin-top: 32px;
grid-template-columns: 27% 25% 25% 23%; grid-template-rows: auto; grid-template-columns: 27% 25% 25% 23%; grid-template-rows: auto;
@ -53,6 +54,7 @@ grid-template-areas: 'loader sand compare compare' ;">
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
KeyService.Subscribe(HandleClick); KeyService.Subscribe(HandleClick);
FilterService.Subscribe(StateHasChanged); FilterService.Subscribe(StateHasChanged);
EconomyService.Subscribe(StateHasChanged); EconomyService.Subscribe(StateHasChanged);

1
IGP/Pages/Comparision/Parts/BuildLoaderComponent.razor

@ -20,6 +20,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
BuildComparisionService.Subscribe(StateHasChanged); BuildComparisionService.Subscribe(StateHasChanged);
} }

1
IGP/Pages/Comparision/Parts/SandComponent.razor

@ -13,6 +13,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
BuildComparisonService.Subscribe(StateHasChanged); BuildComparisonService.Subscribe(StateHasChanged);
} }

3
IGP/Pages/ContactPage.razor

@ -1,5 +1,8 @@
@layout PageLayout @layout PageLayout
@inject IDataCollectionService DataCollectionService
@inherits BasePage
@page "/contact" @page "/contact"
<LayoutMediumContentComponent> <LayoutMediumContentComponent>

3
IGP/Pages/DataCollectionPage.razor

@ -1,5 +1,8 @@
@page "/data-collection" @page "/data-collection"
@inject IDataCollectionService DataCollectionService
@inherits BasePage
@layout PageLayout @layout PageLayout

20
IGP/Pages/Database/DatabasePage.razor

@ -1,11 +1,12 @@
@layout PageLayout @layout PageLayout
@inherits BasePage
@page "/database" @page "/database"
@implements IDisposable @implements IDisposable
@inject IEntityDisplayService entityDisplayService @inject IEntityDisplayService EntityDisplayService
@inject IVariableService variableService @inject IVariableService VariableService
<LayoutLargeContentComponent> <LayoutLargeContentComponent>
<WebsiteTitleComponent>Database</WebsiteTitleComponent> <WebsiteTitleComponent>Database</WebsiteTitleComponent>
@ -13,13 +14,13 @@
<PaperComponent> <PaperComponent>
<FormDisplayComponent Label="Patch"> <FormDisplayComponent Label="Patch">
<Display> <Display>
Game Patch: @variableService.Variables["GamePatch"] Game Patch: @VariableService.Variables["GamePatch"]
</Display> </Display>
</FormDisplayComponent> </FormDisplayComponent>
</PaperComponent> </PaperComponent>
<div style="margin-left: 8px"> <div style="margin-left: 8px">
<ButtonGroupComponent OnClick="choice => { entityDisplayService.SetDisplayType(choice); }" Choice="@entityDisplayService.GetDisplayType()" Choices="@entityDisplayService.DefaultChoices()"></ButtonGroupComponent> <ButtonGroupComponent OnClick="choice => { EntityDisplayService.SetDisplayType(choice); }" Choice="@EntityDisplayService.GetDisplayType()" Choices="@EntityDisplayService.DefaultChoices()"></ButtonGroupComponent>
</div> </div>
<PaperComponent> <PaperComponent>
@ -31,7 +32,7 @@
@foreach (var entity in searches) @foreach (var entity in searches)
{ {
<CascadingValue Value="entity"> <CascadingValue Value="entity">
<CascadingValue Value="@entityDisplayService.GetDisplayType()"> <CascadingValue Value="@EntityDisplayService.GetDisplayType()">
<EntityViewComponent></EntityViewComponent> <EntityViewComponent></EntityViewComponent>
</CascadingValue> </CascadingValue>
</CascadingValue> </CascadingValue>
@ -67,7 +68,7 @@
Is this database updated to the latest version? Is this database updated to the latest version?
</InfoQuestionComponent> </InfoQuestionComponent>
<InfoAnswerComponent> <InfoAnswerComponent>
Maybe. Check this <b>@variableService.Variables["GamePatch"]</b> version number, and compare it to the number on discord, in the <b>#game-updates</b> channel. That should give a general sense of how out of date the data is. Maybe. Check this <b>@VariableService.Variables["GamePatch"]</b> version number, and compare it to the number on discord, in the <b>#game-updates</b> channel. That should give a general sense of how out of date the data is.
</InfoAnswerComponent> </InfoAnswerComponent>
</InfoBodyComponent> </InfoBodyComponent>
@ -134,16 +135,17 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
RefreshFactionSearch(); RefreshFactionSearch();
EntityFilterService.Subscribe(OnChange); EntityFilterService.Subscribe(OnChange);
entityDisplayService.Subscribe(StateHasChanged); EntityDisplayService.Subscribe(StateHasChanged);
} }
void IDisposable.Dispose() void IDisposable.Dispose()
{ {
EntityFilterService.Unsubscribe(OnChange); EntityFilterService.Unsubscribe(OnChange);
entityDisplayService.Unsubscribe(StateHasChanged); EntityDisplayService.Unsubscribe(StateHasChanged);
} }
void OnChange(EntityFilterEvent filterEntityEvent) void OnChange(EntityFilterEvent filterEntityEvent)

36
IGP/Pages/Database/DatabaseSinglePage.razor

@ -1,24 +1,27 @@
@layout PageLayout @layout PageLayout
@inherits BasePage
@page "/database/{text}" @page "/database/{text}"
@inject IEntityDisplayService entityDisplayService @inject IEntityDisplayService EntityDisplayService
@inject IVariableService VariableService
@inject IVariableService variableService
@implements IDisposable @implements IDisposable
<LayoutLargeContentComponent> <LayoutLargeContentComponent>
<PaperComponent> <PaperComponent>
<FormDisplayComponent Label="Patch"> <FormDisplayComponent Label="Patch">
<Display> <Display>
Game Patch: @variableService.Variables["GamePatch"] Game Patch: @VariableService.Variables["GamePatch"]
</Display> </Display>
</FormDisplayComponent> </FormDisplayComponent>
</PaperComponent> </PaperComponent>
<div style="margin-left: 8px"> <div style="margin-left: 8px">
<ButtonGroupComponent OnClick="choice => { entityDisplayService.SetDisplayType(choice); }" Choice="@entityDisplayService.GetDisplayType()" Choices="@entityDisplayService.DefaultChoices()"></ButtonGroupComponent> <ButtonGroupComponent OnClick="choice => { EntityDisplayService.SetDisplayType(choice); }" Choice="@EntityDisplayService.GetDisplayType()" Choices="@EntityDisplayService.DefaultChoices()"></ButtonGroupComponent>
</div> </div>
@ -33,7 +36,7 @@
</CodeComponent> </CodeComponent>
</PaperComponent> </PaperComponent>
} }
else if (entity == null) else if (_entity == null)
{ {
<PaperComponent> <PaperComponent>
<div>Invalid entity name entered: @Text</div> <div>Invalid entity name entered: @Text</div>
@ -44,8 +47,8 @@
else else
{ {
<PaperComponent> <PaperComponent>
<CascadingValue Value="entity"> <CascadingValue Value="_entity">
<CascadingValue Value="@entityDisplayService.GetDisplayType()"> <CascadingValue Value="@EntityDisplayService.GetDisplayType()">
<EntityViewComponent></EntityViewComponent> <EntityViewComponent></EntityViewComponent>
</CascadingValue> </CascadingValue>
@ -62,17 +65,28 @@
[Parameter] [Parameter]
public string? Text { get; set; } public string? Text { get; set; }
private EntityModel? entity; private EntityModel? _entity;
protected override void OnInitialized() protected override void OnInitialized()
{ {
entityDisplayService.Subscribe(StateHasChanged); EntityDisplayService.Subscribe(StateHasChanged);
}
protected override void OnParametersSet()
{
base.OnParametersSet();
base.OnInitialized();
FocusEntity();
}
private void FocusEntity()
{
foreach (var e in DATA.Get().Values) foreach (var e in DATA.Get().Values)
{ {
if (e.Info().Name.ToLower().Equals(Text!.ToLower())) if (e.Info().Name.ToLower().Equals(Text!.ToLower()))
{ {
entity = e; _entity = e;
return; return;
} }
} }
@ -80,7 +94,7 @@
void IDisposable.Dispose() void IDisposable.Dispose()
{ {
entityDisplayService.Unsubscribe(StateHasChanged); EntityDisplayService.Unsubscribe(StateHasChanged);
} }
} }

1
IGP/Pages/Database/Entity/Parts/EntityWeaponsComponent.razor

@ -244,6 +244,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
StorageService.Subscribe(RefreshDefaults); StorageService.Subscribe(RefreshDefaults);
} }

1
IGP/Pages/Database/Parts/EntityFilterComponent.razor

@ -213,6 +213,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
} }
void OnChangeFaction(string clickedFaction) void OnChangeFaction(string clickedFaction)

14
IGP/Pages/Documentation/DocumentationIndexPage.razor

@ -1,11 +1,12 @@
@layout PageLayout @layout PageLayout
@inherits BasePage
@inject IDocumentationService documentationService @inject IDocumentationService DocumentationService
@implements IDisposable @implements IDisposable
@page "/docs" @page "/docs"
@if (!documentationService.IsLoaded()) @if (!DocumentationService.IsLoaded())
{ {
<LoadingComponent/> <LoadingComponent/>
} }
@ -13,7 +14,7 @@ else
{ {
<LayoutMediumContentComponent> <LayoutMediumContentComponent>
<PaperComponent> <PaperComponent>
@foreach (var docSection in documentationService.DocSectionModels) @foreach (var docSection in DocumentationService.DocSectionModels)
{ {
<div class="docSectionContainer"> <div class="docSectionContainer">
<div class="docSectionTitle">@docSection.Name</div> <div class="docSectionTitle">@docSection.Name</div>
@ -102,14 +103,15 @@ else
protected override void OnInitialized() protected override void OnInitialized()
{ {
documentationService.Subscribe(StateHasChanged); base.OnInitialized();
DocumentationService.Subscribe(StateHasChanged);
documentationService.Load(); DocumentationService.Load();
} }
void IDisposable.Dispose() void IDisposable.Dispose()
{ {
documentationService.Unsubscribe(StateHasChanged); DocumentationService.Unsubscribe(StateHasChanged);
} }
} }

18
IGP/Pages/Documentation/DocumentationPage.razor

@ -1,12 +1,13 @@
@layout PageLayout @layout PageLayout
@inherits BasePage
@inject IDocumentationService documentationService @inject IDocumentationService DocumentationService
@implements IDisposable @implements IDisposable
@page "/docs/{href1}/{href2?}/{href3?}/{href4?}/{href5?}" @page "/docs/{href1}/{href2?}/{href3?}/{href4?}/{href5?}"
@if (!documentationService.IsLoaded()) @if (!DocumentationService.IsLoaded())
{ {
<LoadingComponent/> <LoadingComponent/>
} }
@ -15,12 +16,12 @@ else
<LayoutWithSidebarComponent> <LayoutWithSidebarComponent>
<Sidebar> <Sidebar>
<DocumentNavComponent <DocumentNavComponent
Connections="documentationService.DocConnectionModels" Connections="DocumentationService.DocConnectionModels"
Documents="documentationService.DocContentModels"/> Documents="DocumentationService.DocContentModels"/>
</Sidebar> </Sidebar>
<Content> <Content>
<PaperComponent> <PaperComponent>
@foreach (var doc in documentationService.DocContentModels) @foreach (var doc in DocumentationService.DocContentModels)
{ {
if (!doc.Href.Equals(Href)) if (!doc.Href.Equals(Href))
{ {
@ -108,14 +109,15 @@ else
protected override void OnInitialized() protected override void OnInitialized()
{ {
documentationService.Subscribe(StateHasChanged); base.OnInitialized();
DocumentationService.Subscribe(StateHasChanged);
documentationService.Load(); DocumentationService.Load();
} }
void IDisposable.Dispose() void IDisposable.Dispose()
{ {
documentationService.Unsubscribe(StateHasChanged); DocumentationService.Unsubscribe(StateHasChanged);
} }
} }

3
IGP/Pages/EconomyComparison/EconomyComparisonPage.razor

@ -1,5 +1,7 @@
@page "/economy-comparison" @page "/economy-comparison"
@inherits BasePage
@implements IDisposable @implements IDisposable
@inject IEconomyComparisonService EconomyComparisonService @inject IEconomyComparisonService EconomyComparisonService
@layout PageLayout @layout PageLayout
@ -40,6 +42,7 @@
@code { @code {
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
EconomyComparisonService.Subscribe(StateHasChanged); EconomyComparisonService.Subscribe(StateHasChanged);
} }

1
IGP/Pages/EconomyComparison/Parts/ChartComponent.razor

@ -62,6 +62,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
economyComparisonService.Subscribe(OnBuilderOrderChanged); economyComparisonService.Subscribe(OnBuilderOrderChanged);
OnBuilderOrderChanged(); OnBuilderOrderChanged();

1
IGP/Pages/EconomyComparison/Parts/EconomyDifferenceComponent.razor

@ -72,6 +72,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
economyComparisonService.Subscribe(CalculateDifferences); economyComparisonService.Subscribe(CalculateDifferences);
} }

1
IGP/Pages/EconomyComparison/Parts/EconomyInputComponent.razor

@ -49,6 +49,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
economyComparisonService.Subscribe(StateHasChanged); economyComparisonService.Subscribe(StateHasChanged);
} }

4
IGP/Pages/HarassCalculatorPage.razor

@ -1,5 +1,8 @@
@layout PageLayout @layout PageLayout
@inject IDataCollectionService DataCollectionService
@inherits BasePage
@page "/harass-calculator" @page "/harass-calculator"
@using Model @using Model
@ -261,6 +264,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
Calculate(); Calculate();
} }

2
IGP/Pages/Home/HomePage.razor

@ -1,5 +1,7 @@
@layout PageLayout; @layout PageLayout;
@inherits BasePage
@page "/immortal-home" @page "/immortal-home"
<LayoutMediumContentComponent> <LayoutMediumContentComponent>

4
IGP/Pages/MakingOf/MakingOfPage.razor

@ -1,5 +1,9 @@
@page "/makingof" @page "/makingof"
@inherits BasePage
@inject IDataCollectionService DataCollectionService
@layout PageLayout @layout PageLayout
<LayoutLargeContentComponent> <LayoutLargeContentComponent>

2
IGP/Pages/MemoryTester/MemoryTesterPage.razor

@ -1,5 +1,7 @@
@layout PageLayout @layout PageLayout
@inherits BasePage
@page "/memory-tester" @page "/memory-tester"
<LayoutMediumContentComponent> <LayoutMediumContentComponent>

1
IGP/Pages/MemoryTester/Parts/UnitMemory.razor

@ -62,6 +62,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
MemoryTesterService.Subscribe(OnMemoryEvent); MemoryTesterService.Subscribe(OnMemoryEvent);
OnRefresh(); OnRefresh();

1
IGP/Pages/MemoryTester/Parts/UnitMemoryManager.razor

@ -64,6 +64,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
MemoryTesterService.Subscribe(OnMemoryEvent); MemoryTesterService.Subscribe(OnMemoryEvent);
MemoryTesterService.GenerateQuiz(); MemoryTesterService.GenerateQuiz();

17
IGP/Pages/Notes/NotesIndexPage.razor

@ -1,12 +1,16 @@
@layout PageLayout @layout PageLayout
@inject INoteService noteService @inherits BasePage
@inject INoteService NoteService
@implements IDisposable @implements IDisposable
@inject IDataCollectionService DataCollectionService
@page "/notes" @page "/notes"
@if (!noteService.IsLoaded()) @if (!NoteService.IsLoaded())
{ {
<LoadingComponent/> <LoadingComponent/>
} }
@ -15,7 +19,7 @@ else
<LayoutMediumContentComponent> <LayoutMediumContentComponent>
<PaperComponent> <PaperComponent>
@foreach (var noteSection in noteService.NoteSectionModels) @foreach (var noteSection in NoteService.NoteSectionModels)
{ {
<div class="noteSectionContainer"> <div class="noteSectionContainer">
<div class="noteSectionTitle">@noteSection.Name</div> <div class="noteSectionTitle">@noteSection.Name</div>
@ -119,15 +123,16 @@ else
protected override void OnInitialized() protected override void OnInitialized()
{ {
noteService.Subscribe(StateHasChanged); base.OnInitialized();
NoteService.Subscribe(StateHasChanged);
noteService.Load(); NoteService.Load();
} }
void IDisposable.Dispose() void IDisposable.Dispose()
{ {
noteService.Unsubscribe(StateHasChanged); NoteService.Unsubscribe(StateHasChanged);
} }

21
IGP/Pages/Notes/NotesPage.razor

@ -1,12 +1,16 @@
@layout PageLayout @layout PageLayout
@inject INoteService noteService @inherits BasePage
@inject INoteService NoteService
@implements IDisposable @implements IDisposable
@inject IDataCollectionService DataCollectionService
@page "/notes/{href1}/{href2?}/{href3?}/{href4?}/{href5?}" @page "/notes/{href1}/{href2?}/{href3?}/{href4?}/{href5?}"
@if (!noteService.IsLoaded()) @if (!NoteService.IsLoaded())
{ {
<LoadingComponent/> <LoadingComponent/>
} }
@ -15,12 +19,12 @@ else
<LayoutWithSidebarComponent> <LayoutWithSidebarComponent>
<Sidebar> <Sidebar>
<NoteNavComponent <NoteNavComponent
Connections="noteService.NoteConnectionModels" Connections="NoteService.NoteConnectionModels"
Notes="noteService.NoteContentModels"/> Notes="NoteService.NoteContentModels"/>
</Sidebar> </Sidebar>
<Content> <Content>
<PaperComponent> <PaperComponent>
@foreach (var note in noteService.NoteContentModels) @foreach (var note in NoteService.NoteContentModels)
{ {
if (!note.Href.Equals(Href)) if (!note.Href.Equals(Href))
{ {
@ -107,14 +111,15 @@ else
protected override void OnInitialized() protected override void OnInitialized()
{ {
noteService.Subscribe(StateHasChanged); base.OnInitialized();
NoteService.Subscribe(StateHasChanged);
noteService.Load(); NoteService.Load();
} }
void IDisposable.Dispose() void IDisposable.Dispose()
{ {
noteService.Unsubscribe(StateHasChanged); NoteService.Unsubscribe(StateHasChanged);
} }
} }

48
IGP/Pages/PermissionsPage.razor

@ -2,9 +2,11 @@
@inject IPermissionService PermissionService @inject IPermissionService PermissionService
@layout PageLayout @layout PageLayout
@using Services.Website
@inject Blazored.LocalStorage.ILocalStorageService LocalStorage
@inject IDialogService DialogService
@inherits BasePage
@using Services.Website
@implements IDisposable @implements IDisposable
@ -14,12 +16,13 @@
<FormToggleComponent <FormToggleComponent
Label="Storage Enabled" Label="Storage Enabled"
Info="Is storage enabled?" Info="Is storage enabled?"
Value="@_storageEnabled" Value="_storageEnabled"
OnChange="StoragePermissionChanged"/> OnChange="StoragePermissionChanged"/>
<FormToggleComponent <FormToggleComponent
Label="Data Collection Enabled" Label="Data Collection Enabled"
Info="Is data collection enabled?" Info="Is data collection enabled?"
Value="@_dataCollectionEnabled" Value="_dataCollectionEnabled"
OnChange="DataCollectionPermissionChanged"/> OnChange="DataCollectionPermissionChanged"/>
</FormLayoutComponent> </FormLayoutComponent>
</PaperComponent> </PaperComponent>
@ -44,7 +47,10 @@
<InfoBodyComponent> <InfoBodyComponent>
<InfoQuestionComponent>What data does this website collect?</InfoQuestionComponent> <InfoQuestionComponent>What data does this website collect?</InfoQuestionComponent>
<InfoAnswerComponent>This website usages Google Analytics to collect data enabled on the Analytics page.</InfoAnswerComponent> <InfoAnswerComponent>This website usages Google Analytics to collect data on usage of this website.
<br/><br/>
Items include: if people use keyboard or mouse in build calculator, what pages people visit, and other usages.
</InfoAnswerComponent>
</InfoBodyComponent> </InfoBodyComponent>
<InfoBodyComponent> <InfoBodyComponent>
@ -70,7 +76,6 @@
{ {
_storageEnabled = PermissionService.GetIsStorageEnabled(); _storageEnabled = PermissionService.GetIsStorageEnabled();
_dataCollectionEnabled = PermissionService.GetIsDataCollectionEnabled(); _dataCollectionEnabled = PermissionService.GetIsDataCollectionEnabled();
StateHasChanged(); StateHasChanged();
} }
@ -79,17 +84,40 @@
PermissionService.Unsubscribe(Update); PermissionService.Unsubscribe(Update);
} }
private void StoragePermissionChanged(ChangeEventArgs obj) private void StoragePermissionChanged(ChangeEventArgs obj)
{ {
PermissionService.SetIsStorageEnabled((bool)obj.Value!); PermissionService.SetIsStorageEnabled(!PermissionService.GetIsStorageEnabled());
} }
private void DataCollectionPermissionChanged(ChangeEventArgs obj) private void DataCollectionPermissionChanged(ChangeEventArgs obj)
{ {
PermissionService.SetIsDataCollectionEnabled((bool)obj.Value!); void OnDataCollectionConfirmClicked(MouseEventArgs mouseEventArgs)
{
PermissionService.SetIsDataCollectionEnabled(!PermissionService.GetIsDataCollectionEnabled());
DialogService.Hide();
} }
void OnDataCollectionCancelClicked(MouseEventArgs mouseEventArgs)
{
DialogService.Hide();
}
if (_storageEnabled && !PermissionService.GetIsDataCollectionEnabled())
{
DialogService.Show(new DialogContents
{
Title = "Permission Request",
Message = "Are you sure you want to enable data collection? This feature is implemented with Google Analytics, and your data will be used to gauge interests, find bugs, and optimize updates in IGP Fan Reference.",
OnConfirm = new EventCallback<EventArgs>(this, OnDataCollectionConfirmClicked),
OnCancel = new EventCallback<EventArgs>(this, OnDataCollectionCancelClicked),
ConfirmButtonLabel = "Enable Data Collection"
});
}
else
{
PermissionService.SetIsDataCollectionEnabled(!PermissionService.GetIsDataCollectionEnabled());
}
}
} }

4
IGP/Pages/RawDatabase.razor

@ -1,4 +1,6 @@
@page "/raw-database" @inherits BasePage
@page "/raw-database"
<div class="page"> <div class="page">
<AlertComponent> <AlertComponent>

4
IGP/Pages/RoadMap/RoadMapPage.razor

@ -1,5 +1,9 @@
@layout PageLayout @layout PageLayout
@inherits BasePage
@inject IDataCollectionService DataCollectionService
@page "/roadmap" @page "/roadmap"
<LayoutMediumContentComponent> <LayoutMediumContentComponent>

4
IGP/Pages/StoragePage.razor

@ -1,5 +1,7 @@
@page "/storage" @page "/storage"
@inherits BasePage
@inject IStorageService StorageService @inject IStorageService StorageService
@using Services.Website @using Services.Website
@implements IDisposable @implements IDisposable
@ -145,6 +147,8 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
_enabledPermissions = StorageService.GetValue<bool>(StorageKeys.EnabledStorage); _enabledPermissions = StorageService.GetValue<bool>(StorageKeys.EnabledStorage);
RefreshDefaults(); RefreshDefaults();

2
IGP/Pages/StreamsPage.razor

@ -1,5 +1,7 @@
@page "/streams" @page "/streams"
@inherits BasePage
@layout PageLayout @layout PageLayout
<LayoutMediumContentComponent> <LayoutMediumContentComponent>

25
IGP/Portals/ConfirmationDialogPortal.razor

@ -0,0 +1,25 @@
@implements IDisposable;
@inject IDialogService DialogService
<ConfirmationDialogComponent></ConfirmationDialogComponent>
@code {
protected override void OnInitialized()
{
base.OnInitialized();
DialogService.Subscribe(OnUpdate);
}
void IDisposable.Dispose()
{
DialogService.Unsubscribe(OnUpdate);
}
void OnUpdate()
{
StateHasChanged();
}
}

1
IGP/Portals/EntityDialogPortal.razor

@ -12,6 +12,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
entityDialogService.Subscribe(OnUpdate); entityDialogService.Subscribe(OnUpdate);
} }

21
IGP/Portals/SearchPortal.razor

@ -1,29 +1,28 @@
@implements IDisposable; @implements IDisposable;
@inject ISearchService searchService @inject ISearchService SearchService
@inject IJSRuntime jsRuntime @inject IJSRuntime JsRuntime
<SearchDialogComponent></SearchDialogComponent> <SearchDialogComponent></SearchDialogComponent>
@code { @code {
private string test = "Q";
protected override void OnInitialized() protected override void OnInitialized()
{ {
searchService.Subscribe(OnUpdate); base.OnInitialized();
SearchService.Subscribe(OnUpdate);
} }
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
await searchService.Load(); await SearchService.Load();
await jsRuntime.InvokeVoidAsync("SetDotnetReference", DotNetObjectReference.Create(this)); await JsRuntime.InvokeVoidAsync("SetDotnetReference", DotNetObjectReference.Create(this));
} }
void IDisposable.Dispose() void IDisposable.Dispose()
{ {
searchService.Unsubscribe(OnUpdate); SearchService.Unsubscribe(OnUpdate);
} }
void OnUpdate() void OnUpdate()
@ -36,13 +35,13 @@
{ {
if (code.ToLower().Equals("k") && (ctrlKey || shiftKey || altKey || metaKey)) if (code.ToLower().Equals("k") && (ctrlKey || shiftKey || altKey || metaKey))
{ {
if (searchService.IsVisible) if (SearchService.IsVisible)
{ {
searchService.Hide(); SearchService.Hide();
} }
else else
{ {
searchService.Show(); SearchService.Show();
} }
} }
} }

1
IGP/Portals/ToastPortal.razor

@ -31,6 +31,7 @@
protected override void OnInitialized() protected override void OnInitialized()
{ {
base.OnInitialized();
toastService.Subscribe(OnUpdate); toastService.Subscribe(OnUpdate);
ageTimer = new Timer(10); ageTimer = new Timer(10);

68
IGP/Program.cs

@ -1,6 +1,7 @@
using System.Globalization; using System.Globalization;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using Blazor.Analytics;
using Blazored.LocalStorage; using Blazored.LocalStorage;
using IGP; using IGP;
using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.Web;
@ -10,6 +11,7 @@ using Services.Development;
using Services.Immortal; using Services.Immortal;
using Services.Website; using Services.Website;
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US"); CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("en-US");
CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("en-US"); CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("en-US");
@ -19,8 +21,10 @@ builder.Logging.SetMinimumLevel(LogLevel.Warning);
builder.RootComponents.Add<App>("#app"); builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after"); builder.RootComponents.Add<HeadOutlet>("head::after");
builder.Services.AddSingleton(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddSingleton<LazyAssemblyLoader>();
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddScoped<LazyAssemblyLoader>();
builder.Services.AddProtectedBrowserStorage(); builder.Services.AddProtectedBrowserStorage();
@ -37,32 +41,40 @@ builder.Services.AddBlazoredLocalStorageAsSingleton(config =>
config.JsonSerializerOptions.WriteIndented = false; config.JsonSerializerOptions.WriteIndented = false;
}); });
builder.Services.AddSingleton<INavigationService, NavigationService>(); #if DEBUG
builder.Services.AddSingleton<IKeyService, KeyService>(); builder.Services.AddGoogleAnalytics("G-S96LW7TVFY");
builder.Services.AddSingleton<IImmortalSelectionService, ImmortalSelectionService>(); #else
builder.Services.AddSingleton<IBuildComparisonService, DeprecatedBuildComparisionService>(); builder.Services.AddGoogleAnalytics(builder.Configuration["GA-Tag"]);
builder.Services.AddSingleton<IBuildOrderService, BuildOrderService>(); #endif
builder.Services.AddSingleton<IEconomyService, EconomyService>();
builder.Services.AddSingleton<ITimingService, TimingService>(); builder.Services.AddScoped<INavigationService, NavigationService>();
builder.Services.AddSingleton<IMemoryTesterService, MemoryTesterService>(); builder.Services.AddScoped<IKeyService, KeyService>();
builder.Services.AddSingleton<IEntityFilterService, EntityFilterService>(); builder.Services.AddScoped<IImmortalSelectionService, ImmortalSelectionService>();
builder.Services.AddSingleton<IEntityDisplayService, EntityDisplayService>(); builder.Services.AddScoped<IBuildComparisonService, DeprecatedBuildComparisionService>();
builder.Services.AddSingleton<IEntityDialogService, EntityDialogService>(); builder.Services.AddScoped<IBuildOrderService, BuildOrderService>();
builder.Services.AddSingleton<IToastService, ToastService>(); builder.Services.AddScoped<IEconomyService, EconomyService>();
builder.Services.AddSingleton<IWebsiteService, WebsiteService>(); builder.Services.AddScoped<ITimingService, TimingService>();
builder.Services.AddSingleton<IAgileService, AgileService>(); builder.Services.AddScoped<IMemoryTesterService, MemoryTesterService>();
builder.Services.AddSingleton<IGitService, GitService>(); builder.Services.AddScoped<IEntityFilterService, EntityFilterService>();
builder.Services.AddSingleton<INoteService, NoteService>(); builder.Services.AddScoped<IEntityDisplayService, EntityDisplayService>();
builder.Services.AddSingleton<IDocumentationService, DocumentationService>(); builder.Services.AddScoped<IEntityDialogService, EntityDialogService>();
builder.Services.AddSingleton<ISearchService, SearchService>(); builder.Services.AddScoped<IToastService, ToastService>();
builder.Services.AddSingleton<IVariableService, VariableService>(); builder.Services.AddScoped<IWebsiteService, WebsiteService>();
builder.Services.AddScoped<IAgileService, AgileService>();
builder.Services.AddSingleton<IStorageService, StorageService>(); builder.Services.AddScoped<IGitService, GitService>();
builder.Services.AddSingleton<IPermissionService, PermissionService>(); builder.Services.AddScoped<INoteService, NoteService>();
builder.Services.AddScoped<IDocumentationService, DocumentationService>();
builder.Services.AddSingleton<IEconomyComparisonService, EconomyComparisionService>(); builder.Services.AddScoped<ISearchService, SearchService>();
builder.Services.AddScoped<IVariableService, VariableService>();
builder.Services.AddSingleton(new HttpClient builder.Services.AddScoped<IStorageService, StorageService>();
builder.Services.AddScoped<IPermissionService, PermissionService>();
builder.Services.AddScoped<IEconomyComparisonService, EconomyComparisionService>();
builder.Services.AddScoped<IDataCollectionService, DataCollectionService>();
builder.Services.AddScoped<IDialogService, DialogService>();
builder.Services.AddScoped(sp => new HttpClient
{ {
BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
}); });

3
IGP/_Imports.razor

@ -59,3 +59,6 @@
@using System.Globalization @using System.Globalization
@using System.Reflection @using System.Reflection
@using System.Timers @using System.Timers
@using Blazor.Analytics
@using Blazor.Analytics.Components
@using Blazor.Analytics.Abstractions

2
IGP/wwwroot/generated/AgileTaskModels.json

File diff suppressed because one or more lines are too long

2
IGP/wwwroot/generated/WebPageModels.json

@ -1 +1 @@
[{"Id":1,"WebSectionModelId":2,"Name":"Database","Description":"Database of game information","Href":"database","IsPrivate":"False"},{"Id":2,"WebSectionModelId":1,"Name":"Build Calculator","Description":"Build order calculator for determining army timings","Href":"build-calculator","IsPrivate":"False"},{"Id":3,"WebSectionModelId":1,"Name":"Harass Calculator","Description":"Alloy harassment calculator","Href":"harass-calculator","IsPrivate":"False"},{"Id":4,"WebSectionModelId":1,"Name":"Memory Tester","Description":"Testing memory","Href":"memory-tester","IsPrivate":"False"},{"Id":5,"WebSectionModelId":1,"Name":"Comparion Charts","Description":"Ecnomy charts to compare build orders","Href":"comparison-charts","IsPrivate":"True"},{"Id":6,"WebSectionModelId":2,"Name":"Notes","Description":"General player notes","Href":"notes","IsPrivate":"False"},{"Id":7,"WebSectionModelId":2,"Name":"Key Mapping","Description":"General key mapping info","Href":"keymapping","IsPrivate":"True"},{"Id":8,"WebSectionModelId":4,"Name":"Road Map","Description":"Plans for this website","Href":"roadmap","IsPrivate":"False"},{"Id":9,"WebSectionModelId":4,"Name":"Change Log","Description":"Past updates to the website","Href":"changelog","IsPrivate":"False"},{"Id":10,"WebSectionModelId":4,"Name":"Agile","Description":"Showing agile view of this website","Href":"agile","IsPrivate":"False"},{"Id":11,"WebSectionModelId":4,"Name":"Making Of","Description":"Explaining development details of this website","Href":"makingof","IsPrivate":"False"},{"Id":12,"WebSectionModelId":2,"Name":"Documentation","Description":"Explaining how to use this website","Href":"documentation","IsPrivate":"True"},{"Id":13,"WebSectionModelId":3,"Name":"About","Description":"Answering general questions on the website","Href":"about","IsPrivate":"False"},{"Id":14,"WebSectionModelId":3,"Name":"Contact","Description":"My contact info","Href":"contact","IsPrivate":"False"},{"Id":15,"WebSectionModelId":3,"Name":"Streams","Description":"Stream info","Href":"streams","IsPrivate":"False"},{"Id":16,"WebSectionModelId":4,"Name":"Documentation","Description":"Development information","Href":"docs","IsPrivate":"False"},{"Id":17,"WebSectionModelId":5,"Name":"Permissions","Description":"Permission Settings","Href":"permissions","IsPrivate":"False"},{"Id":18,"WebSectionModelId":5,"Name":"Data Collection","Description":"Data Collection Settings","Href":"data-collection","IsPrivate":"False"},{"Id":19,"WebSectionModelId":5,"Name":"Storage","Description":"Storage Settings","Href":"storage","IsPrivate":"False"},{"Id":20,"WebSectionModelId":1,"Name":"Economy Comparison","Description":"Compare economies","Href":"economy-comparison","IsPrivate":"False"}] [{"Id":1,"WebSectionModelId":2,"Name":"Database","Description":"Database of game information","Href":"database","IsPrivate":"False"},{"Id":2,"WebSectionModelId":1,"Name":"Build Calculator","Description":"Build order calculator for determining army timings","Href":"build-calculator","IsPrivate":"False"},{"Id":3,"WebSectionModelId":1,"Name":"Harass Calculator","Description":"Alloy harassment calculator","Href":"harass-calculator","IsPrivate":"False"},{"Id":4,"WebSectionModelId":1,"Name":"Memory Tester","Description":"Testing memory","Href":"memory-tester","IsPrivate":"False"},{"Id":5,"WebSectionModelId":1,"Name":"Comparion Charts","Description":"Ecnomy charts to compare build orders","Href":"comparison-charts","IsPrivate":"True"},{"Id":6,"WebSectionModelId":2,"Name":"Notes","Description":"General player notes","Href":"notes","IsPrivate":"False"},{"Id":7,"WebSectionModelId":2,"Name":"Key Mapping","Description":"General key mapping info","Href":"keymapping","IsPrivate":"True"},{"Id":8,"WebSectionModelId":4,"Name":"Road Map","Description":"Plans for this website","Href":"roadmap","IsPrivate":"False"},{"Id":9,"WebSectionModelId":4,"Name":"Change Log","Description":"Past updates to the website","Href":"changelog","IsPrivate":"False"},{"Id":10,"WebSectionModelId":4,"Name":"Agile","Description":"Showing agile view of this website","Href":"agile","IsPrivate":"False"},{"Id":11,"WebSectionModelId":4,"Name":"Making Of","Description":"Explaining development details of this website","Href":"makingof","IsPrivate":"False"},{"Id":12,"WebSectionModelId":2,"Name":"Documentation","Description":"Explaining how to use this website","Href":"documentation","IsPrivate":"True"},{"Id":13,"WebSectionModelId":3,"Name":"About","Description":"Answering general questions on the website","Href":"about","IsPrivate":"False"},{"Id":14,"WebSectionModelId":3,"Name":"Contact","Description":"My contact info","Href":"contact","IsPrivate":"False"},{"Id":15,"WebSectionModelId":3,"Name":"Streams","Description":"Stream info","Href":"streams","IsPrivate":"False"},{"Id":16,"WebSectionModelId":4,"Name":"Documentation","Description":"Development information","Href":"docs","IsPrivate":"False"},{"Id":17,"WebSectionModelId":5,"Name":"Permissions","Description":"Permission Settings","Href":"permissions","IsPrivate":"False"},{"Id":18,"WebSectionModelId":5,"Name":"Data Collection","Description":"Data Collection Settings","Href":"data-collection","IsPrivate":"True"},{"Id":19,"WebSectionModelId":5,"Name":"Storage","Description":"Storage Settings","Href":"storage","IsPrivate":"False"},{"Id":20,"WebSectionModelId":1,"Name":"Economy Comparison","Description":"Compare economies","Href":"economy-comparison","IsPrivate":"False"}]

1
IGP/wwwroot/index.html

@ -31,6 +31,7 @@
integrity="sha384-VHvPCCyXqtD5DqJeNxl2dtTyhF78xXNXdkwX1CZeRusQfRKp+tA7hAShOK/B/fQ2" integrity="sha384-VHvPCCyXqtD5DqJeNxl2dtTyhF78xXNXdkwX1CZeRusQfRKp+tA7hAShOK/B/fQ2"
src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.min.js"></script> src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.min.js"></script>
<script src="javascript/download.js"></script> <script src="javascript/download.js"></script>
<script src="_content/Blazor-Analytics/blazor-analytics.js"></script>
<script> <script>
Blazor.start({ Blazor.start({
applicationCulture: 'en-US' applicationCulture: 'en-US'

19
Services/IServices.cs

@ -10,6 +10,7 @@ using Model.Website;
using Model.Website.Enums; using Model.Website.Enums;
using Model.Work.Tasks; using Model.Work.Tasks;
using Services.Immortal; using Services.Immortal;
using Services.Website;
namespace Services; namespace Services;
@ -25,6 +26,12 @@ public interface IToastService
void ClearAllToasts(); void ClearAllToasts();
} }
public interface IDataCollectionService
{
public void SendEvent<T>(string eventName, T eventData);
}
public interface IStorageService public interface IStorageService
{ {
public void Subscribe(Action action); public void Subscribe(Action action);
@ -45,8 +52,6 @@ public interface IPermissionService
public void SetIsStorageEnabled(bool isEnabled); public void SetIsStorageEnabled(bool isEnabled);
public void SetIsDataCollectionEnabled(bool isEnabled); public void SetIsDataCollectionEnabled(bool isEnabled);
Task Load();
} }
public interface ISearchService public interface ISearchService
@ -69,6 +74,16 @@ public interface ISearchService
void Hide(); void Hide();
} }
public interface IDialogService
{
public bool IsVisible { get; set; }
public void Subscribe(Action action);
public void Unsubscribe(Action action);
public void Show(DialogContents dialogContents);
public DialogContents GetDialogContents();
public void Hide();
}
public interface IVariableService public interface IVariableService
{ {
public Dictionary<string, string> Variables { get; set; } public Dictionary<string, string> Variables { get; set; }

11
Services/Immortal/BuildOrderService.cs

@ -338,8 +338,6 @@ public class BuildOrderService : IBuildOrderService
public int? WillMeetTrainingQueue(EntityModel entity) public int? WillMeetTrainingQueue(EntityModel entity)
{ {
Console.WriteLine($"WillMeetTrainingQueue {entity.Info().Name}");
var supply = entity.Supply(); var supply = entity.Supply();
var production = entity.Production(); var production = entity.Production();
@ -347,15 +345,12 @@ public class BuildOrderService : IBuildOrderService
if (supply == null || production == null || supply.Takes.Equals(0)) if (supply == null || production == null || supply.Takes.Equals(0))
{ {
Console.WriteLine(supply == null ? "Was Null" : supply.Takes);
return 1; return 1;
} }
var producedBy = production.ProducedBy; var producedBy = production.ProducedBy;
if (producedBy == null) if (producedBy == null)
{ {
Console.WriteLine("Produced by Nothing");
return 1; return 1;
} }
@ -377,9 +372,6 @@ public class BuildOrderService : IBuildOrderService
usedSlots += used.UsedSlots; usedSlots += used.UsedSlots;
var duration = used.StopUsageTime - used.StartingUsageTime; var duration = used.StopUsageTime - used.StartingUsageTime;
if (duration < shortestIncrement) shortestIncrement = duration; if (duration < shortestIncrement) shortestIncrement = duration;
Console.WriteLine(
$"Used slots {used.UsedSlots} Duration {duration} Start {used.StartingUsageTime} Stop {used.StopUsageTime} ");
} }
if (usedSlots + supply.Takes <= trainingSlots) if (usedSlots + supply.Takes <= trainingSlots)
@ -391,8 +383,6 @@ public class BuildOrderService : IBuildOrderService
Message = $"Had to wait {checkedInterval - _lastInterval}s for Training Queue." Message = $"Had to wait {checkedInterval - _lastInterval}s for Training Queue."
}); });
Console.WriteLine($"Time {checkedInterval} did Delay {didDelay}");
return checkedInterval; return checkedInterval;
} }
@ -401,7 +391,6 @@ public class BuildOrderService : IBuildOrderService
if (shortestIncrement == int.MaxValue) if (shortestIncrement == int.MaxValue)
{ {
Console.WriteLine("MaxValue");
return null; return null;
} }
} }

1
Services/Services.csproj

@ -15,6 +15,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Blazor-Analytics" Version="3.11.0" />
<PackageReference Include="Blazored.LocalStorage" Version="4.3.0-preview.1" /> <PackageReference Include="Blazored.LocalStorage" Version="4.3.0-preview.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.ProtectedBrowserStorage" Version="5.0.0-rc.1.20451.17" /> <PackageReference Include="Microsoft.AspNetCore.Components.ProtectedBrowserStorage" Version="5.0.0-rc.1.20451.17" />
<PackageReference Include="Microsoft.JSInterop" Version="7.0.0-preview.2.22153.2" /> <PackageReference Include="Microsoft.JSInterop" Version="7.0.0-preview.2.22153.2" />

50
Services/Website/DataCollectionService.cs

@ -0,0 +1,50 @@
using Blazor.Analytics;
using Blazored.LocalStorage;
using Model.Feedback;
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 = false;
private readonly IAnalytics _globalTracking;
public DataCollectionService(IAnalytics globalTracking,
IStorageService storageService)
{
_globalTracking = globalTracking;
_storageService = storageService;
_storageService.Subscribe(Refresh);
Refresh();
}
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);
}
}
}

63
Services/Website/DialogService.cs

@ -0,0 +1,63 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using Model.Entity.Data;
using Model.Website;
namespace Services.Website;
public class DialogContents
{
public string Title { get; set; }
public string Message { get; set; }
public string ConfirmButtonLabel { get; set; }
public EventCallback<EventArgs> OnConfirm { get; set; }
public EventCallback<EventArgs> OnCancel { get; set; }
}
public class DialogService : IDialogService
{
private DialogContents _dialogContents;
public DialogService()
{
}
public bool IsVisible { get; set; }
public void Subscribe(Action action)
{
OnChange += action;
}
public void Unsubscribe(Action action)
{
OnChange += action;
}
public void Show(DialogContents dialogContents)
{
_dialogContents = dialogContents;
IsVisible = true;
NotifyDataChanged();
}
public DialogContents GetDialogContents()
{
return _dialogContents;
}
public void Hide()
{
IsVisible = false;
NotifyDataChanged();
}
private event Action OnChange = null!;
private void NotifyDataChanged()
{
OnChange();
}
}

14
Services/Website/PermissionService.cs

@ -2,7 +2,7 @@
namespace Services.Website; namespace Services.Website;
public class PermissionService : IPermissionService public class PermissionService : IPermissionService, IDisposable
{ {
private IJSRuntime _jsRuntime; private IJSRuntime _jsRuntime;
private readonly IStorageService _storageService; private readonly IStorageService _storageService;
@ -15,6 +15,13 @@ public class PermissionService : IPermissionService
_jsRuntime = jsRuntime; _jsRuntime = jsRuntime;
_toastService = toastService; _toastService = toastService;
_storageService = storageService; _storageService = storageService;
_storageService.Subscribe(NotifyDataChanged);
}
void IDisposable.Dispose()
{
_storageService.Unsubscribe(NotifyDataChanged);
} }
public void Subscribe(Action action) public void Subscribe(Action action)
@ -47,11 +54,6 @@ public class PermissionService : IPermissionService
_storageService.SetValue(StorageKeys.EnabledDataCollection, isEnabled); _storageService.SetValue(StorageKeys.EnabledDataCollection, isEnabled);
} }
public Task Load()
{
throw new NotImplementedException();
}
private event Action OnChange = null!; private event Action OnChange = null!;
private void NotifyDataChanged() private void NotifyDataChanged()

16
Services/Website/StorageService.cs

@ -54,28 +54,12 @@ public class StorageService : IStorageService
{ {
_localStorageService.SetItem(key, value); _localStorageService.SetItem(key, value);
NotifyDataChanged(); NotifyDataChanged();
_toastService.AddToast(new ToastModel
{
Title = "Test 1",
SeverityType = SeverityType.Error,
Message = "Storage must be enabled before Storage can be used."
});
return; return;
} }
if (key.Equals(StorageKeys.EnabledStorage)) if (key.Equals(StorageKeys.EnabledStorage))
{ {
_localStorageService.Clear(); _localStorageService.Clear();
_toastService.AddToast(new ToastModel
{
Title = "Test 2",
SeverityType = SeverityType.Error,
Message = "Storage must be enabled before Storage can be used."
});
NotifyDataChanged(); NotifyDataChanged();
return; return;
} }

Loading…
Cancel
Save