Skip to content

Include uuid in annotation removed event #349

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public void dispatch(RCTEventEmitter rctEventEmitter) {
annotationMap = new HashMap<>();
annotationMap.put("name", annotation.getName());
annotationMap.put("creatorName", annotation.getCreator());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On iOS, we are not including the creator's name when an annotation is deleted:

[annotationsJSON addObject:@{@"uuid" : annotation.uuid, @"name" : annotation.name ?: [NSNull null]}];

The change would be pretty trivial:

- [annotationsJSON addObject:@{@"uuid" : annotation.uuid, @"name" : annotation.name ?: [NSNull null]}];
+ [annotationsJSON addObject:@{@"uuid" : annotation.uuid, @"name" : annotation.name ?: [NSNull null], @"creatorName" : annotation.user ?: [NSNull null]}];

@davidschreiber can you please make this change in this PR? Otherwise, I can do it myself in the PR or a followup PR.

Pinging @nickwinder, as I am not sure what Windows does when an annotation is deleted.

annotationMap.put("uuid", annotation.getUuid());
} else {
JSONObject instantJson = new JSONObject(annotation.toInstantJson());
annotationMap = JsonUtilities.jsonObjectToMap(instantJson);
Expand Down
2 changes: 1 addition & 1 deletion ios/RCTPSPDFKit/Converters/RCTConvert+PSPDFAnnotation.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ @implementation RCTConvert (PSPDFAnnotation)
}
} else {
// We only generate Instant JSON data for attached annotations. When an annotation is deleted, we only set the annotation uuid and name.
[annotationsJSON addObject:@{@"uuid" : annotation.uuid, @"name" : annotation.name ?: [NSNull null]}];
[annotationsJSON addObject:@{@"uuid" : annotation.uuid, @"name" : annotation.name ?: [NSNull null], @"creatorName" : annotation.user ?: [NSNull null]}];
}
}

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-pspdfkit",
"version": "1.27.2",
"version": "1.27.3",
"description": "A React Native module for the PSPDFKit library.",
"keywords": [
"react native",
Expand Down
2 changes: 1 addition & 1 deletion samples/Catalog/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Catalog",
"version": "1.27.2",
"version": "1.27.3",
"private": true,
"scripts": {
"start": "react-native start",
Expand Down
2 changes: 1 addition & 1 deletion samples/NativeCatalog/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "NativeCatalog",
"version": "1.27.2",
"version": "1.27.3",
"private": true,
"scripts": {
"android": "react-native run-android",
Expand Down