diff --git a/package-lock.json b/package-lock.json index 64c281d7..bb5d084d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-native-pspdfkit", - "version": "1.31.0", + "version": "1.31.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 8dd185dd..c41c5727 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-pspdfkit", - "version": "1.31.0", + "version": "1.31.1", "description": "A React Native module for the PSPDFKit library.", "keywords": [ "react native", diff --git a/samples/Catalog/package.json b/samples/Catalog/package.json index c0afc66d..882705d3 100644 --- a/samples/Catalog/package.json +++ b/samples/Catalog/package.json @@ -1,6 +1,6 @@ { "name": "Catalog", - "version": "1.31.0", + "version": "1.31.1", "private": true, "scripts": { "start": "react-native start", diff --git a/samples/Catalog/yarn.lock b/samples/Catalog/yarn.lock index f9fea07d..86bd39dc 100644 --- a/samples/Catalog/yarn.lock +++ b/samples/Catalog/yarn.lock @@ -5420,7 +5420,7 @@ react-native-permissions@^1.1.1: integrity sha512-t0Ujm177bagjUOSzhpmkSz+LqFW04HnY9TeZFavDCmV521fQvFz82aD+POXqWsAdsJVOK3umJYBNNqCjC3g0hQ== "react-native-pspdfkit@file:../..": - version "1.31.0" + version "1.31.1" react-native-qrcode-scanner@^1.2.1: version "1.2.1" diff --git a/samples/NativeCatalog/ios/NativeCatalog/Examples/CustomPdfView.m b/samples/NativeCatalog/ios/NativeCatalog/Examples/CustomPdfView.m index 61d9c88d..84d0f473 100644 --- a/samples/NativeCatalog/ios/NativeCatalog/Examples/CustomPdfView.m +++ b/samples/NativeCatalog/ios/NativeCatalog/Examples/CustomPdfView.m @@ -11,7 +11,7 @@ #import #import "NativeCatalog-Swift.h" -@interface CustomPdfView() +@interface CustomPdfView() @property (nonatomic, nullable) UIViewController *topController; @end @@ -85,19 +85,26 @@ - (UIViewController *)pspdf_parentViewController { } - (BOOL)startSigning { - // Programmatically show the signature view controller - PSPDFSignatureViewController *signatureController = [[PSPDFSignatureViewController alloc] init]; - signatureController.naturalDrawingEnabled = YES; - signatureController.delegate = self; - PSPDFNavigationController *signatureContainer = [[PSPDFNavigationController alloc] initWithRootViewController:signatureController]; - [_pdfController presentViewController:signatureContainer animated:YES completion:NULL]; + // Programmatically show the signature creation view controller + if (@available(iOS 13.0, *)) { + PSPDFSignatureCreationViewController *signatureController = [[PSPDFSignatureCreationViewController alloc] init]; + signatureController.configuration = [PSPDFSignatureCreationConfiguration configurationWithBuilder:^(PSPDFSignatureCreationConfigurationBuilder * _Nonnull builder) { + builder.availableModes = @[@(PSPDFSignatureCreationModeDraw)]; + }]; + signatureController.delegate = self; + [_pdfController presentViewController:signatureController animated:YES completion:NULL]; + } else { + UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"This example is not available on iOS 12" message:@"This example requires iOS 13 and later." preferredStyle:UIAlertControllerStyleAlert]; + [alert addAction:[UIAlertAction actionWithTitle:@"Dismiss" style:UIAlertActionStyleDefault handler:NULL]]; + [_pdfController presentViewController:alert animated:YES completion:NULL]; + } return YES; } #pragma mark - PSPDFSignatureViewControllerDelegate -- (void)signatureViewControllerDidFinish:(PSPDFSignatureViewController *)signatureController withSigner:(nullable PSPDFSigner *)signer shouldSaveSignature:(BOOL)shouldSaveSignature { +- (void)signatureCreationViewControllerDidFinish:(PSPDFSignatureCreationViewController * _Nonnull)signatureController API_AVAILABLE(ios(13.0)){ [signatureController dismissViewControllerAnimated:YES completion:^{ NSURL *samplesURL = [NSBundle.mainBundle.resourceURL URLByAppendingPathComponent:@"PDFs"]; NSURL *p12URL = [samplesURL URLByAppendingPathComponent:@"JohnAppleseed.p12"]; @@ -143,7 +150,7 @@ - (void)signatureViewControllerDidFinish:(PSPDFSignatureViewController *)signatu // Set the bounding box to fit in the signature form element. annotation.boundingBox = CGRectMake(signatureFormElement.boundingBox.origin.x + 70, signatureFormElement.boundingBox.origin.y - 25, 50, 50); annotation.color = signatureController.drawView.strokeColor; - annotation.naturalDrawingEnabled = signatureController.naturalDrawingEnabled; + annotation.naturalDrawingEnabled = signatureController.drawView.naturalDrawingEnabled; annotation.pageIndex = 0; // Add the ink annotation. @@ -163,7 +170,7 @@ - (void)signatureViewControllerDidFinish:(PSPDFSignatureViewController *)signatu }]; } -- (void)signatureViewControllerDidCancel:(PSPDFSignatureViewController *)signatureController { +- (void)signatureCreationViewControllerDidCancel:(PSPDFSignatureCreationViewController * _Nonnull)signatureController API_AVAILABLE(ios(13.0)){ [signatureController dismissViewControllerAnimated:YES completion:NULL]; } diff --git a/samples/NativeCatalog/package.json b/samples/NativeCatalog/package.json index a9d7e7c5..f85ac662 100644 --- a/samples/NativeCatalog/package.json +++ b/samples/NativeCatalog/package.json @@ -1,6 +1,6 @@ { "name": "NativeCatalog", - "version": "1.31.0", + "version": "1.31.1", "private": true, "scripts": { "android": "react-native run-android", diff --git a/samples/NativeCatalog/yarn.lock b/samples/NativeCatalog/yarn.lock index 120bac70..9ad16ea1 100644 --- a/samples/NativeCatalog/yarn.lock +++ b/samples/NativeCatalog/yarn.lock @@ -3020,9 +3020,9 @@ getpass@^0.1.1: assert-plus "^1.0.0" glob-parent@^5.0.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.0.tgz#5f4c1d1e748d30cd73ad2944b3577a81b081e8c2" - integrity sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw== + version "5.1.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== dependencies: is-glob "^4.0.1" @@ -5511,7 +5511,7 @@ react-native-gesture-handler@^1.3.0: prop-types "^15.7.2" "react-native-pspdfkit@file:../..": - version "1.31.0" + version "1.31.1" react-native-safe-area-view@^0.14.1: version "0.14.8"