Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions Firebase/Auth/Source/Utilities/FIRAuthDefaultUIDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,26 @@ - (void)dismissViewControllerAnimated:(BOOL)flag completion:(nullable void (^)(v
applicationClass = cls;
}
}
UIApplication *application = [applicationClass sharedApplication];
UIViewController *topViewController = application.keyWindow.rootViewController;

UIViewController *topViewController;
if (@available(iOS 13.0, *)) {
UIApplication *application = [applicationClass sharedApplication];
NSSet<UIScene *> * connectedScenes = application.connectedScenes;
for (UIScene *scene in connectedScenes) {
if ([scene isKindOfClass:[UIWindowScene class]]) {
UIWindowScene *windowScene = (UIWindowScene *)scene;
for (UIWindow *window in windowScene.windows) {
if (window.isKeyWindow) {
topViewController = window.rootViewController;
}
}
}
}
} else {
UIApplication *application = [applicationClass sharedApplication];
topViewController = application.keyWindow.rootViewController;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: moving this code out to a separate method may improve readability of the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried while it seems the code blocks depend on each other and hard to be separated.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, no problem


while (true){
if (topViewController.presentedViewController) {
topViewController = topViewController.presentedViewController;
Expand Down