mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-11 00:07:59 -06:00
More work on inbox, refactorings (bloc separation of concerns), fixed saved views wrong sort order
This commit is contained in:
@@ -15,11 +15,6 @@ class DocumentsCubit extends Cubit<DocumentsState> {
|
||||
|
||||
DocumentsCubit(this.documentRepository) : super(DocumentsState.initial);
|
||||
|
||||
Future<void> remove(DocumentModel document) async {
|
||||
await documentRepository.delete(document);
|
||||
await reload();
|
||||
}
|
||||
|
||||
Future<void> bulkRemove(List<DocumentModel> documents) async {
|
||||
await documentRepository.bulkAction(
|
||||
BulkDeleteAction(documents.map((doc) => doc.id)),
|
||||
@@ -40,8 +35,13 @@ class DocumentsCubit extends Cubit<DocumentsState> {
|
||||
await reload();
|
||||
}
|
||||
|
||||
Future<void> update(DocumentModel document) async {
|
||||
await documentRepository.update(document);
|
||||
Future<void> update(
|
||||
DocumentModel document, [
|
||||
bool updateRemote = true,
|
||||
]) async {
|
||||
if (updateRemote) {
|
||||
await documentRepository.update(document);
|
||||
}
|
||||
await reload();
|
||||
}
|
||||
|
||||
@@ -83,13 +83,6 @@ class DocumentsCubit extends Cubit<DocumentsState> {
|
||||
isLoaded: true, value: [...state.value, result], filter: newFilter));
|
||||
}
|
||||
|
||||
Future<void> assignAsn(DocumentModel document) async {
|
||||
if (document.archiveSerialNumber == null) {
|
||||
final int asn = await documentRepository.findNextAsn();
|
||||
update(document.copyWith(archiveSerialNumber: asn));
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Update filter state and automatically reload documents. Always resets page to 1.
|
||||
/// Use [DocumentsCubit.loadMore] to load more data.
|
||||
|
||||
Reference in New Issue
Block a user