Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
Deprecate UIApplication.windows access
Browse files Browse the repository at this point in the history
Summary: > 'windows' is deprecated: first deprecated in iOS 15.0 - Use UIWindowScene.windows on a relevant window scene instead [-Werror,-Wdeprecated-declarations]

Reviewed By: ingridwang

Differential Revision: D63657072

fbshipit-source-id: 6a60cb23f6a6396e6b676d9b619fcb71fe3248bc
  • Loading branch information
caodoan authored and facebook-github-bot committed Oct 1, 2024
1 parent f160979 commit d666891
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,21 @@ - (void)hitTest:(SKTouch*)touch forNode:(UIApplication*)node {
}

- (NSArray<UIWindow*>*)visibleChildrenForNode:(UIApplication*)node {
NSMutableArray<UIWindow*>* windows = [NSMutableArray new];
if (@available(iOS 13, *)) {
for (UIWindowScene* scene in node.connectedScenes) {
[windows addObjectsFromArray:scene.windows];
}
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// TODO T202813939 Remove this branch once we drop support for iOS lower
// than 13
[windows addObjectsFromArray:node.windows];
}
#pragma clang diagnostic pop
NSMutableArray<UIWindow*>* children = [NSMutableArray new];
for (UIWindow* window in node.windows) {
for (UIWindow* window in windows) {
if ([window isKindOfClass:[SKHiddenWindow class]] ||
[window
isKindOfClass:objc_lookUpClass("FBAccessibilityOverlayWindow")] ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,21 @@ @implementation UIDUIApplicationDescriptor
"FBAccessibilityOverlayWindow",
"UITextEffectsWindow"});

NSMutableArray<UIWindow*>* windows = [NSMutableArray new];
if (@available(iOS 13, *)) {
for (UIWindowScene* scene in node.connectedScenes) {
[windows addObjectsFromArray:scene.windows];
}
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// TODO T202813939 Remove this branch once we drop support for iOS lower
// than 13
[windows addObjectsFromArray:node.windows];
}
#pragma clang diagnostic pop
NSMutableArray<UIWindow*>* children = [NSMutableArray new];
for (UIWindow* window in node.windows) {
for (UIWindow* window in windows) {
if (ignoredWindows.find(class_getName(window.class)) !=
ignoredWindows.end()) {
continue;
Expand Down

0 comments on commit d666891

Please sign in to comment.