Skip to content
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: 5195 - location search, as a preliminary step #5274

Merged
merged 2 commits into from
May 21, 2024

Conversation

monsieurtanuki
Copy link
Contributor

What

  • This is the first step of Replicate the 'Add a single price' view from the Open Prices web app #5195: the location search.
  • It was a good opportunity to refactor the product search into something more generic: basically, a history of queries and a search to perform from a text.
  • Special cases for locations:
    • we display previously selected results first in the search page, as most of the time we hang around the same shops (that would make no sense for products)
    • map display

Screenshots

The entry point is in the "dev mode" page: "Temporary access to location search".

entry point search page
Screenshot_1716294894 Screenshot_1716294899
results map
Screenshot_1716294907 Screenshot_1716294914

Part of

Files

New files:

  • dao_osm_location.dart: DAO about OSM locations.
  • loading_status.dart: Common loading status.
  • location_list_supplier.dart: Asynchronously loads locations.
  • location_map_page.dart: Page that displays a map centered on a location.
  • location_query_model.dart: Location query model.
  • location_query_page.dart: Page that displays location results during and after download.
  • osm_location.dart: Location as expected from OSM.
  • product_loading_status.dart: Product loading status. Refactored from product_list_item_simple.dart
  • search_app_bar_title.dart: Common search app bar title.
  • search_empty_screen.dart: Common search empty screen.
  • search_helper.dart: Common "text-field + history" search helper.
  • search_loading_screen.dart: Common search loading screen.
  • search_location_helper.dart: Search helper dedicated to location search.
  • search_location_model.dart: Search location model.
  • search_location_preloaded_item.dart: Location search preloaded list item, for locations historically selected.
  • search_preloaded_item.dart: Common search preloaded item.
  • search_product_helper.dart: Search helper dedicated to product search. Used to be in search_page.dart

Impacted files

  • app_en.arb: added a "No location found" label
  • app_fr.arb: added a "No location found" label
  • app_navigator.dart: minor refactoring
  • dao_string_list.dart: history key for new feature "previous location searches"
  • local_database.dart: upgraded the version to take into account new class DaoOsmLocation
  • personalized_ranking_model.dart: now using a common LoadingStatus
  • personalized_ranking_page.dart: now using a common LoadingStatus
  • product_list_item_simple.dart: now using a common ProductLoadingStatus
  • product_model.dart: now using a common ProductLoadingStatus
  • product_price_item.dart: added unrelated TODO comment
  • product_query_model.dart: now using a common LoadingStatus
  • product_query_page.dart: now using common SearchLoadingScreen, SearchEmptyScreen and SearchAppBarTitle
  • product_query_page_helper.dart: removed useless ProductQueryPageResult; refactored EditProductCallback to SearchQueryCallback somewhere else
  • search_history_view.dart: refactored with SearchHelper and preloaded items
  • search_page.dart: refactored the actual search code to SearchHelper; added preloaded items; found a bug
  • smooth_product_carousel.dart: minor refactoring
  • user_preferences_dev_mode.dart: added a temporary access to location search; removed useless key

New files:
* `dao_osm_location.dart`: DAO about OSM locations.
* `loading_status.dart`: Common loading status.
* `location_list_supplier.dart`: Asynchronously loads locations.
* `location_map_page.dart`: Page that displays a map centered on a location.
* `location_query_model.dart`: Location query model.
* `location_query_page.dart`: Page that displays location results during and after download.
* `osm_location.dart`: Location as expected from OSM.
* `product_loading_status.dart`: Product loading status. Refactored from `product_list_item_simple.dart`
* `search_app_bar_title.dart`: Common search app bar title.
* `search_empty_screen.dart`: Common search empty screen.
* `search_helper.dart`: Common "text-field + history" search helper.
* `search_loading_screen.dart`: Common search loading screen.
* `search_location_helper.dart`: Search helper dedicated to location search.
* `search_location_model.dart`: Search location model.
* `search_location_preloaded_item.dart`: Location search preloaded list item, for locations historically selected.
* `search_preloaded_item.dart`: Common search preloaded item.
* `search_product_helper.dart`: Search helper dedicated to product search. Used to be in `search_page.dart`

