Fix can not refresh change list mailbox and email after take actions with email in succession
This commit is contained in:
@@ -3,6 +3,8 @@ import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.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 LoadingCreateNewMailbox extends UIState {}
|
||||
|
||||
class CreateNewMailboxSuccess extends UIActionState {
|
||||
|
||||
final Mailbox newMailbox;
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import 'package:core/presentation/state/failure.dart';
|
||||
import 'package:core/presentation/state/success.dart';
|
||||
import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap;
|
||||
import 'package:tmail_ui_user/features/base/state/ui_action_state.dart';
|
||||
|
||||
class LoadingDeleteMultipleMailboxAll extends UIState {}
|
||||
|
||||
class DeleteMultipleMailboxAllSuccess extends UIActionState {
|
||||
|
||||
final List<MailboxId> listMailboxIdDeleted;
|
||||
|
||||
@@ -4,13 +4,7 @@ import 'package:tmail_ui_user/features/base/state/ui_action_state.dart';
|
||||
import 'package:tmail_ui_user/features/email/domain/model/move_action.dart';
|
||||
import 'package:jmap_dart_client/jmap/core/state.dart' as jmap;
|
||||
|
||||
class MoveMailboxLoading extends UIState {
|
||||
|
||||
MoveMailboxLoading();
|
||||
|
||||
@override
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
class LoadingMoveMailbox extends UIState {}
|
||||
|
||||
class MoveMailboxSuccess extends UIActionState {
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ import 'package:core/core.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 LoadingRenameMailbox extends UIState {}
|
||||
|
||||
class RenameMailboxSuccess extends UIActionState {
|
||||
|
||||
RenameMailboxSuccess({
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:core/core.dart';
|
||||
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||
|
||||
class LoadingSearchMailbox extends UIState {}
|
||||
|
||||
class SearchMailboxSuccess extends UIState {
|
||||
|
||||
final List<PresentationMailbox> mailboxesSearched;
|
||||
|
||||
@@ -12,6 +12,8 @@ class CreateNewMailboxInteractor {
|
||||
|
||||
Stream<Either<Failure, Success>> execute(AccountId accountId, CreateNewMailboxRequest newMailboxRequest) async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(LoadingCreateNewMailbox());
|
||||
|
||||
final currentMailboxState = await _mailboxRepository.getMailboxState();
|
||||
final newMailbox = await _mailboxRepository.createNewMailbox(accountId, newMailboxRequest);
|
||||
if (newMailbox != null) {
|
||||
|
||||
@@ -20,6 +20,8 @@ class DeleteMultipleMailboxInteractor {
|
||||
List<MailboxId> listMailboxIdToDelete
|
||||
) async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(LoadingDeleteMultipleMailboxAll());
|
||||
|
||||
final currentMailboxState = await _mailboxRepository.getMailboxState();
|
||||
|
||||
final listResult = await Future.wait(
|
||||
|
||||
@@ -12,6 +12,8 @@ class MoveMailboxInteractor {
|
||||
|
||||
Stream<Either<Failure, Success>> execute(AccountId accountId, MoveMailboxRequest request) async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(LoadingMoveMailbox());
|
||||
|
||||
final currentMailboxState = await _mailboxRepository.getMailboxState();
|
||||
final result = await _mailboxRepository.moveMailbox(accountId, request);
|
||||
if (result) {
|
||||
|
||||
@@ -12,6 +12,8 @@ class RenameMailboxInteractor {
|
||||
|
||||
Stream<Either<Failure, Success>> execute(AccountId accountId, RenameMailboxRequest request) async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(LoadingRenameMailbox());
|
||||
|
||||
final currentMailboxState = await _mailboxRepository.getMailboxState();
|
||||
|
||||
final result = await _mailboxRepository.renameMailbox(accountId, request);
|
||||
|
||||
@@ -9,6 +9,8 @@ class SearchMailboxInteractor {
|
||||
|
||||
Stream<Either<Failure, Success>> execute(List<PresentationMailbox> mailboxes, SearchQuery searchQuery) async* {
|
||||
try {
|
||||
yield Right<Failure, Success>(LoadingSearchMailbox());
|
||||
|
||||
final resultList = mailboxes
|
||||
.where((mailbox) => mailbox.name?.name.toLowerCase().contains(searchQuery.value.toLowerCase()) == true)
|
||||
.toList();
|
||||
|
||||
Reference in New Issue
Block a user