@mleonard9/vin-scanner 1.4.5 → 1.4.7

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/README.md CHANGED
@@ -51,7 +51,8 @@ export function VinScannerExample(): JSX.Element {
51
51
 
52
52
  const options = useMemo(
53
53
  () => ({
54
- barcode: { formats: ['code-39', 'code-128', 'pdf-417'] },
54
+ // Include QR for corner codes on auction tags
55
+ barcode: { formats: ['code-39', 'code-128', 'pdf-417', 'qr'] },
55
56
  onResult: (candidates, event) => {
56
57
  setResults(candidates);
57
58
  console.log(`Scan took ${event.duration}ms`);
@@ -340,7 +341,7 @@ Phase 1 optimizations dramatically improve scanning performance through native R
340
341
  ```tsx
341
342
  const { frameProcessor } = useVinScanner({
342
343
  detection: {
343
- // Focus on center 50% of frame
344
+ // Focus on center 50% of frame (set null to cover full frame / corner QR)
344
345
  scanRegion: { x: 0.25, y: 0.25, width: 0.5, height: 0.5 },
345
346
  textScanInterval: 2,
346
347
  },
@@ -1,6 +1,7 @@
1
1
  package com.visioncamerabarcodescanner
2
2
 
3
3
  import android.media.Image
4
+ import android.util.Log
4
5
  import com.google.android.gms.tasks.Task
5
6
  import com.google.android.gms.tasks.Tasks
6
7
  import com.google.mlkit.vision.barcode.BarcodeScannerOptions
@@ -182,7 +183,10 @@ class VisionCameraBarcodeScannerModule(
182
183
  }
183
184
  response
184
185
  } catch (e: Exception) {
185
- throw Exception("Error processing barcode scanner: $e")
186
+ Log.e("vinScannerBarcode", "Error processing barcode scanner", e)
187
+ val response = HashMap<String, Any?>()
188
+ response["detections"] = emptyList<Map<String, Any?>>()
189
+ return response
186
190
  }
187
191
  }
188
192
  }
@@ -1,6 +1,7 @@
1
1
  package com.visioncameratextrecognition
2
2
 
3
3
  import android.media.Image
4
+ import android.util.Log
4
5
  import com.google.android.gms.tasks.Task
5
6
  import com.google.android.gms.tasks.Tasks
6
7
  import com.google.mlkit.vision.common.InputImage
@@ -224,7 +225,10 @@ class VisionCameraTextRecognitionModule(
224
225
  }
225
226
  return response
226
227
  } catch (e: Exception) {
227
- throw Exception("Error processing text recognition: $e ")
228
+ Log.e("vinScannerText", "Error processing text recognition", e)
229
+ val response = HashMap<String, Any?>()
230
+ response["detections"] = ArrayList<Map<String, Any?>>()
231
+ return response
228
232
  }
229
233
  }
230
234
  }
@@ -37,15 +37,26 @@
37
37
  return self;
38
38
  }
39
39
 
40
- - (NSDictionary*)cropImage:(MLKVisionImage*)image
40
+ - (UIImage *)extractUIImage:(MLKVisionImage *)image {
41
+ // MLKVisionImage may not expose `.image` when created from CMSampleBuffer.
42
+ if ([image respondsToSelector:@selector(image)]) {
43
+ #pragma clang diagnostic push
44
+ #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
45
+ return [image performSelector:@selector(image)];
46
+ #pragma clang diagnostic pop
47
+ }
48
+ return nil;
49
+ }
50
+
51
+ - (NSDictionary*)cropImage:(MLKVisionImage*)image
41
52
  withRegion:(NSDictionary*)scanRegion {
42
53
  double x = [scanRegion[@"x"] doubleValue];
43
54
  double y = [scanRegion[@"y"] doubleValue];
44
55
  double width = [scanRegion[@"width"] doubleValue];
45
56
  double height = [scanRegion[@"height"] doubleValue];
46
57
 
47
- // Get image dimensions from the underlying UIImage
48
- UIImage *uiImage = image.image;
58
+ // Get image dimensions from the underlying UIImage if available
59
+ UIImage *uiImage = [self extractUIImage:image];
49
60
  if (!uiImage) {
50
61
  return @{@"image": image, @"offsetX": @(0), @"offsetY": @(0)};
51
62
  }
@@ -78,6 +78,16 @@
78
78
  return fallback;
79
79
  }
80
80
 
81
+ - (UIImage *)extractUIImage:(MLKVisionImage *)image {
82
+ if ([image respondsToSelector:@selector(image)]) {
83
+ #pragma clang diagnostic push
84
+ #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
85
+ return [image performSelector:@selector(image)];
86
+ #pragma clang diagnostic pop
87
+ }
88
+ return nil;
89
+ }
90
+
81
91
  - (NSDictionary*)cropImage:(MLKVisionImage*)image
82
92
  withRegion:(NSDictionary*)scanRegion {
83
93
  double x = [scanRegion[@"x"] doubleValue];
@@ -85,8 +95,8 @@
85
95
  double width = [scanRegion[@"width"] doubleValue];
86
96
  double height = [scanRegion[@"height"] doubleValue];
87
97
 
88
- // Get image dimensions from the underlying UIImage
89
- UIImage *uiImage = image.image;
98
+ // Get image dimensions from the underlying UIImage if available
99
+ UIImage *uiImage = [self extractUIImage:image];
90
100
  if (!uiImage) {
91
101
  return @{@"image": image, @"offsetX": @(0), @"offsetY": @(0)};
92
102
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mleonard9/vin-scanner",
3
- "version": "1.4.5",
3
+ "version": "1.4.7",
4
4
  "description": "High-performance VIN scanner for React Native Vision Camera powered by Google ML Kit barcode + text recognition.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -32,8 +32,7 @@
32
32
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
33
33
  "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
34
34
  "prepare": "bob build",
35
- "release": "release-it",
36
- "publish": "npm publish"
35
+ "release": "release-it"
37
36
  },
38
37
  "keywords": [
39
38
  "react-native",