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

fix: 5576 - first step towards multi product types #5593

Merged
merged 6 commits into from
Sep 25, 2024

Conversation

monsieurtanuki
Copy link
Contributor

What

  • This is the first step towards a single app that works for all product types (off, obf, opff, opf)
  • In the current PR, the changes impact only
    • the query of a single barcode (looking for it in all 4 product type servers)
    • the storage of the related product type in our local database for single products
    • the refresh of a product from the correct product type server
  • Given the large impact of supporting all product types, there'll be other PRs (cf. Add a project switcher to search (and store the type on each product opened "off", "obf", "opf" and "opff", and for any search we store locally) #5586 (comment)) about
    • saving a product data to the correct server (for the moment, it will be save to the food server by default)
    • refreshing lists of products from different servers
  • En passant, closed 2 related issues.

Screenshots

4 product types "beauty" photos
Screenshot_1726679880 Screenshot_1726679890
"pet food" photos "product" info
Screenshot_1726679840 Screenshot_1726679875

Fixes bug(s)

Part of

Impacted files

  • add_basic_details_page.dart: replaced getter ProductQuery.uriProductHelper with method ProductQuery.getUriProductHelper
  • background_task.dart: replaced getter ProductQuery.uriProductHelper with method ProductQuery.getUriProductHelper
  • background_task_download_products.dart: saved new field Product.productType
  • dao_product.dart: now we're storing the Product.productType field
  • edit_new_packagings.dart: now using new field Product.productType
  • edit_new_packagings_component.dart: now using new field Product.productType
  • edit_product_page.dart: specific icon for "food" categories; no nutrition for "beauty" and "product"
  • forgot_password_page.dart: replaced getter ProductQuery.uriProductHelper with method ProductQuery.getUriProductHelper
  • lazy_counter.dart: replaced getter ProductQuery.uriProductHelper with method ProductQuery.getUriProductHelper
  • login_result.dart: replaced getter ProductQuery.uriProductHelper with method ProductQuery.getUriProductHelper
  • newsfeed_provider.dart: replaced getter ProductQuery.uriProductHelper with method ProductQuery.getUriProductHelper
  • ocr_ingredients_helper.dart: replaced getter ProductQuery.uriProductHelper with method ProductQuery.getUriProductHelper
  • ocr_packaging_helper.dart: replaced getter ProductQuery.uriProductHelper with method ProductQuery.getUriProductHelper
  • onboarding_data_product.dart: replaced getter ProductQuery.uriProductHelper with method ProductQuery.getUriProductHelper
  • ordered_nutrients_cache.dart: replaced getter ProductQuery.uriProductHelper with method ProductQuery.getUriProductHelper
  • paged_product_query.dart: replaced getter ProductQuery.uriProductHelper with method ProductQuery.getUriProductHelper
  • product_cards_helper.dart: replaced getter ProductQuery.uriProductHelper with method ProductQuery.getUriProductHelper
  • product_image_crop_button.dart: replaced getter ProductQuery.uriProductHelper with method ProductQuery.getUriProductHelper
  • product_image_gallery_other_view.dart: now using new field Product.productType
  • product_image_other_page.dart: now using new field Product.productType
  • product_image_server_button.dart: now using new field Product.productType
  • product_image_widget.dart: now using new field Product.productType
  • product_list_page.dart: replaced getter ProductQuery.uriProductHelper with method ProductQuery.getUriProductHelper
  • product_query.dart: now when we look for a barcode (or refresh a product), we use all productTypes if needed
  • product_refresher.dart: replaced getter ProductQuery.uriProductHelper with method ProductQuery.getUriProductHelper
  • pubspec.lock: wtf
  • pubspec.yaml: upgraded openfoodfacts to 3.15.0 for new Product.productType field
  • sign_up_page.dart: replaced getter ProductQuery.uriProductHelper with method ProductQuery.getUriProductHelper
  • simple_input_page_helpers.dart: new class dedicated to non-food categories
  • simple_input_text_field.dart: replaced getter ProductQuery.uriProductHelper with method ProductQuery.getUriProductHelper
  • simple_input_widget.dart: now using new field Product.productType
  • temp_product_list_share_helper.dart: replaced getter ProductQuery.uriProductHelper with method ProductQuery.getUriProductHelper
  • uploaded_image_gallery.dart: now using new field Product.productType
  • user_preferences_dev_debug_info.dart: replaced getter ProductQuery.uriProductHelper with method ProductQuery.getUriProductHelper

