From dbdffff3553ac13e67ed05b8c36057d2bc9bcd2b Mon Sep 17 00:00:00 2001 From: dab246 Date: Thu, 9 Nov 2023 16:49:20 +0700 Subject: [PATCH] TF-2302 Resolve conflicts on the master branch Signed-off-by: dab246 (cherry picked from commit 6eb9f32ee0f67d9b78be13a4ecd4b1ae2b4de9a0) --- .../get_all_autocomplete_interactor.dart | 2 +- .../presentation/composer_controller.dart | 37 ++++++++--------- .../presentation/contact_controller.dart | 41 +++++++++---------- .../mailbox/data/network/mailbox_api.dart | 7 +--- .../domain/constants/mailbox_constants.dart | 12 ++++++ .../presentation/mailbox_controller.dart | 1 - .../presentation/utils/mailbox_constants.dart | 15 ------- .../advanced_filter_controller.dart | 41 +++++++++---------- .../forward_recipient_controller.dart | 32 +++++++-------- 9 files changed, 87 insertions(+), 101 deletions(-) delete mode 100644 lib/features/mailbox/presentation/utils/mailbox_constants.dart diff --git a/lib/features/composer/domain/usecases/get_all_autocomplete_interactor.dart b/lib/features/composer/domain/usecases/get_all_autocomplete_interactor.dart index 2237c0ee8..beddd2054 100644 --- a/lib/features/composer/domain/usecases/get_all_autocomplete_interactor.dart +++ b/lib/features/composer/domain/usecases/get_all_autocomplete_interactor.dart @@ -34,7 +34,7 @@ class GetAllAutoCompleteInteractor { ? success.listEmailAddress : [] ); - log('GetAllAutoCompleteInteractor::execute:listEmailAddressFromServerc: $listEmailAddressFromServer'); + log('GetAllAutoCompleteInteractor::execute:listEmailAddressFromServer: $listEmailAddressFromServer'); autoCompleteResults.addAll(listEmailAddressFromServer); final listEmailAddressFromDevice = resultExecutions[1].fold( diff --git a/lib/features/composer/presentation/composer_controller.dart b/lib/features/composer/presentation/composer_controller.dart index ed56af677..905d9e460 100644 --- a/lib/features/composer/presentation/composer_controller.dart +++ b/lib/features/composer/presentation/composer_controller.dart @@ -1036,40 +1036,35 @@ class ComposerController extends BaseController { _getAutoCompleteInteractor = getBinding(); _getDeviceContactSuggestionsInteractor = getBinding(); - final accountId = mailboxDashBoardController.accountId.value; - if (_contactSuggestionSource == ContactSuggestionSource.all) { - if (_getAllAutoCompleteInteractor == null && _getDeviceContactSuggestionsInteractor == null) { - return []; - } else if (_getDeviceContactSuggestionsInteractor != null) { - final listEmailAddress = await _getDeviceContactSuggestionsInteractor! - .execute(AutoCompletePattern(word: word, accountId: accountId)) + if (_getAllAutoCompleteInteractor != null) { + return await _getAllAutoCompleteInteractor! + .execute(AutoCompletePattern(word: word, accountId: mailboxDashBoardController.accountId.value)) .then((value) => value.fold( (failure) => [], (success) => _getAutoCompleteSuccess(success, word) )); - return listEmailAddress; + } else if (_getDeviceContactSuggestionsInteractor != null) { + return await _getDeviceContactSuggestionsInteractor! + .execute(AutoCompletePattern(word: word, accountId: mailboxDashBoardController.accountId.value)) + .then((value) => value.fold( + (failure) => [], + (success) => _getAutoCompleteSuccess(success, word) + )); + } else { + return []; } - - final listEmailAddress = await _getAllAutoCompleteInteractor! - .execute(AutoCompletePattern(word: word, accountId: accountId)) - .then((value) => value.fold( - (failure) => [], - (success) => _getAutoCompleteSuccess(success, word) - )); - return listEmailAddress; } else { if (_getAutoCompleteInteractor == null) { return []; - } - - final listEmailAddress = await _getAutoCompleteInteractor! - .execute(AutoCompletePattern(word: word, accountId: accountId)) + } else { + return await _getAutoCompleteInteractor! + .execute(AutoCompletePattern(word: word, accountId: mailboxDashBoardController.accountId.value)) .then((value) => value.fold( (failure) => [], (success) => _getAutoCompleteSuccess(success, word) )); - return listEmailAddress; + } } } diff --git a/lib/features/contact/presentation/contact_controller.dart b/lib/features/contact/presentation/contact_controller.dart index b1bccbd3b..d38e1dba9 100644 --- a/lib/features/contact/presentation/contact_controller.dart +++ b/lib/features/contact/presentation/contact_controller.dart @@ -125,10 +125,17 @@ class ContactController extends BaseController { _getDeviceContactSuggestionsInteractor = getBinding(); if (_contactSuggestionSource == ContactSuggestionSource.all) { - if (_getAllAutoCompleteInteractor == null && _getDeviceContactSuggestionsInteractor == null) { - return []; + if (_getAllAutoCompleteInteractor != null) { + return await _getAllAutoCompleteInteractor! + .execute(AutoCompletePattern(word: query, limit: 30, accountId: _accountId)) + .then((value) => value.fold( + (failure) => [], + (success) => success is GetAutoCompleteSuccess + ? success.listEmailAddress + : [] + )); } else if (_getDeviceContactSuggestionsInteractor != null) { - final listEmailAddress = await _getDeviceContactSuggestionsInteractor! + return await _getDeviceContactSuggestionsInteractor! .execute(AutoCompletePattern(word: query, limit: 30, accountId: _accountId)) .then((value) => value.fold( (failure) => [], @@ -136,30 +143,22 @@ class ContactController extends BaseController { ? success.listEmailAddress : [] )); - return listEmailAddress; + } else { + return []; } - - final listEmailAddress = await _getAllAutoCompleteInteractor! - .execute(AutoCompletePattern(word: query, limit: 30, accountId: _accountId)) - .then((value) => value.fold( - (failure) => [], - (success) => success is GetAutoCompleteSuccess - ? success.listEmailAddress - : [])); - return listEmailAddress; } else { if (_getAutoCompleteInteractor == null) { return []; - } - - final listEmailAddress = await _getAutoCompleteInteractor! + } else { + return await _getAutoCompleteInteractor! .execute(AutoCompletePattern(word: query, limit: 30, accountId: _accountId)) .then((value) => value.fold( - (failure) => [], - (success) => success is GetAutoCompleteSuccess - ? success.listEmailAddress - : [])); - return listEmailAddress; + (failure) => [], + (success) => success is GetAutoCompleteSuccess + ? success.listEmailAddress + : [] + )); + } } } diff --git a/lib/features/mailbox/data/network/mailbox_api.dart b/lib/features/mailbox/data/network/mailbox_api.dart index e75bb11ae..db123fe7e 100644 --- a/lib/features/mailbox/data/network/mailbox_api.dart +++ b/lib/features/mailbox/data/network/mailbox_api.dart @@ -422,8 +422,7 @@ class MailboxAPI with HandleSetErrorMixin { SetMailboxResponse.deserialize ); - final listEntriesErrors = handleSetResponse([createResponse]); - final mapErrors = Map.fromEntries(listEntriesErrors); + final mapErrors = handleSetResponse([createResponse]); if (mapErrors.isNotEmpty) { throw SetMailboxMethodException(mapErrors); @@ -495,9 +494,7 @@ class MailboxAPI with HandleSetErrorMixin { SetMailboxResponse.deserialize ); - final listEntriesErrors = handleSetResponse([updateResponse]); - final mapErrors = Map.fromEntries(listEntriesErrors); - + final mapErrors = handleSetResponse([updateResponse]); if (mapErrors.isNotEmpty) { throw SetMailboxMethodException(mapErrors); } diff --git a/lib/features/mailbox/domain/constants/mailbox_constants.dart b/lib/features/mailbox/domain/constants/mailbox_constants.dart index 80eb285e0..5dcbced28 100644 --- a/lib/features/mailbox/domain/constants/mailbox_constants.dart +++ b/lib/features/mailbox/domain/constants/mailbox_constants.dart @@ -1,5 +1,7 @@ import 'package:jmap_dart_client/jmap/core/properties/properties.dart'; +import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart'; import 'package:model/mailbox/mailbox_property.dart'; +import 'package:model/mailbox/presentation_mailbox.dart'; class MailboxConstants { static final propertiesDefault = Properties({ @@ -16,4 +18,14 @@ class MailboxConstants { MailboxProperty.myRights, MailboxProperty.namespace }); + + static final List defaultMailboxRoles = [ + PresentationMailbox.roleInbox, + PresentationMailbox.roleOutbox, + PresentationMailbox.roleDrafts, + PresentationMailbox.roleSent, + PresentationMailbox.roleTrash, + PresentationMailbox.roleSpam, + PresentationMailbox.roleTemplates, + ]; } \ No newline at end of file diff --git a/lib/features/mailbox/presentation/mailbox_controller.dart b/lib/features/mailbox/presentation/mailbox_controller.dart index 5334f6742..d09144008 100644 --- a/lib/features/mailbox/presentation/mailbox_controller.dart +++ b/lib/features/mailbox/presentation/mailbox_controller.dart @@ -64,7 +64,6 @@ import 'package:tmail_ui_user/features/mailbox/presentation/model/mailbox_catego 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'; -import 'package:tmail_ui_user/features/mailbox/presentation/utils/mailbox_constants.dart'; import 'package:tmail_ui_user/features/mailbox/presentation/utils/mailbox_utils.dart'; import 'package:tmail_ui_user/features/mailbox_creator/domain/usecases/verify_name_interactor.dart'; import 'package:tmail_ui_user/features/mailbox_creator/presentation/model/mailbox_creator_arguments.dart'; diff --git a/lib/features/mailbox/presentation/utils/mailbox_constants.dart b/lib/features/mailbox/presentation/utils/mailbox_constants.dart deleted file mode 100644 index 366a9e772..000000000 --- a/lib/features/mailbox/presentation/utils/mailbox_constants.dart +++ /dev/null @@ -1,15 +0,0 @@ - -import 'package:jmap_dart_client/jmap/mail/mailbox/mailbox.dart'; -import 'package:model/mailbox/presentation_mailbox.dart'; - -class MailboxConstants { - static final List defaultMailboxRoles = [ - PresentationMailbox.roleInbox, - PresentationMailbox.roleOutbox, - PresentationMailbox.roleDrafts, - PresentationMailbox.roleSent, - PresentationMailbox.roleTrash, - PresentationMailbox.roleSpam, - PresentationMailbox.roleTemplates, - ]; -} \ No newline at end of file diff --git a/lib/features/mailbox_dashboard/presentation/controller/advanced_filter_controller.dart b/lib/features/mailbox_dashboard/presentation/controller/advanced_filter_controller.dart index 8f9a0a951..563a7b1c6 100644 --- a/lib/features/mailbox_dashboard/presentation/controller/advanced_filter_controller.dart +++ b/lib/features/mailbox_dashboard/presentation/controller/advanced_filter_controller.dart @@ -198,10 +198,17 @@ class AdvancedFilterController extends BaseController { _getDeviceContactSuggestionsInteractor = getBinding(); if (_contactSuggestionSource == ContactSuggestionSource.all) { - if (_getAllAutoCompleteInteractor == null && _getDeviceContactSuggestionsInteractor == null) { - return []; + if (_getAllAutoCompleteInteractor != null) { + return await _getAllAutoCompleteInteractor! + .execute(AutoCompletePattern(word: word, accountId: _mailboxDashBoardController.accountId.value)) + .then((value) => value.fold( + (failure) => [], + (success) => success is GetAutoCompleteSuccess + ? success.listEmailAddress + : [] + )); } else if (_getDeviceContactSuggestionsInteractor != null) { - final listEmailAddress = await _getDeviceContactSuggestionsInteractor! + return await _getDeviceContactSuggestionsInteractor! .execute(AutoCompletePattern(word: word, accountId: _mailboxDashBoardController.accountId.value)) .then((value) => value.fold( (failure) => [], @@ -209,30 +216,22 @@ class AdvancedFilterController extends BaseController { ? success.listEmailAddress : [] )); - return listEmailAddress; + } else { + return []; } - - final listEmailAddress = await _getAllAutoCompleteInteractor! - .execute(AutoCompletePattern(word: word, accountId: _mailboxDashBoardController.accountId.value)) - .then((value) => value.fold( - (failure) => [], - (success) => success is GetAutoCompleteSuccess - ? success.listEmailAddress - : [])); - return listEmailAddress; } else { if (_getAutoCompleteInteractor == null) { return []; - } - - final listEmailAddress = await _getAutoCompleteInteractor! + } else { + return await _getAutoCompleteInteractor! .execute(AutoCompletePattern(word: word, accountId: _mailboxDashBoardController.accountId.value)) .then((value) => value.fold( - (failure) => [], - (success) => success is GetAutoCompleteSuccess - ? success.listEmailAddress - : [])); - return listEmailAddress; + (failure) => [], + (success) => success is GetAutoCompleteSuccess + ? success.listEmailAddress + : [] + )); + } } } diff --git a/lib/features/manage_account/presentation/forward/controller/forward_recipient_controller.dart b/lib/features/manage_account/presentation/forward/controller/forward_recipient_controller.dart index 61d44b157..9def28097 100644 --- a/lib/features/manage_account/presentation/forward/controller/forward_recipient_controller.dart +++ b/lib/features/manage_account/presentation/forward/controller/forward_recipient_controller.dart @@ -59,30 +59,29 @@ class ForwardRecipientController { _getDeviceContactSuggestionsInteractor = getBinding(); if (_contactSuggestionSource == ContactSuggestionSource.all) { - if (_getAllAutoCompleteInteractor == null && _getDeviceContactSuggestionsInteractor == null) { - return []; - } else if (_getDeviceContactSuggestionsInteractor != null) { - final listEmailAddress = await _getDeviceContactSuggestionsInteractor! - .execute(AutoCompletePattern(word: word, accountId: _accountId)) - .then((value) => value.fold( - (failure) => [], - (success) => success is GetDeviceContactSuggestionsSuccess - ? success.listEmailAddress - : [] - )); - return listEmailAddress; - } else { + if (_getAllAutoCompleteInteractor != null) { return await _getAllAutoCompleteInteractor! .execute(AutoCompletePattern(word: word, accountId: _accountId)) .then((value) => value.fold( (failure) => [], (success) => success is GetAutoCompleteSuccess ? success.listEmailAddress - : [])); + : [] + )); + } else if (_getDeviceContactSuggestionsInteractor != null) { + return await _getDeviceContactSuggestionsInteractor! + .execute(AutoCompletePattern(word: word, accountId: _accountId)) + .then((value) => value.fold( + (failure) => [], + (success) => success is GetDeviceContactSuggestionsSuccess + ? success.listEmailAddress + : [] + )); + } else { + return []; } } else { if (_getAutoCompleteInteractor == null) { - log('ForwardRecipientController::getAutoCompleteSuggestion(): _getAutoCompleteInteractor is NULL'); return []; } else { return await _getAutoCompleteInteractor! @@ -91,7 +90,8 @@ class ForwardRecipientController { (failure) => [], (success) => success is GetAutoCompleteSuccess ? success.listEmailAddress - : [])); + : [] + )); } } }