-
-
Notifications
You must be signed in to change notification settings - Fork 277
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
Handle openfoodfacts.org links (Add deeplinking towards the product page) #920
Comments
Note: Its not straight forward, we have to switch to either named routes or router 2.0 |
You're right @M123-dev, before handling deep links, we have to migrate the app named routes or Navigator 2. |
@teolemon Could you make the document publicly readable, please? |
Fixed @g123k |
On Android, here are all the supported links:
|
I would like this PR to be merged first: flutter/packages#2416 Can we wait for it? Or should I start with a fork containing it? |
Before any code is started, I would like to understand the goal, the strategy, and the impact of waiting/not waiting for flutter/packages#2416 to be merged. I'm old-fashioned, sorry about that ;) As far as I understand, the goal is to allow deep-linking, and the most relevant way to do that is "named routes" or "router 2.0". Btw are both solution equivalent? Is that just the same concept with a different name? Does that mean that
|
So let me explain: to achieve the goal of having deep-links, the best solution is to migrate to Navigator 2.0. I had started a few weeks ago an implementation (never pushed, my fault), but I was soon stuck with codes like this:
Basically go_router doesn't allow receiving a result from a closing route. The only is by tricking and making the code totally awful and unreadable. And the PR I mentioned finally fixes that issue. |
@g123k Thank you for your answer! That's why I wanted to discuss the matter before any code writing: it looks like what causes problems is:
My comments (a bit late in the evening to my standards) are:
The first step would be to list the How does that sound? |
Working on step one: transforming all Current status: % grep -r "await Navigator.push" *
cards/data_cards/image_upload_card.dart: final bool? refreshed = await Navigator.push<bool>(
cards/product_cards/smooth_product_card_not_found.dart: final String? result = await Navigator.push<String>(
cards/product_cards/product_title_card.dart: await Navigator.push<Product?>(
cards/product_cards/smooth_product_card_found.dart: await Navigator.push<Widget>(
pages/scan/scan_header.dart: await Navigator.push<Widget>(
pages/scan/scan_product_card.dart: await Navigator.push<Widget>(
pages/product/edit_product_page.dart: await Navigator.push<Product?>(
pages/product/edit_product_page.dart: final bool? refreshed = await Navigator.push<bool>(
pages/product/edit_product_page.dart: await Navigator.push<Product?>(
pages/product/edit_product_page.dart: await Navigator.push<Product?>(
pages/product/edit_product_page.dart: await Navigator.push<Product?>(
pages/product/edit_product_page.dart: await Navigator.push<Product>(
pages/product/edit_product_page.dart: await Navigator.push<Product>(
pages/product/product_image_gallery_view.dart: final File? photoUploaded = await Navigator.push<File?>(
pages/product/add_ingredients_button.dart: await Navigator.push<bool>(
pages/product/add_nutrition_button.dart: await Navigator.push<Product>(
pages/product/common/product_list_page.dart: await Navigator.push<Widget>(
pages/product/summary_card.dart: await Navigator.push<Product?>(
pages/product/summary_card.dart: await Navigator.push<Widget>(
pages/product/new_product_page.dart: await Navigator.push<void>(
pages/product/add_category_button.dart: await Navigator.push<Product>(
pages/product/add_new_product_page.dart: final File? finalPhoto = await Navigator.push<File?>(
pages/product/add_new_product_page.dart: final Product? result = await Navigator.push<Product?>(
pages/product/add_new_product_page.dart: final Product? result = await Navigator.push<Product?>(
pages/all_user_product_list_page.dart: await Navigator.push<void>(
pages/question_page.dart: await Navigator.push<Widget>(
pages/user_management/login_page.dart: final bool? registered = await Navigator.push<bool>( |
AFAIK named routes and Router 2.0 implementations like go_router are completely different and for deeplinking we likely need router 2.0 so we can skip named routes. I just checked and it looks like we can (with what seems like replacing routes) indeed somewhat pop a value https://stackoverflow.com/questions/71359432/flutter-go-router-how-to-return-result-to-previous-page |
@M123-dev If you ask me, from what I read I prefer the dynamic named routes solution: it's easier to implement, and it allows deep-linking all the same. |
FYI: flutter/packages#2416, they want to change stuff before they merge, so it's going to take a little more time |
Heyy just one little detail I've seen in the Medium article for flutter 3.3 go_router now supports async push.
Can't say if that allows to pop values but still interesting to know |
"It reduces the amount of code needed", dixit Edouard |
@monsieurtanuki does the move to Flutter 3.7 change things on this one ? |
@teolemon I think we were alright even before, as since months ago we no longer expect pop'ed values from our navigator calls. Except for minor cases that are now handled as "full screen dialog"s rather than as pages. |
If that's ok for you, it will take back this issue and implement it. I will start with the products. |
@g123k That's perfect: I started 30 minutes ago with only preliminary works, and I reassign this issue to you. For what it's worth:
|
What kind of solution do you plan to use @g123k a self build one or a package like go_router |
My idea is to use |
Sounds good 👍🏼 |
The config file (assets links) is now deployed on the website |
Who for
What
Design doc with links to implementations in the classic apps
Why
Part of
Mockup
Code pointer
Status
At the moment we handle these urls:
/product
/additive
/allergen
/category
/cgi/search.pl
/contributor
/country
/label
/manufacturing-place
/origin
/packaging
/state
/store
Note that we should support those URLs in plural (list of all existing additives), and in singular (list of products for a given additive)
Urls we'd like to support
Depends on
The text was updated successfully, but these errors were encountered: