You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
3.2 KiB
95 lines
3.2 KiB
@page "/permissions" |
|
|
|
@inject IPermissionService PermissionService |
|
@layout PageLayout |
|
@using Services.Website |
|
@inject Blazored.LocalStorage.ILocalStorageService LocalStorage |
|
|
|
@implements IDisposable |
|
|
|
|
|
<LayoutMediumContentComponent> |
|
<PaperComponent> |
|
<FormLayoutComponent> |
|
<FormToggleComponent |
|
Label="Storage Enabled" |
|
Info="Is storage enabled?" |
|
Value="@_storageEnabled" |
|
OnChange="StoragePermissionChanged"/> |
|
<FormToggleComponent |
|
Label="Data Collection Enabled" |
|
Info="Is data collection enabled?" |
|
Value="@_dataCollectionEnabled" |
|
OnChange="DataCollectionPermissionChanged"/> |
|
</FormLayoutComponent> |
|
</PaperComponent> |
|
|
|
<ContentDividerComponent/> |
|
|
|
<PaperComponent> |
|
<InfoBodyComponent> |
|
<InfoQuestionComponent>What's this page?</InfoQuestionComponent> |
|
<InfoAnswerComponent>This page has options to enable and disable certain permissions settings. Such as Storage and Data Collection.</InfoAnswerComponent> |
|
</InfoBodyComponent> |
|
|
|
<InfoBodyComponent> |
|
<InfoQuestionComponent>What does this website store?</InfoQuestionComponent> |
|
<InfoAnswerComponent>This website usages storage to track user defined default on the Storage page.</InfoAnswerComponent> |
|
</InfoBodyComponent> |
|
|
|
<InfoBodyComponent> |
|
<InfoQuestionComponent>Why would I enable storage?</InfoQuestionComponent> |
|
<InfoAnswerComponent>Enable storage if you want to website to remeber past settings whenever you visit the website on the same web browser.</InfoAnswerComponent> |
|
</InfoBodyComponent> |
|
|
|
<InfoBodyComponent> |
|
<InfoQuestionComponent>What data does this website collect?</InfoQuestionComponent> |
|
<InfoAnswerComponent>This website usages Google Analytics to collect data enabled on the Analytics page.</InfoAnswerComponent> |
|
</InfoBodyComponent> |
|
|
|
<InfoBodyComponent> |
|
<InfoQuestionComponent>Why would I enable data collection?</InfoQuestionComponent> |
|
<InfoAnswerComponent>Enable data tracking if you want the website maintainer to know how your using the website.</InfoAnswerComponent> |
|
</InfoBodyComponent> |
|
</PaperComponent> |
|
</LayoutMediumContentComponent> |
|
|
|
|
|
@code { |
|
private bool _storageEnabled = false; |
|
private bool _dataCollectionEnabled = false; |
|
|
|
protected override void OnInitialized() |
|
{ |
|
PermissionService.Subscribe(Update); |
|
|
|
Update(); |
|
} |
|
|
|
void Update() |
|
{ |
|
_storageEnabled = PermissionService.GetIsStorageEnabled(); |
|
_dataCollectionEnabled = PermissionService.GetIsDataCollectionEnabled(); |
|
|
|
StateHasChanged(); |
|
} |
|
|
|
void IDisposable.Dispose() |
|
{ |
|
PermissionService.Unsubscribe(Update); |
|
} |
|
|
|
|
|
|
|
private void StoragePermissionChanged(ChangeEventArgs obj) |
|
{ |
|
PermissionService.SetIsStorageEnabled((bool)obj.Value!); |
|
} |
|
|
|
private void DataCollectionPermissionChanged(ChangeEventArgs obj) |
|
{ |
|
PermissionService.SetIsDataCollectionEnabled((bool)obj.Value!); |
|
} |
|
|
|
|
|
} |