Skip to content

Commit 8572ef5

Browse files
author
irgendeinich
committed
Wrap annotations in object before returning
1 parent 12f4163 commit 8572ef5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

android/src/main/java/com/pspdfkit/react/events/PdfViewDataReturnedEvent.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,20 @@ public class PdfViewDataReturnedEvent extends Event<PdfViewDataReturnedEvent> {
2424

2525
private final WritableMap payload;
2626

27-
public PdfViewDataReturnedEvent(@IdRes int viewId, int requestId, @NonNull List<Annotation> annotations) {
27+
public PdfViewDataReturnedEvent(@IdRes int viewId, int requestId, @NonNull List<Annotation> annotationsToSerialize) {
2828
super(viewId);
2929
Map<String, Object> map = new HashMap<>();
3030
map.put("requestId", requestId);
3131
try {
3232
List<Map<String, Object>> annotationsSerialized = new ArrayList<>();
33-
for (Annotation annotation : annotations) {
33+
for (Annotation annotation : annotationsToSerialize) {
3434
JSONObject instantJson = new JSONObject(annotation.toInstantJson());
3535
annotationsSerialized.add(JsonUtilities.jsonObjectToMap(instantJson));
3636
}
37-
map.put("result", annotationsSerialized);
37+
38+
Map<String, Object> annotations = new HashMap<>();
39+
annotations.put("annotations", annotationsSerialized);
40+
map.put("result", annotations);
3841
} catch (JSONException e) {
3942
map.put("error", e.getMessage());
4043
}

0 commit comments

Comments
 (0)