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

Set deep linking flag to true by default #52350

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

hangyujin
Copy link
Contributor

@hangyujin hangyujin commented Apr 24, 2024

doc: flutter.dev/go/deep-link-flag-migration

Action item: make sure customers are aware of this change before merging this PR.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard

This comment was marked as outdated.

@jmagman jmagman self-requested a review April 24, 2024 21:04
@hangyujin hangyujin requested a review from chunhtai April 24, 2024 21:21
Copy link
Member

@jmagman jmagman left a comment

Choose a reason for hiding this comment

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

Is there any mechanism for the framework to say whether pushRouteInformation successfully pushed a known route? If so, it might be better to return that (the non-deprecated version of this API is async https://developer.apple.com/documentation/uikit/uiapplication/1648685-openurl, so we could migrate onto that)

@hangyujin
Copy link
Contributor Author

hangyujin commented Apr 24, 2024

@jmagman yes, framework method Future<bool> didPushRouteInformation(RouteInformation routeInformation) does return true when successfully pushed a known route.

But i think migrating to a non-deprecated async API will be a separated issue and a separated PR from this flag change .

@jmagman
Copy link
Member

jmagman commented Apr 24, 2024

But i think migrating to a non-deprecated async API will be a separated issue and a separated PR from this flag change .

I'm not really concerned that it's deprecated, more that this PR changes behavior where this method will be returning true even when there's no deep linking set up, and it's not opted into.

@camsim99 camsim99 requested a review from reidbaker April 26, 2024 17:47
@jmagman jmagman self-requested a review May 1, 2024 21:06
@hangyujin
Copy link
Contributor Author

hangyujin commented May 1, 2024

Looks like the framework currently sends routeInformationUpdated message to navigationChannel when route changes. But these navigation messages are only handled on the web, it’s not handled on the iOS engine.

Maybe we can do

  1. On the iOS engine, add a method call handler to ios navigationChannel and save the route information so the engine knows if the route is changed.

  2. On the iOS engine openURL method, after sending pushRouteInformation, wait for 1 second(just an eye-balled value) and check if the route information is changed, if so, return YES, if not, return NO.

@chunhtai
Copy link
Contributor

chunhtai commented May 1, 2024

Looks like the framework currently sends routeInformationUpdated message to navigationChannel when route changes. But these navigation messages are only handled on the web, it’s not handled on the iOS engine.

Maybe we can do

  1. On the iOS engine, add a method call handler to ios navigationChannel and save the route information so the engine knows if the route is changed.
  2. On the iOS engine openURL method, after sending pushRouteInformation, wait for 1 second(just an eye-balled value) and check if the route information is changed, if so, return YES, if not, return NO.

Why does iOS need to listen for routeInformationUpdated ? should we be able to tell from didPushRouteInformation's return value to tell whether anything has handled the deeplink?

@hangyujin
Copy link
Contributor Author

hangyujin commented May 1, 2024

cause didPushRouteInformation's return value is on the framework side, i thought the way for engine to get it is through a method channel, so the ios openURL returns true only when the route is changed on the framework side

@chunhtai
Copy link
Contributor

chunhtai commented May 1, 2024

Can you make _handleNavigationInvocation to return a future of boolean to indicate whether any of the widgetbindObserver.didpushRouteInformation has handled the route or not?

The didUpdateRouteInformation is to report current route in framework to engine. It will be smart enough to check whether the current route/state with the one in engine is the same or not before sending the request. So it is not guaranteed that didUpdateRouteInformation will be called after a successful deeplink

@chunhtai
Copy link
Contributor

chunhtai commented May 1, 2024

That being said we should probably add the feature to reject deeplink in go_router, right now it just swallow all and handle error on the framework side

@hangyujin
Copy link
Contributor Author

Can you make _handleNavigationInvocation to return a future of boolean to indicate whether any of the widgetbindObserver.didpushRouteInformation has handled the route or not? >> noted, I will do that, thanks!

@reidbaker
Copy link
Contributor

@hangyujin Are you wanting to make more changes or is this ready for revew?

@hangyujin
Copy link
Contributor Author

@reidbaker i want to land flutter/flutter#147901 and #52643 first.

auto-submit bot pushed a commit to flutter/flutter that referenced this pull request May 15, 2024
…r any of the observer has handled the route or not (#147901)

follow up on comments on flutter/engine#52350
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants