Show full event name in sidebar
Summary: Show info about the event which triggered a new changeset generation; in case of a state update, also show the name of the method which triggered the state update. Reviewed By: pasqualeanatriello Differential Revision: D17162202 fbshipit-source-id: ebf218f8ce71799e4dd452f54b1621af7f83cc51
This commit is contained in:
committed by
Facebook Github Bot
parent
0c307b7c27
commit
fc2b8db8cf
@@ -32,7 +32,9 @@ public class ChangesetDebug implements ChangesetDebugListener {
|
||||
|
||||
public interface ChangesetListener {
|
||||
void onChangesetApplied(
|
||||
String name,
|
||||
String eventName,
|
||||
String eventSource,
|
||||
String updateStateMethodName,
|
||||
boolean isAsync,
|
||||
String surfaceId,
|
||||
String id,
|
||||
@@ -90,8 +92,12 @@ public class ChangesetDebug implements ChangesetDebugListener {
|
||||
eventSourceSection = updatedStateSection == null ? "" : updatedStateSection.getSimpleName();
|
||||
}
|
||||
|
||||
final String stateUpdateMethodName = stateUpdateAttribution == null ? null : attribution;
|
||||
|
||||
sSectionsFlipperPlugin.onChangesetApplied(
|
||||
eventSourceName + " " + eventSourceSection,
|
||||
eventSourceName,
|
||||
eventSourceSection,
|
||||
stateUpdateMethodName,
|
||||
isEventAsync(eventSource),
|
||||
surfaceId,
|
||||
sChangesetIdGenerator.incrementAndGet() + "-" + surfaceId,
|
||||
|
||||
@@ -45,7 +45,7 @@ public class SectionsFlipperPlugin implements FlipperPlugin, ChangesetListener {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name Name of event
|
||||
* @param eventName Name of event
|
||||
* @param isAsync Whether the event was sync or async
|
||||
* @param surfaceId SectionTree tag
|
||||
* @param id Changeset generation unique id
|
||||
@@ -54,7 +54,9 @@ public class SectionsFlipperPlugin implements FlipperPlugin, ChangesetListener {
|
||||
*/
|
||||
@Override
|
||||
public void onChangesetApplied(
|
||||
String name,
|
||||
String eventName,
|
||||
String eventSource,
|
||||
String updateStateMethodName,
|
||||
boolean isAsync,
|
||||
String surfaceId,
|
||||
String id,
|
||||
@@ -63,16 +65,26 @@ public class SectionsFlipperPlugin implements FlipperPlugin, ChangesetListener {
|
||||
if (mConnection == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String reason = eventName + " " + eventSource;
|
||||
final FlipperObject.Builder eventPayloadBuilder = new FlipperObject.Builder();
|
||||
eventPayloadBuilder.put("Event", eventName);
|
||||
eventPayloadBuilder.put("Async", isAsync);
|
||||
eventPayloadBuilder.put("Section", eventSource);
|
||||
if (updateStateMethodName != null) {
|
||||
eventPayloadBuilder.put("Update state method", updateStateMethodName);
|
||||
}
|
||||
|
||||
mConnection.send(
|
||||
"addEvent",
|
||||
new FlipperObject.Builder()
|
||||
.put("id", id)
|
||||
.put("update_mode", isAsync ? 0 : 1)
|
||||
.put("reason", name)
|
||||
.put("reason", reason)
|
||||
.put("surface_key", surfaceId)
|
||||
.put("tree_generation_timestamp", 10000) // TODO
|
||||
.put("stack_trace", new FlipperArray.Builder().build())
|
||||
.put("payload", new FlipperObject.Builder().build())
|
||||
.put("payload", eventPayloadBuilder.build())
|
||||
.build());
|
||||
|
||||
mConnection.send(
|
||||
@@ -82,7 +94,7 @@ public class SectionsFlipperPlugin implements FlipperPlugin, ChangesetListener {
|
||||
.put("hierarchy_generation_timestamp", 10000) // TODO
|
||||
.put("hierarchy_generation_duration", 0) // TODO
|
||||
.put("tree", tree)
|
||||
.put("reason", name)
|
||||
.put("reason", eventName)
|
||||
.build());
|
||||
|
||||
// Not sure both CHANGESET_GENERATED and CHANGESET_APPLIED need to sent here, need
|
||||
|
||||
Reference in New Issue
Block a user