mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-09 06:07:54 -06:00
Added dependencies which fix crash on android 12L/13, improved list layout in inbox
This commit is contained in:
@@ -35,13 +35,7 @@ class DocumentUploadCubit extends Cubit<DocumentUploadState> {
|
||||
_tagRepository = tagRepository,
|
||||
_correspondentRepository = correspondentRepository,
|
||||
_documentTypeRepository = documentTypeRepository,
|
||||
super(
|
||||
const DocumentUploadState(
|
||||
tags: {},
|
||||
correspondents: {},
|
||||
documentTypes: {},
|
||||
),
|
||||
) {
|
||||
super(const DocumentUploadState()) {
|
||||
_subs.add(_tagRepository.values.listen(
|
||||
(tags) => emit(state.copyWith(tags: tags?.values)),
|
||||
));
|
||||
|
||||
@@ -7,9 +7,9 @@ class DocumentUploadState extends Equatable {
|
||||
final Map<int, DocumentType> documentTypes;
|
||||
|
||||
const DocumentUploadState({
|
||||
required this.tags,
|
||||
required this.correspondents,
|
||||
required this.documentTypes,
|
||||
this.tags = const {},
|
||||
this.correspondents = const {},
|
||||
this.documentTypes = const {},
|
||||
});
|
||||
|
||||
@override
|
||||
|
||||
@@ -236,8 +236,10 @@ class _DocumentUploadPreparationPageState
|
||||
|
||||
final taskId = await cubit.upload(
|
||||
widget.fileBytes,
|
||||
filename:
|
||||
_padWithPdfExtension(_formKey.currentState?.value[fkFileName]),
|
||||
filename: _padWithExtension(
|
||||
_formKey.currentState?.value[fkFileName],
|
||||
widget.fileExtension,
|
||||
),
|
||||
title: title,
|
||||
documentType: docType.id,
|
||||
correspondent: correspondent.id,
|
||||
@@ -261,11 +263,12 @@ class _DocumentUploadPreparationPageState
|
||||
}
|
||||
}
|
||||
|
||||
String _padWithPdfExtension(String source) {
|
||||
return source.endsWith(".pdf") ? source : '$source.pdf';
|
||||
String _padWithExtension(String source, [String? extension]) {
|
||||
final ext = extension ?? '.pdf';
|
||||
return source.endsWith(ext) ? source : '$source$ext';
|
||||
}
|
||||
|
||||
String _formatFilename(String source) {
|
||||
return source.replaceAll(RegExp(r"[\W_]"), "_");
|
||||
return source.replaceAll(RegExp(r"[\W_]"), "_").toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user