Skip to content

Commit 00dcd3b

Browse files
committed
return keywindow code back to code currently working for visionOS
1 parent 604d0e3 commit 00dcd3b

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

IdentityCore/src/util/ios/UIApplication+MSIDExtensions.m

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,20 @@ + (UIViewController *)msidCurrentViewController:(UIViewController *)parentContro
3636

3737
if ([MSIDAppExtensionUtil isExecutingInAppExtension]) return nil;
3838

39-
for (UIWindowScene* scene in [[MSIDAppExtensionUtil sharedApplication] connectedScenes])
39+
NSArray<UIScene *> *scenes; NSArray<UIWindow *> *windows;
40+
41+
scenes = [[[MSIDAppExtensionUtil sharedApplication] connectedScenes] allObjects];
42+
43+
if (scenes && scenes.count != 0)
44+
{
45+
windows = [(UIWindowScene *)[scenes objectAtIndex:0] windows];
46+
}
47+
48+
for (UIWindow *window in windows)
4049
{
41-
if (scene.activationState == UISceneActivationStateForegroundActive)
50+
if (window.isKeyWindow)
4251
{
43-
for (UIWindow *window in scene.windows)
44-
{
45-
if (window.isKeyWindow)
46-
{
47-
return [self msidCurrentViewControllerWithRootViewController:window.rootViewController];
48-
}
49-
}
52+
return [self msidCurrentViewControllerWithRootViewController:window.rootViewController];
5053
}
5154
}
5255

0 commit comments

Comments
 (0)