@thegrizzlylabs/react-native-genius-scan 6.0.0-beta01 → 6.0.0-beta03

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.
Files changed (51) hide show
  1. package/README.md +21 -0
  2. package/android/build.gradle +1 -1
  3. package/android/src/main/java/com/geniusscansdk/reactnative/RNGeniusScanModule.java +9 -4
  4. package/ios/GSSDK/GSSDK.xcframework/ios-arm64/GSSDK.framework/Assets.car +0 -0
  5. package/ios/GSSDK/GSSDK.xcframework/ios-arm64/GSSDK.framework/DeviceGuru_DeviceGuru.bundle/Info.plist +0 -0
  6. package/ios/GSSDK/GSSDK.xcframework/ios-arm64/GSSDK.framework/GSSDK +0 -0
  7. package/ios/GSSDK/GSSDK.xcframework/ios-arm64/GSSDK.framework/Headers/GSKDocumentDetector.h +5 -3
  8. package/ios/GSSDK/GSSDK.xcframework/ios-arm64/GSSDK.framework/Headers/GSKQuadrangle.h +1 -7
  9. package/ios/GSSDK/GSSDK.xcframework/ios-arm64/GSSDK.framework/Headers/GSKScanFlowError+PluginPayload.h +11 -0
  10. package/ios/GSSDK/GSSDK.xcframework/ios-arm64/GSSDK.framework/Headers/GSKScanProcessor.h +6 -4
  11. package/ios/GSSDK/GSSDK.xcframework/ios-arm64/GSSDK.framework/Headers/GSSDK-Swift.h +91 -54
  12. package/ios/GSSDK/GSSDK.xcframework/ios-arm64/GSSDK.framework/Headers/GSSDK.h +1 -3
  13. package/ios/GSSDK/GSSDK.xcframework/ios-arm64/GSSDK.framework/Headers/UIImage+GSKUtils.h +5 -1
  14. package/ios/GSSDK/GSSDK.xcframework/ios-arm64/GSSDK.framework/Info.plist +0 -0
  15. package/ios/GSSDK/GSSDK.xcframework/ios-arm64/GSSDK.framework/Modules/GSSDK.swiftmodule/arm64-apple-ios.abi.json +1975 -1090
  16. package/ios/GSSDK/GSSDK.xcframework/ios-arm64/GSSDK.framework/Modules/GSSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +56 -49
  17. package/ios/GSSDK/GSSDK.xcframework/ios-arm64/GSSDK.framework/Modules/GSSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  18. package/ios/GSSDK/GSSDK.xcframework/ios-arm64/GSSDK.framework/Modules/GSSDK.swiftmodule/arm64-apple-ios.swiftinterface +56 -49
  19. package/ios/GSSDK/GSSDK.xcframework/ios-arm64/GSSDK.framework/PhoneNumberKit_GSKPhoneNumberKit.bundle/Info.plist +0 -0
  20. package/ios/GSSDK/GSSDK.xcframework/ios-arm64/GSSDK.framework/en.lproj/GSSDK.strings +0 -0
  21. package/ios/GSSDK/GSSDK.xcframework/ios-arm64/GSSDK.framework/fr.lproj/GSSDK.strings +0 -0
  22. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/Assets.car +0 -0
  23. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/DeviceGuru_DeviceGuru.bundle/Info.plist +0 -0
  24. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/GSSDK +0 -0
  25. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/Headers/GSKDocumentDetector.h +5 -3
  26. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/Headers/GSKQuadrangle.h +1 -7
  27. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/Headers/GSKScanFlowError+PluginPayload.h +11 -0
  28. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/Headers/GSKScanProcessor.h +6 -4
  29. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/Headers/GSSDK-Swift.h +182 -108
  30. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/Headers/GSSDK.h +1 -3
  31. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/Headers/UIImage+GSKUtils.h +5 -1
  32. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/Info.plist +0 -0
  33. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/Modules/GSSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +1975 -1090
  34. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/Modules/GSSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +56 -49
  35. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/Modules/GSSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  36. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/Modules/GSSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +56 -49
  37. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/Modules/GSSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +1975 -1090
  38. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/Modules/GSSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +56 -49
  39. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/Modules/GSSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  40. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/Modules/GSSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +56 -49
  41. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/PhoneNumberKit_GSKPhoneNumberKit.bundle/Info.plist +0 -0
  42. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/en.lproj/GSSDK.strings +0 -0
  43. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/fr.lproj/GSSDK.strings +0 -0
  44. package/ios/RNGeniusScan.m +22 -7
  45. package/package.json +1 -1
  46. package/ios/GSSDK/GSSDK.xcframework/ios-arm64/GSSDK.framework/Headers/GSKEditableFrame.h +0 -67
  47. package/ios/GSSDK/GSSDK.xcframework/ios-arm64/GSSDK.framework/Headers/GSKMBProgressHUD.h +0 -410
  48. package/ios/GSSDK/GSSDK.xcframework/ios-arm64/GSSDK.framework/Headers/GSKShutterView.h +0 -28
  49. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/Headers/GSKEditableFrame.h +0 -67
  50. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/Headers/GSKMBProgressHUD.h +0 -410
  51. package/ios/GSSDK/GSSDK.xcframework/ios-arm64_x86_64-simulator/GSSDK.framework/Headers/GSKShutterView.h +0 -28
