TF-1074 Handle go to path /mailbox_creator

This commit is contained in:
dab246
2022-10-25 00:25:08 +07:00
committed by Dat H. Pham
parent daddeb78dc
commit 50bba630d5
9 changed files with 142 additions and 42 deletions
@@ -380,20 +380,37 @@ class MailboxController extends BaseMailboxController {
_openMailboxEventController.add(OpenMailboxViewEvent(context, presentationMailboxSelected));
}
void goToCreateNewMailboxView() async {
void goToCreateNewMailboxView(BuildContext context) async {
final accountId = mailboxDashBoardController.accountId.value;
if (accountId != null) {
final newMailboxArguments = await push(
AppRoutes.mailboxCreator,
arguments: MailboxCreatorArguments(accountId, defaultMailboxTree.value, folderMailboxTree.value)
);
final arguments = MailboxCreatorArguments(
accountId,
defaultMailboxTree.value,
folderMailboxTree.value);
if (newMailboxArguments != null && newMailboxArguments is NewMailboxArguments) {
final generateCreateId = Id(_uuid.v1());
_createNewMailboxAction(accountId, CreateNewMailboxRequest(
generateCreateId,
newMailboxArguments.newName,
parentId: newMailboxArguments.mailboxLocation?.id));
if (BuildUtils.isWeb) {
showDialogMailboxCreator(
context: context,
arguments: arguments,
onCreatedMailbox: (newMailboxArguments) {
final generateCreateId = Id(_uuid.v1());
_createNewMailboxAction(accountId, CreateNewMailboxRequest(
generateCreateId,
newMailboxArguments.newName,
parentId: newMailboxArguments.mailboxLocation?.id));
});
} else {
final newMailboxArguments = await push(
AppRoutes.mailboxCreator,
arguments: arguments);
if (newMailboxArguments != null && newMailboxArguments is NewMailboxArguments) {
final generateCreateId = Id(_uuid.v1());
_createNewMailboxAction(accountId, CreateNewMailboxRequest(
generateCreateId,
newMailboxArguments.newName,
parentId: newMailboxArguments.mailboxLocation?.id));
}
}
}
}