mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-10 06:07:57 -06:00
feat: bugfixes, finished go_router migration, implemented better visibility of states
This commit is contained in:
@@ -20,7 +20,8 @@ class PaperlessFormValidationException implements Exception {
|
||||
}
|
||||
|
||||
static bool canParse(Map<String, dynamic> json) {
|
||||
return json.values.every((element) => element is String);
|
||||
return json.values
|
||||
.every((element) => element is String || element is List);
|
||||
}
|
||||
|
||||
factory PaperlessFormValidationException.fromJson(Map<String, dynamic> json) {
|
||||
|
||||
@@ -20,13 +20,15 @@ class PaperlessAuthenticationApiImpl implements PaperlessAuthenticationApi {
|
||||
"password": password,
|
||||
},
|
||||
options: Options(
|
||||
sendTimeout: const Duration(seconds: 5),
|
||||
receiveTimeout: const Duration(seconds: 5),
|
||||
followRedirects: false,
|
||||
headers: {
|
||||
"Accept": "application/json",
|
||||
},
|
||||
validateStatus: (status) {
|
||||
return status! == 200;
|
||||
},
|
||||
// validateStatus: (status) {
|
||||
// return status! == 200;
|
||||
// },
|
||||
),
|
||||
);
|
||||
return response.data['token'];
|
||||
|
||||
@@ -29,7 +29,7 @@ abstract class PaperlessDocumentsApi {
|
||||
DocumentModel document,
|
||||
String localFilePath, {
|
||||
bool original = false,
|
||||
void Function(double)? onProgressChanged,
|
||||
void Function(double progress)? onProgressChanged,
|
||||
});
|
||||
Future<FieldSuggestions> findSuggestions(DocumentModel document);
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ class PaperlessDocumentsApiImpl implements PaperlessDocumentsApi {
|
||||
int? correspondent,
|
||||
Iterable<int> tags = const [],
|
||||
int? asn,
|
||||
void Function(double progress)? onProgressChanged,
|
||||
}) async {
|
||||
final formData = FormData();
|
||||
formData.files.add(
|
||||
@@ -55,7 +56,7 @@ class PaperlessDocumentsApiImpl implements PaperlessDocumentsApi {
|
||||
'/api/documents/post_document/',
|
||||
data: formData,
|
||||
onSendProgress: (count, total) {
|
||||
debugPrint("Uploading ${(count / total) * 100}%...");
|
||||
onProgressChanged?.call(count.toDouble() / total.toDouble());
|
||||
},
|
||||
options: Options(validateStatus: (status) => status == 200),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user