TF-145 Add data layer for getAllEmail in Caching
This commit is contained in:
@@ -48,6 +48,9 @@ class EmailCache extends HiveObject with EquatableMixin {
|
||||
@HiveField(12)
|
||||
final List<EmailAddressHiveCache>? replyTo;
|
||||
|
||||
@HiveField(13)
|
||||
Map<String, bool>? mailboxIds;
|
||||
|
||||
EmailCache(
|
||||
this.id,
|
||||
{
|
||||
@@ -63,6 +66,7 @@ class EmailCache extends HiveObject with EquatableMixin {
|
||||
this.cc,
|
||||
this.bcc,
|
||||
this.replyTo,
|
||||
this.mailboxIds,
|
||||
}
|
||||
);
|
||||
|
||||
@@ -80,6 +84,7 @@ class EmailCache extends HiveObject with EquatableMixin {
|
||||
sentAt,
|
||||
replyTo,
|
||||
preview,
|
||||
hasAttachment
|
||||
hasAttachment,
|
||||
mailboxIds,
|
||||
];
|
||||
}
|
||||
@@ -30,13 +30,14 @@ class EmailCacheAdapter extends TypeAdapter<EmailCache> {
|
||||
cc: (fields[10] as List?)?.cast<EmailAddressHiveCache>(),
|
||||
bcc: (fields[11] as List?)?.cast<EmailAddressHiveCache>(),
|
||||
replyTo: (fields[12] as List?)?.cast<EmailAddressHiveCache>(),
|
||||
mailboxIds: (fields[13] as Map?)?.cast<String, bool>(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, EmailCache obj) {
|
||||
writer
|
||||
..writeByte(13)
|
||||
..writeByte(14)
|
||||
..writeByte(0)
|
||||
..write(obj.id)
|
||||
..writeByte(1)
|
||||
@@ -62,7 +63,9 @@ class EmailCacheAdapter extends TypeAdapter<EmailCache> {
|
||||
..writeByte(11)
|
||||
..write(obj.bcc)
|
||||
..writeByte(12)
|
||||
..write(obj.replyTo);
|
||||
..write(obj.replyTo)
|
||||
..writeByte(13)
|
||||
..write(obj.mailboxIds);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
import 'package:model/model.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/properties/properties.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/state.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
|
||||
|
||||
class EmailChangeResponse with EquatableMixin {
|
||||
final List<Email>? updated;
|
||||
final List<Email>? created;
|
||||
final List<EmailId>? destroyed;
|
||||
final State? newStateEmail;
|
||||
final State? newStateChanges;
|
||||
final bool hasMoreChanges;
|
||||
final Properties? updatedProperties;
|
||||
|
||||
EmailChangeResponse({
|
||||
this.updated,
|
||||
this.created,
|
||||
this.destroyed,
|
||||
this.newStateEmail,
|
||||
this.newStateChanges,
|
||||
this.hasMoreChanges = false,
|
||||
this.updatedProperties,
|
||||
});
|
||||
|
||||
EmailChangeResponse union(EmailChangeResponse other) => EmailChangeResponse(
|
||||
updated: updated.union(other.updated),
|
||||
created: created.union(other.created),
|
||||
destroyed: destroyed.union(other.destroyed),
|
||||
newStateEmail: other.newStateEmail,
|
||||
newStateChanges: other.newStateChanges,
|
||||
hasMoreChanges: other.hasMoreChanges,
|
||||
updatedProperties: other.updatedProperties,
|
||||
);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
updated,
|
||||
created,
|
||||
destroyed,
|
||||
newStateEmail,
|
||||
newStateChanges,
|
||||
hasMoreChanges,
|
||||
updatedProperties
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user