Skip to content

Commit

Permalink
find a even better api
Browse files Browse the repository at this point in the history
  • Loading branch information
themiswang committed Nov 8, 2024
1 parent 5ce1afa commit 3845f72
Showing 1 changed file with 1 addition and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,36 +69,9 @@ void InstrumentViewDidAppear(FPRUIViewControllerInstrument *instrument,

// This has to be called on the main thread and so it's done here instead of in
// FPRScreenTraceTracker.
#if !defined(TARGET_OS_VISION) || !TARGET_OS_VISION
NSArray *windows = nil;

if (@available(iOS 13.0, *)) {
NSArray *scenes = FPRSharedApplication().connectedScenes.allObjects;
for (UIScreen *scene in scenes) {
if ([scene isKindOfClass:[UIWindowScene class]]) {
windows = [(UIWindowScene *)scene windows];
break;
}
}
} else {
windows = FPRSharedApplication().windows;
}

if (!windows || windows.count == 0) {
return;
}

UIWindow *foundKeyWindow = nil;
for (UIWindow *window in windows) {
if (window.isKeyWindow) {
foundKeyWindow = window;
break;
}
}
if (foundKeyWindow && [((UIViewController *)_self).view isDescendantOfView:foundKeyWindow]) {
if (FPRSharedApplication() && ((UIViewController *)_self).view.window.keyWindow) {
[[FPRScreenTraceTracker sharedInstance] viewControllerDidAppear:_self];
}
#endif
}];
}

Expand Down

0 comments on commit 3845f72

Please sign in to comment.