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
FlutterFragment predictive back #52302
base: main
Are you sure you want to change the base?
Conversation
// can be changed by calling setFrameworkHandlesBack. For example, the | ||
// framework will call this automatically in a typical app when it has | ||
// routes to pop. | ||
onBackPressedCallback.setEnabled(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably also need to update the implementation of popSystemNavigator()
to restore the previous state of the callback-enablement, instead of unconditionally re-enabling it on line 1673.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@math1man Thanks for jumping back in here, I've been trying to catch back up on your comments from the last PR. Pushing a fix for that now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries. Honestly, I think besides this comment everything looks good. Happy to look into anything specific you might be concerned about though.
Could @math1man or @reidbaker point me in the right direction for how to test this? Sorry I'm pretty inexperienced here, I'm struggling to even get into a real workflow. It seems like I need to recompile every time I touch the engine code (but not the test code). I'm doing:
But for one, I don't know how to view the output of Log statements I put in the test or in the engine code. They never show up in the test output. I added some code in FlutterFragmentTest to verify popSystemNavigator is enabling/disabling the callback, but it doesn't seem to fail if I revert the PR's changes, and I'm struggling to understand why not without the benefit of logs. |
Honestly @matanlurey is who I go to for engine help but tomorrow I can take a look. |
@camsim99 helped me out on Discord, the answer is |
Sometimes |
Ah thanks, I was using |
Following up on #39208 and #42789, which added predictive back support for FlutterActivity.
My test app for this is: https://github.com/justinmc/flutter-add-to-app
I tried this both with the Flutter app as the main activity, and with it as a secondary activity after an initial Android route. Predictive back worked in both cases.
Related: flutter/flutter#109558, and my comment flutter/flutter#109558 (comment).
b/242216228