react-native-rectangle-doc-scanner 1.14.0 → 1.16.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.
@@ -0,0 +1,9 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(node:*)"
5
+ ],
6
+ "deny": [],
7
+ "ask": []
8
+ }
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "1.14.0",
3
+ "version": "1.16.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -15,7 +15,8 @@
15
15
  },
16
16
  "scripts": {
17
17
  "build": "tsc",
18
- "prepare": "yarn build"
18
+ "prepare": "yarn build",
19
+ "postinstall": "patch-package"
19
20
  },
20
21
  "peerDependencies": {
21
22
  "@shopify/react-native-skia": "*",
@@ -26,6 +27,7 @@
26
27
  "devDependencies": {
27
28
  "@types/react": "^18.2.41",
28
29
  "@types/react-native": "0.73.0",
30
+ "patch-package": "^8.0.0",
29
31
  "typescript": "^5.3.3"
30
32
  },
31
33
  "dependencies": {
@@ -0,0 +1,60 @@
1
+ diff --git a/node_modules/react-native-document-scanner/ios/IPDFCameraViewController.m b/node_modules/react-native-document-scanner/ios/IPDFCameraViewController.m
2
+ index 1234567..abcdefg 100644
3
+ --- a/node_modules/react-native-document-scanner/ios/IPDFCameraViewController.m
4
+ +++ b/node_modules/react-native-document-scanner/ios/IPDFCameraViewController.m
5
+ @@ -76,7 +76,7 @@
6
+ GLKView *view = [[GLKView alloc] initWithFrame:self.bounds];
7
+ view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
8
+ view.translatesAutoresizingMaskIntoConstraints = YES;
9
+ view.context = self.context;
10
+ - view.contentScaleFactor = 1.0f;
11
+ + view.contentScaleFactor = [UIScreen mainScreen].scale;
12
+ view.drawableDepthFormat = GLKViewDrawableDepthFormat24;
13
+ [self insertSubview:view atIndex:0];
14
+ _glkView = view;
15
+ @@ -115,7 +115,16 @@
16
+
17
+ NSError *error = nil;
18
+ AVCaptureDeviceInput* input = [AVCaptureDeviceInput deviceInputWithDevice:device error:&error];
19
+ - session.sessionPreset = AVCaptureSessionPresetPhoto;
20
+ +
21
+ + // Try to use the highest quality preset available
22
+ + if ([session canSetSessionPreset:AVCaptureSessionPreset3840x2160]) {
23
+ + session.sessionPreset = AVCaptureSessionPreset3840x2160; // 4K
24
+ + } else if ([session canSetSessionPreset:AVCaptureSessionPreset1920x1080]) {
25
+ + session.sessionPreset = AVCaptureSessionPreset1920x1080; // Full HD
26
+ + } else {
27
+ + session.sessionPreset = AVCaptureSessionPresetPhoto; // Fallback
28
+ + }
29
+ +
30
+ [session addInput:input];
31
+
32
+ AVCaptureVideoDataOutput *dataOutput = [[AVCaptureVideoDataOutput alloc] init];
33
+ @@ -134,6 +143,14 @@
34
+ [session addOutput:dataOutput];
35
+
36
+ self.stillImageOutput = [[AVCaptureStillImageOutput alloc] init];
37
+ +
38
+ + // Set high quality JPEG output
39
+ + NSDictionary *outputSettings = @{
40
+ + AVVideoCodecKey: AVVideoCodecJPEG,
41
+ + AVVideoQualityKey: @(0.95)
42
+ + };
43
+ + [self.stillImageOutput setOutputSettings:outputSettings];
44
+ +
45
+ [session addOutput:self.stillImageOutput];
46
+
47
+ AVCaptureConnection *connection = [dataOutput.connections firstObject];
48
+ @@ -405,8 +422,10 @@
49
+ {
50
+ enhancedImage = [self correctPerspectiveForImage:enhancedImage withFeatures:rectangleFeature];
51
+
52
+ - UIGraphicsBeginImageContext(CGSizeMake(enhancedImage.extent.size.height, enhancedImage.extent.size.width));
53
+ - [[UIImage imageWithCIImage:enhancedImage scale:1.0 orientation:UIImageOrientationRight] drawInRect:CGRectMake(0,0, enhancedImage.extent.size.height, enhancedImage.extent.size.width)];
54
+ + CGSize imageSize = CGSizeMake(enhancedImage.extent.size.height, enhancedImage.extent.size.width);
55
+ + CGFloat scale = [UIScreen mainScreen].scale;
56
+ + UIGraphicsBeginImageContextWithOptions(imageSize, NO, scale);
57
+ + [[UIImage imageWithCIImage:enhancedImage scale:scale orientation:UIImageOrientationRight] drawInRect:CGRectMake(0,0, imageSize.width, imageSize.height)];
58
+ UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
59
+ UIImage *initialImage = [UIImage imageWithData:imageData];
60
+ UIGraphicsEndImageContext();