TF-1708 Update props properties for all state object in interactor

(cherry picked from commit 2a5441c2ef4facf28e7e6e1678e89601d72259be)
This commit is contained in:
dab246
2023-07-07 13:07:53 +07:00
committed by Dat Vu
parent 24d7eee69a
commit 0583406e3b
142 changed files with 348 additions and 1092 deletions
@@ -1,14 +1,9 @@
import 'package:core/core.dart';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:tmail_ui_user/features/base/state/ui_action_state.dart';
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap;
class StartDeleteEmailPermanently extends UIState {
StartDeleteEmailPermanently();
@override
List<Object?> get props => [];
}
class StartDeleteEmailPermanently extends UIState {}
class DeleteEmailPermanentlySuccess extends UIActionState {
@@ -16,17 +11,9 @@ class DeleteEmailPermanentlySuccess extends UIActionState {
jmap.State? currentEmailState,
jmap.State? currentMailboxState,
}) : super(currentEmailState, currentMailboxState);
@override
List<Object?> get props => [];
}
class DeleteEmailPermanentlyFailure extends FeatureFailure {
final dynamic exception;
DeleteEmailPermanentlyFailure(this.exception);
@override
List<Object?> get props => [exception];
DeleteEmailPermanentlyFailure(dynamic exception) : super(exception: exception);
}
@@ -1,4 +1,5 @@
import 'package:core/core.dart';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap;
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
import 'package:tmail_ui_user/features/base/state/ui_action_state.dart';
@@ -18,7 +19,7 @@ class DeleteMultipleEmailsPermanentlyAllSuccess extends UIActionState {
) : super(currentEmailState, currentMailboxState);
@override
List<Object?> get props => [emailIds];
List<Object?> get props => [emailIds, ...super.props];
}
class DeleteMultipleEmailsPermanentlyHasSomeEmailFailure extends UIActionState {
@@ -34,23 +35,12 @@ class DeleteMultipleEmailsPermanentlyHasSomeEmailFailure extends UIActionState {
) : super(currentEmailState, currentMailboxState);
@override
List<Object> get props => [emailIds];
List<Object?> get props => [emailIds, ...super.props];
}
class DeleteMultipleEmailsPermanentlyAllFailure extends FeatureFailure {
DeleteMultipleEmailsPermanentlyAllFailure();
@override
List<Object?> get props => [];
}
class DeleteMultipleEmailsPermanentlyAllFailure extends FeatureFailure {}
class DeleteMultipleEmailsPermanentlyFailure extends FeatureFailure {
final dynamic exception;
DeleteMultipleEmailsPermanentlyFailure(this.exception);
@override
List<Object?> get props => [exception];
DeleteMultipleEmailsPermanentlyFailure(dynamic exception) : super(exception: exception);
}
@@ -7,7 +7,4 @@ class DeleteSendingEmailSuccess extends UIState {}
class DeleteSendingEmailFailure extends FeatureFailure {
DeleteSendingEmailFailure(dynamic exception) : super(exception: exception);
@override
List<Object?> get props => [exception];
}
@@ -1,7 +1,8 @@
import 'dart:typed_data';
import 'package:core/core.dart';
import 'package:model/model.dart';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:model/download/download_task_id.dart';
import 'package:model/email/attachment.dart';
class StartDownloadAttachmentForWeb extends UIState {
@@ -55,10 +56,9 @@ class DownloadAttachmentForWebSuccess extends UIState {
class DownloadAttachmentForWebFailure extends FeatureFailure {
final DownloadTaskId taskId;
final dynamic exception;
DownloadAttachmentForWebFailure(this.taskId, this.exception);
DownloadAttachmentForWebFailure(this.taskId, dynamic exception) : super(exception: exception);
@override
List<Object?> get props => [taskId, exception];
List<Object?> get props => [taskId, ...super.props];
}
@@ -1,5 +1,6 @@
import 'package:core/core.dart';
import 'package:model/model.dart';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:model/download/download_task_id.dart';
class DownloadAttachmentsSuccess extends UIState {
final List<DownloadTaskId> taskIds;
@@ -11,10 +12,6 @@ class DownloadAttachmentsSuccess extends UIState {
}
class DownloadAttachmentsFailure extends FeatureFailure {
final dynamic exception;
DownloadAttachmentsFailure(this.exception);
@override
List<Object?> get props => [exception];
DownloadAttachmentsFailure(dynamic exception) : super(exception: exception);
}
@@ -1,4 +1,6 @@
import 'package:core/core.dart';
import 'package:core/data/network/download/downloaded_response.dart';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
class ExportAttachmentSuccess extends UIState {
final DownloadedResponse downloadedResponse;
@@ -10,10 +12,6 @@ class ExportAttachmentSuccess extends UIState {
}
class ExportAttachmentFailure extends FeatureFailure {
final dynamic exception;
ExportAttachmentFailure(this.exception);
@override
List<Object?> get props => [exception];
ExportAttachmentFailure(dynamic exception) : super(exception: exception);
}
@@ -22,7 +22,4 @@ class GetDetailedEmailByIdSuccess extends UIState {
class GetDetailedEmailByIdFailure extends FeatureFailure {
GetDetailedEmailByIdFailure(dynamic exception) : super(exception: exception);
@override
List<Object?> get props => [exception];
}
@@ -49,7 +49,4 @@ class GetEmailContentFromCacheSuccess extends UIState {
class GetEmailContentFailure extends FeatureFailure {
GetEmailContentFailure(dynamic exception) : super(exception: exception);
@override
List<Object?> get props => [exception];
}
@@ -13,19 +13,9 @@ class GetStoredEmailStateSuccess extends UIState {
List<Object> get props => [state];
}
class NotFoundEmailState extends FeatureFailure {
NotFoundEmailState();
@override
List<Object> get props => [];
}
class NotFoundEmailState extends FeatureFailure {}
class GetStoredEmailStateFailure extends FeatureFailure {
final dynamic exception;
GetStoredEmailStateFailure(this.exception);
@override
List<Object?> get props => [exception];
GetStoredEmailStateFailure(dynamic exception) : super(exception: exception);
}
@@ -1,4 +1,4 @@
import 'package:core/core.dart';
import 'package:core/presentation/state/failure.dart';
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap;
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
import 'package:model/email/read_actions.dart';
@@ -19,15 +19,14 @@ class MarkAsEmailReadSuccess extends UIActionState {
) : super(currentEmailState, currentMailboxState);
@override
List<Object?> get props => [updatedEmail, readActions];
List<Object?> get props => [updatedEmail, readActions, ...super.props];
}
class MarkAsEmailReadFailure extends FeatureFailure {
final dynamic exception;
final ReadActions readActions;
MarkAsEmailReadFailure(this.exception, this.readActions);
MarkAsEmailReadFailure(this.readActions, {dynamic exception}) : super(exception: exception);
@override
List<Object?> get props => [exception, readActions];
List<Object?> get props => [readActions, ...super.props];
}
@@ -1,4 +1,4 @@
import 'package:core/core.dart';
import 'package:core/presentation/state/failure.dart';
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap;
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
import 'package:model/model.dart';
@@ -18,15 +18,14 @@ class MarkAsStarEmailSuccess extends UIActionState {
) : super(currentEmailState, currentMailboxState);
@override
List<Object?> get props => [updatedEmail, markStarAction];
List<Object?> get props => [updatedEmail, markStarAction, ...super.props];
}
class MarkAsStarEmailFailure extends FeatureFailure {
final dynamic exception;
final MarkStarAction markStarAction;
MarkAsStarEmailFailure(this.exception, this.markStarAction);
MarkAsStarEmailFailure(this.markStarAction, {dynamic exception}) : super(exception: exception);
@override
List<Object?> get props => [exception, markStarAction];
List<Object?> get props => [markStarAction, ...super.props];
}
@@ -1,4 +1,5 @@
import 'package:core/core.dart';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap;
import 'package:jmap_dart_client/jmap/mail/email/email.dart';
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
@@ -36,16 +37,16 @@ class MoveToMailboxSuccess extends UIActionState {
destinationMailboxId,
moveAction,
emailActionType,
destinationPath
destinationPath,
...super.props
];
}
class MoveToMailboxFailure extends FeatureFailure {
final EmailActionType emailActionType;
final dynamic exception;
MoveToMailboxFailure(this.emailActionType, this.exception);
MoveToMailboxFailure(this.emailActionType, {dynamic exception}) : super(exception: exception);
@override
List<Object?> get props => [emailActionType, exception];
List<Object?> get props => [emailActionType, ...super.props];
}
@@ -16,10 +16,5 @@ class SendReceiptToSenderSuccess extends UIState {
class SendReceiptToSenderFailure extends FeatureFailure {
final dynamic exception;
SendReceiptToSenderFailure(this.exception);
@override
List<Object?> get props => [exception];
SendReceiptToSenderFailure(dynamic exception) : super(exception: exception);
}
@@ -1,4 +1,5 @@
import 'package:core/core.dart';
import 'package:core/presentation/state/failure.dart';
import 'package:core/presentation/state/success.dart';
class StoreNewEmailLoading extends UIState {}
@@ -7,7 +8,4 @@ class StoreNewEmailSuccess extends UIState {}
class StoreNewEmailFailure extends FeatureFailure {
StoreNewEmailFailure(dynamic exception) : super(exception: exception);
@override
List<Object?> get props => [exception];
}
@@ -8,7 +8,4 @@ class StoreOpenedEmailSuccess extends UIState {}
class StoreOpenedEmailFailure extends FeatureFailure {
StoreOpenedEmailFailure(dynamic exception) : super(exception: exception);
@override
List<Object?> get props => [exception];
}
@@ -17,7 +17,4 @@ class StoreSendingEmailSuccess extends UIState {
class StoreSendingEmailFailure extends FeatureFailure {
StoreSendingEmailFailure(dynamic exception) : super(exception: exception);
@override
List<Object?> get props => [exception];
}
@@ -33,10 +33,10 @@ class MarkAsEmailReadInteractor {
currentEmailState: currentEmailState,
currentMailboxState: currentMailboxState));
} else {
yield Left(MarkAsEmailReadFailure(null, readAction));
yield Left(MarkAsEmailReadFailure(readAction));
}
} catch (e) {
yield Left(MarkAsEmailReadFailure(e, readAction));
yield Left(MarkAsEmailReadFailure(readAction, exception: e));
}
}
}
@@ -23,10 +23,10 @@ class MarkAsStarEmailInteractor {
markStarAction,
currentEmailState: currentEmailState));
} else {
yield Left(MarkAsStarEmailFailure(null, markStarAction));
yield Left(MarkAsStarEmailFailure(markStarAction));
}
} catch (e) {
yield Left(MarkAsStarEmailFailure(e, markStarAction));
yield Left(MarkAsStarEmailFailure(markStarAction, exception: e));
}
}
}
@@ -37,10 +37,10 @@ class MoveToMailboxInteractor {
currentMailboxState: currentMailboxState,
currentEmailState: currentEmailState));
} else {
yield Left(MoveToMailboxFailure(moveRequest.emailActionType, null));
yield Left(MoveToMailboxFailure(moveRequest.emailActionType));
}
} catch (e) {
yield Left(MoveToMailboxFailure(moveRequest.emailActionType, e));
yield Left(MoveToMailboxFailure(moveRequest.emailActionType, exception: e));
}
}
}