TF-825 Download email as EML file (#2854)

This commit is contained in:
Dat Vu
2024-05-16 15:50:01 +07:00
committed by GitHub
parent 175f285e51
commit ca4cf68f87
29 changed files with 153 additions and 26 deletions
@@ -4,4 +4,6 @@ class NotFoundEmailContentException implements Exception {}
class EmptyEmailContentException implements Exception {}
class NotFoundEmailRecoveryActionException implements Exception {}
class NotFoundEmailRecoveryActionException implements Exception {}
class NotFoundEmailBlobIdException implements Exception {}
@@ -1,7 +1,6 @@
import 'dart:typed_data';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:jmap_dart_client/jmap/core/id.dart';
import 'package:model/download/download_task_id.dart';
import 'package:model/email/attachment.dart';
@@ -59,14 +58,14 @@ class DownloadAttachmentForWebSuccess extends UIState {
class DownloadAttachmentForWebFailure extends FeatureFailure {
final DownloadTaskId? taskId;
final Id? attachmentBlobId;
final Attachment? attachment;
DownloadAttachmentForWebFailure({
required this.attachmentBlobId,
this.attachment,
this.taskId,
dynamic exception
}) : super(exception: exception);
@override
List<Object?> get props => [taskId, ...super.props];
List<Object?> get props => [attachment, taskId, ...super.props];
}
@@ -22,7 +22,7 @@ class ViewAttachmentForWebSuccess extends DownloadAttachmentForWebSuccess {
class ViewAttachmentForWebFailure extends DownloadAttachmentForWebFailure {
ViewAttachmentForWebFailure({
required super.attachmentBlobId,
required super.attachment,
super.taskId,
super.exception,
});
@@ -72,7 +72,7 @@ class DownloadAttachmentForWebInteractor {
} catch (exception) {
yield Left<Failure, Success>(
DownloadAttachmentForWebFailure(
attachmentBlobId: attachment.blobId,
attachment: attachment,
taskId: taskId,
exception: exception
)
@@ -34,7 +34,7 @@ class ViewAttachmentForWebInteractor {
(failure) {
if (failure is DownloadAttachmentForWebFailure) {
return Left(ViewAttachmentForWebFailure(
attachmentBlobId: attachment.blobId,
attachment: attachment,
taskId: failure.taskId,
exception: failure.exception,
));