TF-1310: [Presentation] Refactor buildTree logic in TreeBuilder + BaseMailboxController

This commit is contained in:
HuyNguyen
2023-02-02 22:19:43 +07:00
committed by Dat Vu
parent d57bcd10dd
commit 10ba3867d8
30 changed files with 523 additions and 237 deletions
@@ -110,6 +110,7 @@ class DestinationPickerController extends BaseMailboxController {
mailboxAction.value = arguments!.mailboxAction;
mailboxIdSelected = arguments!.mailboxIdSelected;
accountId = arguments!.accountId;
_session = arguments!.session;
getAllMailboxAction();
}
}
@@ -175,9 +176,9 @@ class DestinationPickerController extends BaseMailboxController {
mailboxCategoriesExpandMode.value.defaultMailbox = newExpandMode;
mailboxCategoriesExpandMode.refresh();
break;
case MailboxCategories.folders:
final newExpandMode = mailboxCategoriesExpandMode.value.folderMailbox == ExpandMode.EXPAND ? ExpandMode.COLLAPSE : ExpandMode.EXPAND;
mailboxCategoriesExpandMode.value.folderMailbox = newExpandMode;
case MailboxCategories.personalMailboxes:
final newExpandMode = mailboxCategoriesExpandMode.value.personalMailboxes == ExpandMode.EXPAND ? ExpandMode.COLLAPSE : ExpandMode.EXPAND;
mailboxCategoriesExpandMode.value.personalMailboxes = newExpandMode;
mailboxCategoriesExpandMode.refresh();
break;
default:
@@ -235,7 +236,7 @@ class DestinationPickerController extends BaseMailboxController {
if (mailboxDestination.value == null ||
mailboxDestination.value == PresentationMailbox.unifiedMailbox) {
final allChildrenAtMailboxLocation = (defaultMailboxTree.value.root.childrenItems ?? <MailboxNode>[]) +
(folderMailboxTree.value.root.childrenItems ?? <MailboxNode>[]);
(personalMailboxTree.value.root.childrenItems ?? <MailboxNode>[]);
if (allChildrenAtMailboxLocation.isNotEmpty) {
listMailboxNameAsStringExist = allChildrenAtMailboxLocation
.where((mailboxNode) => mailboxNode.nameNotEmpty)