TF-4002 Don't need to keep the expand/collapse state of creation dialog the same as the mailbox view
This commit is contained in:
@@ -844,11 +844,7 @@ class MailboxController extends BaseMailboxController
|
|||||||
|
|
||||||
void goToCreateNewMailboxView(BuildContext context, {PresentationMailbox? parentMailbox}) async {
|
void goToCreateNewMailboxView(BuildContext context, {PresentationMailbox? parentMailbox}) async {
|
||||||
if (session != null && accountId != null) {
|
if (session != null && accountId != null) {
|
||||||
final arguments = MailboxCreatorArguments(
|
final arguments = MailboxCreatorArguments(allMailboxes, parentMailbox);
|
||||||
defaultMailboxTree.value,
|
|
||||||
personalMailboxTree.value,
|
|
||||||
parentMailbox,
|
|
||||||
);
|
|
||||||
|
|
||||||
final result = PlatformInfo.isWeb
|
final result = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.mailboxCreator, arguments: arguments)
|
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.mailboxCreator, arguments: arguments)
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ class TreeBuilder {
|
|||||||
required MailboxTree currentPersonalTree,
|
required MailboxTree currentPersonalTree,
|
||||||
required MailboxTree currentTeamMailboxTree,
|
required MailboxTree currentTeamMailboxTree,
|
||||||
MailboxId? mailboxIdSelected,
|
MailboxId? mailboxIdSelected,
|
||||||
|
MailboxId? mailboxIdExpanded,
|
||||||
}) async {
|
}) async {
|
||||||
final Map<MailboxId, MailboxNode> mailboxDictionary = HashMap();
|
final Map<MailboxId, MailboxNode> mailboxDictionary = HashMap();
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_tree_builder.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_creator/domain/usecases/verify_name_interactor.dart';
|
import 'package:tmail_ui_user/features/mailbox_creator/domain/usecases/verify_name_interactor.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_creator/presentation/mailbox_creator_controller.dart';
|
import 'package:tmail_ui_user/features/mailbox_creator/presentation/mailbox_creator_controller.dart';
|
||||||
|
|
||||||
@@ -6,7 +7,11 @@ class MailboxCreatorBindings extends Bindings {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dependencies() {
|
void dependencies() {
|
||||||
|
Get.lazyPut(() => TreeBuilder());
|
||||||
Get.lazyPut(() => VerifyNameInteractor());
|
Get.lazyPut(() => VerifyNameInteractor());
|
||||||
Get.lazyPut(() => MailboxCreatorController(Get.find<VerifyNameInteractor>()));
|
Get.lazyPut(() => MailboxCreatorController(
|
||||||
|
Get.find<VerifyNameInteractor>(),
|
||||||
|
Get.find<TreeBuilder>(),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,7 @@ import 'package:tmail_ui_user/features/base/mixin/expand_folder_trigger_scrollab
|
|||||||
import 'package:tmail_ui_user/features/mailbox/presentation/extensions/expand_mode_extension.dart';
|
import 'package:tmail_ui_user/features/mailbox/presentation/extensions/expand_mode_extension.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_node.dart';
|
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_node.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_tree.dart';
|
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_tree.dart';
|
||||||
|
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_tree_builder.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_creator/domain/model/verification/duplicate_name_validator.dart';
|
import 'package:tmail_ui_user/features/mailbox_creator/domain/model/verification/duplicate_name_validator.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_creator/domain/model/verification/empty_name_validator.dart';
|
import 'package:tmail_ui_user/features/mailbox_creator/domain/model/verification/empty_name_validator.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox_creator/domain/model/verification/name_with_space_only_validator.dart';
|
import 'package:tmail_ui_user/features/mailbox_creator/domain/model/verification/name_with_space_only_validator.dart';
|
||||||
@@ -25,6 +26,7 @@ class MailboxCreatorController extends BaseController
|
|||||||
with ExpandFolderTriggerScrollableMixin {
|
with ExpandFolderTriggerScrollableMixin {
|
||||||
|
|
||||||
final VerifyNameInteractor _verifyNameInteractor;
|
final VerifyNameInteractor _verifyNameInteractor;
|
||||||
|
final TreeBuilder _treeBuilder;
|
||||||
|
|
||||||
final selectedMailbox = Rxn<PresentationMailbox>();
|
final selectedMailbox = Rxn<PresentationMailbox>();
|
||||||
final newNameMailbox = Rxn<String>();
|
final newNameMailbox = Rxn<String>();
|
||||||
@@ -40,7 +42,7 @@ class MailboxCreatorController extends BaseController
|
|||||||
|
|
||||||
List<String> listMailboxNameAsStringExist = <String>[];
|
List<String> listMailboxNameAsStringExist = <String>[];
|
||||||
|
|
||||||
MailboxCreatorController(this._verifyNameInteractor);
|
MailboxCreatorController(this._verifyNameInteractor, this._treeBuilder);
|
||||||
|
|
||||||
void setNewNameMailbox(String newName) => newNameMailbox.value = newName;
|
void setNewNameMailbox(String newName) => newNameMailbox.value = newName;
|
||||||
|
|
||||||
@@ -49,10 +51,7 @@ class MailboxCreatorController extends BaseController
|
|||||||
super.onInit();
|
super.onInit();
|
||||||
MailboxCreatorArguments? arguments = Get.arguments;
|
MailboxCreatorArguments? arguments = Get.arguments;
|
||||||
if (arguments != null) {
|
if (arguments != null) {
|
||||||
personalMailboxTree.value = arguments.personalMailboxTree;
|
_buildMailboxTree(arguments);
|
||||||
defaultMailboxTree.value = arguments.defaultMailboxTree;
|
|
||||||
selectedMailbox.value = arguments.selectedMailbox;
|
|
||||||
_createListMailboxNameAsStringInMailboxLocation();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,6 +65,19 @@ class MailboxCreatorController extends BaseController
|
|||||||
super.onClose();
|
super.onClose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> _buildMailboxTree(MailboxCreatorArguments arguments) async {
|
||||||
|
final recordTree = await _treeBuilder.generateMailboxTreeInUI(
|
||||||
|
allMailboxes: arguments.listMailboxes,
|
||||||
|
currentDefaultTree: defaultMailboxTree.value,
|
||||||
|
currentPersonalTree: personalMailboxTree.value,
|
||||||
|
currentTeamMailboxTree: MailboxTree(MailboxNode.root()),
|
||||||
|
);
|
||||||
|
personalMailboxTree.value = recordTree.personalTree;
|
||||||
|
defaultMailboxTree.value = recordTree.defaultTree;
|
||||||
|
selectedMailbox.value = arguments.selectedMailbox;
|
||||||
|
_createListMailboxNameAsStringInMailboxLocation();
|
||||||
|
}
|
||||||
|
|
||||||
MailboxNode? _findMailboxNodeById(MailboxId mailboxId) {
|
MailboxNode? _findMailboxNodeById(MailboxId mailboxId) {
|
||||||
final mailboxNode = defaultMailboxTree.value.findNode((node) => node.item.id == mailboxId)
|
final mailboxNode = defaultMailboxTree.value.findNode((node) => node.item.id == mailboxId)
|
||||||
?? personalMailboxTree.value.findNode((node) => node.item.id == mailboxId);
|
?? personalMailboxTree.value.findNode((node) => node.item.id == mailboxId);
|
||||||
|
|||||||
@@ -1,23 +1,12 @@
|
|||||||
|
|
||||||
import 'package:equatable/equatable.dart';
|
import 'package:equatable/equatable.dart';
|
||||||
import 'package:model/mailbox/presentation_mailbox.dart';
|
import 'package:model/mailbox/presentation_mailbox.dart';
|
||||||
import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_tree.dart';
|
|
||||||
|
|
||||||
class MailboxCreatorArguments with EquatableMixin{
|
class MailboxCreatorArguments with EquatableMixin {
|
||||||
final MailboxTree personalMailboxTree;
|
final List<PresentationMailbox> listMailboxes;
|
||||||
final MailboxTree defaultMailboxTree;
|
|
||||||
final PresentationMailbox? selectedMailbox;
|
final PresentationMailbox? selectedMailbox;
|
||||||
|
|
||||||
MailboxCreatorArguments(
|
MailboxCreatorArguments(this.listMailboxes, this.selectedMailbox);
|
||||||
this.defaultMailboxTree,
|
|
||||||
this.personalMailboxTree,
|
|
||||||
this.selectedMailbox,
|
|
||||||
);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Object?> get props => [
|
List<Object?> get props => [listMailboxes, selectedMailbox];
|
||||||
defaultMailboxTree,
|
}
|
||||||
personalMailboxTree,
|
|
||||||
selectedMailbox,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -755,11 +755,7 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa
|
|||||||
|
|
||||||
void goToCreateNewMailboxView(BuildContext context, {PresentationMailbox? parentMailbox}) async {
|
void goToCreateNewMailboxView(BuildContext context, {PresentationMailbox? parentMailbox}) async {
|
||||||
if (session != null && accountId != null) {
|
if (session != null && accountId != null) {
|
||||||
final arguments = MailboxCreatorArguments(
|
final arguments = MailboxCreatorArguments(allMailboxes, parentMailbox);
|
||||||
defaultMailboxTree.value,
|
|
||||||
personalMailboxTree.value,
|
|
||||||
parentMailbox,
|
|
||||||
);
|
|
||||||
|
|
||||||
final result = PlatformInfo.isWeb
|
final result = PlatformInfo.isWeb
|
||||||
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.mailboxCreator, arguments: arguments)
|
? await DialogRouter.pushGeneralDialog(routeName: AppRoutes.mailboxCreator, arguments: arguments)
|
||||||
|
|||||||
Reference in New Issue
Block a user