-
Notifications
You must be signed in to change notification settings - Fork 6k
[iOS] Fixes system navigator pop not work when App's root vc is TabBarController #30939
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
dnfield
left a comment
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.
| [((UINavigationController*)viewController) popViewControllerAnimated:isAnimated]; | ||
|
|
||
| auto engineViewController = static_cast<UIViewController*>([_engine.get() viewController]); | ||
| UINavigationController* navigationController = [engineViewController navigationController]; |
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.
Should this fall back on UIApplication.sharedApplication.keyWindow.rootViewController if it's nil to match the old behavior?
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.
Isn't that what it's doing on line 250?
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.
That code path isn't calling popViewControllerAnimated.
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.
Should this fall back on
UIApplication.sharedApplication.keyWindow.rootViewControllerif it'snilto match the old behavior?
Em, I think we can't match the old behavior, because if UIApplication.sharedApplication.keyWindow.rootViewController is UINavigationController but FlutterViewController's navigationController is nil, like FlutterViewController is presented, it would pop the top native view controller but not presented FlutterViewController
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.
Ah, I see, thanks for the explanation.
jmagman
left a comment
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.
LGTM
| [((UINavigationController*)viewController) popViewControllerAnimated:isAnimated]; | ||
|
|
||
| auto engineViewController = static_cast<UIViewController*>([_engine.get() viewController]); | ||
| UINavigationController* navigationController = [engineViewController navigationController]; |
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.
Ah, I see, thanks for the explanation.
|
@gaaclarke do you have any opinions? |
|
|
gaaclarke
left a comment
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.
Yea, I think this sounds alright. There is just a bit of cleanup needed.
shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.mm
Outdated
Show resolved
Hide resolved
…is TabBarController (flutter/engine#30939)
…is TabBarController (flutter/engine#30939)
…is TabBarController (flutter/engine#30939)
…is TabBarController (flutter/engine#30939)
| UIViewController* engineViewController = [_engine.get() viewController]; | ||
| UINavigationController* navigationController = [engineViewController navigationController]; | ||
| if (navigationController) { | ||
| [navigationController popViewControllerAnimated:isAnimated]; |
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.
如果是present出来的UINavigationController而且rootViewController是FlutterViewController,这里是没办法关闭的吧?
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.
Translation:
If it is the presented UINavigationController and the rootViewController is the FlutterViewController, there is no way to close it, right?
@rakeyang If you're seeing a specific problem related to this, please file an issue and we'll investigate. Closed PRs aren't usually monitored.
In add-to-app scene, if App's root view controller is
TabBarViewController, system navigator pop is not work because window's root view controller is notUINavigationController. We can useengineViewController'snavigationControllerinstead.Pre-launch Checklist
writing and running engine tests.
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.