package/README.md CHANGED
@@ -193,6 +193,27 @@ RNGeniusScan.scanWithConfiguration({ source: 'image', sourceImageUrl: imageUri }
193
193
  })
194
194
  ```
195
195
 
196
+ ### Error handling
197
+
198
+ Errors are rejected with a structured payload:
199
+
200
+ - `code`: standardized error code
201
+ - `message`: user-facing message
202
+ - `recovery_message`: recovery suggestion (may be empty)
203
+ - `underlying_error`: stringified underlying error (may be empty)
204
+
205
+ Example:
206
+
207
+ ```javascript
208
+ RNGeniusScan.scanWithConfiguration({ source: 'camera' })
209
+ .catch((error) => {
210
+ console.log(error.code);
211
+ console.log(error.message);
212
+ console.log(error.recovery_message);
213
+ console.log(error.underlying_error);
214
+ })
215
+ ```
216
+
196
217
  # FAQ
197
218
 
198
219
  ## How do I get the UI translated to another language?
@@ -42,5 +42,5 @@ rootProject.allprojects {
42
42
 
43
43
  dependencies {
44
44
  implementation 'com.facebook.react:react-native:+'
45
- implementation 'com.geniusscansdk:gssdk:6.0.0-beta01'
45
+ implementation 'com.geniusscansdk:gssdk:6.0.0-beta03'
46
46
  }
@@ -15,7 +15,7 @@ import com.facebook.react.bridge.ReactMethod;
15
15
  import com.facebook.react.bridge.ReadableMap;
16
16
  import com.facebook.react.bridge.WritableMap;
17
17
  import com.facebook.react.bridge.WritableNativeMap;
18
- import com.geniusscansdk.barcodeflow.BarcodeFlow;
18
+ import com.geniusscansdk.barcodeflow.BarcodeScanFlow;
19
19
  import com.geniusscansdk.scanflow.PluginBridge;
20
20
  import com.geniusscansdk.scanflow.PromiseResult;
21
21
  import com.geniusscansdk.scanflow.ScanFlow;
@@ -42,7 +42,12 @@ public class RNGeniusScanModule extends ReactContextBaseJavaModule {
42
42
  // We don't work directly with Promise here as it is a React Native Bridge module
43
43
  private void resolvePromiseWithPromiseResult(Promise promise, PromiseResult promiseResult) {
44
44
  if (promiseResult.isError) {
45
- promise.reject(promiseResult.errorCode, promiseResult.errorMessage);
45
+ Map<String, String> error = promiseResult.error;
46
+ if (error != null) {
47
+ promise.reject(error.get("code"), error.get("message"), Arguments.makeNativeMap(error));
48
+ } else {
49
+ promise.reject("internal_error", "No error payload");
50
+ }
46
51
  } else if (promiseResult.result == null) {
47
52
  promise.resolve(null);
48
53
  } else {
@@ -57,10 +62,10 @@ public class RNGeniusScanModule extends ReactContextBaseJavaModule {
57
62
  PromiseResult promiseResult = PluginBridge.getPromiseResultFromActivityResult(requestCode, resultCode, intent);
58
63
  if (promiseResult != null) {
59
64
  Promise promise = null;
60
- if (requestCode == ScanFlow.SCAN_REQUEST) {
65
+ if (requestCode == ScanFlow.REQUEST_CODE) {
61
66
  promise = mScanPromise;
62
67
  mScanPromise = null;
63
- } else if (requestCode == BarcodeFlow.REQUEST_CODE) {
68
+ } else if (requestCode == BarcodeScanFlow.REQUEST_CODE) {
64
69
  promise = mBarcodeScanPromise;
65
70
  mBarcodeScanPromise = null;
66
71
  }
@@ -52,6 +52,8 @@ NS_ASSUME_NONNULL_BEGIN
52
52
  @end
53
53
 
54
54
  /**
55
+ Detects the frame of a document in an image.
56
+
55
57
  - Performance:
56
58
  A document detector can be expensive to create: it's recommended to keep a reference to it if it's needed several times in a row.
57
59
  */
@@ -61,12 +63,12 @@ NS_ASSUME_NONNULL_BEGIN
61
63
  - (instancetype)init;
62
64
 
63
65
  /**
64
- Detects the quadrangle corresponding to the edges of a document in video frame
66
+ Detects the quadrangle corresponding to the edges of a document in a video frame
65
67
 
66
68
  @param sampleBuffer a YCbCr sample buffer of a video frame. Make sure the video output generating these frames is configured with the pixel format kCVPixelFormatType_420YpCbCr8BiPlanarFullRange
67
69
  @param error On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
68
70
 
69
- @return The detected quadrangle or nil if an error occured.
71
+ @return The detected quadrangle or nil if an error occurred.
70
72
  */
71
73
  - (GSKDocumentDetectionResult * _Nullable)detectDocumentInSampleBuffer:(CMSampleBufferRef)sampleBuffer error:(NSError * _Nullable *)error;
72
74
 
@@ -76,7 +78,7 @@ NS_ASSUME_NONNULL_BEGIN
76
78
  @param image The photo to detect a document in
77
79
  @param error On input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify nil for this parameter if you do not want the error information.
78
80
 
79
- @return The detected quadrangle or nil if an error occured.
81
+ @return The detected quadrangle or nil if an error occurred.
80
82
  */
81
83
  - (GSKDocumentDetectionResult * _Nullable)detectDocumentInImage:(UIImage *)image error:(NSError * _Nullable *)error;
82
84
 
@@ -9,14 +9,8 @@
9
9
 
10
10
  #import <Foundation/Foundation.h>
11
11
  #import <CoreGraphics/CoreGraphics.h>
12
-
12
+ #import <GSSDK/GSKRotation.h>
13
13
  #import <UIKit/UIKit.h>
14
- #import "GSKRotation.h"
15
-
16
- extern const CGPoint GSKQuadrangleTopRightPoint;
17
- extern const CGPoint GSKQuadrangleTopLeftPoint;
18
- extern const CGPoint GSKQuadrangleBottomLeftPoint;
19
- extern const CGPoint GSKQuadrangleBottomRightPoint;
20
14
 
21
15
  NS_ASSUME_NONNULL_BEGIN
22
16
 
@@ -0,0 +1,11 @@
1
+ #import <Foundation/Foundation.h>
2
+
3
+ NS_ASSUME_NONNULL_BEGIN
4
+
5
+ @interface GSKScanFlowErrorPayload : NSObject
6
+
7
+ + (NSDictionary<NSString *, NSString *> *)payloadFromNSError:(NSError *)error;
8
+
9
+ @end
10
+
11
+ NS_ASSUME_NONNULL_END
@@ -32,9 +32,11 @@ NS_ASSUME_NONNULL_BEGIN
32
32
  The document processor is the central class of the GSSDK's image processing algorithms.
33
33
 
34
34
  With the document processor, you can correct the distortion in your documents, as well as improve their legibility.
35
- If you are only interested in the detecting a document in an image, please refer to GSKDocumentDetector.
35
+ The scan processor can also analyze the scan and evaluate its readability.
36
36
 
37
- Warning: `GSKScanProcessor` is not thread-safe; you shouldn't reuse the same instance accross threads.
37
+ If you are only interested in detecting a document in an image, please refer to ``GSKDocumentDetector``. If you are looking to detect whether an image contains a document, use ``GSKDocumentFinder`` instead.
38
+
39
+ Warning: `GSKScanProcessor` is not thread-safe; you shouldn't reuse the same instance across threads.
38
40
  */
39
41
  @interface GSKScanProcessor : NSObject
40
42
 
@@ -44,8 +46,8 @@ NS_ASSUME_NONNULL_BEGIN
44
46
 
45
47
  @param configuration The configuration of the different steps of the processing.
46
48
 
47
- @returns The result of the processing, nil if there is an error. The results includes the parameters that have been selected for the different processing steps,
48
- as well as the temporary path were the output was written. The output is written in a temporary folder. The caller can take ownership of this file.
49
+ @returns The result of the processing, nil if there is an error. The result includes the parameters that have been selected for the different processing steps,
50
+ as well as the temporary path where the output was written. The output is written in a temporary folder. The caller can take ownership of this file.
49
51
  By default, the best output format will be chosen by this method. For instance, if the monochrome enhancement was selected, the output will not
50
52
  be saved as JPEG but as a 1-bit PNG image. The result's processedImagePath file extension will reflect this.
51
53
  */
@@ -1,6 +1,6 @@
1
1
  #if 0
2
2
  #elif defined(__arm64__) && __arm64__
3
- // Generated by Apple Swift version 6.2 effective-5.10 (swiftlang-6.2.0.19.9 clang-1700.3.19.1)
3
+ // Generated by Apple Swift version 6.2.3 effective-5.10 (swiftlang-6.2.3.3.21 clang-1700.6.3.2)
4
4
  #ifndef GSSDK_SWIFT_H
5
5
  #define GSSDK_SWIFT_H
6
6
  #pragma clang diagnostic push
@@ -359,7 +359,14 @@ SWIFT_CLASS("_TtC5GSSDK10GSKBarcode")
359
359
  @class GSKBarcodeScanFlowConfiguration;
360
360
  @class UIViewController;
361
361
  @class GSKBarcodeScanFlowResult;
362
- /// A flow for scanning barcodes and QR codes.
362
+ /// A UI flow for scanning barcodes and QR codes using the device camera.
363
+ /// Configure the flow with <code>GSKBarcodeScanFlowConfiguration</code> to select the
364
+ /// barcode types to detect and whether batch mode is enabled. Present it from
365
+ /// a view controller and await a <code>GSKBarcodeScanFlowResult</code> containing the
366
+ /// decoded barcodes.
367
+ /// important:
368
+ /// Camera access requires <code>NSCameraUsageDescription</code> in
369
+ /// <code>Info.plist</code>.
363
370
  SWIFT_CLASS("_TtC5GSSDK18GSKBarcodeScanFlow")
364
371
  @interface GSKBarcodeScanFlow : NSObject
365
372
  /// Initializes a new barcode scan flow
@@ -399,7 +406,7 @@ SWIFT_CLASS("_TtC5GSSDK18GSKBarcodeScanFlow")
399
406
  /// do {
400
407
  /// let result = try await flow.resultByStarting(fromViewController: self)
401
408
  /// print("Scanned codes: \(result.barcodes.map { $0.value })")
402
- /// } catch GSKBarcodeScanFlowError.userCancellation {
409
+ /// } catch GSKScanFlowError.cancellation {
403
410
  /// print("User canceled scanning")
404
411
  /// } catch {
405
412
  /// print("Scanning failed: \(error)")
@@ -419,7 +426,7 @@ SWIFT_CLASS("_TtC5GSSDK18GSKBarcodeScanFlow")
419
426
  ///
420
427
  /// <ul>
421
428
  /// <li>
422
- /// Typically throws a <code>GSKBarcodeScanFlowError</code>
429
+ /// A <code>GSKScanFlowError</code>
423
430
  /// </li>
424
431
  /// </ul>
425
432
  ///
@@ -473,7 +480,7 @@ SWIFT_CLASS("_TtC5GSSDK31GSKBarcodeScanFlowConfiguration")
473
480
  /// \endcode
474
481
  @property (nonatomic) BOOL isBatchModeEnabled;
475
482
  /// The highlight color used for the UI (overlay). Defaults
476
- /// to <code>.green</code>. For good constrast, we recommend using a bright color.
483
+ /// to <code>.green</code>. For good contrast, we recommend using a bright color.
477
484
  @property (nonatomic, strong) UIColor * _Nonnull highlightColor;
478
485
  /// The menu color used for the UI. Defaults to <code>nil</code>, meaning that the system
479
486
  /// default color will be used (blue on iOS, for example).
@@ -494,19 +501,6 @@ SWIFT_CLASS("_TtC5GSSDK31GSKBarcodeScanFlowConfiguration")
494
501
  + (GSKBarcodeScanFlowConfiguration * _Nullable)configurationWithJSON:(NSString * _Nonnull)json error:(NSError * _Nullable * _Nullable)error SWIFT_WARN_UNUSED_RESULT;
495
502
  @end
496
503
 
497
- /// Enum that defines various errors that can occur during a barcode scan flow.
498
- typedef SWIFT_ENUM(NSInteger, GSKBarcodeScanFlowError, open) {
499
- /// User has canceled the barcode scan flow
500
- GSKBarcodeScanFlowUserCancelationError SWIFT_COMPILE_NAME("userCancellation") = 0,
501
- /// A general error due to a bad configuration parameter
502
- GSKBarcodeScanFlowConfigurationError SWIFT_COMPILE_NAME("configuration") = 1,
503
- /// Camera permission was denied
504
- GSKBarcodeScanFlowPermissionDeniedError SWIFT_COMPILE_NAME("permissionDenied") = 2,
505
- /// Failed to initialize the barcode detector
506
- GSKBarcodeScanFlowDetectorError SWIFT_COMPILE_NAME("detectorError") = 3,
507
- };
508
- static NSString * _Nonnull const GSKBarcodeScanFlowErrorDomain = @"GSSDK.GSKBarcodeScanFlowError";
509
-
510
504
  /// The result of a barcode scanning flow.
511
505
  /// This class encapsulates the successful outcome of a barcode or QR code scanning session,
512
506
  /// containing the detected barcode or QR code data.
@@ -572,7 +566,7 @@ typedef SWIFT_ENUM(NSInteger, GSKCameraSessionError, open) {
572
566
  /// A camera view controller to scan documents or barcodes.
573
567
  /// Inherit from this view controller to create a custom scanning experience. Lay out the <code>cameraView</code> as desired:
574
568
  /// By default, <code>cameraView</code> fills the entire screen. You can disable its resizing mask
575
- /// (<code>cameraView.translateAutoresizingMaskIntoConstraints</code>) and use Auto Layout constraints.
569
+ /// (<code>cameraView.translatesAutoresizingMaskIntoConstraints</code>) and use Auto Layout constraints.
576
570
  /// note:
577
571
  ///
578
572
  /// When a photo of a document is taken, whether manually or automatically, the capture session is paused
@@ -580,9 +574,16 @@ typedef SWIFT_ENUM(NSInteger, GSKCameraSessionError, open) {
580
574
  /// In this callback, you can decide whether to exit the camera view controller (if you just need to scan a
581
575
  /// single page), or keep scanning more images (to support a “batch scanning” flow). For the latter scenario,
582
576
  /// you will need to resume the camera session (see <code>resume()</code>). You also need to “reveal” the shutter screen
583
- /// (see <code>hideShutterView(animated:)</code>.
577
+ /// (see <code>hideShutterView(animated:)</code>).
584
578
  SWIFT_CLASS("_TtC5GSSDK23GSKCameraViewController")
585
579
  @interface GSKCameraViewController : UIViewController
580
+ /// Requests camera access if needed.
581
+ /// This returns immediately when access is already determined. It only shows the system prompt
582
+ /// when access has not been requested yet.
583
+ ///
584
+ /// returns:
585
+ /// <code>true</code> when access is authorized.
586
+ + (void)requestCameraAccessWithCompletionHandler:(void (^ _Nonnull)(BOOL))completionHandler;
586
587
  - (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder OBJC_DESIGNATED_INITIALIZER SWIFT_UNAVAILABLE;
587
588
  - (void)viewDidLoad;
588
589
  - (void)viewWillAppear:(BOOL)animated;
@@ -746,24 +747,24 @@ SWIFT_PROTOCOL("_TtP5GSSDK31GSKCameraViewControllerDelegate_")
746
747
  typedef SWIFT_ENUM(NSInteger, GSKDocumentFinderImageType, closed) {
747
748
  /// No document present in the image
748
749
  GSKDocumentFinderImageTypeNoDocument = 0,
749
- /// A document present in the image, but no crop, perspective correction have been applied
750
+ /// A document is present in the image, but no crop or perspective correction has been applied.
750
751
  GSKDocumentFinderImageTypeUnwarped = 1,
751
- /// A document present in the image, and crop, perspective correction have been applied
752
+ /// A document is present in the image, and crop and perspective correction have been applied.
752
753
  GSKDocumentFinderImageTypeWarped = 2,
753
- /// A document present in the image, crop/perspective correction and
754
- /// enhanced have been applied.
754
+ /// A document is present in the image, and crop/perspective correction and
755
+ /// enhancement have been applied.
755
756
  GSKDocumentFinderImageTypeEnhanced = 3,
756
757
  };
757
758
 
758
759
  @class GSKPDFDocument;
759
760
  @protocol GSKDocumentImageProcessor;
760
761
  @class GSKDocumentGeneratorConfiguration;
761
- /// This class exposes the capacility to generate a PDF document file.
762
+ /// This class exposes the capability to generate a PDF or TIFF multi-page document file.
762
763
  SWIFT_CLASS("_TtC5GSSDK20GSKDocumentGenerator")
763
764
  @interface GSKDocumentGenerator : NSObject
764
765
  - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
765
766
  /// Generates a document file based on a document model and a generator configuration.
766
- /// \param document The source document to generate as PDF.
767
+ /// \param document The source document to generate as PDF or TIFF depending on the configuration.
767
768
  ///
768
769
  /// \param imageProcessor An object used to process each source document’s image before inserting it in the resulting document.
769
770
  /// Only used when generating a PDF document
@@ -772,7 +773,7 @@ SWIFT_CLASS("_TtC5GSSDK20GSKDocumentGenerator")
772
773
  ///
773
774
  - (BOOL)generate:(GSKPDFDocument * _Nonnull)document imageProcessor:(id <GSKDocumentImageProcessor> _Nonnull)imageProcessor configuration:(GSKDocumentGeneratorConfiguration * _Nonnull)configuration error:(NSError * _Nullable * _Nullable)error;
774
775
  /// Generates a document file based on a document model and a generator configuration.
775
- /// \param document The source document to generate as PDF.
776
+ /// \param document The source document to generate as PDF or TIFF depending on the configuration.
776
777
  ///
777
778
  /// \param configuration The configuration for the document generation.
778
779
  ///
@@ -786,7 +787,7 @@ SWIFT_CLASS("_TtC5GSSDK33GSKDocumentGeneratorConfiguration")
786
787
  @interface GSKDocumentGeneratorConfiguration : NSObject
787
788
  + (GSKDocumentGeneratorConfiguration * _Nonnull)pdfConfigurationWithOutputFilePath:(NSString * _Nonnull)outputFilePath SWIFT_WARN_UNUSED_RESULT;
788
789
  + (GSKDocumentGeneratorConfiguration * _Nonnull)tiffConfigurationWithOutputFilePath:(NSString * _Nonnull)outputFilePath SWIFT_WARN_UNUSED_RESULT;
789
- /// The output file format of the document generator. Must be .pdf or .tif.
790
+ /// The output file format of the document generator. Must be .pdf or .tiff.
790
791
  @property (nonatomic, readonly) enum GSKDocumentGeneratorFileFormat outputFileFormat;
791
792
  /// The path where the generated document will be written. The extension will not be validated.
792
793
  @property (nonatomic, readonly, copy) NSString * _Nonnull outputFilePath;
@@ -817,7 +818,7 @@ SWIFT_CLASS("_TtC5GSSDK33GSKDocumentGeneratorConfiguration")
817
818
 
818
819
  SWIFT_CLASS("_TtC5GSSDK38GSKDocumentGeneratorDebugConfiguration")
819
820
  @interface GSKDocumentGeneratorDebugConfiguration : NSObject
820
- /// If true, OCR’ed text will visible on the PDF.
821
+ /// If true, OCR’ed text will be visible on the PDF.
821
822
  /// Defaults to false. Use this for debug only
822
823
  @property (nonatomic, readonly) BOOL isOCRTextShownOnPDF;
823
824
  - (nonnull instancetype)initWithIsOCRTextShownOnPDF:(BOOL)isOCRTextShownOnPDF OBJC_DESIGNATED_INITIALIZER;
@@ -863,6 +864,16 @@ SWIFT_PROTOCOL("_TtP5GSSDK25GSKDocumentImageProcessor_")
863
864
 
864
865
  @class UIImage;
865
866
  @class UIView;
867
+ /// A view controller that displays a scanned image with an interactive quadrangle overlay
868
+ /// for manual cropping and perspective adjustment.
869
+ /// <code>GSKEditFrameViewController</code> presents an image and allows the user to refine the detected
870
+ /// document boundaries by dragging the quadrangle’s corner handles. As the user edits the
871
+ /// quadrangle, changes are reflected in the <code>quadrangle</code> property, which is Key-Value
872
+ /// Observing (KVO) compliant.
873
+ /// The overlay’s appearance—including colors, handle size, transparency, and magnifier
874
+ /// behavior—can be customized through the exposed properties. This view controller is
875
+ /// typically used after automatic document detection, to let the user fine-tune the crop
876
+ /// before further processing (such as perspective correction or export).
866
877
  SWIFT_CLASS("_TtC5GSSDK26GSKEditFrameViewController")
867
878
  @interface GSKEditFrameViewController : UIViewController
868
879
  /// The image on which the quadrangle is overlaid.
@@ -870,6 +881,10 @@ SWIFT_CLASS("_TtC5GSSDK26GSKEditFrameViewController")
870
881
  @property (nonatomic, readonly, strong) UIView * _Nonnull frameView;
871
882
  /// Used to set the quadrangle to display in the view controller, and to retrieve the new quadrangle edited by the user.
872
883
  @property (nonatomic, strong) GSKQuadrangle * _Nonnull quadrangle;
884
+ /// Insets applied around the image.
885
+ /// By default this matches half the quadrangle overlay handle width, so handles remain visible even when
886
+ /// the corners are on the edge of the image.
887
+ @property (nonatomic) CGFloat inset;
873
888
  /// Customize the color of the shade within the quadrangle.
874
889
  @property (nonatomic, strong) UIColor * _Nonnull shadeColor SWIFT_DEPRECATED_MSG("Deprecated in favor of frameView.imageSelection.insideShadeColor.");
875
890
  /// Customize the color of the shade outside the quadrangle.
@@ -878,6 +893,8 @@ SWIFT_CLASS("_TtC5GSSDK26GSKEditFrameViewController")
878
893
  @property (nonatomic, strong) UIColor * _Nonnull lineColor;
879
894
  /// Customize the width of the corner handles.
880
895
  @property (nonatomic) CGFloat handleWidth;
896
+ /// Customize the transparency of the entire overlay
897
+ @property (nonatomic) CGFloat overlayAlpha;
881
898
  /// Customize the magnifier center style shown while dragging corners.
882
899
  @property (nonatomic) GSKMagnifierViewCenterStyle magnifierViewCenterStyle;
883
900
  /// \param image The image on which to draw the quadrangle. This is typically the original photo from the camera.
@@ -1101,14 +1118,14 @@ SWIFT_CLASS("_TtC5GSSDK6GSKOCR")
1101
1118
  /// The OCR decides what post-processing to apply for the best results.
1102
1119
  ///
1103
1120
  /// \param configuration Configuration for the OCR process, in particular the language in which the OCR is
1104
- /// performed. Note that you must provided the appropriate trained data.
1121
+ /// performed. Note that you must provide the appropriate trained data.
1105
1122
  ///
1106
1123
  /// \param progressBlock The progress between 0 and 1. Called on the same thread.
1107
1124
  ///
1108
1125
  ///
1109
1126
  /// returns:
1110
1127
  /// An OCR result.
1111
- - (void)recognizeTextForImageAtPath:(NSString * _Nonnull)imagePath ocrConfiguration:(GSKOCRConfiguration * _Nonnull)configuration onProgress:(void (^ _Nullable)(float))progressBlock completionHandler:(void (^ _Nonnull)(GSKOCRResult * _Nullable, NSError * _Nullable))completionHandler;
1128
+ - (void)recognizeTextForImageAtPath:(NSString * _Nonnull)imagePath configuration:(GSKOCRConfiguration * _Nonnull)configuration onProgress:(void (^ _Nullable)(float))progressBlock completionHandler:(void (^ _Nonnull)(GSKOCRResult * _Nullable, NSError * _Nullable))completionHandler;
1112
1129
  @end
1113
1130
 
1114
1131
  /// The configuration for an OCR operation.
@@ -1214,9 +1231,15 @@ SWIFT_CLASS("_TtC5GSSDK13GSKReceiptVAT")
1214
1231
  @end
1215
1232
 
1216
1233
  @class GSKScanFlowConfiguration;
1217
- /// A high-level scanner module.
1218
- /// You present it and when the user is done, you obtain a result object containing the scanned documents.
1219
- /// The scan flow can be customized with a <code>GSKScanFlowConfiguration</code> instance.
1234
+ /// A UI-driven scan flow for turning physical documents into processed digital pages.
1235
+ /// Create an instance with <code>GSKScanFlowConfiguration</code> to choose the source
1236
+ /// (camera, photo library, or image URL), multi-page behavior, output format,
1237
+ /// filters, OCR, and structured-data extraction. Present the flow from a view
1238
+ /// controller and await a <code>GSKScanFlowResult</code> with the captured pages and the
1239
+ /// optional multi-page document.
1240
+ /// important:
1241
+ /// If you start a scan flow with the camera, your app must declare the
1242
+ /// <code>NSCameraUsageDescription</code> key in <code>Info.plist</code>.
1220
1243
  SWIFT_CLASS("_TtC5GSSDK11GSKScanFlow")
1221
1244
  @interface GSKScanFlow : NSObject
1222
1245
  - (nonnull instancetype)initWithConfiguration:(GSKScanFlowConfiguration * _Nonnull)configuration OBJC_DESIGNATED_INITIALIZER;
@@ -1335,15 +1358,33 @@ SWIFT_CLASS("_TtC5GSSDK24GSKScanFlowConfiguration")
1335
1358
  + (nullable instancetype)configurationWithJSON:(NSString * _Nonnull)json error:(NSError * _Nullable * _Nullable)error SWIFT_WARN_UNUSED_RESULT;
1336
1359
  @end
1337
1360
 
1338
- /// Enum that defines various errors that can occur during a scan flow.
1339
- typedef SWIFT_ENUM(NSInteger, GSKScanFlowError, open) {
1361
+ /// Enum that defines various numeric error codes that can occur during a scan flow.
1362
+ typedef SWIFT_ENUM(NSInteger, GSKScanFlowErrorCode, open) {
1340
1363
  /// User has canceled the scan flow
1341
- GSKScanFlowUserCancelationError SWIFT_COMPILE_NAME("userCancellation") = 999,
1342
- /// A general error due to a bad input parameter. Verify that your
1364
+ GSKScanFlowCancellationErrorCode SWIFT_COMPILE_NAME("cancellation") = 999,
1365
+ /// A general error due to an incorrect configuration. Verify that your
1343
1366
  /// inputs match the API requirements.
1344
- GSKScanFlowBadInputError SWIFT_COMPILE_NAME("badInput") = 1000,
1367
+ GSKScanFlowConfigurationErrorCode SWIFT_COMPILE_NAME("configuration") = 1000,
1368
+ /// A licensing error. This is a developer error and you should contact the
1369
+ /// Genius Scan SDK support team to make sure you have a valid license key.
1370
+ GSKScanFlowLicensingErrorCode SWIFT_COMPILE_NAME("licensing") = 1001,
1371
+ /// An error that happened while capturing the scans. This can sometimes be recovered
1372
+ /// by restarting the device.
1373
+ GSKScanFlowCaptureErrorCode SWIFT_COMPILE_NAME("capture") = 1002,
1374
+ /// An error caused by low storage space. This can be recovered by cleaning up
1375
+ /// storage space and trying again.
1376
+ GSKScanFlowStorageSpaceErrorCode SWIFT_COMPILE_NAME("storageSpace") = 1003,
1377
+ /// An internal error. This is a catch-all category, and the underlying error will
1378
+ /// give more details.
1379
+ GSKScanFlowInternalErrorCode SWIFT_COMPILE_NAME("internal") = 9999,
1345
1380
  };
1346
1381
 
1382
+ SWIFT_CLASS("_TtC5GSSDK26GSKScanFlowErrorCodeBridge")
1383
+ @interface GSKScanFlowErrorCodeBridge : NSObject
1384
+ + (NSString * _Nonnull)stringCodeForRawValue:(NSInteger)rawValue SWIFT_WARN_UNUSED_RESULT;
1385
+ - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
1386
+ @end
1387
+
1347
1388
  /// The different possible filters for the scanner UI.
1348
1389
  /// Each case maps to a predefined filter configuration except <code>.automatic</code>.
1349
1390
  typedef SWIFT_ENUM(NSInteger, GSKScanFlowFilterType, open) {
@@ -1386,8 +1427,8 @@ typedef SWIFT_ENUM(NSUInteger, GSKScanFlowFlashMode, open) {
1386
1427
  /// The format of the exported document.
1387
1428
  typedef SWIFT_ENUM(NSUInteger, GSKScanFlowMultiPageFormat, open) {
1388
1429
  GSKScanFlowNone SWIFT_COMPILE_NAME("none") = 0,
1389
- GSKScanFlowPDF SWIFT_COMPILE_NAME("PDF") = 1,
1390
- GSKScanFlowTIFF SWIFT_COMPILE_NAME("TIFF") = 2,
1430
+ GSKScanFlowPDF SWIFT_COMPILE_NAME("pdf") = 1,
1431
+ GSKScanFlowTIFF SWIFT_COMPILE_NAME("tiff") = 2,
1391
1432
  };
1392
1433
 
1393
1434
  /// The configuration for text recognition
@@ -1426,9 +1467,9 @@ typedef SWIFT_ENUM(NSUInteger, GSKScanFlowPDFPageSize, open) {
1426
1467
  SWIFT_CLASS("_TtC5GSSDK17GSKScanFlowResult")
1427
1468
  @interface GSKScanFlowResult : NSObject
1428
1469
  /// Document containing the pages that were scanned during the scan
1429
- /// flow. The format is specified by <code>multiPageFormat</code> property of
1430
- /// the used <code>GSKScanFlowConfiguration</code>. Is <code>nil</code> if no format was
1431
- /// specified or if generation failed.
1470
+ /// flow. The format is specified by the <code>multiPageFormat</code> property of
1471
+ /// the <code>GSKScanFlowConfiguration</code> used for the scan flow. This is <code>nil</code>
1472
+ /// when <code>multiPageFormat</code> is <code>.none</code> or if document generation failed.
1432
1473
  @property (nonatomic, copy) NSURL * _Nullable multiPageDocumentURL;
1433
1474
  /// The individual scans taken during the scan flow.
1434
1475
  /// Each scan object contains both the original and the enhanced scans.
@@ -1632,23 +1673,19 @@ SWIFT_CLASS("_TtC5GSSDK13GSKTextLayout")
1632
1673
  + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
1633
1674
  @end
1634
1675
 
1635
- @class GSKTextLayoutToTextConverterResult;
1676
+ /// Converts an OCR text layout into plain text.
1677
+ /// A <code>GSKOCRResult</code> contains both raw text and a <code>GSKTextLayout</code>, which preserves spatial information such as
1678
+ /// bounding boxes and line/word positions. This converter reconstructs the raw text from a <code>GSKTextLayout</code> by
1679
+ /// traversing its bounding boxes in reading order and grouping content into paragraphs.
1680
+ /// Use this when you want to retain only the spatial representation (for highlighting, selection, reflow, etc.)
1681
+ /// and regenerate the plain-text representation on demand, rather than storing both.
1636
1682
  SWIFT_CLASS("_TtC5GSSDK28GSKTextLayoutToTextConverter")
1637
1683
  @interface GSKTextLayoutToTextConverter : NSObject
1638
- - (GSKTextLayoutToTextConverterResult * _Nullable)convert:(GSKTextLayout * _Nonnull)textLayout error:(NSError * _Nullable * _Nullable)error SWIFT_WARN_UNUSED_RESULT;
1639
1684
  - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
1640
1685
  @end
1641
1686
 
1642
1687
  SWIFT_CLASS("_TtC5GSSDK34GSKTextLayoutToTextConverterResult")
1643
1688
  @interface GSKTextLayoutToTextConverterResult : NSObject
1644
- /// The text reconstructed from the text layout.
1645
- @property (nonatomic, readonly, copy) NSString * _Nonnull text;
1646
- /// The average word confidence of the recognized text.
1647
- /// A value between 0 and 100
1648
- @property (nonatomic, readonly) NSInteger averageWordConfidence;
1649
- /// The number of words in the recognized text.
1650
- /// This is the number of words on which the average word confidence has been computed.
1651
- @property (nonatomic, readonly) NSInteger wordCount;
1652
1689
  - (nonnull instancetype)init SWIFT_UNAVAILABLE;
1653
1690
  + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
1654
1691
  @end
@@ -18,7 +18,6 @@ FOUNDATION_EXPORT const unsigned char GSSDKVersionString[];
18
18
  #import <GSSDK/GSKDocumentComposition.h>
19
19
  #import <GSSDK/GSKDocumentDetector.h>
20
20
  #import <GSSDK/GSKEdgeCleaning.h>
21
- #import <GSSDK/GSKEditableFrame.h>
22
21
  #import <GSSDK/GSKEnhancementConfiguration.h>
23
22
  #import <GSSDK/GSKError.h>
24
23
  #import <GSSDK/GSKFilterColorPalette.h>
@@ -26,7 +25,6 @@ FOUNDATION_EXPORT const unsigned char GSSDKVersionString[];
26
25
  #import <GSSDK/GSKLicenseKeyChecker.h>
27
26
  #import <GSSDK/GSKLog.h>
28
27
  #import <GSSDK/GSKLoggerSeverity.h>
29
- #import <GSSDK/GSKMBProgressHUD.h>
30
28
  #import <GSSDK/GSKMagnifierView.h>
31
29
  #import <GSSDK/GSKOutputConfiguration.h>
32
30
  #import <GSSDK/GSKPerspectiveCorrectionConfiguration.h>
@@ -38,11 +36,11 @@ FOUNDATION_EXPORT const unsigned char GSSDKVersionString[];
38
36
  #import <GSSDK/GSKRotationConfiguration.h>
39
37
  #import <GSSDK/GSKScan.h>
40
38
  #import <GSSDK/GSKScanFlowErrorDomain.h>
39
+ #import <GSSDK/GSKScanFlowError+PluginPayload.h>
41
40
  #import <GSSDK/GSKScanFlowOCROutputFormats.h>
42
41
  #import <GSSDK/GSKScanFlowPostProcessingActions.h>
43
42
  #import <GSSDK/GSKScanFlowStructuredData.h>
44
43
  #import <GSSDK/GSKScanProcessor.h>
45
- #import <GSSDK/GSKShutterView.h>
46
44
  #import <GSSDK/UIImage+GSKUtils.h>
47
45
  #import <GSSDK/GSKReadabilityLevel.h>
48
46
  #import <GSSDK/GSKReadabilityConfiguration.h>
@@ -27,7 +27,7 @@ typedef NS_ENUM(NSUInteger, GSKRotationDirection) {
27
27
  @param maxSize The square to fit the image in. The largest image dimension will fit maxSize.
28
28
  @param quality The quality of the interpolation.
29
29
  @param scale The scale (density) of the resulting image.
30
- @param error An optional error pointer filled when the scaling fails.
30
+ @param error An optional error pointer filled if the input image is invalid or the scaling fails.
31
31
  */
32
32
  - (nullable UIImage *)gsk_scaleWithMaxSize:(CGFloat)maxSize
33
33
  quality:(CGInterpolationQuality)quality
@@ -36,6 +36,8 @@ typedef NS_ENUM(NSUInteger, GSKRotationDirection) {
36
36
 
37
37
  /**
38
38
  Rotates the image according to its orientation. The resulting image orientation will be "up".
39
+
40
+ @param error An optional error pointer filled if the input image is invalid or cannot be rotated.
39
41
  */
40
42
  - (nullable UIImage *)gsk_upOrientedImageWithError:(NSError * _Nullable __autoreleasing * _Nullable)error NS_SWIFT_NAME(gsk_upOriented());
41
43
 
@@ -47,6 +49,8 @@ typedef NS_ENUM(NSUInteger, GSKRotationDirection) {
47
49
  orientation by the system methods.
48
50
 
49
51
  Should you want to actually rotate the image, you can apply `gsk_upOrientedImage` after rotating it.
52
+
53
+ @param error An optional error pointer filled if the input image is invalid or cannot be rotated.
50
54
  */
51
55
  - (nullable UIImage *)gsk_rotate:(GSKRotationDirection)direction
52
56
  error:(NSError * _Nullable __autoreleasing * _Nullable)error NS_SWIFT_NAME(gsk_rotate(_:));