diff --git a/lib/features/base/base_mailbox_controller.dart b/lib/features/base/base_mailbox_controller.dart index 2aca687111..c366cff9fc 100644 --- a/lib/features/base/base_mailbox_controller.dart +++ b/lib/features/base/base_mailbox_controller.dart @@ -37,6 +37,7 @@ import 'package:tmail_ui_user/features/mailbox/presentation/extensions/presentat import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_actions.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_categories.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_categories_expand_mode.dart'; +import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_collection.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_builder.dart'; @@ -62,6 +63,7 @@ typedef OnMoveFolderContentActionCallback = void Function( ); typedef DeleteMailboxActionCallback = void Function(PresentationMailbox mailbox); typedef AllowSubaddressingActionCallback = void Function(MailboxId, Map?>?, MailboxActions); +typedef OnUpdateMailboxCollectionCallback = MailboxCollection Function(MailboxCollection); abstract class BaseMailboxController extends BaseController with ExpandFolderTriggerScrollableMixin { @@ -88,39 +90,58 @@ abstract class BaseMailboxController extends BaseController List allMailboxes = []; Future buildTree( - List allMailbox, - {MailboxId? mailboxIdSelected} - ) async { - final recordTree = await _treeBuilder.generateMailboxTreeInUI( + List allMailbox, { + MailboxId? mailboxIdSelected, + OnUpdateMailboxCollectionCallback? onUpdateMailboxCollectionCallback, + }) async { + MailboxCollection mailboxCollection = + await _treeBuilder.generateMailboxTreeInUI( allMailboxes: allMailbox, currentDefaultTree: defaultMailboxTree.value, currentPersonalTree: personalMailboxTree.value, currentTeamMailboxTree: teamMailboxesTree.value, mailboxIdSelected: mailboxIdSelected, ); - defaultMailboxTree.firstRebuild = true; - personalMailboxTree.firstRebuild = true; - teamMailboxesTree.firstRebuild = true; - defaultMailboxTree.value = recordTree.defaultTree; - personalMailboxTree.value = recordTree.personalTree; - teamMailboxesTree.value = recordTree.teamMailboxTree; - allMailboxes = recordTree.allMailboxes; + + if (onUpdateMailboxCollectionCallback != null) { + mailboxCollection = onUpdateMailboxCollectionCallback(mailboxCollection); + } + + updateMailboxTree(mailboxCollection: mailboxCollection); } - Future refreshTree(List allMailbox) async { - final recordTree = await _treeBuilder.generateMailboxTreeInUIAfterRefreshChanges( + Future refreshTree( + List allMailbox, { + OnUpdateMailboxCollectionCallback? onUpdateMailboxCollectionCallback, + }) async { + MailboxCollection mailboxCollection = + await _treeBuilder.generateMailboxTreeInUIAfterRefreshChanges( allMailboxes: allMailbox, currentDefaultTree: defaultMailboxTree.value, currentPersonalTree: personalMailboxTree.value, currentTeamMailboxTree: teamMailboxesTree.value, ); - defaultMailboxTree.firstRebuild = true; - personalMailboxTree.firstRebuild = true; - teamMailboxesTree.firstRebuild = true; - defaultMailboxTree.value = recordTree.defaultTree; - personalMailboxTree.value = recordTree.personalTree; - teamMailboxesTree.value = recordTree.teamMailboxTree; - allMailboxes = allMailbox; + + if (onUpdateMailboxCollectionCallback != null) { + mailboxCollection = onUpdateMailboxCollectionCallback(mailboxCollection); + } + + updateMailboxTree(mailboxCollection: mailboxCollection); + } + + void updateMailboxTree({ + required MailboxCollection mailboxCollection, + bool isRefreshTrigger = true, + }) { + if (isRefreshTrigger) { + defaultMailboxTree.firstRebuild = true; + personalMailboxTree.firstRebuild = true; + teamMailboxesTree.firstRebuild = true; + } + defaultMailboxTree.value = mailboxCollection.defaultTree; + personalMailboxTree.value = mailboxCollection.personalTree; + teamMailboxesTree.value = mailboxCollection.teamTree; + allMailboxes = mailboxCollection.allMailboxes; } void syncAllMailboxWithDisplayName(BuildContext context) { @@ -675,10 +696,26 @@ abstract class BaseMailboxController extends BaseController } } - void autoCreateVirtualFolder(bool isAINeedsActionEnabled) { - addFavoriteFolderToMailboxList(); + bool get isAINeedsActionEnabled => false; + + MailboxCollection autoCreateVirtualFolder({ + required MailboxCollection mailboxCollection, + }) { + MailboxCollection newMailboxCollection = addFavoriteFolderToMailboxList( + mailboxCollection: mailboxCollection, + ); if (isAINeedsActionEnabled) { - addActionRequiredFolder(); + newMailboxCollection = addActionRequiredFolder( + mailboxCollection: newMailboxCollection, + ); } + + return newMailboxCollection; + } + + MailboxCollection updateMailboxCollection( + MailboxCollection mailboxCollection, + ) { + return autoCreateVirtualFolder(mailboxCollection: mailboxCollection); } } \ No newline at end of file diff --git a/lib/features/mailbox/presentation/extensions/handle_action_required_tab_extension.dart b/lib/features/mailbox/presentation/extensions/handle_action_required_tab_extension.dart index 08b42fb8be..8083905636 100644 --- a/lib/features/mailbox/presentation/extensions/handle_action_required_tab_extension.dart +++ b/lib/features/mailbox/presentation/extensions/handle_action_required_tab_extension.dart @@ -3,15 +3,29 @@ import 'package:model/mailbox/presentation_mailbox.dart'; import 'package:tmail_ui_user/features/base/base_mailbox_controller.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/extensions/list_mailbox_node_extension.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/extensions/presentation_mailbox_extension.dart'; +import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_collection.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/main/routes/route_navigation.dart'; extension HandleActionRequiredTabExtension on BaseMailboxController { - void addActionRequiredFolder() { + MailboxCollection addActionRequiredFolder({ + required MailboxCollection mailboxCollection, + }) { final folder = _buildActionRequiredFolder(); - _addToDefaultMailboxTree(folder); - _addToAllMailboxes(folder); + final newDefaultTree = _addToDefaultMailboxTree( + folder: folder, + currentDefaultTree: mailboxCollection.defaultTree, + ); + final newAllMailboxes = _addToAllMailboxes( + folder: folder, + currentAllMailboxes: mailboxCollection.allMailboxes, + ); + + return mailboxCollection.copyWith( + defaultTree: newDefaultTree, + allMailboxes: newAllMailboxes, + ); } PresentationMailbox _buildActionRequiredFolder() { @@ -23,24 +37,39 @@ extension HandleActionRequiredTabExtension on BaseMailboxController { ); } - void _addToDefaultMailboxTree(PresentationMailbox folder) { - final root = defaultMailboxTree.value.root; + MailboxTree _addToDefaultMailboxTree({ + required PresentationMailbox folder, + required MailboxTree currentDefaultTree, + }) { + final root = currentDefaultTree.root; final children = List.from(root.childrenItems ?? []); + if (children.any((node) => node.item.id == folder.id)) { + return currentDefaultTree; + } children.insertAfterStarredOrInbox(MailboxNode(folder)); - defaultMailboxTree.value = MailboxTree( - root.copyWith(children: children), - ); + return MailboxTree(root.copyWith(children: children)); } - void _addToAllMailboxes(PresentationMailbox folder) { - if (_allMailboxesContains(folder.id)) return; - allMailboxes.add(folder); + List _addToAllMailboxes({ + required PresentationMailbox folder, + required List currentAllMailboxes, + }) { + if (_allMailboxesContains( + id: folder.id, + currentAllMailboxes: currentAllMailboxes, + )) { + return currentAllMailboxes; + } + return [...currentAllMailboxes, folder]; } - bool _allMailboxesContains(MailboxId id) { - return allMailboxes.any((mailbox) => mailbox.id == id); + bool _allMailboxesContains({ + required MailboxId id, + required List currentAllMailboxes, + }) { + return currentAllMailboxes.any((mailbox) => mailbox.id == id); } void removeActionRequiredFolder() { diff --git a/lib/features/mailbox/presentation/extensions/handle_favorite_tab_extension.dart b/lib/features/mailbox/presentation/extensions/handle_favorite_tab_extension.dart index 373b963114..3d45480c4b 100644 --- a/lib/features/mailbox/presentation/extensions/handle_favorite_tab_extension.dart +++ b/lib/features/mailbox/presentation/extensions/handle_favorite_tab_extension.dart @@ -2,12 +2,15 @@ import 'package:model/mailbox/presentation_mailbox.dart'; import 'package:tmail_ui_user/features/base/base_mailbox_controller.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/extensions/list_mailbox_node_extension.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/extensions/presentation_mailbox_extension.dart'; +import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_collection.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/main/routes/route_navigation.dart'; extension HandleFavoriteTabExtension on BaseMailboxController { - void addFavoriteFolderToMailboxList() { + MailboxCollection addFavoriteFolderToMailboxList({ + required MailboxCollection mailboxCollection, + }) { PresentationMailbox favoriteFolder = PresentationMailbox.favoriteFolder; if (currentContext != null) { favoriteFolder = favoriteFolder.copyWith( @@ -15,16 +18,28 @@ extension HandleFavoriteTabExtension on BaseMailboxController { ); } - _addFavoriteFolderToDefaultMailboxTree(favoriteFolder); - _addFavoriteFolderToAllMailboxes(favoriteFolder); + final newDefaultTree = _addFavoriteFolderToDefaultMailboxTree( + favoriteFolder: favoriteFolder, + defaultTree: mailboxCollection.defaultTree, + ); + final newAllMailboxes = _addFavoriteFolderToAllMailboxes( + favoriteFolder: favoriteFolder, + allMailboxes: mailboxCollection.allMailboxes, + ); + + return mailboxCollection.copyWith( + defaultTree: newDefaultTree, + allMailboxes: newAllMailboxes, + ); } - void _addFavoriteFolderToDefaultMailboxTree( - PresentationMailbox favoriteFolder, - ) { - final defaultMailboxNode = defaultMailboxTree.value.root; - List currentDefaultFolders = - defaultMailboxNode.childrenItems ?? []; + MailboxTree _addFavoriteFolderToDefaultMailboxTree({ + required PresentationMailbox favoriteFolder, + required MailboxTree defaultTree, + }) { + final defaultMailboxNode = defaultTree.root; + final currentDefaultFolders = + List.from(defaultMailboxNode.childrenItems ?? []); if (currentDefaultFolders.isEmpty) { currentDefaultFolders.add(MailboxNode(favoriteFolder)); @@ -32,17 +47,20 @@ extension HandleFavoriteTabExtension on BaseMailboxController { currentDefaultFolders.insertAfterInbox(MailboxNode(favoriteFolder)); } - defaultMailboxTree.value = MailboxTree( + return MailboxTree( defaultMailboxNode.copyWith(children: currentDefaultFolders), ); } - void _addFavoriteFolderToAllMailboxes(PresentationMailbox favoriteFolder) { + List _addFavoriteFolderToAllMailboxes({ + required PresentationMailbox favoriteFolder, + required List allMailboxes, + }) { final alreadyExists = allMailboxes.any( (mailbox) => mailbox.id == favoriteFolder.id, ); - if (alreadyExists) return; + if (alreadyExists) return allMailboxes; - allMailboxes.add(favoriteFolder); + return [...allMailboxes, favoriteFolder]; } } diff --git a/lib/features/mailbox/presentation/mailbox_controller.dart b/lib/features/mailbox/presentation/mailbox_controller.dart index 4cb7ef4eeb..d98c3f2bfe 100644 --- a/lib/features/mailbox/presentation/mailbox_controller.dart +++ b/lib/features/mailbox/presentation/mailbox_controller.dart @@ -74,6 +74,7 @@ import 'package:tmail_ui_user/features/mailbox/presentation/extensions/presentat import 'package:tmail_ui_user/features/mailbox/presentation/mixin/mailbox_widget_mixin.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_actions.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_categories_expand_mode.dart'; +import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_collection.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_node.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_tree_builder.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/model/open_mailbox_view_event.dart'; @@ -264,8 +265,17 @@ class MailboxController extends BaseMailboxController viewState.value.fold( (failure) { if (failure is GetAllMailboxFailure) { - autoCreateVirtualFolder( - mailboxDashBoardController.isAINeedsActionEnabled, + final newMailboxCollection = updateMailboxCollection( + MailboxCollection( + allMailboxes: allMailboxes, + defaultTree: defaultMailboxTree.value, + personalTree: personalMailboxTree.value, + teamTree: teamMailboxesTree.value, + ), + ); + updateMailboxTree( + mailboxCollection: newMailboxCollection, + isRefreshTrigger: false, ); mailboxDashBoardController.updateRefreshAllMailboxState(Left(RefreshAllMailboxFailure())); showRetryToast(failure); @@ -273,9 +283,6 @@ class MailboxController extends BaseMailboxController }, (success) { if (success is GetAllMailboxSuccess) { - autoCreateVirtualFolder( - mailboxDashBoardController.isAINeedsActionEnabled, - ); mailboxDashBoardController.updateRefreshAllMailboxState(Right(RefreshAllMailboxSuccess())); _handleCreateDefaultFolderIfMissing(mailboxDashBoardController.mapDefaultMailboxIdByRole); _handleDataFromNavigationRouter(); @@ -283,10 +290,6 @@ class MailboxController extends BaseMailboxController if (PlatformInfo.isIOS) { _updateMailboxIdsBlockNotificationToKeychain(success.mailboxList); } - } else if (success is CreateDefaultMailboxAllSuccess) { - autoCreateVirtualFolder( - mailboxDashBoardController.isAINeedsActionEnabled, - ); } }); } @@ -325,7 +328,18 @@ class MailboxController extends BaseMailboxController refreshAllMailbox(); mailboxDashBoardController.clearMailboxUIAction(); } else if (action is AutoCreateActionRequiredFolderMailboxAction) { - addActionRequiredFolder(); + final newMailboxCollection = addActionRequiredFolder( + mailboxCollection: MailboxCollection( + allMailboxes: allMailboxes, + defaultTree: defaultMailboxTree.value, + personalTree: personalMailboxTree.value, + teamTree: teamMailboxesTree.value, + ), + ); + updateMailboxTree( + mailboxCollection: newMailboxCollection, + isRefreshTrigger: false, + ); mailboxDashBoardController.clearMailboxUIAction(); } else if (action is AutoRemoveActionRequiredFolderMailboxAction) { removeActionRequiredFolder(); @@ -612,14 +626,14 @@ class MailboxController extends BaseMailboxController .mailboxList .listSubscribedMailboxesAndDefaultMailboxes; - await refreshTree(listMailboxDisplayed); + await refreshTree( + listMailboxDisplayed, + onUpdateMailboxCollectionCallback: updateMailboxCollection, + ); if (currentContext != null) { syncAllMailboxWithDisplayName(currentContext!); } - autoCreateVirtualFolder( - mailboxDashBoardController.isAINeedsActionEnabled, - ); _setMapMailbox(); _setOutboxMailbox(); _selectSelectedMailboxDefault(); @@ -630,6 +644,10 @@ class MailboxController extends BaseMailboxController } } + @override + bool get isAINeedsActionEnabled => + mailboxDashBoardController.isAINeedsActionEnabled; + void _setMapMailbox() { final mapDefaultMailboxIdByRole = { for (var mailboxNode in defaultMailboxTree.value.root.childrenItems ?? List.empty()) @@ -731,7 +749,10 @@ class MailboxController extends BaseMailboxController allMailboxes.add(mailbox.toPresentationMailbox()); } - await buildTree(allMailboxes); + await buildTree( + allMailboxes, + onUpdateMailboxCollectionCallback: updateMailboxCollection, + ); if (currentContext != null) { syncAllMailboxWithDisplayName(currentContext!); } @@ -1315,7 +1336,10 @@ class MailboxController extends BaseMailboxController currentMailboxState = success.currentMailboxState; log('MailboxController::_handleGetAllMailboxSuccess:currentMailboxState: $currentMailboxState'); final listMailboxDisplayed = success.mailboxList.listSubscribedMailboxesAndDefaultMailboxes; - await buildTree(listMailboxDisplayed); + await buildTree( + listMailboxDisplayed, + onUpdateMailboxCollectionCallback: updateMailboxCollection, + ); if (currentContext != null) { syncAllMailboxWithDisplayName(currentContext!); } diff --git a/lib/features/mailbox/presentation/model/mailbox_collection.dart b/lib/features/mailbox/presentation/model/mailbox_collection.dart new file mode 100644 index 0000000000..9683f5cd15 --- /dev/null +++ b/lib/features/mailbox/presentation/model/mailbox_collection.dart @@ -0,0 +1,39 @@ +import 'package:equatable/equatable.dart'; +import 'package:model/mailbox/presentation_mailbox.dart'; +import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_tree.dart'; + +class MailboxCollection with EquatableMixin { + final List allMailboxes; + final MailboxTree defaultTree; + final MailboxTree personalTree; + final MailboxTree teamTree; + + const MailboxCollection({ + required this.allMailboxes, + required this.defaultTree, + required this.personalTree, + required this.teamTree, + }); + + MailboxCollection copyWith({ + List? allMailboxes, + MailboxTree? defaultTree, + MailboxTree? personalTree, + MailboxTree? teamTree, + }) { + return MailboxCollection( + allMailboxes: allMailboxes ?? this.allMailboxes, + defaultTree: defaultTree ?? this.defaultTree, + personalTree: personalTree ?? this.personalTree, + teamTree: teamTree ?? this.teamTree, + ); + } + + @override + List get props => [ + allMailboxes, + defaultTree, + personalTree, + teamTree, + ]; +} diff --git a/lib/features/mailbox/presentation/model/mailbox_tree_builder.dart b/lib/features/mailbox/presentation/model/mailbox_tree_builder.dart index d749a81265..d1c5fac904 100644 --- a/lib/features/mailbox/presentation/model/mailbox_tree_builder.dart +++ b/lib/features/mailbox/presentation/model/mailbox_tree_builder.dart @@ -8,6 +8,7 @@ import 'package:model/mailbox/expand_mode.dart'; import 'package:model/mailbox/mailbox_state.dart'; import 'package:model/mailbox/presentation_mailbox.dart'; import 'package:model/mailbox/select_mode.dart'; +import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_collection.dart'; import 'mailbox_node.dart'; import 'mailbox_tree.dart'; @@ -37,12 +38,7 @@ class TreeBuilder { return tree; } - Future<({ - List allMailboxes, - MailboxTree defaultTree, - MailboxTree personalTree, - MailboxTree teamMailboxTree - })> generateMailboxTreeInUI({ + Future generateMailboxTreeInUI({ required List allMailboxes, required MailboxTree currentDefaultTree, required MailboxTree currentPersonalTree, @@ -106,19 +102,15 @@ class TreeBuilder { sortNodeChildren(newDefaultTree.root); - return ( + return MailboxCollection( allMailboxes: newAllMailboxes, defaultTree: newDefaultTree, personalTree: newPersonalTree, - teamMailboxTree: newTeamMailboxTree, + teamTree: newTeamMailboxTree, ); } - Future<({ - MailboxTree defaultTree, - MailboxTree personalTree, - MailboxTree teamMailboxTree - })> generateMailboxTreeInUIAfterRefreshChanges({ + Future generateMailboxTreeInUIAfterRefreshChanges({ required List allMailboxes, required MailboxTree currentDefaultTree, required MailboxTree currentPersonalTree, @@ -169,10 +161,11 @@ class TreeBuilder { sortNodeChildren(newDefaultTree.root); - return ( + return MailboxCollection( + allMailboxes: allMailboxes, defaultTree: newDefaultTree, personalTree: newPersonalTree, - teamMailboxTree: newTeamMailboxTree, + teamTree: newTeamMailboxTree, ); } diff --git a/lib/features/search/mailbox/presentation/search_mailbox_controller.dart b/lib/features/search/mailbox/presentation/search_mailbox_controller.dart index d1c15396e6..25c94d8636 100644 --- a/lib/features/search/mailbox/presentation/search_mailbox_controller.dart +++ b/lib/features/search/mailbox/presentation/search_mailbox_controller.dart @@ -60,6 +60,7 @@ import 'package:tmail_ui_user/features/mailbox/domain/usecases/subscribe_multipl import 'package:tmail_ui_user/features/mailbox/presentation/action/mailbox_ui_action.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/extensions/presentation_mailbox_extension.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_actions.dart'; +import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_collection.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_tree_builder.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/utils/mailbox_action_reactor.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/utils/mailbox_utils.dart'; @@ -165,13 +166,19 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa void handleSuccessViewState(Success success) async { if (success is GetAllMailboxSuccess) { currentMailboxState = success.currentMailboxState; - await buildTree(success.mailboxList); + await buildTree( + success.mailboxList, + onUpdateMailboxCollectionCallback: updateMailboxCollection, + ); if (currentContext != null) { syncAllMailboxWithDisplayName(currentContext!); } } else if (success is RefreshChangesAllMailboxSuccess) { currentMailboxState = success.currentMailboxState; - await refreshTree(success.mailboxList); + await refreshTree( + success.mailboxList, + onUpdateMailboxCollectionCallback: updateMailboxCollection, + ); if (currentContext != null) { syncAllMailboxWithDisplayName(currentContext!); } @@ -213,19 +220,25 @@ class SearchMailboxController extends BaseMailboxController with MailboxActionHa super.onDone(); viewState.value.fold((failure) { if (failure is GetAllMailboxFailure) { - autoCreateVirtualFolder( - dashboardController.isAINeedsActionEnabled, + final newMailboxCollection = updateMailboxCollection( + MailboxCollection( + allMailboxes: allMailboxes, + defaultTree: defaultMailboxTree.value, + personalTree: personalMailboxTree.value, + teamTree: teamMailboxesTree.value, + ), ); - } - }, (success) { - if (success is GetAllMailboxSuccess) { - autoCreateVirtualFolder( - dashboardController.isAINeedsActionEnabled, + updateMailboxTree( + mailboxCollection: newMailboxCollection, + isRefreshTrigger: false, ); } - }); + }, (success) {}); } + @override + bool get isAINeedsActionEnabled => dashboardController.isAINeedsActionEnabled; + void _initializeDebounceTimeTextSearchChange() { _deBouncerTime = Debouncer( const Duration(milliseconds: 300), diff --git a/test/features/mailbox_dashboard/presentation/view/mailbox_dashboard_view_widget_test.dart b/test/features/mailbox_dashboard/presentation/view/mailbox_dashboard_view_widget_test.dart index 2524d91e8f..33ba026457 100644 --- a/test/features/mailbox_dashboard/presentation/view/mailbox_dashboard_view_widget_test.dart +++ b/test/features/mailbox_dashboard/presentation/view/mailbox_dashboard_view_widget_test.dart @@ -60,6 +60,7 @@ import 'package:tmail_ui_user/features/mailbox/domain/usecases/subscribe_mailbox import 'package:tmail_ui_user/features/mailbox/domain/usecases/subscribe_multiple_mailbox_interactor.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/mailbox_controller.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/mailbox_view_web.dart'; +import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_collection.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_builder.dart'; @@ -821,11 +822,11 @@ void main() { mailboxIdExpanded: anyNamed('mailboxIdExpanded'), ), ).thenAnswer( - (_) async => ( + (_) async => MailboxCollection( allMailboxes: currentMailboxList, defaultTree: defaultTree, personalTree: personalTree, - teamMailboxTree: teamTree, + teamTree: teamTree, ), ); @@ -963,11 +964,11 @@ void main() { mailboxIdExpanded: anyNamed('mailboxIdExpanded'), ), ).thenAnswer( - (_) async => ( + (_) async => MailboxCollection( allMailboxes: currentMailboxList, defaultTree: defaultTree, personalTree: personalTree, - teamMailboxTree: teamTree, + teamTree: teamTree, ), ); diff --git a/test/features/rule_filter_creator/presentation/rule_filter_creator_controller_test.dart b/test/features/rule_filter_creator/presentation/rule_filter_creator_controller_test.dart index 171379a322..f5836a112c 100644 --- a/test/features/rule_filter_creator/presentation/rule_filter_creator_controller_test.dart +++ b/test/features/rule_filter_creator/presentation/rule_filter_creator_controller_test.dart @@ -32,6 +32,7 @@ import 'package:tmail_ui_user/features/login/domain/usecases/delete_authority_oi import 'package:tmail_ui_user/features/login/domain/usecases/delete_credential_interactor.dart'; import 'package:tmail_ui_user/features/mailbox/domain/state/get_all_mailboxes_state.dart'; import 'package:tmail_ui_user/features/mailbox/domain/usecases/get_all_mailbox_interactor.dart'; +import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_collection.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_builder.dart'; @@ -215,11 +216,11 @@ void main() { currentPersonalTree: MailboxTree(MailboxNode.root()), currentTeamMailboxTree: MailboxTree(MailboxNode.root()), )).thenAnswer((_) async { - return ( + return MailboxCollection( allMailboxes: [spamMailbox], defaultTree: MailboxTree(MailboxNode(spamMailbox)), personalTree: MailboxTree(MailboxNode.root()), - teamMailboxTree: MailboxTree(MailboxNode.root()), + teamTree: MailboxTree(MailboxNode.root()), ); }); @@ -296,11 +297,11 @@ void main() { currentPersonalTree: MailboxTree(MailboxNode.root()), currentTeamMailboxTree: MailboxTree(MailboxNode.root()), )).thenAnswer((_) async { - return ( + return MailboxCollection( allMailboxes: [mailboxA], defaultTree: MailboxTree(MailboxNode.root()), personalTree: MailboxTree(MailboxNode(mailboxA)), - teamMailboxTree: MailboxTree(MailboxNode.root()), + teamTree: MailboxTree(MailboxNode.root()), ); });