mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-15 02:12:25 -06:00
feat: Improve notifications, add donation button, improved asn form field
This commit is contained in:
@@ -76,7 +76,7 @@ class DocumentModel extends Equatable {
|
||||
DateTime? created,
|
||||
DateTime? modified,
|
||||
DateTime? added,
|
||||
int? archiveSerialNumber,
|
||||
int? Function()? archiveSerialNumber,
|
||||
String? originalFileName,
|
||||
String? archivedFileName,
|
||||
}) {
|
||||
@@ -84,17 +84,18 @@ class DocumentModel extends Equatable {
|
||||
id: id,
|
||||
title: title ?? this.title,
|
||||
content: content ?? this.content,
|
||||
documentType:
|
||||
documentType != null ? documentType.call() : this.documentType,
|
||||
documentType: documentType != null ? documentType() : this.documentType,
|
||||
correspondent:
|
||||
correspondent != null ? correspondent.call() : this.correspondent,
|
||||
storagePath: storagePath != null ? storagePath.call() : this.storagePath,
|
||||
correspondent != null ? correspondent() : this.correspondent,
|
||||
storagePath: storagePath != null ? storagePath() : this.storagePath,
|
||||
tags: tags ?? this.tags,
|
||||
created: created ?? this.created,
|
||||
modified: modified ?? this.modified,
|
||||
added: added ?? this.added,
|
||||
originalFileName: originalFileName ?? this.originalFileName,
|
||||
archiveSerialNumber: archiveSerialNumber ?? this.archiveSerialNumber,
|
||||
archiveSerialNumber: archiveSerialNumber != null
|
||||
? archiveSerialNumber()
|
||||
: this.archiveSerialNumber,
|
||||
archivedFileName: archivedFileName ?? this.archivedFileName,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,12 @@ abstract class PaperlessDocumentsApi {
|
||||
Future<Uint8List> getPreview(int docId);
|
||||
String getThumbnailUrl(int docId);
|
||||
Future<Uint8List> download(DocumentModel document, {bool original});
|
||||
Future<void> downloadToFile(
|
||||
DocumentModel document,
|
||||
String localFilePath, {
|
||||
bool original = false,
|
||||
void Function(double)? onProgressChanged,
|
||||
});
|
||||
Future<FieldSuggestions> findSuggestions(DocumentModel document);
|
||||
|
||||
Future<List<String>> autocomplete(String query, [int limit = 10]);
|
||||
|
||||
@@ -199,7 +199,7 @@ class PaperlessDocumentsApiImpl implements PaperlessDocumentsApi {
|
||||
try {
|
||||
final response = await client.get(
|
||||
"/api/documents/${document.id}/download/",
|
||||
queryParameters: original ? {'original': true} : {},
|
||||
queryParameters: {'original': original},
|
||||
options: Options(responseType: ResponseType.bytes),
|
||||
);
|
||||
return response.data;
|
||||
@@ -208,6 +208,27 @@ class PaperlessDocumentsApiImpl implements PaperlessDocumentsApi {
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> downloadToFile(
|
||||
DocumentModel document,
|
||||
String localFilePath, {
|
||||
bool original = false,
|
||||
void Function(double)? onProgressChanged,
|
||||
}) async {
|
||||
try {
|
||||
final response = await client.download(
|
||||
"/api/documents/${document.id}/download/",
|
||||
localFilePath,
|
||||
onReceiveProgress: (count, total) =>
|
||||
onProgressChanged?.call(count / total),
|
||||
queryParameters: {'original': original},
|
||||
);
|
||||
return response.data;
|
||||
} on DioError catch (err) {
|
||||
throw err.error!;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<DocumentMetaData> getMetaData(DocumentModel document) async {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user