Impacted files
* `app_en.arb`: added a "No location found" label
* `app_fr.arb`: added a "No location found" label
* `app_navigator.dart`: minor refactoring
* `dao_string_list.dart`: history key for new feature "previous location searches"
* `local_database.dart`: upgraded the version to take into account new class `DaoOsmLocation`
* `personalized_ranking_model.dart`: now using a common `LoadingStatus`
* `personalized_ranking_page.dart`: now using a common `LoadingStatus`
* `product_list_item_simple.dart`: now using a common `ProductLoadingStatus`
* `product_model.dart`: now using a common `ProductLoadingStatus`
* `product_price_item.dart`: added unrelated TODO comment
* `product_query_model.dart`: now using a common `LoadingStatus`
* `product_query_page.dart`: now using common `SearchLoadingScreen`, `SearchEmptyScreen` and `SearchAppBarTitle`
* `product_query_page_helper.dart`: removed useless `ProductQueryPageResult`; refactored `EditProductCallback` to `SearchQueryCallback` somewhere else
* `search_history_view.dart`: refactored with `SearchHelper` and preloaded items
* `search_page.dart`: refactored the actual search code to `SearchHelper`; added preloaded items; found a bug
* `smooth_product_carousel.dart`: minor refactoring
* `user_preferences_dev_mode.dart`: added a temporary access to location search; removed useless key
@monsieurtanuki monsieurtanuki requested a review from a team as a code owner May 21, 2024 13:29
@github-actions github-actions bot added 🥫 Product page 🤳🥫 Scan We need to be able to scan on low-end, old devices, even with a bad camera, connexion… product scan carousel labels May 21, 2024
@codecov-commenter
Copy link

codecov-commenter commented May 21, 2024

Codecov Report

Attention: Patch coverage is 1.01781% with 389 lines in your changes are missing coverage. Please review.

Project coverage is 8.37%. Comparing base (4d9c7fc) to head (350e422).
Report is 126 commits behind head on develop.

Files Patch % Lines
...h_app/lib/pages/locations/location_query_page.dart 0.00% 63 Missing ⚠️
...ages/smooth_app/lib/database/dao_osm_location.dart 0.00% 44 Missing ⚠️
...th_app/lib/data_models/location_list_supplier.dart 0.00% 36 Missing ⚠️
...ooth_app/lib/pages/scan/search_product_helper.dart 3.33% 29 Missing ⚠️
...s/smooth_app/lib/pages/locations/osm_location.dart 0.00% 26 Missing ⚠️
...ages/locations/search_location_preloaded_item.dart 0.00% 23 Missing ⚠️
...b/pages/preferences/user_preferences_dev_mode.dart 0.00% 22 Missing ⚠️
...oth_app/lib/pages/locations/location_map_page.dart 0.00% 20 Missing ⚠️
...ooth_app/lib/data_models/location_query_model.dart 0.00% 18 Missing ⚠️
...smooth_app/lib/pages/scan/search_history_view.dart 0.00% 18 Missing ⚠️
... and 12 more
Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #5274      +/-   ##
==========================================
- Coverage     9.54%   8.37%   -1.18%     
==========================================
  Files          325     348      +23     
  Lines        16411   17287     +876     
==========================================
- Hits          1567    1448     -119     
- Misses       14844   15839     +995     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@monsieurtanuki monsieurtanuki requested a review from teolemon May 21, 2024 13:36
Copy link
Member

@teolemon teolemon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very promising 👌

@monsieurtanuki monsieurtanuki merged commit 5a95ca6 into openfoodfacts:develop May 21, 2024
6 checks passed
@monsieurtanuki
Copy link
Contributor Author

Thank you very much @teolemon for your review!

As I had to refactor the standard product search, don't hesitate to test it again.
Next step will be entering a product price in Smoothie!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Prices 🥫 Product page product scan carousel 🤳🥫 Scan We need to be able to scan on low-end, old devices, even with a bad camera, connexion…
Development

Successfully merging this pull request may close these issues.

3 participants