Skip to content

Commit

Permalink
TF-1328 Add function handle archiveMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
hieutbui authored and hoangdat committed Jan 2, 2024
1 parent a88525e commit a6ff6c4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/features/mailbox/presentation/mailbox_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import 'package:tmail_ui_user/features/composer/domain/state/save_email_as_draft
import 'package:tmail_ui_user/features/composer/domain/state/send_email_state.dart';
import 'package:tmail_ui_user/features/composer/domain/state/update_email_drafts_state.dart';
import 'package:tmail_ui_user/features/email/domain/model/move_action.dart';
import 'package:tmail_ui_user/features/email/domain/model/move_to_mailbox_request.dart';
import 'package:tmail_ui_user/features/email/domain/state/delete_email_permanently_state.dart';
import 'package:tmail_ui_user/features/email/domain/state/delete_multiple_emails_permanently_state.dart';
import 'package:tmail_ui_user/features/email/domain/state/mark_as_email_read_state.dart';
Expand Down Expand Up @@ -1346,4 +1347,25 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
mailboxDashBoardController.emptySpamFolderAction(spamFolderId: presentationMailbox.id);
}
}

void archiveMessage(PresentationEmail email) {
final mailboxContain = email.findMailboxContain(mailboxDashBoardController.mapMailboxById);
if (mailboxContain != null) {
final archiveMailboxId = mailboxDashBoardController.getMailboxIdByRole(PresentationMailbox.roleArchive);
if (archiveMailboxId != null) {
final moveToArchiveMailboxRequest = MoveToMailboxRequest(
{mailboxContain.id: [email.id!]},
archiveMailboxId,
MoveAction.moving,
EmailActionType.moveToMailbox,
destinationPath:findNodePath(archiveMailboxId)
);
mailboxDashBoardController.moveToMailbox(
mailboxDashBoardController.sessionCurrent!,
mailboxDashBoardController.accountId.value!,
moveToArchiveMailboxRequest
);
}
}
}
}

0 comments on commit a6ff6c4

Please sign in to comment.