feat: bugfixes, finished go_router migration, implemented better visibility of states

This commit is contained in:
Anton Stubenbord
2023-10-06 01:17:08 +02:00
parent ad23df4f89
commit a2c5ced3b7
102 changed files with 1512 additions and 3090 deletions

View File

@@ -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) {

View File

@@ -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'];

View File

@@ -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);

View File

@@ -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),
);