This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -241,12 +241,15 @@ - (void)popSystemNavigator:(BOOL)isAnimated { | |
| // in the navigation hierarchy. | ||
| // It's also possible in an Add2App scenario that the FlutterViewController was presented | ||
| // outside the context of a UINavigationController, and still wants to be popped. | ||
| UIViewController* viewController = [UIApplication sharedApplication].keyWindow.rootViewController; | ||
| if ([viewController isKindOfClass:[UINavigationController class]]) { | ||
| [((UINavigationController*)viewController) popViewControllerAnimated:isAnimated]; | ||
|
|
||
| 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 commentThe reason will be displayed to describe this comment to others. Learn more. 如果是present出来的UINavigationController而且rootViewController是FlutterViewController,这里是没办法关闭的吧?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Translation:
@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. |
||
| } else { | ||
| auto engineViewController = static_cast<UIViewController*>([_engine.get() viewController]); | ||
| if (engineViewController != viewController) { | ||
| UIViewController* rootViewController = | ||
| [UIApplication sharedApplication].keyWindow.rootViewController; | ||
| if (engineViewController != rootViewController) { | ||
| [engineViewController dismissViewControllerAnimated:isAnimated completion:nil]; | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?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.
Em, I think we can't match the old behavior, because if
UIApplication.sharedApplication.keyWindow.rootViewControllerisUINavigationControllerbutFlutterViewController'snavigationControlleris nil, likeFlutterViewControlleris presented, it would pop the top native view controller but not presentedFlutterViewControllerThere 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.