From 4b4badab67f9e814a5bb0f12803452f0efac012c Mon Sep 17 00:00:00 2001 From: Reinhard Hafenscher Date: Mon, 11 Jan 2021 16:28:47 +0100 Subject: [PATCH] Fix stamps not being correctly detected (#384) * Fix stamps not being correctly detected * Fix stamps and polylines not being correctly detected on iOS Co-authored-by: RadAzzouz --- .../java/com/pspdfkit/react/helper/ConversionHelpers.java | 3 +++ ios/RCTPSPDFKit/Converters/RCTConvert+PSPDFAnnotation.m | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/android/src/main/java/com/pspdfkit/react/helper/ConversionHelpers.java b/android/src/main/java/com/pspdfkit/react/helper/ConversionHelpers.java index 3a4db8d4..d78dadc3 100644 --- a/android/src/main/java/com/pspdfkit/react/helper/ConversionHelpers.java +++ b/android/src/main/java/com/pspdfkit/react/helper/ConversionHelpers.java @@ -64,6 +64,9 @@ public static EnumSet getAnnotationTypeFromString(@Nullable fina if ("pspdfkit/text".equalsIgnoreCase(type)) { return EnumSet.of(AnnotationType.FREETEXT); } + if ("pspdfkit/stamp".equalsIgnoreCase(type)) { + return EnumSet.of(AnnotationType.STAMP); + } return EnumSet.noneOf(AnnotationType.class); } } diff --git a/ios/RCTPSPDFKit/Converters/RCTConvert+PSPDFAnnotation.m b/ios/RCTPSPDFKit/Converters/RCTConvert+PSPDFAnnotation.m index 7139b209..2ef12288 100644 --- a/ios/RCTPSPDFKit/Converters/RCTConvert+PSPDFAnnotation.m +++ b/ios/RCTPSPDFKit/Converters/RCTConvert+PSPDFAnnotation.m @@ -54,10 +54,14 @@ + (PSPDFAnnotationType)annotationTypeFromInstantJSONType:(NSString *)type { return PSPDFAnnotationTypeLine; } else if ([type isEqualToString:@"pspdfkit/shape/polygon"]) { return PSPDFAnnotationTypePolygon; + } else if ([type isEqualToString:@"pspdfkit/shape/polyline"]) { + return PSPDFAnnotationTypePolyLine; } else if ([type isEqualToString:@"pspdfkit/shape/rectangle"]) { return PSPDFAnnotationTypeSquare; } else if ([type isEqualToString:@"pspdfkit/text"]) { return PSPDFAnnotationTypeFreeText; + } else if ([type isEqualToString:@"pspdfkit/stamp"]) { + return PSPDFAnnotationTypeStamp; } else { return PSPDFAnnotationTypeUndefined; }