From ec35ca0108cf2f0fb6b68c5bd5d0c4e2aac8a304 Mon Sep 17 00:00:00 2001 From: Luke De Feo Date: Wed, 9 Oct 2024 09:22:22 -0700 Subject: [PATCH] Fix black snapshot issue Summary: Many users are reporting an issue with a black snapshot occuring on messenger and fbios. https://fb.workplace.com/groups/flippersupport/permalink/1935441610269821/ This is because the snapshotting code snapshots all windows in order and composites them together. https://fburl.com/code/gcnbkpda The issue is the app can add additional windows such as this one {F1916776068} which itself it full screen and contains an empty view which effetively covers the real content with black pixels. Additionally react native adds a window to display the debug with metro banner I dont know how in the real app this doesst paint over the real content but for whatever it causes issues with our snapshotting process The solution is to only snapshot the active child of the application. This is how it works on android. The theory is that if we are only traversing the key window (active chld means we dont traverse other children) we should also only snapshot that one Reviewed By: lblasa Differential Revision: D64044875 fbshipit-source-id: 9ed83a0ef5f89948f1575c09f496384471985a56 --- .../Descriptors/UIDUIApplicationDescriptor.mm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/iOS/Plugins/FlipperKitUIDebuggerPlugin/FlipperKitUIDebuggerPlugin/Descriptors/UIDUIApplicationDescriptor.mm b/iOS/Plugins/FlipperKitUIDebuggerPlugin/FlipperKitUIDebuggerPlugin/Descriptors/UIDUIApplicationDescriptor.mm index d5edf203626..39879755f3e 100644 --- a/iOS/Plugins/FlipperKitUIDebuggerPlugin/FlipperKitUIDebuggerPlugin/Descriptors/UIDUIApplicationDescriptor.mm +++ b/iOS/Plugins/FlipperKitUIDebuggerPlugin/FlipperKitUIDebuggerPlugin/Descriptors/UIDUIApplicationDescriptor.mm @@ -59,7 +59,12 @@ - (UIDBounds*)boundsForNode:(UIApplication*)node { } - (UIImage*)snapshotForNode:(UIApplication*)node { - return UIDApplicationSnapshot(node, [self childrenOfNode:node]); + NSMutableArray* windows = [NSMutableArray new]; + UIWindow* window = node.keyWindow; + if (window != nil) { + [windows addObject:window]; + } + return UIDApplicationSnapshot(node, windows); } @end