react-native-rectangle-doc-scanner 3.64.0 → 3.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -15,17 +15,20 @@
|
|
|
15
15
|
#import <ImageIO/ImageIO.h>
|
|
16
16
|
#import <GLKit/GLKit.h>
|
|
17
17
|
|
|
18
|
-
@interface IPDFCameraViewController () <AVCaptureVideoDataOutputSampleBufferDelegate>
|
|
18
|
+
@interface IPDFCameraViewController () <AVCaptureVideoDataOutputSampleBufferDelegate, AVCapturePhotoCaptureDelegate>
|
|
19
19
|
|
|
20
20
|
@property (nonatomic,strong) AVCaptureSession *captureSession;
|
|
21
21
|
@property (nonatomic,strong) AVCaptureDevice *captureDevice;
|
|
22
22
|
@property (nonatomic,strong) EAGLContext *context;
|
|
23
23
|
|
|
24
|
-
@property (nonatomic, strong)
|
|
24
|
+
@property (nonatomic, strong) AVCapturePhotoOutput* photoOutput;
|
|
25
|
+
@property (nonatomic, strong) AVCaptureStillImageOutput* stillImageOutput; // Kept for backward compatibility
|
|
25
26
|
|
|
26
27
|
@property (nonatomic, assign) BOOL forceStop;
|
|
27
28
|
@property (nonatomic, assign) float lastDetectionRate;
|
|
28
29
|
|
|
30
|
+
@property (nonatomic, copy) void (^captureCompletionHandler)(UIImage *, UIImage *, CIRectangleFeature *);
|
|
31
|
+
|
|
29
32
|
@end
|
|
30
33
|
|
|
31
34
|
@implementation IPDFCameraViewController
|
|
@@ -143,8 +146,30 @@
|
|
|
143
146
|
[dataOutput setSampleBufferDelegate:self queue:dispatch_get_main_queue()];
|
|
144
147
|
[session addOutput:dataOutput];
|
|
145
148
|
|
|
146
|
-
|
|
147
|
-
|
|
149
|
+
// Use modern AVCapturePhotoOutput for iOS 10+
|
|
150
|
+
if (@available(iOS 10.0, *)) {
|
|
151
|
+
self.photoOutput = [[AVCapturePhotoOutput alloc] init];
|
|
152
|
+
if ([session canAddOutput:self.photoOutput]) {
|
|
153
|
+
[session addOutput:self.photoOutput];
|
|
154
|
+
NSLog(@"[IPDFCamera] Using AVCapturePhotoOutput (modern API)");
|
|
155
|
+
} else {
|
|
156
|
+
NSLog(@"[IPDFCamera] WARNING: Cannot add AVCapturePhotoOutput, falling back to AVCaptureStillImageOutput");
|
|
157
|
+
self.photoOutput = nil;
|
|
158
|
+
// Fallback to legacy API
|
|
159
|
+
self.stillImageOutput = [[AVCaptureStillImageOutput alloc] init];
|
|
160
|
+
if ([session canAddOutput:self.stillImageOutput]) {
|
|
161
|
+
[session addOutput:self.stillImageOutput];
|
|
162
|
+
NSLog(@"[IPDFCamera] Fallback successful: Using AVCaptureStillImageOutput");
|
|
163
|
+
} else {
|
|
164
|
+
NSLog(@"[IPDFCamera] CRITICAL ERROR: Cannot add any capture output!");
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
} else {
|
|
168
|
+
// Fallback for older iOS versions (< iOS 10)
|
|
169
|
+
self.stillImageOutput = [[AVCaptureStillImageOutput alloc] init];
|
|
170
|
+
[session addOutput:self.stillImageOutput];
|
|
171
|
+
NSLog(@"[IPDFCamera] Using AVCaptureStillImageOutput (legacy API)");
|
|
172
|
+
}
|
|
148
173
|
|
|
149
174
|
AVCaptureConnection *connection = [dataOutput.connections firstObject];
|
|
150
175
|
[connection setVideoOrientation:AVCaptureVideoOrientationPortrait];
|
|
@@ -420,6 +445,17 @@
|
|
|
420
445
|
return;
|
|
421
446
|
}
|
|
422
447
|
|
|
448
|
+
if (!completionHandler) {
|
|
449
|
+
NSLog(@"[IPDFCameraViewController] ERROR: No completion handler provided");
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
if (!self.captureSession || !self.captureSession.isRunning) {
|
|
454
|
+
NSLog(@"[IPDFCameraViewController] ERROR: captureSession is not running");
|
|
455
|
+
_isCapturing = NO;
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
|
|
423
459
|
__weak typeof(self) weakSelf = self;
|
|
424
460
|
|
|
425
461
|
[weakSelf hideGLKView:YES completion:^
|
|
@@ -432,76 +468,222 @@
|
|
|
432
468
|
|
|
433
469
|
_isCapturing = YES;
|
|
434
470
|
|
|
435
|
-
|
|
436
|
-
|
|
471
|
+
// Store completion handler for delegate callback
|
|
472
|
+
self.captureCompletionHandler = completionHandler;
|
|
473
|
+
|
|
474
|
+
// Use modern AVCapturePhotoOutput API (iOS 10+)
|
|
475
|
+
if (@available(iOS 10.0, *)) {
|
|
476
|
+
if (self.photoOutput) {
|
|
477
|
+
NSLog(@"[IPDFCameraViewController] Using AVCapturePhotoOutput to capture");
|
|
478
|
+
AVCapturePhotoSettings *settings = [AVCapturePhotoSettings photoSettings];
|
|
479
|
+
[self.photoOutput capturePhotoWithSettings:settings delegate:self];
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
NSLog(@"[IPDFCameraViewController] photoOutput is nil, trying fallback to stillImageOutput");
|
|
484
|
+
// Fallback to legacy API if photoOutput is not available
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
// Fallback: Use legacy AVCaptureStillImageOutput (iOS < 10 or when photoOutput failed)
|
|
488
|
+
{
|
|
489
|
+
if (!self.stillImageOutput) {
|
|
490
|
+
NSLog(@"[IPDFCameraViewController] ERROR: stillImageOutput is nil");
|
|
491
|
+
_isCapturing = NO;
|
|
492
|
+
self.captureCompletionHandler = nil;
|
|
493
|
+
[weakSelf hideGLKView:NO completion:nil];
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
AVCaptureConnection *videoConnection = nil;
|
|
498
|
+
for (AVCaptureConnection *connection in self.stillImageOutput.connections)
|
|
499
|
+
{
|
|
500
|
+
for (AVCaptureInputPort *port in [connection inputPorts])
|
|
501
|
+
{
|
|
502
|
+
if ([[port mediaType] isEqual:AVMediaTypeVideo] )
|
|
503
|
+
{
|
|
504
|
+
videoConnection = connection;
|
|
505
|
+
break;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
if (videoConnection) break;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
if (!videoConnection) {
|
|
512
|
+
NSLog(@"[IPDFCameraViewController] ERROR: No video connection found");
|
|
513
|
+
_isCapturing = NO;
|
|
514
|
+
self.captureCompletionHandler = nil;
|
|
515
|
+
[weakSelf hideGLKView:NO completion:nil];
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
NSLog(@"[IPDFCameraViewController] Using AVCaptureStillImageOutput (legacy)");
|
|
520
|
+
[self.stillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler: ^(CMSampleBufferRef imageSampleBuffer, NSError *error)
|
|
521
|
+
{
|
|
522
|
+
[weakSelf handleCapturedImageData:imageSampleBuffer error:error];
|
|
523
|
+
}];
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
// AVCapturePhotoCaptureDelegate method for iOS 11+
|
|
528
|
+
- (void)captureOutput:(AVCapturePhotoOutput *)output didFinishProcessingPhoto:(AVCapturePhoto *)photo error:(NSError *)error API_AVAILABLE(ios(11.0)) {
|
|
529
|
+
NSLog(@"[IPDFCameraViewController] didFinishProcessingPhoto called, error=%@", error);
|
|
530
|
+
|
|
531
|
+
if (error) {
|
|
532
|
+
NSLog(@"[IPDFCameraViewController] ERROR in didFinishProcessingPhoto: %@", error);
|
|
533
|
+
_isCapturing = NO;
|
|
534
|
+
self.captureCompletionHandler = nil;
|
|
535
|
+
[self hideGLKView:NO completion:nil];
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// iOS 11+ uses fileDataRepresentation
|
|
540
|
+
NSData *imageData = [photo fileDataRepresentation];
|
|
541
|
+
if (!imageData) {
|
|
542
|
+
NSLog(@"[IPDFCameraViewController] ERROR: Failed to get image data from photo");
|
|
543
|
+
_isCapturing = NO;
|
|
544
|
+
self.captureCompletionHandler = nil;
|
|
545
|
+
[self hideGLKView:NO completion:nil];
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
NSLog(@"[IPDFCameraViewController] Got image data from AVCapturePhoto, size: %lu bytes", (unsigned long)imageData.length);
|
|
550
|
+
[self processImageData:imageData];
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
// AVCapturePhotoCaptureDelegate method for iOS 10
|
|
554
|
+
- (void)captureOutput:(AVCapturePhotoOutput *)output didFinishProcessingPhotoSampleBuffer:(CMSampleBufferRef)photoSampleBuffer previewPhotoSampleBuffer:(CMSampleBufferRef)previewPhotoSampleBuffer resolvedSettings:(AVCaptureResolvedPhotoSettings *)resolvedSettings bracketSettings:(AVCaptureBracketedStillImageSettings *)bracketSettings error:(NSError *)error API_DEPRECATED("Use -captureOutput:didFinishProcessingPhoto:error: instead.", ios(10.0, 11.0)) {
|
|
555
|
+
NSLog(@"[IPDFCameraViewController] didFinishProcessingPhotoSampleBuffer called (iOS 10)");
|
|
556
|
+
|
|
557
|
+
if (error) {
|
|
558
|
+
NSLog(@"[IPDFCameraViewController] ERROR in didFinishProcessingPhotoSampleBuffer: %@", error);
|
|
559
|
+
_isCapturing = NO;
|
|
560
|
+
self.captureCompletionHandler = nil;
|
|
561
|
+
[self hideGLKView:NO completion:nil];
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
if (!photoSampleBuffer) {
|
|
566
|
+
NSLog(@"[IPDFCameraViewController] ERROR: photoSampleBuffer is nil");
|
|
567
|
+
_isCapturing = NO;
|
|
568
|
+
self.captureCompletionHandler = nil;
|
|
569
|
+
[self hideGLKView:NO completion:nil];
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
// iOS 10: Use AVCapturePhotoOutput's method for converting sample buffer
|
|
574
|
+
NSData *imageData = [AVCapturePhotoOutput JPEGPhotoDataRepresentationForJPEGSampleBuffer:photoSampleBuffer previewPhotoSampleBuffer:previewPhotoSampleBuffer];
|
|
575
|
+
|
|
576
|
+
if (!imageData) {
|
|
577
|
+
NSLog(@"[IPDFCameraViewController] ERROR: Failed to create JPEG data from photo sample buffer");
|
|
578
|
+
_isCapturing = NO;
|
|
579
|
+
self.captureCompletionHandler = nil;
|
|
580
|
+
[self hideGLKView:NO completion:nil];
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
NSLog(@"[IPDFCameraViewController] Got image data from photo sample buffer (iOS 10), size: %lu bytes", (unsigned long)imageData.length);
|
|
585
|
+
[self processImageData:imageData];
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
// Helper method for legacy AVCaptureStillImageOutput (iOS < 10)
|
|
589
|
+
- (void)handleCapturedImageData:(CMSampleBufferRef)sampleBuffer error:(NSError *)error {
|
|
590
|
+
NSLog(@"[IPDFCameraViewController] handleCapturedImageData called (legacy), error=%@, buffer=%@", error, sampleBuffer ? @"YES" : @"NO");
|
|
591
|
+
|
|
592
|
+
if (error) {
|
|
593
|
+
NSLog(@"[IPDFCameraViewController] ERROR capturing image: %@", error);
|
|
594
|
+
_isCapturing = NO;
|
|
595
|
+
self.captureCompletionHandler = nil;
|
|
596
|
+
[self hideGLKView:NO completion:nil];
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
if (!sampleBuffer) {
|
|
601
|
+
NSLog(@"[IPDFCameraViewController] ERROR: sampleBuffer is nil");
|
|
602
|
+
_isCapturing = NO;
|
|
603
|
+
self.captureCompletionHandler = nil;
|
|
604
|
+
[self hideGLKView:NO completion:nil];
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
// iOS < 10: Use AVCaptureStillImageOutput's method
|
|
609
|
+
NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:sampleBuffer];
|
|
610
|
+
|
|
611
|
+
if (!imageData) {
|
|
612
|
+
NSLog(@"[IPDFCameraViewController] ERROR: Failed to create image data from sample buffer (legacy)");
|
|
613
|
+
_isCapturing = NO;
|
|
614
|
+
self.captureCompletionHandler = nil;
|
|
615
|
+
[self hideGLKView:NO completion:nil];
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
NSLog(@"[IPDFCameraViewController] Got image data from still image output (legacy), size: %lu bytes", (unsigned long)imageData.length);
|
|
620
|
+
[self processImageData:imageData];
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
- (void)processImageData:(NSData *)imageData {
|
|
624
|
+
NSLog(@"[IPDFCameraViewController] processImageData called, imageData size: %lu bytes", (unsigned long)imageData.length);
|
|
625
|
+
|
|
626
|
+
__weak typeof(self) weakSelf = self;
|
|
627
|
+
void (^completionHandler)(UIImage *, UIImage *, CIRectangleFeature *) = self.captureCompletionHandler;
|
|
628
|
+
|
|
629
|
+
if (!completionHandler) {
|
|
630
|
+
NSLog(@"[IPDFCameraViewController] ERROR: completionHandler is nil");
|
|
631
|
+
_isCapturing = NO;
|
|
632
|
+
[self hideGLKView:NO completion:nil];
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
if (self.cameraViewType == IPDFCameraViewTypeBlackAndWhite || self.isBorderDetectionEnabled)
|
|
437
637
|
{
|
|
438
|
-
|
|
638
|
+
CIImage *enhancedImage = [CIImage imageWithData:imageData];
|
|
639
|
+
|
|
640
|
+
if (self.cameraViewType == IPDFCameraViewTypeBlackAndWhite)
|
|
641
|
+
{
|
|
642
|
+
enhancedImage = [self filteredImageUsingEnhanceFilterOnImage:enhancedImage];
|
|
643
|
+
}
|
|
644
|
+
else
|
|
439
645
|
{
|
|
440
|
-
|
|
646
|
+
enhancedImage = [self filteredImageUsingContrastFilterOnImage:enhancedImage];
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
if (self.isBorderDetectionEnabled && rectangleDetectionConfidenceHighEnough(_imageDedectionConfidence))
|
|
650
|
+
{
|
|
651
|
+
CIRectangleFeature *rectangleFeature = [self biggestRectangleInRectangles:[[self highAccuracyRectangleDetector] featuresInImage:enhancedImage]];
|
|
652
|
+
|
|
653
|
+
if (rectangleFeature)
|
|
441
654
|
{
|
|
442
|
-
|
|
443
|
-
|
|
655
|
+
enhancedImage = [self correctPerspectiveForImage:enhancedImage withFeatures:rectangleFeature];
|
|
656
|
+
|
|
657
|
+
UIGraphicsBeginImageContext(CGSizeMake(enhancedImage.extent.size.height, enhancedImage.extent.size.width));
|
|
658
|
+
[[UIImage imageWithCIImage:enhancedImage scale:1.0 orientation:UIImageOrientationRight] drawInRect:CGRectMake(0,0, enhancedImage.extent.size.height, enhancedImage.extent.size.width)];
|
|
659
|
+
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
|
|
660
|
+
UIImage *initialImage = [UIImage imageWithData:imageData];
|
|
661
|
+
UIGraphicsEndImageContext();
|
|
662
|
+
|
|
663
|
+
[weakSelf hideGLKView:NO completion:nil];
|
|
664
|
+
completionHandler(image, initialImage, rectangleFeature);
|
|
665
|
+
} else {
|
|
666
|
+
// No rectangle detected, return original image
|
|
667
|
+
NSLog(@"[IPDFCameraViewController] No rectangle detected during manual capture, returning original image");
|
|
668
|
+
[weakSelf hideGLKView:NO completion:nil];
|
|
669
|
+
UIImage *initialImage = [UIImage imageWithData:imageData];
|
|
670
|
+
completionHandler(initialImage, initialImage, nil);
|
|
444
671
|
}
|
|
672
|
+
} else {
|
|
673
|
+
[weakSelf hideGLKView:NO completion:nil];
|
|
674
|
+
UIImage *initialImage = [UIImage imageWithData:imageData];
|
|
675
|
+
completionHandler(initialImage, initialImage, nil);
|
|
445
676
|
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
if (weakSelf.cameraViewType == IPDFCameraViewTypeBlackAndWhite)
|
|
458
|
-
{
|
|
459
|
-
enhancedImage = [self filteredImageUsingEnhanceFilterOnImage:enhancedImage];
|
|
460
|
-
}
|
|
461
|
-
else
|
|
462
|
-
{
|
|
463
|
-
enhancedImage = [self filteredImageUsingContrastFilterOnImage:enhancedImage];
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
if (weakSelf.isBorderDetectionEnabled && rectangleDetectionConfidenceHighEnough(_imageDedectionConfidence))
|
|
467
|
-
{
|
|
468
|
-
CIRectangleFeature *rectangleFeature = [self biggestRectangleInRectangles:[[self highAccuracyRectangleDetector] featuresInImage:enhancedImage]];
|
|
469
|
-
|
|
470
|
-
if (rectangleFeature)
|
|
471
|
-
{
|
|
472
|
-
enhancedImage = [self correctPerspectiveForImage:enhancedImage withFeatures:rectangleFeature];
|
|
473
|
-
|
|
474
|
-
UIGraphicsBeginImageContext(CGSizeMake(enhancedImage.extent.size.height, enhancedImage.extent.size.width));
|
|
475
|
-
[[UIImage imageWithCIImage:enhancedImage scale:1.0 orientation:UIImageOrientationRight] drawInRect:CGRectMake(0,0, enhancedImage.extent.size.height, enhancedImage.extent.size.width)];
|
|
476
|
-
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
|
|
477
|
-
UIImage *initialImage = [UIImage imageWithData:imageData];
|
|
478
|
-
UIGraphicsEndImageContext();
|
|
479
|
-
|
|
480
|
-
[weakSelf hideGLKView:NO completion:nil];
|
|
481
|
-
completionHandler(image, initialImage, rectangleFeature);
|
|
482
|
-
} else {
|
|
483
|
-
// No rectangle detected, return original image
|
|
484
|
-
NSLog(@"[IPDFCameraViewController] No rectangle detected during manual capture, returning original image");
|
|
485
|
-
[weakSelf hideGLKView:NO completion:nil];
|
|
486
|
-
UIImage *initialImage = [UIImage imageWithData:imageData];
|
|
487
|
-
completionHandler(initialImage, initialImage, nil);
|
|
488
|
-
}
|
|
489
|
-
} else {
|
|
490
|
-
[weakSelf hideGLKView:NO completion:nil];
|
|
491
|
-
UIImage *initialImage = [UIImage imageWithData:imageData];
|
|
492
|
-
completionHandler(initialImage, initialImage, nil);
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
}
|
|
496
|
-
else
|
|
497
|
-
{
|
|
498
|
-
[weakSelf hideGLKView:NO completion:nil];
|
|
499
|
-
UIImage *initialImage = [UIImage imageWithData:imageData];
|
|
500
|
-
completionHandler(initialImage, initialImage, nil);
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
_isCapturing = NO;
|
|
504
|
-
}];
|
|
677
|
+
}
|
|
678
|
+
else
|
|
679
|
+
{
|
|
680
|
+
[weakSelf hideGLKView:NO completion:nil];
|
|
681
|
+
UIImage *initialImage = [UIImage imageWithData:imageData];
|
|
682
|
+
completionHandler(initialImage, initialImage, nil);
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
_isCapturing = NO;
|
|
686
|
+
self.captureCompletionHandler = nil;
|
|
505
687
|
}
|
|
506
688
|
|
|
507
689
|
- (void)hideGLKView:(BOOL)hidden completion:(void(^)())completion
|
|
@@ -34,8 +34,22 @@ RCT_EXPORT_VIEW_PROPERTY(quality, float)
|
|
|
34
34
|
RCT_EXPORT_VIEW_PROPERTY(brightness, float)
|
|
35
35
|
RCT_EXPORT_VIEW_PROPERTY(contrast, float)
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
// Main capture method - uses the last created scanner view
|
|
38
|
+
RCT_EXPORT_METHOD(capture) {
|
|
39
|
+
NSLog(@"[RNPdfScannerManager] capture called, scannerView: %@", _scannerView ? @"YES" : @"NO");
|
|
40
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
41
|
+
if (!self->_scannerView) {
|
|
42
|
+
NSLog(@"[RNPdfScannerManager] ERROR: No scanner view available");
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
NSLog(@"[RNPdfScannerManager] Calling capture on view: %@", self->_scannerView);
|
|
46
|
+
[self->_scannerView capture];
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Alternative method that takes reactTag - for future use
|
|
51
|
+
RCT_EXPORT_METHOD(captureWithTag:(nonnull NSNumber *)reactTag) {
|
|
52
|
+
NSLog(@"[RNPdfScannerManager] captureWithTag called with reactTag: %@", reactTag);
|
|
39
53
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
40
54
|
UIView *view = [self.bridge.uiManager viewForReactTag:reactTag];
|
|
41
55
|
if (!view || ![view isKindOfClass:[DocumentScannerView class]]) {
|
|
@@ -48,12 +62,6 @@ RCT_EXPORT_METHOD(capture:(nonnull NSNumber *)reactTag) {
|
|
|
48
62
|
});
|
|
49
63
|
}
|
|
50
64
|
|
|
51
|
-
// Deprecated - kept for backward compatibility
|
|
52
|
-
RCT_EXPORT_METHOD(captureGlobal) {
|
|
53
|
-
NSLog(@"[RNPdfScannerManager] captureGlobal called (deprecated), scannerView: %@", _scannerView ? @"YES" : @"NO");
|
|
54
|
-
[_scannerView capture];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
65
|
- (UIView*) view {
|
|
58
66
|
_scannerView = [[DocumentScannerView alloc] init];
|
|
59
67
|
// Force layout update
|