TF-1714 Remove constructor domain state class unnecessary
(cherry picked from commit 6293b3d5f4b1220ad285913804b7ce99ed96d54b)
This commit is contained in:
@@ -19,23 +19,4 @@ class UIState extends ViewState {
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
class LoadingState extends UIState {
|
||||
LoadingState();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
class LoadingMoreState extends UIState {
|
||||
LoadingMoreState();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
class RefreshingState extends UIState {
|
||||
RefreshingState();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
class LoadingState extends UIState {}
|
||||
@@ -3,6 +3,8 @@ import 'package:core/presentation/state/success.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/state.dart';
|
||||
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||
|
||||
class RefreshChangesAllMailboxLoading extends LoadingState {}
|
||||
|
||||
class RefreshChangesAllMailboxSuccess extends UIState {
|
||||
final List<PresentationMailbox> mailboxList;
|
||||
final State? currentMailboxState;
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/session/session.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap_state;
|
||||
import 'package:model/model.dart';
|
||||
import 'package:model/extensions/mailbox_extension.dart';
|
||||
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/domain/model/mailbox_response.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/domain/repository/mailbox_repository.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/domain/state/refresh_changes_all_mailboxes_state.dart';
|
||||
@@ -15,8 +17,7 @@ class RefreshAllMailboxInteractor {
|
||||
|
||||
Stream<Either<Failure, Success>> execute(Session session, AccountId accountId, jmap_state.State currentState) async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(RefreshingState());
|
||||
|
||||
yield Right<Failure, Success>(RefreshChangesAllMailboxLoading());
|
||||
yield* _mailboxRepository
|
||||
.refresh(session, accountId, currentState)
|
||||
.map(_toGetMailboxState);
|
||||
|
||||
@@ -16,29 +16,11 @@ class DashBoardAction extends UIAction {
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
class RefreshAllEmailAction extends DashBoardAction {
|
||||
class RefreshAllEmailAction extends DashBoardAction {}
|
||||
|
||||
RefreshAllEmailAction();
|
||||
class SelectionAllEmailAction extends DashBoardAction {}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
class SelectionAllEmailAction extends DashBoardAction {
|
||||
|
||||
SelectionAllEmailAction();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
class CancelSelectionAllEmailAction extends DashBoardAction {
|
||||
|
||||
CancelSelectionAllEmailAction();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
class CancelSelectionAllEmailAction extends DashBoardAction {}
|
||||
|
||||
class FilterMessageAction extends DashBoardAction {
|
||||
|
||||
@@ -74,13 +56,7 @@ class OpenEmailDetailedFromSuggestionQuickSearchAction extends DashBoardAction {
|
||||
List<Object?> get props => [presentationEmail];
|
||||
}
|
||||
|
||||
class StartSearchEmailAction extends DashBoardAction {
|
||||
|
||||
StartSearchEmailAction();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
class StartSearchEmailAction extends DashBoardAction {}
|
||||
|
||||
class EmptyTrashAction extends DashBoardAction {
|
||||
|
||||
@@ -92,19 +68,9 @@ class EmptyTrashAction extends DashBoardAction {
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
class ClearSearchEmailAction extends DashBoardAction {
|
||||
ClearSearchEmailAction();
|
||||
class ClearSearchEmailAction extends DashBoardAction {}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
class ClearAllFieldOfAdvancedSearchAction extends DashBoardAction {
|
||||
ClearAllFieldOfAdvancedSearchAction();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
class ClearAllFieldOfAdvancedSearchAction extends DashBoardAction {}
|
||||
|
||||
class SelectEmailByIdAction extends DashBoardAction {
|
||||
|
||||
|
||||
@@ -3,6 +3,10 @@ import 'package:core/presentation/state/success.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/state.dart';
|
||||
import 'package:model/email/presentation_email.dart';
|
||||
|
||||
class RefreshAllEmailLoading extends LoadingState {}
|
||||
|
||||
class GetAllEmailLoading extends LoadingState {}
|
||||
|
||||
class GetAllEmailSuccess extends UIState {
|
||||
final List<PresentationEmail> emailList;
|
||||
final State? currentEmailState;
|
||||
|
||||
@@ -2,6 +2,8 @@ import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:model/email/presentation_email.dart';
|
||||
|
||||
class LoadingMoreEmails extends LoadingState {}
|
||||
|
||||
class LoadMoreEmailsSuccess extends UIState {
|
||||
final List<PresentationEmail> emailList;
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@ import 'package:core/presentation/state/success.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/state.dart';
|
||||
import 'package:model/email/presentation_email.dart';
|
||||
|
||||
class RefreshChangesAllEmailLoading extends LoadingState {}
|
||||
|
||||
class RefreshChangesAllEmailSuccess extends UIState {
|
||||
final List<PresentationEmail> emailList;
|
||||
final State? currentEmailState;
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:model/email/presentation_email.dart';
|
||||
|
||||
class SearchingState extends UIState {}
|
||||
class SearchingState extends LoadingState {}
|
||||
|
||||
class SearchEmailSuccess extends UIState {
|
||||
final List<PresentationEmail> emailList;
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:model/email/presentation_email.dart';
|
||||
|
||||
class SearchingMoreState extends UIState {}
|
||||
class SearchingMoreState extends LoadingState {}
|
||||
|
||||
class SearchMoreEmailSuccess extends UIState {
|
||||
final List<PresentationEmail> emailList;
|
||||
|
||||
@@ -28,7 +28,7 @@ class GetEmailsInMailboxInteractor {
|
||||
}
|
||||
) async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(LoadingState());
|
||||
yield Right<Failure, Success>(GetAllEmailLoading());
|
||||
|
||||
yield* threadRepository
|
||||
.getAllEmail(
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:model/extensions/email_extension.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/model/email_response.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/model/get_email_request.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/repository/thread_repository.dart';
|
||||
import 'package:model/model.dart';
|
||||
import 'package:tmail_ui_user/features/thread/domain/state/load_more_emails_state.dart';
|
||||
|
||||
class LoadMoreEmailsInMailboxInteractor {
|
||||
@@ -13,8 +14,7 @@ class LoadMoreEmailsInMailboxInteractor {
|
||||
|
||||
Stream<Either<Failure, Success>> execute(GetEmailRequest emailRequest) async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(LoadingMoreState());
|
||||
|
||||
yield Right<Failure, Success>(LoadingMoreEmails());
|
||||
yield* threadRepository.loadMoreEmails(emailRequest).map(_toGetEmailState);
|
||||
} catch (e) {
|
||||
yield Left(LoadMoreEmailsFailure(e));
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ class RefreshChangesEmailsInMailboxInteractor {
|
||||
EmailFilter? emailFilter,
|
||||
}
|
||||
) async* {
|
||||
yield Right<Failure, Success>(RefreshingState());
|
||||
yield Right<Failure, Success>(RefreshChangesAllEmailLoading());
|
||||
|
||||
try {
|
||||
yield* threadRepository
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email_comparator.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email_comparator_property.dart';
|
||||
import 'package:model/model.dart';
|
||||
@@ -82,7 +81,7 @@ void main() {
|
||||
|
||||
expect(states.length, equals(3));
|
||||
expect(states, containsAllInOrder({
|
||||
Right(LoadingState()),
|
||||
Right(GetAllEmailLoading()),
|
||||
Right(GetAllEmailSuccess(
|
||||
emailList: {
|
||||
EmailFixtures.email1.toPresentationEmail(),
|
||||
|
||||
+1
-2
@@ -1,6 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email_comparator.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/email/email_comparator_property.dart';
|
||||
import 'package:model/model.dart';
|
||||
@@ -72,7 +71,7 @@ void main() {
|
||||
|
||||
expect(states.length, equals(2));
|
||||
expect(states, containsAllInOrder({
|
||||
Right(RefreshingState()),
|
||||
Right(RefreshChangesAllEmailLoading()),
|
||||
Right(RefreshChangesAllEmailSuccess(
|
||||
emailList: {
|
||||
EmailFixtures.email1.toPresentationEmail(),
|
||||
|
||||
Reference in New Issue
Block a user