Simplify EnvelopeReceiverPage logic and update settings

Removed redundant `EnvelopeKey` checks in `LogoutAsync` and
`OnInitializedAsync` methods, simplifying logout and initialization
logic. Updated navigation URL to `/envelope/login/`. Streamlined
document fetching logic by removing unnecessary conditions.

Added logging in `CreateReportInstance` to track report creation.
Enabled `ForceToUseFakeDocument` in `appsettings.json` to default
to using fake documents. These changes improve code clarity and
align behavior with updated requirements.
This commit is contained in:
2026-06-11 12:51:04 +02:00
parent a9fb82bbea
commit c3e8f09291
2 changed files with 20 additions and 25 deletions

View File

@@ -162,7 +162,6 @@
</svg>
PDF exportieren
</button>
@if (!string.IsNullOrWhiteSpace(EnvelopeKey)) {
<button class="btn btn-sm btn-outline-danger" @onclick="LogoutAsync" disabled="@IsLoggingOut" title="Abmelden">
@if (IsLoggingOut) {
<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span>
@@ -173,7 +172,6 @@
</svg>
}
</button>
}
</div>
</div>
</div>
@@ -311,33 +309,29 @@ Shown="OnPopupShownAsync">
int _lastOverlayViewerKey = -1;
async Task LogoutAsync() {
if (string.IsNullOrWhiteSpace(EnvelopeKey) || IsLoggingOut) return;
if (IsLoggingOut) return;
IsLoggingOut = true;
await InvokeAsync(StateHasChanged);
await AuthService.LogoutEnvelopeReceiverAsync(EnvelopeKey);
Navigation.NavigateTo($"/login/{Uri.EscapeDataString(EnvelopeKey)}", forceLoad: true);
Navigation.NavigateTo($"/envelope/login/{Uri.EscapeDataString(EnvelopeKey)}", forceLoad: true);
}
protected override async Task OnInitializedAsync() {
if (!string.IsNullOrWhiteSpace(EnvelopeKey)) {
var hasAccess = await AuthService.CheckEnvelopeAccessAsync(EnvelopeKey);
if (!hasAccess) {
Navigation.NavigateTo($"/login/{Uri.EscapeDataString(EnvelopeKey)}");
Navigation.NavigateTo($"/envelope/login/{Uri.EscapeDataString(EnvelopeKey)}");
return;
}
else
{
ActiveSignatureTab = SignatureTabDraw;
SignaturePopupVisible = true;
SignatureValidationMessage = null;
PopupValidationMessage = null;
}
}
_annotations = await AnnotationService.GetAnnotationsAsync(EnvelopeKey ?? "fake");
_envelopeReceiver = await EnvelopeReceiverService.GetAsync(EnvelopeKey ?? "fake");
_annotations = await AnnotationService.GetAnnotationsAsync(EnvelopeKey);
_envelopeReceiver = await EnvelopeReceiverService.GetAsync(EnvelopeKey);
if (!AppOptions.Value.ForceToUseFakeDocument && !string.IsNullOrWhiteSpace(EnvelopeKey)) {
if (!AppOptions.Value.ForceToUseFakeDocument) {
var (pdfBytes, _) = await DocumentService.GetDocumentAsync(EnvelopeKey);
if (pdfBytes is { Length: > 0 })
_basePdfBytes = pdfBytes;
@@ -574,6 +568,7 @@ Shown="OnPopupShownAsync">
}
XtraReport CreateReportInstance() {
Console.WriteLine("Created with predefinedReports");
return ReportStorage.TryGetReport("LargeDatasetReport", out var savedReport)
? savedReport
: PredefinedReports.ReportsFactory.GetReport("LargeDatasetReport");

View File

@@ -1,7 +1,7 @@
{
"Api": {
"BaseUrl": "",
"ForceToUseFakeDocument": false
"ForceToUseFakeDocument": true
},
"PdfViewer": {
"ThumbnailBaseScale": 0.75,