TF-2930 Fix not persist hasRequestReadReceipt when reload browser
This commit is contained in:
@@ -1,44 +1,35 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:jmap_dart_client/jmap/identities/identity.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:tmail_ui_user/features/composer/presentation/model/screen_display_mode.dart';
|
||||
|
||||
part 'composer_cache.g.dart';
|
||||
|
||||
@JsonSerializable(explicitToJson: true, includeIfNull: false)
|
||||
class ComposerCache with EquatableMixin {
|
||||
|
||||
final Email? email;
|
||||
final Identity? identity;
|
||||
final bool? readReceipentEnabled;
|
||||
final bool? hasRequestReadReceipt;
|
||||
final ScreenDisplayMode displayMode;
|
||||
|
||||
ComposerCache({
|
||||
required this.displayMode,
|
||||
this.email,
|
||||
this.identity,
|
||||
this.readReceipentEnabled,
|
||||
this.hasRequestReadReceipt,
|
||||
this.displayMode = ScreenDisplayMode.normal
|
||||
});
|
||||
|
||||
factory ComposerCache.fromJson(Map<String, dynamic> json) => _$ComposerCacheFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$ComposerCacheToJson(this);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
email,
|
||||
identity,
|
||||
readReceipentEnabled
|
||||
hasRequestReadReceipt,
|
||||
displayMode
|
||||
];
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return <String, dynamic>{
|
||||
'email': email?.toJson(),
|
||||
'identity': identity?.toJson(),
|
||||
'readReceipentEnabled': readReceipentEnabled,
|
||||
'displayMode': displayMode.toJson()
|
||||
};
|
||||
}
|
||||
|
||||
factory ComposerCache.fromJson(Map<String, dynamic> map) {
|
||||
return ComposerCache(
|
||||
displayMode: ScreenDisplayMode.fromJson(map['displayMode'] ?? ''),
|
||||
email: map['email'] != null ? Email.fromJson(map['email']) : null,
|
||||
identity: map['identity'] != null ? Identity.fromJson(map['identity']) : null,
|
||||
readReceipentEnabled: map['readReceipentEnabled'] as bool?
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user