mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-14 22:12:18 -06:00
Cleaned up code, implemented message queue to notify subscribers of document updates.
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/core/repository/state/repository_state.dart';
|
||||
import 'package:paperless_mobile/core/repository/state/indexed_repository_state.dart';
|
||||
|
||||
part 'correspondent_repository_state.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class CorrespondentRepositoryState
|
||||
extends RepositoryState<Map<int, Correspondent>> {
|
||||
extends IndexedRepositoryState<Correspondent> {
|
||||
const CorrespondentRepositoryState({
|
||||
super.values = const {},
|
||||
super.hasLoaded,
|
||||
|
||||
@@ -20,6 +20,6 @@ CorrespondentRepositoryState _$CorrespondentRepositoryStateFromJson(
|
||||
Map<String, dynamic> _$CorrespondentRepositoryStateToJson(
|
||||
CorrespondentRepositoryState instance) =>
|
||||
<String, dynamic>{
|
||||
'values': instance.values.map((k, e) => MapEntry(k.toString(), e)),
|
||||
'values': instance.values?.map((k, e) => MapEntry(k.toString(), e)),
|
||||
'hasLoaded': instance.hasLoaded,
|
||||
};
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/core/repository/state/repository_state.dart';
|
||||
import 'package:paperless_mobile/core/repository/state/indexed_repository_state.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'document_type_repository_state.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class DocumentTypeRepositoryState
|
||||
extends RepositoryState<Map<int, DocumentType>> {
|
||||
class DocumentTypeRepositoryState extends IndexedRepositoryState<DocumentType> {
|
||||
const DocumentTypeRepositoryState({
|
||||
super.values = const {},
|
||||
super.hasLoaded,
|
||||
});
|
||||
|
||||
@override
|
||||
DocumentTypeRepositoryState copyWith(
|
||||
{Map<int, DocumentType>? values, bool? hasLoaded}) {
|
||||
DocumentTypeRepositoryState copyWith({
|
||||
Map<int, DocumentType>? values,
|
||||
bool? hasLoaded,
|
||||
}) {
|
||||
return DocumentTypeRepositoryState(
|
||||
values: values ?? this.values,
|
||||
hasLoaded: hasLoaded ?? this.hasLoaded,
|
||||
|
||||
@@ -20,6 +20,6 @@ DocumentTypeRepositoryState _$DocumentTypeRepositoryStateFromJson(
|
||||
Map<String, dynamic> _$DocumentTypeRepositoryStateToJson(
|
||||
DocumentTypeRepositoryState instance) =>
|
||||
<String, dynamic>{
|
||||
'values': instance.values.map((k, e) => MapEntry(k.toString(), e)),
|
||||
'values': instance.values?.map((k, e) => MapEntry(k.toString(), e)),
|
||||
'hasLoaded': instance.hasLoaded,
|
||||
};
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/core/repository/state/repository_state.dart';
|
||||
import 'package:paperless_mobile/core/repository/state/indexed_repository_state.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'saved_view_repository_state.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class SavedViewRepositoryState extends RepositoryState<Map<int, SavedView>> {
|
||||
class SavedViewRepositoryState extends IndexedRepositoryState<SavedView> {
|
||||
const SavedViewRepositoryState({
|
||||
super.values = const {},
|
||||
super.hasLoaded = false,
|
||||
|
||||
@@ -20,6 +20,6 @@ SavedViewRepositoryState _$SavedViewRepositoryStateFromJson(
|
||||
Map<String, dynamic> _$SavedViewRepositoryStateToJson(
|
||||
SavedViewRepositoryState instance) =>
|
||||
<String, dynamic>{
|
||||
'values': instance.values.map((k, e) => MapEntry(k.toString(), e)),
|
||||
'values': instance.values?.map((k, e) => MapEntry(k.toString(), e)),
|
||||
'hasLoaded': instance.hasLoaded,
|
||||
};
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/core/repository/state/repository_state.dart';
|
||||
import 'package:paperless_mobile/core/repository/state/indexed_repository_state.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'storage_path_repository_state.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class StoragePathRepositoryState
|
||||
extends RepositoryState<Map<int, StoragePath>> {
|
||||
class StoragePathRepositoryState extends IndexedRepositoryState<StoragePath> {
|
||||
const StoragePathRepositoryState({
|
||||
super.values = const {},
|
||||
super.hasLoaded = false,
|
||||
});
|
||||
|
||||
@override
|
||||
StoragePathRepositoryState copyWith(
|
||||
{Map<int, StoragePath>? values, bool? hasLoaded}) {
|
||||
StoragePathRepositoryState copyWith({
|
||||
Map<int, StoragePath>? values,
|
||||
bool? hasLoaded,
|
||||
}) {
|
||||
return StoragePathRepositoryState(
|
||||
values: values ?? this.values,
|
||||
hasLoaded: hasLoaded ?? this.hasLoaded,
|
||||
|
||||
@@ -20,6 +20,6 @@ StoragePathRepositoryState _$StoragePathRepositoryStateFromJson(
|
||||
Map<String, dynamic> _$StoragePathRepositoryStateToJson(
|
||||
StoragePathRepositoryState instance) =>
|
||||
<String, dynamic>{
|
||||
'values': instance.values.map((k, e) => MapEntry(k.toString(), e)),
|
||||
'values': instance.values?.map((k, e) => MapEntry(k.toString(), e)),
|
||||
'hasLoaded': instance.hasLoaded,
|
||||
};
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:paperless_api/paperless_api.dart';
|
||||
import 'package:paperless_mobile/core/repository/state/repository_state.dart';
|
||||
import 'package:paperless_mobile/core/repository/state/indexed_repository_state.dart';
|
||||
|
||||
part 'tag_repository_state.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class TagRepositoryState extends RepositoryState<Map<int, Tag>> {
|
||||
class TagRepositoryState extends IndexedRepositoryState<Tag> {
|
||||
const TagRepositoryState({
|
||||
super.values = const {},
|
||||
super.hasLoaded = false,
|
||||
});
|
||||
|
||||
@override
|
||||
TagRepositoryState copyWith({Map<int, Tag>? values, bool? hasLoaded}) {
|
||||
TagRepositoryState copyWith({
|
||||
Map<int, Tag>? values,
|
||||
bool? hasLoaded,
|
||||
}) {
|
||||
return TagRepositoryState(
|
||||
values: values ?? this.values,
|
||||
hasLoaded: hasLoaded ?? this.hasLoaded,
|
||||
|
||||
@@ -18,6 +18,6 @@ TagRepositoryState _$TagRepositoryStateFromJson(Map<String, dynamic> json) =>
|
||||
|
||||
Map<String, dynamic> _$TagRepositoryStateToJson(TagRepositoryState instance) =>
|
||||
<String, dynamic>{
|
||||
'values': instance.values.map((k, e) => MapEntry(k.toString(), e)),
|
||||
'values': instance.values?.map((k, e) => MapEntry(k.toString(), e)),
|
||||
'hasLoaded': instance.hasLoaded,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user