Add support for tagged messages on the Layout Inspector

Summary:
Related diff [CK]: D23243009

This diff adds support for a protocol for layout messages where the type is recursively encoded as:

```
{
 kind: "type",
 data: ???
}
```

The meat of the diff is on FlipperEditor.java, SetDataOperations.java and InspectorFlipperPlugin.java. The others are there just for a change on an interface.

We check if the message adheres to the new encoding, otherwise we fall back to the old behavior. If it's the new encoding, the message is traversed recursively flattening the types to EditorValue using the type hints provided.

Reviewed By: muraziz

Differential Revision: D23243009

fbshipit-source-id: 0f313455885930f3beaaadb66f3bf394f109ea23
This commit is contained in:
Paco Estevez Garcia
2020-08-28 08:49:51 -07:00
committed by Facebook GitHub Bot
parent 19b5b65081
commit ff3584e2e0
23 changed files with 323 additions and 49 deletions

View File

@@ -15,6 +15,7 @@ import com.facebook.flipper.core.FlipperDynamic;
import com.facebook.flipper.core.FlipperObject;
import com.facebook.flipper.testing.FlipperConnectionMock;
import java.util.List;
import javax.annotation.Nullable;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
@@ -56,7 +57,12 @@ public class DescriptorMappingTest {
}
@Override
public void setValue(T node, String[] path, FlipperDynamic value) throws Exception {}
public void setValue(
T node,
String[] path,
@Nullable SetDataOperations.FlipperValueHint kind,
FlipperDynamic value)
throws Exception {}
@Override
public List<Named<String>> getAttributes(T node) {

View File

@@ -394,7 +394,12 @@ public class InspectorFlipperPluginTest {
}
@Override
public void setValue(TestNode node, String[] path, FlipperDynamic value) throws Exception {
public void setValue(
TestNode node,
String[] path,
@Nullable SetDataOperations.FlipperValueHint kind,
FlipperDynamic value)
throws Exception {
if (path[0].equals("data")) {
node.data = value.asObject();
}