Impacted files:
* `add_basic_details_page.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `background_task.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `background_task_download_products.dart`: saved new field `Product.productType`
* `dao_product.dart`: now we're storing the `Product.productType` field
* `edit_new_packagings.dart`: now using new field `Product.productType`
* `edit_new_packagings_component.dart`: now using new field `Product.productType`
* `edit_product_page.dart`: specific icon for "food" categories; no nutrition for "beauty" and "product"
* `forgot_password_page.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `lazy_counter.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `login_result.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `newsfeed_provider.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `ocr_ingredients_helper.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `ocr_packaging_helper.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `onboarding_data_product.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `ordered_nutrients_cache.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `paged_product_query.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `product_cards_helper.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `product_image_crop_button.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `product_image_gallery_other_view.dart`: now using new field `Product.productType`
* `product_image_other_page.dart`: now using new field `Product.productType`
* `product_image_server_button.dart`: now using new field `Product.productType`
* `product_image_widget.dart`: now using new field `Product.productType`
* `product_list_page.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `product_query.dart`: now when we look for a barcode (or refresh a product), we use all productTypes if needed
* `product_refresher.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `pubspec.lock`: wtf
* `pubspec.yaml`: upgraded `openfoodfacts` to `3.15.0` for new `Product.productType` field
* `sign_up_page.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `simple_input_page_helpers.dart`: new class dedicated to non-food categories
* `simple_input_text_field.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `simple_input_widget.dart`: now using new field `Product.productType`
* `temp_product_list_share_helper.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
* `uploaded_image_gallery.dart`: now using new field `Product.productType`
* `user_preferences_dev_debug_info.dart`: replaced getter `ProductQuery.uriProductHelper` with method `ProductQuery.getUriProductHelper`
@codecov-commenter
Copy link

codecov-commenter commented Sep 18, 2024

Codecov Report

Attention: Patch coverage is 0% with 114 lines in your changes missing coverage. Please review.

Project coverage is 6.94%. Comparing base (4d9c7fc) to head (5df1a70).
Report is 323 commits behind head on develop.

Files with missing lines Patch % Lines
...pp/lib/pages/product/common/product_refresher.dart 0.00% 24 Missing ⚠️
packages/smooth_app/lib/query/product_query.dart 0.00% 19 Missing ⚠️
...mooth_app/lib/pages/product/edit_product_page.dart 0.00% 16 Missing ⚠️
..._app/lib/pages/image/product_image_other_page.dart 0.00% 6 Missing ⚠️
...b/pages/product/edit_new_packagings_component.dart 0.00% 5 Missing ⚠️
packages/smooth_app/lib/database/dao_product.dart 0.00% 4 Missing ⚠️
...lib/pages/product/product_image_server_button.dart 0.00% 4 Missing ⚠️
...th_app/lib/pages/image/uploaded_image_gallery.dart 0.00% 3 Missing ⚠️
...p/lib/pages/product/product_image_crop_button.dart 0.00% 3 Missing ⚠️
.../background/background_task_download_products.dart 0.00% 2 Missing ⚠️
... and 21 more
Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #5593      +/-   ##
==========================================
- Coverage     9.54%   6.94%   -2.61%     
==========================================
  Files          325     402      +77     
  Lines        16411   21268    +4857     
==========================================
- Hits          1567    1476      -91     
- Misses       14844   19792    +4948     

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

@teolemon teolemon requested review from g123k and a team September 19, 2024 09:43
Copy link
Collaborator

@g123k g123k left a comment

Choose a reason for hiding this comment

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

As a first step, it seems OK for me 👍

@monsieurtanuki monsieurtanuki merged commit 93fc899 into openfoodfacts:develop Sep 25, 2024
6 checks passed
@monsieurtanuki
Copy link
Contributor Author

Thank you @g123k for your review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment