-
-
Notifications
You must be signed in to change notification settings - Fork 282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 4068 - autocomplete for brands #4871
feat: 4068 - autocomplete for brands #4871
Conversation
New files: * `agnostic_suggestion_manager.dart`: Suggestion manager for "old" and elastic search taxonomies. * `brand_suggestion_manager.dart`: Manager that returns the elastic suggestions for the latest brand input. * `smooth_autocomplete_text_field.dart`: Autocomplete text field. Code largely moved from `simple_input_text_field.dart`. * `unfocus_when_tap_outside.dart`: Allows to unfocus TextField (and dismiss the keyboard). Code moved from `simple_input_text_field.dart`. Impacted files: * `add_basic_details_page.dart`: added elastic autocomplete for brands * `edit_new_packagings.dart`: minor refactoring * `paged_to_be_completed_product_query.dart`: minor refactoring * `paged_user_product_query.dart`: minor refactoring * `pubspec.lock`: wtf * `pubspec.yaml`: ugraded to openfoodfacts 3.2.1 * `simple_input_page.dart`: minor refactoring * `simple_input_text_field.dart`: moved most of the code to new class `SmoothAutocompleteTextField` in order to deal also with elastic search autocompletion.
// TODO(monsieurtanuki): there's probably a more elegant way to do it. | ||
/// Suggestion manager for "old" taxonomies and elastic search taxonomies. | ||
class AgnosticSuggestionManager { | ||
AgnosticSuggestionManager.tagType(this.tagTypeSuggestionManager) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't a factory be a nicer API.
It would allow to hide the complexity of the implementation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@g123k I honestly cannot see how a factory
would help, but I would gladly see what you would write instead.
Btw I wouldn't call the code of this file "complex" (one class, 28 lines of code, 2 fields, 1 method).
packages/smooth_app/lib/pages/input/smooth_autocomplete_text_field.dart
Outdated
Show resolved
Hide resolved
packages/smooth_app/lib/pages/product/add_basic_details_page.dart
Outdated
Show resolved
Hide resolved
packages/smooth_app/lib/pages/product/add_basic_details_page.dart
Outdated
Show resolved
Hide resolved
packages/smooth_app/lib/pages/product/add_basic_details_page.dart
Outdated
Show resolved
Hide resolved
10:55 |
@teolemon Doesn't seem to work for brands autocomplete for the moment. |
Still getting the |
@monsieurtanuki sorry I missed your comment. I didn't import the taxonomies, only the product data. I will do it this week! |
Thank you @raphael0202, ping me when you're done! |
@monsieurtanuki It's done! |
packages/smooth_app/lib/pages/input/brand_suggestion_manager.dart
Outdated
Show resolved
Hide resolved
Thank you @raphael0202! I've just updated the PR in order to target PROD brands instead of DEV brands. |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## develop #4871 +/- ##
==========================================
- Coverage 9.67% 9.64% -0.03%
==========================================
Files 319 323 +4
Lines 16147 16197 +50
==========================================
Hits 1563 1563
- Misses 14584 14634 +50 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK there's just a suggestion, so let's go as-is
Thank you @g123k for the review! |
What
Screenshot
Fixes bug(s)
Files
New files:
agnostic_suggestion_manager.dart
: Suggestion manager for "old" and elastic search taxonomies.brand_suggestion_manager.dart
: Manager that returns the elastic suggestions for the latest brand input.smooth_autocomplete_text_field.dart
: Autocomplete text field. Code largely moved fromsimple_input_text_field.dart
.unfocus_when_tap_outside.dart
: Allows to unfocus TextField (and dismiss the keyboard). Code moved fromsimple_input_text_field.dart
.Impacted files:
add_basic_details_page.dart
: added elastic autocomplete for brandsedit_new_packagings.dart
: minor refactoringpaged_to_be_completed_product_query.dart
: minor refactoringpaged_user_product_query.dart
: minor refactoringpubspec.lock
: wtfpubspec.yaml
: ugraded to openfoodfacts 3.2.1simple_input_page.dart
: minor refactoringsimple_input_text_field.dart
: moved most of the code to new classSmoothAutocompleteTextField
in order to deal also with elastic search autocompletion.