TF-189 Update use-case: Do no split mailbox list into 2 default and folder
This commit is contained in:
committed by
Dat H. Pham
parent
17499e70db
commit
25337069b2
@@ -3,18 +3,16 @@ import 'package:jmap_dart_client/jmap/core/state.dart';
|
||||
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||
|
||||
class GetAllMailboxSuccess extends UIState {
|
||||
final List<PresentationMailbox> defaultMailboxList;
|
||||
final List<PresentationMailbox> folderMailboxList;
|
||||
final List<PresentationMailbox> mailboxList;
|
||||
final State? currentMailboxState;
|
||||
|
||||
GetAllMailboxSuccess({
|
||||
required this.defaultMailboxList,
|
||||
required this.folderMailboxList,
|
||||
required this.mailboxList,
|
||||
required this.currentMailboxState
|
||||
});
|
||||
|
||||
@override
|
||||
List<Object?> get props => [defaultMailboxList, folderMailboxList, currentMailboxState];
|
||||
List<Object?> get props => [mailboxList, currentMailboxState];
|
||||
}
|
||||
|
||||
class GetAllMailboxFailure extends FeatureFailure {
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/properties/properties.dart';
|
||||
import 'package:model/model.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/domain/model/mailbox_response.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/domain/extensions/list_mailbox_extension.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/domain/repository/mailbox_repository.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/domain/state/get_all_mailboxes_state.dart';
|
||||
|
||||
@@ -26,12 +25,12 @@ class GetAllMailboxInteractor {
|
||||
}
|
||||
|
||||
Either<Failure, Success> _toGetMailboxState(MailboxResponse mailboxResponse) {
|
||||
final tupleList = mailboxResponse.mailboxes
|
||||
?.splitMailboxList((mailbox) => mailbox.hasRole()) ?? Tuple2([], []);
|
||||
final mailboxList = mailboxResponse.mailboxes
|
||||
?.map((mailbox) => mailbox.toPresentationMailbox()).toList()
|
||||
?? List<PresentationMailbox>.empty();
|
||||
|
||||
return Right<Failure, Success>(GetAllMailboxSuccess(
|
||||
defaultMailboxList: tupleList.value1,
|
||||
folderMailboxList: tupleList.value2,
|
||||
mailboxList: mailboxList,
|
||||
currentMailboxState: mailboxResponse.state)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:dartz/dartz.dart';
|
||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/state.dart' as jmapState;
|
||||
import 'package:model/model.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/get_all_mailboxes_state.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox/domain/extensions/list_mailbox_extension.dart';
|
||||
import 'package:model/model.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/state.dart' as jmapState;
|
||||
|
||||
class RefreshAllMailboxInteractor {
|
||||
final MailboxRepository _mailboxRepository;
|
||||
@@ -26,12 +25,13 @@ class RefreshAllMailboxInteractor {
|
||||
}
|
||||
|
||||
Either<Failure, Success> _toGetMailboxState(MailboxResponse mailboxResponse) {
|
||||
final tupleList = mailboxResponse.mailboxes
|
||||
?.splitMailboxList((mailbox) => mailbox.hasRole()) ?? Tuple2([], []);
|
||||
final mailboxList = mailboxResponse.mailboxes
|
||||
?.map((mailbox) => mailbox.toPresentationMailbox()).toList()
|
||||
?? List<PresentationMailbox>.empty();
|
||||
|
||||
return Right<Failure, Success>(GetAllMailboxSuccess(
|
||||
defaultMailboxList: tupleList.value1,
|
||||
folderMailboxList: tupleList.value2,
|
||||
currentMailboxState: mailboxResponse.state));
|
||||
mailboxList: mailboxList,
|
||||
currentMailboxState: mailboxResponse.state)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user