feat(Permission) Added start of the Storage feature. Detailed/Plain default toggle

This commit is contained in:
2022-04-24 19:33:18 -04:00
parent 8a4d00054a
commit afaafbe713
20 changed files with 538 additions and 65 deletions
+58 -7
View File
@@ -1,16 +1,27 @@
@page "/permissions"
@inject IPermissionService PermissionService
@layout PageLayout
@using Services.Website
@inject Blazored.LocalStorage.ILocalStorageService LocalStorage
@implements IDisposable
<LayoutMediumContentComponent>
<AlertComponent>
<Title>Not Implemented</Title>
<Message></Message>
</AlertComponent>
<PaperComponent>
TODO
<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/>
@@ -41,4 +52,44 @@
<InfoAnswerComponent>Enable data tracking if you want the website maintainer to know how your using the website.</InfoAnswerComponent>
</InfoBodyComponent>
</PaperComponent>
</LayoutMediumContentComponent>
</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();
}
public void Dispose()
{
PermissionService.Unsubscribe(Update);
}
private void StoragePermissionChanged(ChangeEventArgs obj)
{
PermissionService.SetIsStorageEnabled((bool)obj.Value!);
}
private void DataCollectionPermissionChanged(ChangeEventArgs obj)
{
PermissionService.SetIsDataCollectionEnabled((bool)obj.Value!);
}
}