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: 3018 - now there's only one place where we upload pictures from #3323

Merged
merged 1 commit into from Nov 15, 2022

Conversation

monsieurtanuki
Copy link
Contributor

Deleted file:

  • picture_capture_helper.dart: moved code to ConfirmAndUploadPicture, that is now the only place where we upload images

Impacted files:

  • add_new_product_page.dart: minor refactoring
  • background_task_details.dart: minor refactoring
  • background_task_image.dart: minor refactoring
  • confirm_and_upload_picture.dart: minor refactoring; moved here code from picture_capture_helper.dart
  • edit_ingredients_page.dart: replaced uploadCapturedPicture with a call to page ConfirmAndUploadPicture
  • image_crop_page.dart: refactored into a single startImageCropping method
  • image_upload_page.dart: replaced uploadCapturedPicture with a call to page ConfirmAndUploadPicture
  • new_crop_page.dart: minor refactoring
  • product_image_gallery_view.dart: replaced uploadCapturedPicture with a call to page ConfirmAndUploadPicture; refactoring around refresh
  • product_image_viewer.dart: minor refactoring
  • up_to_date_product_provider.dart: removed old-fashioned code

What

  • Another step for 3018...
  • Here the idea is to clean the code: from now on, there's only one page we can upload images from (this page can of course be called from anywhere). There used to be 2 separate ways to upload: less confusion now.
  • For the record, we can change images from
    • the carousel (if there's no image for that field type, we can create one)
    • the "add new product" page
    • the OCR pages (packaging and ingredients)
    • the product gallery (cf. carousel: for field types without images)
    • the image viewer (called from the gallery, when we tap on the "details" of an image we have an opportunity to change it)

Part of

Deleted file:
* `picture_capture_helper.dart`: moved code to `ConfirmAndUploadPicture`, that is now the only place where we upload images

Impacted files:
* `add_new_product_page.dart`: minor refactoring
* `background_task_details.dart`: minor refactoring
* `background_task_image.dart`: minor refactoring
* `confirm_and_upload_picture.dart`: minor refactoring; moved here code from `picture_capture_helper.dart`
* `edit_ingredients_page.dart`: replaced `uploadCapturedPicture` with a call to page `ConfirmAndUploadPicture`
* `image_crop_page.dart`: refactored into a single `startImageCropping` method
* `image_upload_page.dart`: replaced `uploadCapturedPicture` with a call to page `ConfirmAndUploadPicture`
* `new_crop_page.dart`: minor refactoring
* `product_image_gallery_view.dart`: replaced `uploadCapturedPicture` with a call to page `ConfirmAndUploadPicture`; refactoring around refresh
* `product_image_viewer.dart`: minor refactoring
* `up_to_date_product_provider.dart: removed old-fashioned code
@monsieurtanuki monsieurtanuki requested a review from a team as a code owner November 14, 2022 17:17
@github-actions github-actions bot added 🖼️ Photos - Cropping Product addition The easier it is to add a product and get Nutri-Score, Eco-Score, the happier the users. 🥫 Product page labels Nov 14, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #3323 (7a38025) into develop (4dadf3f) will increase coverage by 0.01%.
The diff coverage is 0.00%.

@@             Coverage Diff             @@
##           develop    #3323      +/-   ##
===========================================
+ Coverage    10.47%   10.48%   +0.01%     
===========================================
  Files          252      251       -1     
  Lines        12335    12322      -13     
===========================================
  Hits          1292     1292              
+ Misses       11043    11030      -13     
Impacted Files Coverage Δ
...th_app/lib/background/background_task_details.dart 0.00% <ø> (ø)
...ooth_app/lib/background/background_task_image.dart 0.00% <0.00%> (ø)
...th_app/lib/cards/data_cards/image_upload_card.dart 0.00% <0.00%> (ø)
...p/lib/data_models/up_to_date_product_provider.dart 0.00% <ø> (ø)
packages/smooth_app/lib/pages/image_crop_page.dart 1.63% <0.00%> (+0.16%) ⬆️
...th_app/lib/pages/product/add_new_product_page.dart 0.00% <0.00%> (ø)
.../lib/pages/product/confirm_and_upload_picture.dart 0.00% <0.00%> (ø)
...h_app/lib/pages/product/edit_ingredients_page.dart 0.00% <0.00%> (ø)
.../lib/pages/product/product_image_gallery_view.dart 0.00% <0.00%> (ø)
...th_app/lib/pages/product/product_image_viewer.dart 0.00% <0.00%> (ø)
... and 3 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

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.

LGTM, thanks @monsieurtanuki

@@ -1,9 +1,12 @@
import 'dart:convert';
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
Copy link
Member

Choose a reason for hiding this comment

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

Never seen that path before but when CI doesn't complain I'm fine with that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@M123-dev Then you never started a localized page, because it's all over the place (96 occurrences...).
For some reason my Android Studio seems to have problems suggesting that import; that's how I learned it the hard way and copied/pasted again and again for each new localized page.

Copy link
Member

Choose a reason for hiding this comment

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

I guess then my first assumption was wrong then, I have the same problem with the import. I just thought it was a different path

@monsieurtanuki monsieurtanuki merged commit 3d944bb into openfoodfacts:develop Nov 15, 2022
@monsieurtanuki
Copy link
Contributor Author

Thank you @M123-dev for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🖼️ Photos - Cropping Product addition The easier it is to add a product and get Nutri-Score, Eco-Score, the happier the users. 🥫 Product page
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants