Skip to content

Commit

Permalink
TF-2316 Store list unsubscribed mailboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
hieutbui committed Jan 30, 2024
1 parent 5ad800a commit 3135dae
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/features/base/base_mailbox_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ abstract class BaseMailboxController extends BaseController {
final teamMailboxesTree = MailboxTree(MailboxNode.root()).obs;

List<PresentationMailbox> allMailboxes = <PresentationMailbox>[];
List<PresentationMailbox> listUnsubscribedMailboxes = <PresentationMailbox>[];

Future<void> buildTree(
List<PresentationMailbox> allMailbox,
Expand Down
2 changes: 2 additions & 0 deletions lib/features/mailbox/presentation/mailbox_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,7 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
currentMailboxState = success.currentMailboxState;
log('MailboxController::_handleGetAllMailboxSuccess:currentMailboxState: $currentMailboxState');
final listMailboxDisplayed = success.mailboxList.listSubscribedMailboxesAndDefaultMailboxes;
listUnsubscribedMailboxes = success.mailboxList.listUnsubscribedMailboxes;
await buildTree(listMailboxDisplayed);
if (currentContext != null) {
await syncAllMailboxWithDisplayName(currentContext!);
Expand All @@ -1134,6 +1135,7 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
currentMailboxState = success.currentMailboxState;
log('MailboxController::_handleRefreshChangesAllMailboxSuccess:currentMailboxState: $currentMailboxState');
final listMailboxDisplayed = success.mailboxList.listSubscribedMailboxesAndDefaultMailboxes;
listUnsubscribedMailboxes = success.mailboxList.listUnsubscribedMailboxes;
await refreshTree(listMailboxDisplayed);
if (currentContext != null) {
await syncAllMailboxWithDisplayName(currentContext!);
Expand Down
3 changes: 3 additions & 0 deletions model/lib/extensions/list_presentation_mailbox_extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ extension ListPresentationMailboxExtension on List<PresentationMailbox> {
List<PresentationMailbox> get listSubscribedMailboxesAndDefaultMailboxes =>
where((mailbox) => mailbox.isSubscribedMailbox || mailbox.isDefault).toList();

List<PresentationMailbox> get listUnsubscribedMailboxes =>
where((mailbox) => !mailbox.isSubscribedMailbox).toList();

List<PresentationMailbox> get listPersonalMailboxes =>
where((mailbox) => mailbox.isPersonal).toList();

Expand Down

0 comments on commit 3135dae

Please sign in to comment.