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 - UpToDateProductProvider now field of LocalDatabase #3220

Merged
merged 3 commits into from Oct 27, 2022

Conversation

monsieurtanuki
Copy link
Contributor

Impacted files:

  • add_basic_details_page.dart: got rid of UpToDateProductProvider
  • add_new_product_page.dart: got rid of UpToDateProductProvider
  • edit_ingredients_page.dart: got rid of UpToDateProductProvider
  • edit_product_page.dart: got rid of UpToDateProductProvider
  • knowledge_panel_page.dart: got rid of UpToDateProductProvider
  • local_database.dart: added an UpToDateProductProvider field
  • main.dart: got rid of UpToDateProductProvider
  • new_product_page.dart: got rid of UpToDateProductProvider
  • nutrition_page_loaded.dart: got rid of UpToDateProductProvider
  • personalized_ranking_model.dart: got rid of UpToDateProductProvider
  • personalized_ranking_page.dart: got rid of UpToDateProductProvider
  • Podfile.lock: wtf
  • product_image_gallery_view.dart: got rid of UpToDateProductProvider
  • product_list_item_simple.dart: got rid of UpToDateProductProvider
  • product_list_page.dart: got rid of UpToDateProductProvider
  • product_refresher.dart: got rid of UpToDateProductProvider
  • simple_input_page.dart: got rid of UpToDateProductProvider
  • summary_card.dart: got rid of UpToDateProductProvider
  • up_to_date_product_provider.dart: not a provider anymore; using LocalDatabase instead

What

Part of

…atabase

Impacted files:
* `add_basic_details_page.dart`: got rid of `UpToDateProductProvider`
* `add_new_product_page.dart`: got rid of `UpToDateProductProvider`
* `edit_ingredients_page.dart`: got rid of `UpToDateProductProvider`
* `edit_product_page.dart`: got rid of `UpToDateProductProvider`
* `knowledge_panel_page.dart`: got rid of `UpToDateProductProvider`
* `local_database.dart`: added an `UpToDateProductProvider` field
* `main.dart`: got rid of `UpToDateProductProvider`
* `new_product_page.dart`: got rid of `UpToDateProductProvider`
* `nutrition_page_loaded.dart`: got rid of `UpToDateProductProvider`
* `personalized_ranking_model.dart`: got rid of `UpToDateProductProvider`
* `personalized_ranking_page.dart`: got rid of `UpToDateProductProvider`
* `Podfile.lock`: wtf
* `product_image_gallery_view.dart`: got rid of `UpToDateProductProvider`
* `product_list_item_simple.dart`: got rid of `UpToDateProductProvider`
* `product_list_page.dart`: got rid of `UpToDateProductProvider`
* `product_refresher.dart`: got rid of `UpToDateProductProvider`
* `simple_input_page.dart`: got rid of `UpToDateProductProvider`
* `summary_card.dart`: got rid of `UpToDateProductProvider`
* `up_to_date_product_provider.dart`: not a provider anymore; using `LocalDatabase` instead
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 good to me, thanks @monsieurtanuki

Comment on lines -15 to 21
void set(
final Product product, {
final bool notify = true,
}) {
void set(final Product product) {
_map[product.barcode!] = product;
_timestamps[product.barcode!] = LocalDatabase.nowInMillis();
if (notify) {
notifyListeners();
}
localDatabase.notifyListeners();
}
Copy link
Member

Choose a reason for hiding this comment

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

I don't know what exactly we used notify=false but we have to check that

Impacted files:
* `product_list_page.dart`: format after merge conflict fix
@monsieurtanuki monsieurtanuki merged commit 222eb6e into openfoodfacts:develop Oct 27, 2022
Copy link
Member

@AshAman999 AshAman999 left a comment

Choose a reason for hiding this comment

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

Looks good, one question is there though

On the new product page screen, I tried adding a new product

  • the button to go to nutrition edit is disabled / hidden as the image is not yet uploaded
  • I upload the photo and let it finish in the background
  • After a few moments it's still not visible though the task of uploading photos is already done

Not sure if the contents of the page refreshed after the background task completed
I am not sure if the pages refreshed after we are done with the background task,
Since we are not using consumers , is that causing so ?

@monsieurtanuki
Copy link
Contributor Author

Thank you @M123-dev for your review!
I don't think the notify: false was really used. Still, I'll have a look at it.

@monsieurtanuki
Copy link
Contributor Author

@AshAman999 I did nothing regarding the background tasks in this PR, it was just the first step.
The pages will refresh because they watch LocalDatabase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
database ✏️ Editing - Nutrition input Product addition The easier it is to add a product and get Nutri-Score, Eco-Score, the happier the users. 🥫 Product page summary card User lists
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants