TF-2628 [Part-2] Add attachment property to DownloadAttachmentForWebFailure & ViewAttachmentForWebFailure
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
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';
|
||||
|
||||
@@ -56,9 +57,12 @@ class DownloadAttachmentForWebSuccess extends UIState {
|
||||
class DownloadAttachmentForWebFailure extends FeatureFailure {
|
||||
|
||||
final DownloadTaskId? taskId;
|
||||
final Id? attachmentBlobId;
|
||||
|
||||
DownloadAttachmentForWebFailure({
|
||||
this.taskId, dynamic exception
|
||||
required this.attachmentBlobId,
|
||||
this.taskId,
|
||||
dynamic exception
|
||||
}) : super(exception: exception);
|
||||
|
||||
@override
|
||||
|
||||
@@ -19,5 +19,9 @@ class ViewAttachmentForWebSuccess extends DownloadAttachmentForWebSuccess {
|
||||
}
|
||||
|
||||
class ViewAttachmentForWebFailure extends DownloadAttachmentForWebFailure {
|
||||
ViewAttachmentForWebFailure({super.taskId, super.exception});
|
||||
ViewAttachmentForWebFailure({
|
||||
required super.attachmentBlobId,
|
||||
super.taskId,
|
||||
super.exception,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ class DownloadAttachmentForWebInteractor {
|
||||
} catch (exception) {
|
||||
yield Left<Failure, Success>(
|
||||
DownloadAttachmentForWebFailure(
|
||||
attachmentBlobId: attachment.blobId,
|
||||
taskId: taskId,
|
||||
exception: exception
|
||||
)
|
||||
|
||||
@@ -34,6 +34,7 @@ class ViewAttachmentForWebInteractor {
|
||||
(failure) {
|
||||
if (failure is DownloadAttachmentForWebFailure) {
|
||||
return Left(ViewAttachmentForWebFailure(
|
||||
attachmentBlobId: attachment.blobId,
|
||||
taskId: failure.taskId,
|
||||
exception: failure.exception,
|
||||
));
|
||||
|
||||
@@ -744,7 +744,9 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
_downloadProgressStateController));
|
||||
} else {
|
||||
consumeState(Stream.value(
|
||||
Left(DownloadAttachmentForWebFailure(exception: NotFoundSessionException()))
|
||||
Left(DownloadAttachmentForWebFailure(
|
||||
attachment: attachment,
|
||||
exception: NotFoundSessionException()))
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -763,7 +765,9 @@ class SingleEmailController extends BaseController with AppLoaderMixin {
|
||||
_downloadProgressStateController));
|
||||
} else {
|
||||
consumeState(Stream.value(
|
||||
Left(ViewAttachmentForWebFailure(exception: NotFoundSessionException()))
|
||||
Left(ViewAttachmentForWebFailure(
|
||||
attachment: attachment,
|
||||
exception: NotFoundSessionException()))
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ void main() {
|
||||
(_) => Stream.value(
|
||||
Left(
|
||||
DownloadAttachmentForWebFailure(
|
||||
attachmentBlobId: testAttachment.blobId,
|
||||
taskId: testDownloadTaskId,
|
||||
exception: testException,
|
||||
),
|
||||
@@ -74,6 +75,7 @@ void main() {
|
||||
emitsInOrder([
|
||||
Left(
|
||||
ViewAttachmentForWebFailure(
|
||||
attachmentBlobId: testAttachment.blobId,
|
||||
taskId: testDownloadTaskId,
|
||||
exception: testException,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user