Always show default mailbox in all MailboxView, Search Mailbox and Settings

This commit is contained in:
dab246
2023-02-17 13:28:08 +07:00
committed by Dat Vu
parent ed3d04a8da
commit 7e969c5e38
14 changed files with 115 additions and 151 deletions
@@ -147,11 +147,9 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
super.onData(newState);
newState.map((success) async {
if (success is GetAllMailboxSuccess) {
currentMailboxState = success.currentMailboxState;
_buildMailboxTreeHasSubscribed(success.mailboxList);
_handleGetAllMailboxSuccess(success);
} else if (success is RefreshChangesAllMailboxSuccess) {
currentMailboxState = success.currentMailboxState;
_refreshMailboxTreeHasSubscribed(success.mailboxList);
_handleRefreshChangesAllMailboxSuccess(success);
}
});
}
@@ -979,14 +977,16 @@ class MailboxController extends BaseMailboxController with MailboxActionHandlerM
curve: Curves.fastOutSlowIn);
}
void _buildMailboxTreeHasSubscribed(List<PresentationMailbox> mailboxList) async {
final _mailboxList = mailboxList.listSubscribedMailboxes;
await buildTree(_mailboxList);
void _handleGetAllMailboxSuccess(GetAllMailboxSuccess success) async {
currentMailboxState = success.currentMailboxState;
final listMailboxDisplayed = success.mailboxList.listSubscribedMailboxesAndDefaultMailboxes;
await buildTree(listMailboxDisplayed);
}
void _refreshMailboxTreeHasSubscribed(List<PresentationMailbox> mailboxList) async {
final _mailboxList = mailboxList.listSubscribedMailboxes;
await refreshTree(_mailboxList);
void _handleRefreshChangesAllMailboxSuccess(RefreshChangesAllMailboxSuccess success) async {
currentMailboxState = success.currentMailboxState;
final listMailboxDisplayed = success.mailboxList.listSubscribedMailboxesAndDefaultMailboxes;
await refreshTree(listMailboxDisplayed);
}
void _unsubscribeMailboxAction(MailboxId mailboxId) {