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: #682 - add a "Clear all" menu item in the product history page #683

Merged
merged 1 commit into from
Nov 25, 2021

Conversation

monsieurtanuki
Copy link
Contributor

Impacted files:

  • dao_product_list.dart: added clear method
  • product_list_dialog_helper.dart: added openClear method
  • product_list_page.dart: added a "clear" menu item whenever relevant

…history page

Impacted files:
* `dao_product_list.dart`: added `clear` method
* `product_list_dialog_helper.dart`: added `openClear` method
* `product_list_page.dart`: added a "clear" menu item whenever relevant
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.

The code looks good, thanks @monsieurtanuki. just the CI, golden tests (screenshot tests) are complaining, but I actually don't know how they really work.

@Piinks can you help there, how are we supposed to check / regenerate them

Future<void> clear(final ProductList productList) async =>
localDatabase.database.transaction(
(final Transaction transaction) async {
final int? id = await _getId(productList, transaction);
Copy link
Member

Choose a reason for hiding this comment

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

I'am cusious, what happens when _getId retuns null

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 You can find the answer in DaoProductExtra._getExtraKey. If I sum up, some lists will always be there and are always meaningful and unique (e.g. history, scan history). They don't need an id: there's only one scan history, we can give it the id 'scanHistory'. Other lists are user-defined: you can create them and delete them. They need a specific id, like list/$id.

@M123-dev
Copy link
Member

Ohh, nevermind it started in #679, but still we need to regenerate the files

@monsieurtanuki monsieurtanuki linked an issue Nov 25, 2021 that may be closed by this pull request
@monsieurtanuki monsieurtanuki merged commit b672d2a into openfoodfacts:develop Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a "Clear all" button in the Product history page.
2 participants