(client) Return Tree instead of Path

Summary:
- Add return parameter to `createTouch` method: stack of node. This reference will be used to retrieve the final tree structure to be sent back to desktop app.
- `Touch` now keeps every step in component tree (I have concerned for app performance here)
- Edit test to reflect changes

Note:
- `path` will also be returned to keep backward compatibility with older server (desktop) side

Reviewed By: adityasharat

Differential Revision: D21040429

fbshipit-source-id: 6c2b9792378bf08b19fbbda1d2381df8c357170c
This commit is contained in:
Chaiwat Ekkaewnumchai
2020-05-07 03:37:49 -07:00
committed by Facebook GitHub Bot
parent f275ee00c5
commit d593409ec4
2 changed files with 109 additions and 44 deletions

View File

@@ -269,9 +269,20 @@ public class InspectorFlipperPluginTest {
connection.sent.get("select"),
hasItem(
new FlipperObject.Builder()
.put(
"tree",
new FlipperObject.Builder()
.put(
"com.facebook.flipper",
new FlipperObject.Builder()
.put(
"test",
new FlipperObject.Builder()
.put("3", new FlipperObject.Builder())
.put("1", new FlipperObject.Builder()))))
.put(
"path",
new FlipperArray.Builder().put("com.facebook.flipper").put("test").put("3"))
new FlipperArray.Builder().put("com.facebook.flipper").put("test").put("1"))
.build()));
}
@@ -391,16 +402,17 @@ public class InspectorFlipperPluginTest {
@Override
public void hitTest(TestNode node, Touch touch) {
boolean finish = true;
for (int i = node.children.size() - 1; i >= 0; i--) {
final TestNode child = node.children.get(i);
final Rect bounds = child.bounds;
if (touch.containedIn(bounds.left, bounds.top, bounds.right, bounds.bottom)) {
touch.continueWithOffset(i, bounds.left, bounds.top);
return;
finish = false;
}
}
touch.finish();
if (finish) touch.finish();
}
@Override