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: 4674 - immediate access to "other" pictures if possible #4928

Merged
merged 6 commits into from
Jan 25, 2024

Conversation

monsieurtanuki
Copy link
Contributor

What

  • With off-dart 3.3.0 we now have a more direct access to "other" pictures.
  • Basically, now we fetch and save in the local database product table "main" AND "other" pictures links.
  • That means that most of the time we don't need to download the "other" image ids from the server, as we already have them.
  • "most of the time"? Yes, because for the legacy data already in the local database we don't have the "other" pictures yet. In that case we keep the "get other pics" button and just refresh the product.
  • En passant while checking I refactored a little the background tasks related to product changes.

Fixes bug(s)

Part of

Files

New file:

  • background_task_product_change.dart: Interface for background tasks that change a product.

Impacted files:

  • background_task_crop.dart: minor refactoring
  • background_task_details.dart: minor refactoring, implementing new interface BackgroundTaskProductChange
  • background_task_image.dart: minor refactoring
  • background_task_unselected.dart: minor refactoring, implementing new interface BackgroundTaskProductChange
  • background_task_upload.dart: minor refactoring, implementing new interface BackgroundTaskProductChange
  • product_cards_helper.dart: new method getRawProductImages
  • product_image_gallery_other_view.dart: now we may have directly the raw images, and if needed we refresh the product instead of fetching specific image ids
  • product_image_gallery_view.dart: minor refactoring
  • product_image_other_page.dart: replaced deprecated method
  • product_image_server_button.dart: now we may have directly the raw images, and if needed we refresh the product instead of fetching specific image ids
  • product_image_viewer.dart: replaced deprecated method
  • pubspec.lock: generated
  • pubspec.yaml: upgraded to off-dart 3.3.0
  • uploaded_image_gallery.dart: now using List<ProductImage> as input

New file:
* `background_task_product_change.dart`: Interface for background tasks that change a product.

Impacted files:
* `background_task_crop.dart`: minor refactoring
* `background_task_details.dart`: minor refactoring, implementing new interface `BackgroundTaskProductChange`
* `background_task_image.dart`: minor refactoring
* `background_task_unselected.dart`: minor refactoring, implementing new interface `BackgroundTaskProductChange`
* `background_task_upload.dart`: minor refactoring, implementing new interface `BackgroundTaskProductChange`
* `product_cards_helper.dart`: new method `getRawProductImages`
* `product_image_gallery_other_view.dart`: now we may have directly the raw images, and if needed we refresh the product instead of fetching specific image ids
* `product_image_gallery_view.dart`: minor refactoring
* `product_image_other_page.dart`: replaced deprecated method
* `product_image_server_button.dart`: now we may have directly the raw images, and if needed we refresh the product instead of fetching specific image ids
* `product_image_viewer.dart`: replaced deprecated method
* `pubspec.lock`: generated
* `pubspec.yaml`: upgraded to off-dart 3.3.0
* `uploaded_image_gallery.dart`: now using `List<ProductImage>` as input
@codecov-commenter
Copy link

codecov-commenter commented Dec 26, 2023

Codecov Report

Attention: 126 lines in your changes are missing coverage. Please review.

Comparison is base (85784fa) 9.62% compared to head (ccd65e8) 9.60%.

Files Patch % Lines
.../pages/image/product_image_gallery_other_view.dart 0.00% 41 Missing ⚠️
...lib/pages/product/product_image_server_button.dart 0.00% 30 Missing ⚠️
...s/smooth_app/lib/helpers/product_cards_helper.dart 0.00% 17 Missing ⚠️
...oth_app/lib/background/background_task_upload.dart 0.00% 9 Missing ⚠️
...th_app/lib/pages/image/uploaded_image_gallery.dart 0.00% 7 Missing ⚠️
.../lib/pages/product/product_image_gallery_view.dart 0.00% 5 Missing ⚠️
...mooth_app/lib/background/background_task_crop.dart 0.00% 4 Missing ⚠️
...th_app/lib/background/background_task_details.dart 0.00% 3 Missing ⚠️
..._app/lib/pages/image/product_image_other_page.dart 0.00% 3 Missing ⚠️
...th_app/lib/pages/product/product_image_viewer.dart 0.00% 3 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #4928      +/-   ##
==========================================
- Coverage     9.62%   9.60%   -0.03%     
==========================================
  Files          323     323              
  Lines        16267   16302      +35     
==========================================
  Hits          1565    1565              
- Misses       14702   14737      +35     

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

@M123-dev M123-dev requested a review from g123k December 27, 2023 15:36
@monsieurtanuki
Copy link
Contributor Author

For the record we need this PR to be merged in order to implement new features for the prices API. It's using off-dart 3.3.0, which has changes that triggers lint warnings.
Or, we need a different PR that just deals with the 3.3.0 version induced warnings.
Or, we are blocked.

@teolemon
Copy link
Member

@g123k @M123-dev @AshAman999 Could you have a look at this one ?

Copy link
Member

@M123-dev M123-dev left a comment

Choose a reason for hiding this comment

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

Looks about right, thanks @monsieurtanuki

@monsieurtanuki monsieurtanuki merged commit 89cea10 into openfoodfacts:develop Jan 25, 2024
6 checks passed
@monsieurtanuki
Copy link
Contributor Author

Thank you @M123-dev for your review!

Possible impact as there are many "raw" images and they are stored in a verbose mode.
Room for improvements if needed, we'll see.

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

Successfully merging this pull request may close these issues.

Extra photos fail to load with an empty product
4 participants