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: #1395 - show newly added product in carousel #1520

Merged

Conversation

@cli1005 cli1005 requested a review from a team as a code owner April 8, 2022 13:21
@cli1005 cli1005 closed this Apr 8, 2022
@cli1005 cli1005 reopened this Apr 8, 2022
@codecov-commenter
Copy link

codecov-commenter commented Apr 8, 2022

Codecov Report

Merging #1520 (238da17) into develop (4449a9f) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           develop   #1520      +/-   ##
==========================================
- Coverage     8.90%   8.89%   -0.02%     
==========================================
  Files          161     161              
  Lines         6569    6580      +11     
==========================================
  Hits           585     585              
- Misses        5984    5995      +11     
Impacted Files Coverage Δ
...s/product_cards/smooth_product_card_not_found.dart 0.00% <0.00%> (ø)
...oth_app/lib/data_models/continuous_scan_model.dart 1.02% <0.00%> (-0.04%) ⬇️
...smooth_app/lib/helpers/picture_capture_helper.dart 0.00% <0.00%> (ø)
...th_app/lib/pages/product/add_new_product_page.dart 0.00% <0.00%> (ø)
...mooth_app/lib/widgets/smooth_product_carousel.dart 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4449a9f...238da17. Read the comment docs.

@M123-dev
Copy link
Member

M123-dev commented Apr 8, 2022

Heyy the code looks good, but there is one flaw in the user flow left. We restrict going back over the back button in the AppBar, but going back via gesture or system back button is still possible. If we need to do some logic before going back we can always do this with WillPopScope

Copy link
Contributor

@monsieurtanuki monsieurtanuki left a comment

Choose a reason for hiding this comment

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

Hi @cli1005!
I have no strong opinions regarding the functional part of this PR.
I have minor comments about the code itself; please have a look at them.

return true;
}

Future<void> updateContinuousScanModel(
Copy link
Contributor

Choose a reason for hiding this comment

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

Unless I missed something, please make it private.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unless I missed something, please make it private.

@@ -35,12 +35,14 @@ class _AddNewProductPageState extends State<AddNewProductPage> {
final Map<ImageField, List<File>> _uploadedImages =
<ImageField, List<File>>{};

bool isProductLoaded = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Unless I missed something, please make it private.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unless I missed something, please make it private.

@@ -33,11 +33,12 @@ class _SmoothProductCarouselState extends State<SmoothProductCarousel> {
bool _returnToSearchCard = false;

int get _searchCardAdjustment => widget.containSearchCard ? 1 : 0;
late ContinuousScanModel model;
Copy link
Contributor

Choose a reason for hiding this comment

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

Unless I missed something please make it private.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unless I missed something please make it private.

@@ -105,6 +105,13 @@ class ContinuousScanModel with ChangeNotifier {
_addBarcode(code);
}

Future<bool> onCreate(String? barcode) async {
Copy link
Contributor

Choose a reason for hiding this comment

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

onCreate is a bit vague and misleading (sounds like a constructor or a lifecycle method). What about onProductCreation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@teolemon teolemon added product scan carousel Product addition The easier it is to add a product and get Nutri-Score, Eco-Score, the happier the users. labels Apr 9, 2022
@teolemon teolemon added this to the V1 milestone Apr 11, 2022
@cli1005
Copy link
Contributor Author

cli1005 commented Apr 11, 2022

Heyy the code looks good, but there is one flaw in the user flow left. We restrict going back over the back button in the AppBar, but going back via gesture or system back button is still possible. If we need to do some logic before going back we can always do this with WillPopScope

Showing the back button after product has been loaded might mislead user that they could end the creation without creating any product since they have not clicked the button Finish 🤔

@M123-dev
Copy link
Member

What about showing a Snackbar directly after every picture is uploaded

@cli1005
Copy link
Contributor Author

cli1005 commented Apr 11, 2022

What about showing a Snackbar directly after every picture is uploaded

And we might change the messages to something like : "Upload your first photo to create a new product", @teolemon, maybe a review of the adding product flow is necessary, for me the following flow is more logical, personal opinion 🤔

Upload your first photo to create a new product

⬇️

Product added ! Add more photo?

⬇️

Upload more photos...

⬇️

Finish

@teolemon
Copy link
Member

The minimum would be front, ingredients, nutrition. Behind the scenes, we can create the product as soon as we want (1st image sounds good)

@cli1005
Copy link
Contributor Author

cli1005 commented Apr 11, 2022

I merge this pr, more features à add concerning add product flow will be handled in #881 or issues related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Product addition The easier it is to add a product and get Nutri-Score, Eco-Score, the happier the users. product scan carousel
Development

Successfully merging this pull request may close these issues.

(Product Addition) The newly added product should be immediately visible once you exit product addition
5 participants