Skip to content

Commit fb6e375

Browse files
committed
find a even better api
1 parent 5ce1afa commit fb6e375

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

FirebasePerformance/Sources/Instrumentation/UIKit/FPRUIViewControllerInstrument.m

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -69,36 +69,9 @@ void InstrumentViewDidAppear(FPRUIViewControllerInstrument *instrument,
6969

7070
// This has to be called on the main thread and so it's done here instead of in
7171
// FPRScreenTraceTracker.
72-
#if !defined(TARGET_OS_VISION) || !TARGET_OS_VISION
73-
NSArray *windows = nil;
74-
75-
if (@available(iOS 13.0, *)) {
76-
NSArray *scenes = FPRSharedApplication().connectedScenes.allObjects;
77-
for (UIScreen *scene in scenes) {
78-
if ([scene isKindOfClass:[UIWindowScene class]]) {
79-
windows = [(UIWindowScene *)scene windows];
80-
break;
81-
}
82-
}
83-
} else {
84-
windows = FPRSharedApplication().windows;
85-
}
86-
87-
if (!windows || windows.count == 0) {
88-
return;
89-
}
90-
91-
UIWindow *foundKeyWindow = nil;
92-
for (UIWindow *window in windows) {
93-
if (window.isKeyWindow) {
94-
foundKeyWindow = window;
95-
break;
96-
}
97-
}
98-
if (foundKeyWindow && [((UIViewController *)_self).view isDescendantOfView:foundKeyWindow]) {
72+
if (((UIViewController *)_self).view.window.keyWindow) {
9973
[[FPRScreenTraceTracker sharedInstance] viewControllerDidAppear:_self];
10074
}
101-
#endif
10275
}];
10376
}
10477

0 commit comments

Comments
 (0)