Enable import all the nodes for android
Summary: Enables Import and Export for all the nodes for android. Also search and Accessibility feature works Reviewed By: danielbuechele Differential Revision: D14406016 fbshipit-source-id: 8976db66d1ca91e98c52983a31ea584764bde0f6
This commit is contained in:
committed by
Facebook Github Bot
parent
063d8aa416
commit
1c8fffa20b
@@ -133,6 +133,7 @@ public class InspectorFlipperPlugin implements FlipperPlugin {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
connection.receive("getRoot", mGetRoot);
|
connection.receive("getRoot", mGetRoot);
|
||||||
|
connection.receive("getAllNodes", mGetAllNodes);
|
||||||
connection.receive("getNodes", mGetNodes);
|
connection.receive("getNodes", mGetNodes);
|
||||||
connection.receive("setData", mSetData);
|
connection.receive("setData", mSetData);
|
||||||
connection.receive("setHighlighted", mSetHighlighted);
|
connection.receive("setHighlighted", mSetHighlighted);
|
||||||
@@ -173,7 +174,7 @@ public class InspectorFlipperPlugin implements FlipperPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean runInBackground() {
|
public boolean runInBackground() {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
final FlipperReceiver mShouldShowLithoAccessibilitySettings =
|
final FlipperReceiver mShouldShowLithoAccessibilitySettings =
|
||||||
@@ -207,6 +208,31 @@ public class InspectorFlipperPlugin implements FlipperPlugin {
|
|||||||
responder.success(getAXNode(trackObject(mApplication)));
|
responder.success(getAXNode(trackObject(mApplication)));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
final FlipperReceiver mGetAllNodes =
|
||||||
|
new MainThreadFlipperReceiver(mConnection) {
|
||||||
|
@Override
|
||||||
|
public void onReceiveOnMainThread(
|
||||||
|
final FlipperObject params, final FlipperResponder responder) throws Exception {
|
||||||
|
final FlipperObject.Builder result = new FlipperObject.Builder();
|
||||||
|
final FlipperObject.Builder AXResults = new FlipperObject.Builder();
|
||||||
|
|
||||||
|
String rootID = trackObject(mApplication);
|
||||||
|
populateAllAXNodes(rootID, AXResults);
|
||||||
|
populateAllNodes(rootID, result);
|
||||||
|
final FlipperObject output =
|
||||||
|
new FlipperObject.Builder()
|
||||||
|
.put(
|
||||||
|
"allNodes",
|
||||||
|
new FlipperObject.Builder()
|
||||||
|
.put("elements", result.build())
|
||||||
|
.put("AXelements", AXResults.build())
|
||||||
|
.put("rootElement", rootID)
|
||||||
|
.put("rootAXElement", rootID)
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
responder.success(output);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
final FlipperReceiver mGetNodes =
|
final FlipperReceiver mGetNodes =
|
||||||
new MainThreadFlipperReceiver(mConnection) {
|
new MainThreadFlipperReceiver(mConnection) {
|
||||||
@@ -235,6 +261,24 @@ public class InspectorFlipperPlugin implements FlipperPlugin {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void populateAllNodes(String rootNode, FlipperObject.Builder builder) throws Exception {
|
||||||
|
FlipperObject object = getNode(rootNode);
|
||||||
|
builder.put(rootNode, object);
|
||||||
|
FlipperArray children = object.getArray("children");
|
||||||
|
for (int i = 0, count = children.length(); i < count; ++i) {
|
||||||
|
populateAllNodes(children.getString(i), builder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void populateAllAXNodes(String rootNode, FlipperObject.Builder builder) throws Exception {
|
||||||
|
FlipperObject object = getAXNode(rootNode);
|
||||||
|
builder.put(rootNode, object);
|
||||||
|
FlipperArray children = object.getArray("children");
|
||||||
|
for (int i = 0, count = children.length(); i < count; ++i) {
|
||||||
|
populateAllAXNodes(children.getString(i), builder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final FlipperReceiver mGetAXNodes =
|
final FlipperReceiver mGetAXNodes =
|
||||||
new MainThreadFlipperReceiver(mConnection) {
|
new MainThreadFlipperReceiver(mConnection) {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -183,8 +183,9 @@ export default connect<Props, OwnProps, _, _, _, _>(
|
|||||||
pluginKey = getPluginKey(target.id, activePlugin.id);
|
pluginKey = getPluginKey(target.id, activePlugin.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const isArchivedDevice = selectedDevice instanceof ArchivedDevice;
|
const isArchivedDevice = !selectedDevice
|
||||||
|
? false
|
||||||
|
: selectedDevice instanceof ArchivedDevice;
|
||||||
return {
|
return {
|
||||||
pluginState: pluginStates[pluginKey],
|
pluginState: pluginStates[pluginKey],
|
||||||
activePlugin,
|
activePlugin,
|
||||||
|
|||||||
@@ -49,7 +49,9 @@ export function searchNodes(
|
|||||||
AXMode: boolean,
|
AXMode: boolean,
|
||||||
state: PersistedState,
|
state: PersistedState,
|
||||||
): ?SearchResultTree {
|
): ?SearchResultTree {
|
||||||
const elements = state[propsForPersistedState(AXMode).ELEMENTS];
|
// Even if the axMode is true, we will have to search the normal elements too.
|
||||||
|
// The AXEelements will automatically populated in constructSearchResultTree
|
||||||
|
const elements = state[propsForPersistedState(false).ELEMENTS];
|
||||||
const children: Array<SearchResultTree> = [];
|
const children: Array<SearchResultTree> = [];
|
||||||
const match = isMatch(node, query);
|
const match = isMatch(node, query);
|
||||||
|
|
||||||
|
|||||||
@@ -83,10 +83,9 @@ function populateChildren(state: PersistedState, axMode: boolean) {
|
|||||||
'child1_child1 view',
|
'child1_child1 view',
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
state.elements = elements;
|
||||||
if (axMode) {
|
if (axMode) {
|
||||||
state.AXelements = elements;
|
state.AXelements = elements;
|
||||||
} else {
|
|
||||||
state.elements = elements;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,11 +67,7 @@ export default class Layout extends FlipperPlugin<State, void, PersistedState> {
|
|||||||
if (!store) {
|
if (!store) {
|
||||||
return defaultPromise;
|
return defaultPromise;
|
||||||
}
|
}
|
||||||
const selectedDevice = store.getState().connections.selectedDevice;
|
return callClient('getAllNodes').then(({allNodes}) => allNodes);
|
||||||
if (selectedDevice && selectedDevice.os === 'iOS') {
|
|
||||||
return callClient('getAllNodes').then(({allNodes}) => allNodes);
|
|
||||||
}
|
|
||||||
return defaultPromise;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static defaultPersistedState = {
|
static defaultPersistedState = {
|
||||||
|
|||||||
Reference in New Issue
Block a user