Skip to content

Commit

Permalink
Merge pull request #14 from blinkcard/release/v2.10.1
Browse files Browse the repository at this point in the history
Release/v2.10.1
  • Loading branch information
mparadina authored Dec 5, 2024
2 parents da0e04e + bd7e187 commit 0185b9a
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 150 deletions.
2 changes: 1 addition & 1 deletion BlinkCard/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion BlinkCard/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microblink/blinkcard-react-native",
"version": "2.10.0",
"version": "2.10.1",
"description": "AI-driven credit card scanning for cross-platform apps built with ReactNative.",
"main": "index.js",
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public UISettings createUISettings(Context context, ReadableMap jsonUISettings,
if (errorCardTooCloseToEdge != null) {
overlayStringsBuilder.setErrorCardTooCloseToEdge(errorCardTooCloseToEdge);
}

VideoResolutionPreset videoResolutionPreset = VideoResolutionPreset.values()[0];
if (jsonUISettings.hasKey("androidCameraResolutionPreset")) {
videoResolutionPreset = VideoResolutionPreset.values()[jsonUISettings.getInt("androidCameraResolutionPreset")];
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#import "MBCOverlaySettingsSerializers.h"
#import "MBCRecognizerWrapper.h"
#import "MBCSerializationUtils.h"

#import <Foundation/Foundation.h>
#import "MBCBlinkCardModule.h"
#import <React/RCTConvert.h>
Expand All @@ -19,12 +18,13 @@ typedef NS_ENUM(NSUInteger, PPImageType) {
static NSString* const MBCErrorDomain = @"microblink.error";
static NSString* const RESULT_CAPTURED_FULL_IMAGE = @"capturedFullImage";
static NSString* const RESULT_DOCUMENT_CAPTURE_RECOGNIZER_RESULT = @"documentCaptureRecognizerResult";

@interface MBCBlinkCardModule () <MBCOverlayViewControllerDelegate, MBCScanningRecognizerRunnerDelegate, MBCFirstSideFinishedRecognizerRunnerDelegate>

@property (nonatomic, strong) MBCRecognizerCollection *recognizerCollection;
@property (nonatomic) id<MBCRecognizerRunnerViewController> scanningViewController;
@property (nonatomic, strong) MBCRecognizerRunner *recognizerRunner;
@property (nonatomic, strong) MBCOverlayViewController *overlayVc;
@property (nonatomic, strong) NSDictionary *recognizerCollectionDict;
@property (nonatomic, strong) NSDictionary *backImageBase64Image;

@property (class, nonatomic, readonly) NSString *STATUS_SCAN_CANCELED;
Expand Down Expand Up @@ -55,7 +55,7 @@ + (BOOL)requiresMainQueueSetup {

/**
Method sanitizes the dictionary replaces all occurances of NSNull with nil
@param dictionary JSON objects
@return new dictionary with NSNull values replaced with nil
*/
Expand All @@ -70,26 +70,27 @@ - (NSDictionary *)sanitizeDictionary:(NSDictionary *)dictionary {
}

RCT_REMAP_METHOD(scanWithCamera, scanWithCamera:(NSDictionary *)jsonOverlaySettings recognizerCollection:(NSDictionary *)jsonRecognizerCollection license:(NSDictionary *)jsonLicense resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {

// Sanitize the dictionaries
jsonOverlaySettings = [self sanitizeDictionary:jsonOverlaySettings];
jsonRecognizerCollection = [self sanitizeDictionary:jsonRecognizerCollection];
_recognizerCollectionDict = jsonRecognizerCollection;
jsonLicense = [self sanitizeDictionary:jsonLicense];

self.promiseResolve = resolve;
self.promiseReject = reject;

if([self setupLicense:jsonLicense]) {
[self setupLanguage:jsonOverlaySettings];

self.recognizerCollection = [[MBCRecognizerSerializers sharedInstance] deserializeRecognizerCollection:jsonRecognizerCollection];

dispatch_sync(dispatch_get_main_queue(), ^{
MBCOverlayViewController *overlayVC = [[MBCOverlaySettingsSerializers sharedInstance] createOverlayViewController:jsonOverlaySettings recognizerCollection:self.recognizerCollection delegate:self];

UIViewController<MBCRecognizerRunnerViewController>* recognizerRunnerViewController = [MBCViewControllerFactory recognizerRunnerViewControllerWithOverlayViewController:overlayVC];
_overlayVc = [[MBCOverlaySettingsSerializers sharedInstance] createOverlayViewController:jsonOverlaySettings recognizerCollection:self.recognizerCollection delegate:self];

UIViewController<MBCRecognizerRunnerViewController>* recognizerRunnerViewController = [MBCViewControllerFactory recognizerRunnerViewControllerWithOverlayViewController:_overlayVc];
[recognizerRunnerViewController setModalPresentationStyle:UIModalPresentationFullScreen];
self.scanningViewController = recognizerRunnerViewController;

UIViewController *rootViewController = [[[UIApplication sharedApplication] keyWindow] rootViewController];
[rootViewController presentViewController:self.scanningViewController animated:YES completion:nil];
});
Expand Down Expand Up @@ -125,25 +126,25 @@ - (void)overlayViewControllerDidFinishScanning:(MBCOverlayViewController *)overl
if (state != MBCRecognizerResultStateEmpty) {
[overlayViewController.recognizerRunnerViewController pauseScanning];
// recognizers within self.recognizerCollection now have their results filled

BOOL isDocumentCaptureRecognizer = NO;

NSMutableArray *jsonResults = [[NSMutableArray alloc] initWithCapacity:self.recognizerCollection.recognizerList.count];

for (NSUInteger i = 0; i < self.recognizerCollection.recognizerList.count; ++i) {
[jsonResults addObject:[[self.recognizerCollection.recognizerList objectAtIndex:i] serializeResult]];

if (!isDocumentCaptureRecognizer) {
self.promiseResolve(jsonResults);
}
// dismiss recognizer runner view controller
dispatch_async(dispatch_get_main_queue(), ^{
UIViewController *rootViewController = [[[UIApplication sharedApplication] keyWindow] rootViewController];
[rootViewController dismissViewControllerAnimated:YES completion:nil];
self.recognizerCollection = nil;
self.scanningViewController = nil;
self.promiseResolve = nil;
self.promiseReject = nil;
if (!isDocumentCaptureRecognizer) {
self.promiseResolve(jsonResults);
}
// dismiss recognizer runner view controller
dispatch_async(dispatch_get_main_queue(), ^{
UIViewController *rootViewController = [[[UIApplication sharedApplication] keyWindow] rootViewController];
[rootViewController dismissViewControllerAnimated:YES completion:nil];
self.recognizerCollection = nil;
self.scanningViewController = nil;
self.promiseResolve = nil;
self.promiseReject = nil;
});
}
}
Expand All @@ -158,7 +159,7 @@ - (void)overlayDidTapClose:(MBCOverlayViewController *)overlayViewController {
code:-58
userInfo:nil];
self.promiseReject(MBCBlinkCardModule.STATUS_SCAN_CANCELED, @"Scanning has been canceled", error);

self.promiseResolve = nil;
self.promiseReject = nil;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,4 @@ - (void)blinkCardOverlayViewControllerDidTapClose:(nonnull MBCBlinkCardOverlayVi
[self.delegate overlayDidTapClose:blinkCardOverlayViewController];
}

@end
@end
6 changes: 6 additions & 0 deletions Release notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 2.10.1

- Added missing camera presets for both Android and iOS camera settings.
- iOS-specific
- Switched the modal presentation style to full screen.

## 2.10.0

- Updated to [Android SDK v2.10.0](https://github.com/blinkcard/blinkcard-android/releases/tag/v2.10.0) and [iOS SDK v2.10.0](https://github.com/BlinkCard/blinkcard-ios/releases/tag/v2.10.0)
Expand Down
2 changes: 1 addition & 1 deletion initReactNativeSampleApp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if [ "$IS_LOCAL_BUILD" = true ]; then
# use directly source code from this repo instead of npm package
# from RN 0.57 symlink does not work any more
npm pack $blink_card_plugin_path
npm install --save microblink-blinkcard-react-native-2.10.0.tgz
npm install --save microblink-blinkcard-react-native-2.10.1.tgz
#pushd node_modules
#ln -s $blinkcard_plugin_path blinkcard-react-native
#popd
Expand Down

0 comments on commit 0185b9a

Please sign in to comment.