TF-3408 Remove limit result in autocomplete
This commit is contained in:
@@ -22,7 +22,9 @@ class ContactAPI {
|
|||||||
autoCompletePattern.accountId!,
|
autoCompletePattern.accountId!,
|
||||||
ContactFilter(autoCompletePattern.word));
|
ContactFilter(autoCompletePattern.word));
|
||||||
|
|
||||||
autoCompleteMethod.addLimit(UnsignedInt(autoCompletePattern.limit ?? 5));
|
if (autoCompletePattern.limit != null) {
|
||||||
|
autoCompleteMethod.addLimit(UnsignedInt(autoCompletePattern.limit!));
|
||||||
|
}
|
||||||
|
|
||||||
final autoCompleteInvocation = requestBuilder.invocation(autoCompleteMethod);
|
final autoCompleteInvocation = requestBuilder.invocation(autoCompleteMethod);
|
||||||
final response = await (requestBuilder
|
final response = await (requestBuilder
|
||||||
|
|||||||
@@ -1110,14 +1110,15 @@ class ComposerController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<EmailAddress>> getAutoCompleteSuggestion(String queryString) async {
|
Future<List<EmailAddress>> getAutoCompleteSuggestion(String queryString, {int? limit}) async {
|
||||||
log('ComposerController::getAutoCompleteSuggestion(): $queryString | $_contactSuggestionSource');
|
log('ComposerController::getAutoCompleteSuggestion():queryString = $queryString | limit = $limit | $_contactSuggestionSource');
|
||||||
_getAllAutoCompleteInteractor = getBinding<GetAllAutoCompleteInteractor>();
|
_getAllAutoCompleteInteractor = getBinding<GetAllAutoCompleteInteractor>();
|
||||||
_getAutoCompleteInteractor = getBinding<GetAutoCompleteInteractor>();
|
_getAutoCompleteInteractor = getBinding<GetAutoCompleteInteractor>();
|
||||||
_getDeviceContactSuggestionsInteractor = getBinding<GetDeviceContactSuggestionsInteractor>();
|
_getDeviceContactSuggestionsInteractor = getBinding<GetDeviceContactSuggestionsInteractor>();
|
||||||
|
|
||||||
final autoCompletePattern = AutoCompletePattern(
|
final autoCompletePattern = AutoCompletePattern(
|
||||||
word: queryString,
|
word: queryString,
|
||||||
|
limit: limit,
|
||||||
accountId: mailboxDashBoardController.accountId.value);
|
accountId: mailboxDashBoardController.accountId.value);
|
||||||
|
|
||||||
if (_contactSuggestionSource == ContactSuggestionSource.all) {
|
if (_contactSuggestionSource == ContactSuggestionSource.all) {
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class RecipientComposerWidgetStyle {
|
|||||||
static const double enableBorderRadius = 10;
|
static const double enableBorderRadius = 10;
|
||||||
static const double suggestionsBoxElevation = 20.0;
|
static const double suggestionsBoxElevation = 20.0;
|
||||||
static const double suggestionsBoxRadius = 20;
|
static const double suggestionsBoxRadius = 20;
|
||||||
static const double suggestionsBoxMaxHeight = 350;
|
static const double suggestionsBoxMaxHeight = 300;
|
||||||
static const double suggestionBoxWidth = 300;
|
static const double suggestionBoxWidth = 300;
|
||||||
static const double minTextFieldWidth = 20;
|
static const double minTextFieldWidth = 20;
|
||||||
static const double tagSpacing = 8;
|
static const double tagSpacing = 8;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import 'package:tmail_ui_user/features/composer/presentation/widgets/recipient_t
|
|||||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||||
import 'package:tmail_ui_user/main/utils/app_config.dart';
|
import 'package:tmail_ui_user/main/utils/app_config.dart';
|
||||||
|
|
||||||
typedef OnSuggestionEmailAddress = Future<List<EmailAddress>> Function(String word);
|
typedef OnSuggestionEmailAddress = Future<List<EmailAddress>> Function(String word, {int? limit});
|
||||||
typedef OnUpdateListEmailAddressAction = void Function(PrefixEmailAddress prefix, List<EmailAddress> newData);
|
typedef OnUpdateListEmailAddressAction = void Function(PrefixEmailAddress prefix, List<EmailAddress> newData);
|
||||||
typedef OnAddEmailAddressTypeAction = void Function(PrefixEmailAddress prefix);
|
typedef OnAddEmailAddressTypeAction = void Function(PrefixEmailAddress prefix);
|
||||||
typedef OnDeleteEmailAddressTypeAction = void Function(PrefixEmailAddress prefix);
|
typedef OnDeleteEmailAddressTypeAction = void Function(PrefixEmailAddress prefix);
|
||||||
@@ -213,7 +213,13 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
onTagChanged: (value) => _handleOnTagChangeAction.call(value, stateSetter),
|
onTagChanged: (value) => _handleOnTagChangeAction.call(value, stateSetter),
|
||||||
findSuggestions: _findSuggestions,
|
findSuggestions: (queryString) => _findSuggestions(
|
||||||
|
queryString,
|
||||||
|
limit: AppConfig.defaultLimitAutocomplete,
|
||||||
|
),
|
||||||
|
isLoadMoreOnlyOnce: true,
|
||||||
|
isLoadMoreReplaceAllOld: false,
|
||||||
|
loadMoreSuggestions: _findSuggestions,
|
||||||
useDefaultHighlight: false,
|
useDefaultHighlight: false,
|
||||||
suggestionBuilder: (context, tagEditorState, suggestionEmailAddress, index, length, highlight, suggestionValid) {
|
suggestionBuilder: (context, tagEditorState, suggestionEmailAddress, index, length, highlight, suggestionValid) {
|
||||||
return RecipientSuggestionItemWidget(
|
return RecipientSuggestionItemWidget(
|
||||||
@@ -297,7 +303,13 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
onTagChanged: (value) => _handleOnTagChangeAction.call(value, stateSetter),
|
onTagChanged: (value) => _handleOnTagChangeAction.call(value, stateSetter),
|
||||||
findSuggestions: _findSuggestions,
|
findSuggestions: (queryString) => _findSuggestions(
|
||||||
|
queryString,
|
||||||
|
limit: AppConfig.defaultLimitAutocomplete,
|
||||||
|
),
|
||||||
|
isLoadMoreOnlyOnce: true,
|
||||||
|
isLoadMoreReplaceAllOld: false,
|
||||||
|
loadMoreSuggestions: _findSuggestions,
|
||||||
useDefaultHighlight: false,
|
useDefaultHighlight: false,
|
||||||
suggestionBuilder: (context, tagEditorState, suggestionEmailAddress, index, length, highlight, suggestionValid) {
|
suggestionBuilder: (context, tagEditorState, suggestionEmailAddress, index, length, highlight, suggestionValid) {
|
||||||
return RecipientSuggestionItemWidget(
|
return RecipientSuggestionItemWidget(
|
||||||
@@ -402,7 +414,7 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
|
|||||||
? _currentListEmailAddress.sublist(0, 1)
|
? _currentListEmailAddress.sublist(0, 1)
|
||||||
: _currentListEmailAddress;
|
: _currentListEmailAddress;
|
||||||
|
|
||||||
FutureOr<List<SuggestionEmailAddress>> _findSuggestions(String query) async {
|
FutureOr<List<SuggestionEmailAddress>> _findSuggestions(String query, {int? limit}) async {
|
||||||
if (_gapBetweenTagChangedAndFindSuggestion?.isActive ?? false) {
|
if (_gapBetweenTagChangedAndFindSuggestion?.isActive ?? false) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -415,7 +427,10 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
|
|||||||
final tmailSuggestion = List<SuggestionEmailAddress>.empty(growable: true);
|
final tmailSuggestion = List<SuggestionEmailAddress>.empty(growable: true);
|
||||||
if (processedQuery.length >= widget.minInputLengthAutocomplete &&
|
if (processedQuery.length >= widget.minInputLengthAutocomplete &&
|
||||||
widget.onSuggestionEmailAddress != null) {
|
widget.onSuggestionEmailAddress != null) {
|
||||||
final listEmailAddress = await widget.onSuggestionEmailAddress!(processedQuery);
|
final listEmailAddress = await widget.onSuggestionEmailAddress!(
|
||||||
|
processedQuery,
|
||||||
|
limit: limit,
|
||||||
|
);
|
||||||
final listSuggestionEmailAddress = listEmailAddress
|
final listSuggestionEmailAddress = listEmailAddress
|
||||||
.map((emailAddress) => _toSuggestionEmailAddress(
|
.map((emailAddress) => _toSuggestionEmailAddress(
|
||||||
emailAddress,
|
emailAddress,
|
||||||
|
|||||||
@@ -229,16 +229,22 @@ class EmailRecoveryController extends BaseController with DateRangePickerMixin {
|
|||||||
hasAttachment.value = value ?? false;
|
hasAttachment.value = value ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<EmailAddress>> getAutoCompleteSuggestion(String word) async {
|
Future<List<EmailAddress>> getAutoCompleteSuggestion(String word, {int? limit}) async {
|
||||||
log('EmailRecoveryController::getAutoCompleteSuggestion(): $word | $_contactSuggestionSource');
|
log('EmailRecoveryController::getAutoCompleteSuggestion(): $word | $_contactSuggestionSource');
|
||||||
_getAllAutoCompleteInteractor = getBinding<GetAllAutoCompleteInteractor>();
|
_getAllAutoCompleteInteractor = getBinding<GetAllAutoCompleteInteractor>();
|
||||||
_getAutoCompleteInteractor = getBinding<GetAutoCompleteInteractor>();
|
_getAutoCompleteInteractor = getBinding<GetAutoCompleteInteractor>();
|
||||||
_getDeviceContactSuggestionsInteractor = getBinding<GetDeviceContactSuggestionsInteractor>();
|
_getDeviceContactSuggestionsInteractor = getBinding<GetDeviceContactSuggestionsInteractor>();
|
||||||
|
|
||||||
|
final autoCompletePattern = AutoCompletePattern(
|
||||||
|
word: word,
|
||||||
|
limit: limit,
|
||||||
|
accountId: _accountId
|
||||||
|
);
|
||||||
|
|
||||||
if (_contactSuggestionSource == ContactSuggestionSource.all) {
|
if (_contactSuggestionSource == ContactSuggestionSource.all) {
|
||||||
if (_getAllAutoCompleteInteractor != null) {
|
if (_getAllAutoCompleteInteractor != null) {
|
||||||
return await _getAllAutoCompleteInteractor!
|
return await _getAllAutoCompleteInteractor!
|
||||||
.execute(AutoCompletePattern(word: word, accountId: _accountId))
|
.execute(autoCompletePattern)
|
||||||
.then((value) => value.fold(
|
.then((value) => value.fold(
|
||||||
(failure) => <EmailAddress>[],
|
(failure) => <EmailAddress>[],
|
||||||
(success) => success is GetAutoCompleteSuccess
|
(success) => success is GetAutoCompleteSuccess
|
||||||
@@ -247,7 +253,7 @@ class EmailRecoveryController extends BaseController with DateRangePickerMixin {
|
|||||||
));
|
));
|
||||||
} else if (_getDeviceContactSuggestionsInteractor != null) {
|
} else if (_getDeviceContactSuggestionsInteractor != null) {
|
||||||
return await _getDeviceContactSuggestionsInteractor!
|
return await _getDeviceContactSuggestionsInteractor!
|
||||||
.execute(AutoCompletePattern(word: word, accountId: _accountId))
|
.execute(autoCompletePattern)
|
||||||
.then((value) => value.fold(
|
.then((value) => value.fold(
|
||||||
(failure) => <EmailAddress>[],
|
(failure) => <EmailAddress>[],
|
||||||
(success) => success is GetDeviceContactSuggestionsSuccess
|
(success) => success is GetDeviceContactSuggestionsSuccess
|
||||||
@@ -262,7 +268,7 @@ class EmailRecoveryController extends BaseController with DateRangePickerMixin {
|
|||||||
return <EmailAddress>[];
|
return <EmailAddress>[];
|
||||||
} else {
|
} else {
|
||||||
return await _getAutoCompleteInteractor!
|
return await _getAutoCompleteInteractor!
|
||||||
.execute(AutoCompletePattern(word: word, accountId: _accountId))
|
.execute(autoCompletePattern)
|
||||||
.then((value) => value.fold(
|
.then((value) => value.fold(
|
||||||
(failure) => <EmailAddress>[],
|
(failure) => <EmailAddress>[],
|
||||||
(success) => success is GetAutoCompleteSuccess
|
(success) => success is GetAutoCompleteSuccess
|
||||||
|
|||||||
+13
-4
@@ -17,7 +17,7 @@ import 'package:tmail_ui_user/features/email_recovery/presentation/widgets/text_
|
|||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/search/suggesstion_email_address.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/model/search/suggesstion_email_address.dart';
|
||||||
import 'package:tmail_ui_user/main/utils/app_config.dart';
|
import 'package:tmail_ui_user/main/utils/app_config.dart';
|
||||||
|
|
||||||
typedef OnSuggestionEmailAddress = Future<List<EmailAddress>> Function(String word);
|
typedef OnSuggestionEmailAddress = Future<List<EmailAddress>> Function(String word, {int? limit});
|
||||||
typedef OnUpdateListEmailAddressAction = void Function(EmailRecoveryField field, List<EmailAddress> newDate);
|
typedef OnUpdateListEmailAddressAction = void Function(EmailRecoveryField field, List<EmailAddress> newDate);
|
||||||
typedef OnDeleteEmailAddressTypeAction = void Function(EmailRecoveryField field, EmailAddress emailAddress);
|
typedef OnDeleteEmailAddressTypeAction = void Function(EmailRecoveryField field, EmailAddress emailAddress);
|
||||||
typedef OnShowFullListEmailAddressAction = void Function(EmailRecoveryField field);
|
typedef OnShowFullListEmailAddressAction = void Function(EmailRecoveryField field);
|
||||||
@@ -160,7 +160,13 @@ class _TextInputFieldSuggestionWidgetState extends State<TextInputFieldSuggestio
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
onTagChanged: (tag) => _handleOnTagChangeAction.call(tag, setState),
|
onTagChanged: (tag) => _handleOnTagChangeAction.call(tag, setState),
|
||||||
findSuggestions: _findSuggestions,
|
findSuggestions: (queryString) => _findSuggestions(
|
||||||
|
queryString,
|
||||||
|
limit: AppConfig.defaultLimitAutocomplete,
|
||||||
|
),
|
||||||
|
isLoadMoreOnlyOnce: true,
|
||||||
|
isLoadMoreReplaceAllOld: false,
|
||||||
|
loadMoreSuggestions: _findSuggestions,
|
||||||
suggestionBuilder: (context, tagEditorState, suggestionEmailAddress, index, length, highlight, suggestionValid) {
|
suggestionBuilder: (context, tagEditorState, suggestionEmailAddress, index, length, highlight, suggestionValid) {
|
||||||
return SuggestionItemWidget(
|
return SuggestionItemWidget(
|
||||||
suggestionState: suggestionEmailAddress.state,
|
suggestionState: suggestionEmailAddress.state,
|
||||||
@@ -315,7 +321,7 @@ class _TextInputFieldSuggestionWidgetState extends State<TextInputFieldSuggestio
|
|||||||
log('_TextFieldAutocompleteEmailAddressWebState::_handleGapBetweenTagChangedAndFindSuggestion:Timeout');
|
log('_TextFieldAutocompleteEmailAddressWebState::_handleGapBetweenTagChangedAndFindSuggestion:Timeout');
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<List<SuggestionEmailAddress>> _findSuggestions(String query) async {
|
FutureOr<List<SuggestionEmailAddress>> _findSuggestions(String query, {int? limit}) async {
|
||||||
if (_gapBetweenTagChangedAndFindSuggestion?.isActive ?? false) {
|
if (_gapBetweenTagChangedAndFindSuggestion?.isActive ?? false) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -330,7 +336,10 @@ class _TextInputFieldSuggestionWidgetState extends State<TextInputFieldSuggestio
|
|||||||
processedQuery.length >= widget.minInputLengthAutocomplete
|
processedQuery.length >= widget.minInputLengthAutocomplete
|
||||||
&& widget.onSuggestionEmailAddress != null
|
&& widget.onSuggestionEmailAddress != null
|
||||||
) {
|
) {
|
||||||
final listEmailAddress = await widget.onSuggestionEmailAddress!(processedQuery);
|
final listEmailAddress = await widget.onSuggestionEmailAddress!(
|
||||||
|
processedQuery,
|
||||||
|
limit: limit,
|
||||||
|
);
|
||||||
log('_TextFieldAutocompleteEmailAddressWebState::_findSuggestions: listEmailAddress: $listEmailAddress');
|
log('_TextFieldAutocompleteEmailAddressWebState::_findSuggestions: listEmailAddress: $listEmailAddress');
|
||||||
final listSuggestionEmailAddress = listEmailAddress.map((emailAddress) => _toSuggestionEmailAddress(emailAddress, _currentListEmailAddress));
|
final listSuggestionEmailAddress = listEmailAddress.map((emailAddress) => _toSuggestionEmailAddress(emailAddress, _currentListEmailAddress));
|
||||||
tmailSuggestion.addAll(listSuggestionEmailAddress);
|
tmailSuggestion.addAll(listSuggestionEmailAddress);
|
||||||
|
|||||||
+4
-3
@@ -222,14 +222,15 @@ class AdvancedFilterController extends BaseController {
|
|||||||
_mailboxDashBoardController.handleAdvancedSearchEmail();
|
_mailboxDashBoardController.handleAdvancedSearchEmail();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<EmailAddress>> getAutoCompleteSuggestion(String word) async {
|
Future<List<EmailAddress>> getAutoCompleteSuggestion(String word, {int? limit}) async {
|
||||||
log('AdvancedFilterController::getAutoCompleteSuggestion(): word = $word');
|
log('AdvancedFilterController::getAutoCompleteSuggestion():word = $word | limit = $limit');
|
||||||
_getAutoCompleteInteractor = getBinding<GetAutoCompleteInteractor>();
|
_getAutoCompleteInteractor = getBinding<GetAutoCompleteInteractor>();
|
||||||
|
|
||||||
return await _getAutoCompleteInteractor
|
return await _getAutoCompleteInteractor
|
||||||
?.execute(AutoCompletePattern(
|
?.execute(AutoCompletePattern(
|
||||||
word: word,
|
word: word,
|
||||||
accountId: _mailboxDashBoardController.accountId.value
|
limit: limit,
|
||||||
|
accountId: _mailboxDashBoardController.accountId.value,
|
||||||
)).then((value) => value.fold(
|
)).then((value) => value.fold(
|
||||||
(failure) => <EmailAddress>[],
|
(failure) => <EmailAddress>[],
|
||||||
(success) => success is GetAutoCompleteSuccess
|
(success) => success is GetAutoCompleteSuccess
|
||||||
|
|||||||
+13
-4
@@ -21,7 +21,7 @@ import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/ad
|
|||||||
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/advanced_search/autocomplete_tag_item_widget_web.dart';
|
import 'package:tmail_ui_user/features/mailbox_dashboard/presentation/widgets/advanced_search/autocomplete_tag_item_widget_web.dart';
|
||||||
import 'package:tmail_ui_user/main/utils/app_config.dart';
|
import 'package:tmail_ui_user/main/utils/app_config.dart';
|
||||||
|
|
||||||
typedef OnSuggestionEmailAddress = Future<List<EmailAddress>> Function(String word);
|
typedef OnSuggestionEmailAddress = Future<List<EmailAddress>> Function(String word, {int? limit});
|
||||||
typedef OnUpdateListEmailAddressAction = void Function(AdvancedSearchFilterField field, List<EmailAddress> newData);
|
typedef OnUpdateListEmailAddressAction = void Function(AdvancedSearchFilterField field, List<EmailAddress> newData);
|
||||||
typedef OnDeleteEmailAddressTypeAction = void Function(AdvancedSearchFilterField field);
|
typedef OnDeleteEmailAddressTypeAction = void Function(AdvancedSearchFilterField field);
|
||||||
typedef OnShowFullListEmailAddressAction = void Function(AdvancedSearchFilterField field);
|
typedef OnShowFullListEmailAddressAction = void Function(AdvancedSearchFilterField field);
|
||||||
@@ -188,7 +188,13 @@ class _TextFieldAutocompleteEmailAddressWebState extends State<TextFieldAutocomp
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
onTagChanged: (tag) => _handleOnTagChangeAction.call(tag, setState),
|
onTagChanged: (tag) => _handleOnTagChangeAction.call(tag, setState),
|
||||||
findSuggestions: _findSuggestions,
|
findSuggestions: (queryString) => _findSuggestions(
|
||||||
|
queryString,
|
||||||
|
limit: AppConfig.defaultLimitAutocomplete,
|
||||||
|
),
|
||||||
|
isLoadMoreOnlyOnce: true,
|
||||||
|
isLoadMoreReplaceAllOld: false,
|
||||||
|
loadMoreSuggestions: _findSuggestions,
|
||||||
suggestionBuilder: (context, tagEditorState, suggestionEmailAddress, index, length, highlight, suggestionValid) {
|
suggestionBuilder: (context, tagEditorState, suggestionEmailAddress, index, length, highlight, suggestionValid) {
|
||||||
return AutoCompleteSuggestionItemWidgetWeb(
|
return AutoCompleteSuggestionItemWidgetWeb(
|
||||||
suggestionState: suggestionEmailAddress.state,
|
suggestionState: suggestionEmailAddress.state,
|
||||||
@@ -233,7 +239,7 @@ class _TextFieldAutocompleteEmailAddressWebState extends State<TextFieldAutocomp
|
|||||||
? _currentListEmailAddress.sublist(0, 1)
|
? _currentListEmailAddress.sublist(0, 1)
|
||||||
: _currentListEmailAddress;
|
: _currentListEmailAddress;
|
||||||
|
|
||||||
FutureOr<List<SuggestionEmailAddress>> _findSuggestions(String query) async {
|
FutureOr<List<SuggestionEmailAddress>> _findSuggestions(String query, {int? limit}) async {
|
||||||
if (_gapBetweenTagChangedAndFindSuggestion?.isActive ?? false) {
|
if (_gapBetweenTagChangedAndFindSuggestion?.isActive ?? false) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -246,7 +252,10 @@ class _TextFieldAutocompleteEmailAddressWebState extends State<TextFieldAutocomp
|
|||||||
final tmailSuggestion = List<SuggestionEmailAddress>.empty(growable: true);
|
final tmailSuggestion = List<SuggestionEmailAddress>.empty(growable: true);
|
||||||
if (processedQuery.length >= widget.minInputLengthAutocomplete &&
|
if (processedQuery.length >= widget.minInputLengthAutocomplete &&
|
||||||
widget.onSuggestionEmailAddress != null) {
|
widget.onSuggestionEmailAddress != null) {
|
||||||
final listEmailAddress = await widget.onSuggestionEmailAddress!(processedQuery);
|
final listEmailAddress = await widget.onSuggestionEmailAddress!(
|
||||||
|
processedQuery,
|
||||||
|
limit: limit,
|
||||||
|
);
|
||||||
final listSuggestionEmailAddress = listEmailAddress.map((emailAddress) => _toSuggestionEmailAddress(emailAddress, _currentListEmailAddress));
|
final listSuggestionEmailAddress = listEmailAddress.map((emailAddress) => _toSuggestionEmailAddress(emailAddress, _currentListEmailAddress));
|
||||||
tmailSuggestion.addAll(listSuggestionEmailAddress);
|
tmailSuggestion.addAll(listSuggestionEmailAddress);
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-5
@@ -52,16 +52,21 @@ class ForwardRecipientController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<EmailAddress>> getAutoCompleteSuggestion(String word) async {
|
Future<List<EmailAddress>> getAutoCompleteSuggestion(String word, {int? limit}) async {
|
||||||
log('ForwardRecipientController::getAutoCompleteSuggestion(): $word');
|
log('ForwardRecipientController::getAutoCompleteSuggestion():word = $word | limit = $limit');
|
||||||
_getAllAutoCompleteInteractor = getBinding<GetAllAutoCompleteInteractor>();
|
_getAllAutoCompleteInteractor = getBinding<GetAllAutoCompleteInteractor>();
|
||||||
_getAutoCompleteInteractor = getBinding<GetAutoCompleteInteractor>();
|
_getAutoCompleteInteractor = getBinding<GetAutoCompleteInteractor>();
|
||||||
_getDeviceContactSuggestionsInteractor = getBinding<GetDeviceContactSuggestionsInteractor>();
|
_getDeviceContactSuggestionsInteractor = getBinding<GetDeviceContactSuggestionsInteractor>();
|
||||||
|
|
||||||
|
final autoCompletePattern = AutoCompletePattern(
|
||||||
|
word: word,
|
||||||
|
limit: limit,
|
||||||
|
accountId: _accountId,
|
||||||
|
);
|
||||||
if (_contactSuggestionSource == ContactSuggestionSource.all) {
|
if (_contactSuggestionSource == ContactSuggestionSource.all) {
|
||||||
if (_getAllAutoCompleteInteractor != null) {
|
if (_getAllAutoCompleteInteractor != null) {
|
||||||
return await _getAllAutoCompleteInteractor!
|
return await _getAllAutoCompleteInteractor!
|
||||||
.execute(AutoCompletePattern(word: word, accountId: _accountId))
|
.execute(autoCompletePattern)
|
||||||
.then((value) => value.fold(
|
.then((value) => value.fold(
|
||||||
(failure) => <EmailAddress>[],
|
(failure) => <EmailAddress>[],
|
||||||
(success) => success is GetAutoCompleteSuccess
|
(success) => success is GetAutoCompleteSuccess
|
||||||
@@ -70,7 +75,7 @@ class ForwardRecipientController {
|
|||||||
));
|
));
|
||||||
} else if (_getDeviceContactSuggestionsInteractor != null) {
|
} else if (_getDeviceContactSuggestionsInteractor != null) {
|
||||||
return await _getDeviceContactSuggestionsInteractor!
|
return await _getDeviceContactSuggestionsInteractor!
|
||||||
.execute(AutoCompletePattern(word: word, accountId: _accountId))
|
.execute(autoCompletePattern)
|
||||||
.then((value) => value.fold(
|
.then((value) => value.fold(
|
||||||
(failure) => <EmailAddress>[],
|
(failure) => <EmailAddress>[],
|
||||||
(success) => success is GetDeviceContactSuggestionsSuccess
|
(success) => success is GetDeviceContactSuggestionsSuccess
|
||||||
@@ -85,7 +90,7 @@ class ForwardRecipientController {
|
|||||||
return <EmailAddress>[];
|
return <EmailAddress>[];
|
||||||
} else {
|
} else {
|
||||||
return await _getAutoCompleteInteractor!
|
return await _getAutoCompleteInteractor!
|
||||||
.execute(AutoCompletePattern(word: word, accountId: _accountId))
|
.execute(autoCompletePattern)
|
||||||
.then((value) => value.fold(
|
.then((value) => value.fold(
|
||||||
(failure) => <EmailAddress>[],
|
(failure) => <EmailAddress>[],
|
||||||
(success) => success is GetAutoCompleteSuccess
|
(success) => success is GetAutoCompleteSuccess
|
||||||
|
|||||||
+13
-4
@@ -26,7 +26,7 @@ import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
|||||||
import 'package:tmail_ui_user/main/utils/app_config.dart';
|
import 'package:tmail_ui_user/main/utils/app_config.dart';
|
||||||
import 'package:tmail_ui_user/main/utils/app_utils.dart';
|
import 'package:tmail_ui_user/main/utils/app_utils.dart';
|
||||||
|
|
||||||
typedef OnSuggestionContactCallbackAction = Future<List<EmailAddress>> Function(String query);
|
typedef OnSuggestionContactCallbackAction = Future<List<EmailAddress>> Function(String query, {int? limit});
|
||||||
typedef OnAddListContactCallbackAction = Function(List<EmailAddress> listEmailAddress);
|
typedef OnAddListContactCallbackAction = Function(List<EmailAddress> listEmailAddress);
|
||||||
typedef OnExceptionAddListContactCallbackAction = Function(Exception exception);
|
typedef OnExceptionAddListContactCallbackAction = Function(Exception exception);
|
||||||
|
|
||||||
@@ -140,7 +140,13 @@ class _AutocompleteContactTextFieldWithTagsState extends State<AutocompleteConta
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
onTagChanged: (_) {},
|
onTagChanged: (_) {},
|
||||||
findSuggestions: _findSuggestions,
|
findSuggestions: (queryString) => _findSuggestions(
|
||||||
|
queryString,
|
||||||
|
limit: AppConfig.defaultLimitAutocomplete,
|
||||||
|
),
|
||||||
|
isLoadMoreOnlyOnce: true,
|
||||||
|
isLoadMoreReplaceAllOld: false,
|
||||||
|
loadMoreSuggestions: _findSuggestions,
|
||||||
suggestionBuilder: (context, tagEditorState, suggestionEmailAddress, index, length, highlight, suggestionValid) {
|
suggestionBuilder: (context, tagEditorState, suggestionEmailAddress, index, length, highlight, suggestionValid) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||||
@@ -200,7 +206,7 @@ class _AutocompleteContactTextFieldWithTagsState extends State<AutocompleteConta
|
|||||||
.contains(inputEmail);
|
.contains(inputEmail);
|
||||||
}
|
}
|
||||||
|
|
||||||
FutureOr<List<SuggestionEmailAddress>> _findSuggestions(String query) async {
|
FutureOr<List<SuggestionEmailAddress>> _findSuggestions(String query, {int? limit}) async {
|
||||||
final processedQuery = query.trim();
|
final processedQuery = query.trim();
|
||||||
|
|
||||||
if (processedQuery.isEmpty) {
|
if (processedQuery.isEmpty) {
|
||||||
@@ -212,7 +218,10 @@ class _AutocompleteContactTextFieldWithTagsState extends State<AutocompleteConta
|
|||||||
&& processedQuery.length >= widget.minInputLengthAutocomplete
|
&& processedQuery.length >= widget.minInputLengthAutocomplete
|
||||||
&& widget.onSuggestionCallback != null
|
&& widget.onSuggestionCallback != null
|
||||||
) {
|
) {
|
||||||
final addedEmailAddresses = await widget.onSuggestionCallback!(processedQuery);
|
final addedEmailAddresses = await widget.onSuggestionCallback!(
|
||||||
|
processedQuery,
|
||||||
|
limit: limit,
|
||||||
|
);
|
||||||
final listSuggestionEmailAddress = addedEmailAddresses
|
final listSuggestionEmailAddress = addedEmailAddresses
|
||||||
.map((emailAddress) => _toSuggestionEmailAddress(emailAddress, listEmailAddress))
|
.map((emailAddress) => _toSuggestionEmailAddress(emailAddress, listEmailAddress))
|
||||||
.toList();
|
.toList();
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
|||||||
class AppConfig {
|
class AppConfig {
|
||||||
static const int defaultMinInputLengthAutocomplete = 3;
|
static const int defaultMinInputLengthAutocomplete = 3;
|
||||||
static const int warningAttachmentFileSizeInMegabytes = 10;
|
static const int warningAttachmentFileSizeInMegabytes = 10;
|
||||||
|
static const int defaultLimitAutocomplete = 8;
|
||||||
|
|
||||||
static const String appDashboardConfigurationPath = "configurations/app_dashboard.json";
|
static const String appDashboardConfigurationPath = "configurations/app_dashboard.json";
|
||||||
static const String appFCMConfigurationPath = "configurations/env.fcm";
|
static const String appFCMConfigurationPath = "configurations/env.fcm";
|
||||||
|
|||||||
+5
-4
@@ -1954,10 +1954,11 @@ packages:
|
|||||||
super_tag_editor:
|
super_tag_editor:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: super_tag_editor
|
path: "."
|
||||||
sha256: "8e6e978c546f665be421bfdf76db3e7f31aaf10a0cf7ff4f69b71d04124e16c6"
|
ref: fix-some-issue-with-suggestion-box
|
||||||
url: "https://pub.dev"
|
resolved-ref: "2d6bc8b1481f555e4aa29f744d1a7168641aed8b"
|
||||||
source: hosted
|
url: "https://github.com/dab246/super_tag_editor.git"
|
||||||
|
source: git
|
||||||
version: "0.3.0"
|
version: "0.3.0"
|
||||||
syncfusion_flutter_core:
|
syncfusion_flutter_core:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
|
|||||||
+4
-2
@@ -86,9 +86,11 @@ dependencies:
|
|||||||
git:
|
git:
|
||||||
url: https://github.com/linagora/flutter-date-range-picker.git
|
url: https://github.com/linagora/flutter-date-range-picker.git
|
||||||
ref: main
|
ref: main
|
||||||
# TODO: Move back to master after sprint 25 released
|
|
||||||
|
|
||||||
super_tag_editor: 0.3.0
|
super_tag_editor:
|
||||||
|
git:
|
||||||
|
url: https://github.com/dab246/super_tag_editor.git
|
||||||
|
ref: fix-some-issue-with-suggestion-box
|
||||||
|
|
||||||
# TODO: We will change it when the PR in upstream repository will be merged
|
# TODO: We will change it when the PR in upstream repository will be merged
|
||||||
# https://github.com/dietfriends/dns_client/pull/9
|
# https://github.com/dietfriends/dns_client/pull/9
|
||||||
|
|||||||
Reference in New Issue
Block a user