Hooked notifications to status changes on document upload - some refactorings

This commit is contained in:
Anton Stubenbord
2023-01-11 01:26:36 +01:00
parent 8cf3020335
commit a4c4726c16
55 changed files with 1128 additions and 761 deletions

View File

@@ -25,14 +25,12 @@ class DocumentUploadPreparationPage extends StatefulWidget {
final String? title;
final String? filename;
final String? fileExtension;
final void Function(DocumentModel)? onSuccessfullyConsumed;
const DocumentUploadPreparationPage({
Key? key,
required this.fileBytes,
this.title,
this.filename,
this.onSuccessfullyConsumed,
this.fileExtension,
}) : super(key: key);
@@ -236,19 +234,18 @@ class _DocumentUploadPreparationPageState
final correspondent =
fv[DocumentModel.correspondentKey] as IdQueryParameter;
await cubit.upload(
final taskId = await cubit.upload(
widget.fileBytes,
filename:
_padWithPdfExtension(_formKey.currentState?.value[fkFileName]),
title: title,
onConsumptionFinished: widget.onSuccessfullyConsumed,
documentType: docType.id,
correspondent: correspondent.id,
tags: tags.ids,
createdAt: createdAt,
);
showSnackBar(context, S.of(context).documentUploadSuccessText);
Navigator.pop(context, true);
Navigator.pop(context, taskId);
} on PaperlessServerException catch (error, stackTrace) {
showErrorMessage(context, error, stackTrace);
} on PaperlessValidationErrors catch (errors) {