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

refactor: #920 - when relevant, switched to "Navigator.push<void>" #2799

Merged
merged 1 commit into from
Aug 20, 2022

Conversation

monsieurtanuki
Copy link
Contributor

Impacted files:

  • add_category_button.dart: now push<void> (no expected returned value, no pop'ed value from SimpleInputPage)
  • add_ingredients_button.dart: now push<void> (no expected returned value, no pop'ed value from EditOcrPage)
  • add_new_product_page.dart: added TODOs about problematic returned values
  • add_nutrition_button.dart: now push<void> (no expected returned value, no pop'ed value from NutritionPageLoaded)
  • edit_ingredients_page.dart: now poping nothing, as nobody cares about the value
  • edit_product_page.dart: now push<void> (no expected returned value, no pop'ed value from AddBasicDetailsPage, EditOcrPage, NutritionPageLoaded, SimpleInputPage); added a TODO about a problematic returned value
  • image_upload_card.dart: added a TODO about a problematic returned value
  • login_page.dart: added a TODO about a problematic returned value
  • new_product_page.dart now push<void> (no expected returned value, no pop'ed value from EditProductPage)
  • product_image_gallery_view.dart: added a TODO about a problematic returned value
  • product_list_page.dart: now push<void> (no expected returned value, no pop'ed value from PersonalizedRankingPage)
  • product_title_card.dart: now push<void> (no expected returned value, no pop'ed value from AddBasicDetailsPage)
  • question_page.dart: now push<void> (no expected returned value, no pop'ed value from LoginPage)
  • scan_header.dart: now push<void> (no expected returned value, no pop'ed value from PersonalizedRankingPage)
  • scan_product_card.dart: now push<void> (no expected returned value, no pop'ed value from ProductPage)
  • smooth_product_card_found.dart: now push<void> (no expected returned value, no pop'ed value from ProductPage)
  • smooth_product_card_not_found.dart: added a TODO about a problematic returned value
  • summary_card.dart: now push<void> (no expected returned value, no pop'ed value from AddBasicDetailsPage, UserPreferencesPage, QuestionPage, `KnowledgePanelPage)

What

  • We could not migrate to Navigator 2.0 / deep-linking because it looked like many times, we were not only opening pages but waiting for a returned value. And that is a deal breaker, unless flutter merges a specific PR (cf. Handle openfoodfacts.org links (Add deeplinking towards the product page) #920 (comment))
  • This PR is about cleaning the code to detect where we actually need a returned value, and where we check a returned value for historical reasons but we don't have to anymore.
  • That way we can focus on the cases where we do need a returned value. What should we do then? Probably change the "pages" into "dialogs", for which it's normal to return a value.
  • There are now 8 cases in 6 files where it looks like we need a returned value. In 2 cases we probably could rewrite easily the code so that we don't.

Part of

…ush<void>`

Impacted files:
* `add_category_button.dart`: now `push<void>` (no expected returned value, no pop'ed value from `SimpleInputPage`)
* `add_ingredients_button.dart`: now `push<void>` (no expected returned value, no pop'ed value from `EditOcrPage`)
* `add_new_product_page.dart`: added `TODO`s about problematic returned values
* `add_nutrition_button.dart`: now `push<void>` (no expected returned value, no pop'ed value from `NutritionPageLoaded`)
* `edit_ingredients_page.dart`: now `pop`ing nothing, as nobody cares about the value
* `edit_product_page.dart`: now `push<void>` (no expected returned value, no pop'ed value from `AddBasicDetailsPage`, `EditOcrPage`, `NutritionPageLoaded`, `SimpleInputPage`); added a `TODO` about a problematic returned value
* `image_upload_card.dart`: added a `TODO` about a problematic returned value
* `login_page.dart`: added a `TODO` about a problematic returned value
* `new_product_page.dart` now `push<void>` (no expected returned value, no pop'ed value from `EditProductPage`)
* `product_image_gallery_view.dart`: added a `TODO` about a problematic returned value
* `product_list_page.dart`: now `push<void>` (no expected returned value, no pop'ed value from `PersonalizedRankingPage`)
* `product_title_card.dart`: now `push<void>` (no expected returned value, no pop'ed value from `AddBasicDetailsPage`)
* `question_page.dart`: now `push<void>` (no expected returned value, no pop'ed value from `LoginPage`)
* `scan_header.dart`: now `push<void>` (no expected returned value, no pop'ed value from `PersonalizedRankingPage`)
* `scan_product_card.dart`: now `push<void>` (no expected returned value, no pop'ed value from `ProductPage`)
* `smooth_product_card_found.dart`: now `push<void>` (no expected returned value, no pop'ed value from `ProductPage`)
* `smooth_product_card_not_found.dart`: added a `TODO` about a problematic returned value
* `summary_card.dart`: now `push<void>` (no expected returned value, no pop'ed value from `AddBasicDetailsPage`, `UserPreferencesPage`, `QuestionPage`, `KnowledgePanelPage)
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.

Good to have this checked, thanks @monsieurtanuki

@monsieurtanuki monsieurtanuki merged commit 18ce300 into openfoodfacts:develop Aug 20, 2022
@monsieurtanuki
Copy link
Contributor Author

Thank you @M123-dev!

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.

3 participants