anyline-ocr-react-native-module 51.6.0 → 53.0.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/android/build.gradle +1 -1
- package/android/src/main/java/com/anyline/reactnative/ScanActivity.java +11 -3
- package/ios/ALNFCScanViewController.m +7 -9
- package/ios/ALPluginHelper.h +1 -1
- package/ios/ALPluginHelper.m +4 -3
- package/ios/ALPluginScanViewController.m +40 -21
- package/ios/AnylineReact.podspec +1 -1
- package/ios/AnylineSDKPlugin.m +25 -24
- package/package.json +8 -8
package/android/build.gradle
CHANGED
|
@@ -61,7 +61,7 @@ repositories {
|
|
|
61
61
|
|
|
62
62
|
dependencies {
|
|
63
63
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
|
64
|
-
implementation 'io.anyline:anylinesdk:
|
|
64
|
+
implementation 'io.anyline:anylinesdk:53.0.0'
|
|
65
65
|
implementation "com.facebook.react:react-native:+"
|
|
66
66
|
implementation("com.google.android.material:material:1.9.0")
|
|
67
67
|
implementation 'androidx.multidex:multidex:2.0.1'
|
|
@@ -124,6 +124,9 @@ public class ScanActivity extends AppCompatActivity {
|
|
|
124
124
|
};
|
|
125
125
|
} catch (JSONException e) {
|
|
126
126
|
finishWithError("Error parsing view config: " + e.getMessage());
|
|
127
|
+
} catch (Exception e) {
|
|
128
|
+
finishWithError(getString(getResources().getIdentifier("error_invalid_json_data", "string", getPackageName()))
|
|
129
|
+
+ "\n" + e.getLocalizedMessage());
|
|
127
130
|
}
|
|
128
131
|
} else {
|
|
129
132
|
finishWithError("View config not found");
|
|
@@ -370,6 +373,7 @@ public class ScanActivity extends AppCompatActivity {
|
|
|
370
373
|
Intent intent = new Intent();
|
|
371
374
|
intent.putExtra(EXTRA_ERROR_MESSAGE, errorMessage);
|
|
372
375
|
setResult(RESULT_ERROR, intent);
|
|
376
|
+
ResultReporter.onError(errorMessage);
|
|
373
377
|
finish();
|
|
374
378
|
}
|
|
375
379
|
|
|
@@ -382,13 +386,17 @@ public class ScanActivity extends AppCompatActivity {
|
|
|
382
386
|
@Override
|
|
383
387
|
protected void onResume() {
|
|
384
388
|
super.onResume();
|
|
385
|
-
scanView.
|
|
389
|
+
if (scanView.isInitialized()) {
|
|
390
|
+
scanView.start();
|
|
391
|
+
}
|
|
386
392
|
}
|
|
387
393
|
|
|
388
394
|
@Override
|
|
389
395
|
protected void onPause() {
|
|
390
|
-
scanView.
|
|
391
|
-
|
|
396
|
+
if (scanView.isInitialized()) {
|
|
397
|
+
scanView.stop();
|
|
398
|
+
scanView.getCameraView().releaseCameraInBackground();
|
|
399
|
+
}
|
|
392
400
|
super.onPause();
|
|
393
401
|
}
|
|
394
402
|
|
|
@@ -109,7 +109,7 @@ API_AVAILABLE(ios(13.0))
|
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
self.mrzScanViewPlugin = (ALScanViewPlugin *)self.scanView.
|
|
112
|
+
self.mrzScanViewPlugin = (ALScanViewPlugin *)self.scanView.viewPlugin;
|
|
113
113
|
|
|
114
114
|
self.scanView.supportedNativeBarcodeFormats = self.uiConfig.nativeBarcodeFormats;
|
|
115
115
|
self.scanView.delegate = self;
|
|
@@ -155,7 +155,7 @@ API_AVAILABLE(ios(13.0))
|
|
|
155
155
|
|
|
156
156
|
- (void)configureMRZPlugin {
|
|
157
157
|
|
|
158
|
-
ALScanViewPlugin *scanViewPlugin = (ALScanViewPlugin *)self.scanView.
|
|
158
|
+
ALScanViewPlugin *scanViewPlugin = (ALScanViewPlugin *)self.scanView.viewPlugin;
|
|
159
159
|
if (![scanViewPlugin isKindOfClass:ALScanViewPlugin.class]) {
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
@@ -183,14 +183,12 @@ API_AVAILABLE(ios(13.0))
|
|
|
183
183
|
mrzConfig.mrzMinFieldConfidences.dateOfExpiry = @(90);
|
|
184
184
|
|
|
185
185
|
NSError *error;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
ALScanViewPlugin *updatedScanViewPlugin = [[ALScanViewPlugin alloc] initWithConfig:scanViewPluginConfig error:&error];
|
|
190
|
-
[self.scanView setScanViewPlugin:updatedScanViewPlugin error:&error];
|
|
186
|
+
|
|
187
|
+
ALViewPluginConfig *scanViewPluginConfig = scanViewPlugin.scanViewPluginConfig;
|
|
188
|
+
[self.scanView setViewPluginConfig:scanViewPluginConfig error:&error];
|
|
191
189
|
|
|
192
190
|
// the delegate binding was lost when you recreated the ScanPlugin it so you have to bring it back here
|
|
193
|
-
scanViewPlugin = (ALScanViewPlugin *)self.scanView.
|
|
191
|
+
scanViewPlugin = (ALScanViewPlugin *)self.scanView.viewPlugin;
|
|
194
192
|
scanViewPlugin.scanPlugin.delegate = self;
|
|
195
193
|
}
|
|
196
194
|
|
|
@@ -243,7 +241,7 @@ API_AVAILABLE(ios(13.0))
|
|
|
243
241
|
resultDictionary[@"nativeBarcodesDetected"] = self.detectedBarcodes;
|
|
244
242
|
}
|
|
245
243
|
|
|
246
|
-
NSObject<
|
|
244
|
+
NSObject<ALViewPluginBase> *scanViewPluginBase = self.scanView.viewPlugin;
|
|
247
245
|
if ([scanViewPluginBase isKindOfClass:ALScanViewPlugin.class]) {
|
|
248
246
|
ALScanViewPlugin *scanViewPlugin = (ALScanViewPlugin *)scanViewPluginBase;
|
|
249
247
|
BOOL cancelOnResult = scanViewPlugin.scanPlugin.pluginConfig.cancelOnResult;
|
package/ios/ALPluginHelper.h
CHANGED
|
@@ -5,7 +5,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
5
5
|
|
|
6
6
|
@class ALPluginConfig;
|
|
7
7
|
|
|
8
|
-
typedef void (^ALPluginCallback)(
|
|
8
|
+
typedef void (^ALPluginCallback)(NSDictionary * _Nullable callbackObj, NSError * _Nullable error);
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
@interface ALPluginHelper : NSObject
|
package/ios/ALPluginHelper.m
CHANGED
|
@@ -27,7 +27,8 @@ NSErrorDomain const ALDefaultDomain = @"ALDefaultErrorDomain";
|
|
|
27
27
|
if (@available(iOS 13.0, *)) {
|
|
28
28
|
|
|
29
29
|
if (![ALNFCDetector readingAvailable]) {
|
|
30
|
-
callback(nil, @"NFC passport reading is not supported on this device or app.");
|
|
30
|
+
callback(nil, [NSError errorWithDomain:@"ALReactDomain" code:100 userInfo:@{@"Error reason": @"NFC passport reading is not supported on this device or app."}]);
|
|
31
|
+
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
33
34
|
|
|
@@ -42,7 +43,7 @@ NSErrorDomain const ALDefaultDomain = @"ALDefaultErrorDomain";
|
|
|
42
43
|
completion:nil];
|
|
43
44
|
}
|
|
44
45
|
} else {
|
|
45
|
-
callback(nil, @"NFC passport reading is only supported on iOS 13 and later.");
|
|
46
|
+
callback(nil,[NSError errorWithDomain:@"ALReactDomain" code:100 userInfo:@{@"Error reason": @"NFC passport reading is only supported on iOS 13 and later."}]);
|
|
46
47
|
return;
|
|
47
48
|
}
|
|
48
49
|
} else {
|
|
@@ -288,7 +289,7 @@ NSErrorDomain const ALDefaultDomain = @"ALDefaultErrorDomain";
|
|
|
288
289
|
|
|
289
290
|
[[UIApplication sharedApplication].keyWindow.rootViewController
|
|
290
291
|
dismissViewControllerAnimated:YES completion:^{
|
|
291
|
-
callback(nil, @"Canceled");
|
|
292
|
+
callback(nil, [NSError errorWithDomain:@"" code:-1 userInfo:@{@"Error reason": @"Canceled"}]);
|
|
292
293
|
}];
|
|
293
294
|
}];
|
|
294
295
|
|
|
@@ -35,6 +35,8 @@
|
|
|
35
35
|
/// Applicable to non-composites (otherwise null)
|
|
36
36
|
@property (nonatomic, readonly, nullable) ALPluginConfig *pluginConfig;
|
|
37
37
|
|
|
38
|
+
@property (nonatomic, strong) NSError *scanViewError;
|
|
39
|
+
|
|
38
40
|
@end
|
|
39
41
|
|
|
40
42
|
|
|
@@ -82,8 +84,9 @@
|
|
|
82
84
|
error:&error];
|
|
83
85
|
|
|
84
86
|
if ([self showErrorAlertIfNeeded:error]) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
self.scanViewError = error;
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
87
90
|
|
|
88
91
|
[self.view addSubview:self.scanView];
|
|
89
92
|
|
|
@@ -118,8 +121,15 @@
|
|
|
118
121
|
[UIApplication sharedApplication].idleTimerDisabled = YES;
|
|
119
122
|
|
|
120
123
|
NSError *error;
|
|
121
|
-
|
|
122
|
-
|
|
124
|
+
if(!self.scanViewError){
|
|
125
|
+
[self.scanView.viewPlugin startWithError:&error];
|
|
126
|
+
[self showErrorAlertIfNeeded:error];
|
|
127
|
+
}
|
|
128
|
+
else{
|
|
129
|
+
[self dismissViewControllerAnimated:YES completion:^{
|
|
130
|
+
self.callback(nil, self.scanViewError);
|
|
131
|
+
}];
|
|
132
|
+
}
|
|
123
133
|
}
|
|
124
134
|
|
|
125
135
|
- (void)viewDidDisappear:(BOOL)animated {
|
|
@@ -200,7 +210,7 @@
|
|
|
200
210
|
}
|
|
201
211
|
|
|
202
212
|
// dismiss the view controller, if cancelOnResult for the config is true
|
|
203
|
-
NSObject<
|
|
213
|
+
NSObject<ALViewPluginBase> *scanViewPluginBase = self.scanView.viewPlugin;
|
|
204
214
|
if ([scanViewPluginBase isKindOfClass:ALScanViewPlugin.class]) {
|
|
205
215
|
ALScanViewPlugin *scanViewPlugin = (ALScanViewPlugin *)scanViewPluginBase;
|
|
206
216
|
BOOL cancelOnResult = scanViewPlugin.scanPlugin.pluginConfig.cancelOnResult;
|
|
@@ -289,7 +299,7 @@
|
|
|
289
299
|
|
|
290
300
|
- (ALPluginConfig * _Nullable)pluginConfig {
|
|
291
301
|
// applic. only to non-composites
|
|
292
|
-
NSObject<
|
|
302
|
+
NSObject<ALViewPluginBase> *scanVwPluginBase = self.scanView.viewPlugin;
|
|
293
303
|
if ([scanVwPluginBase isKindOfClass:ALScanViewPlugin.class]) {
|
|
294
304
|
return ((ALScanViewPlugin *)scanVwPluginBase).scanPlugin.pluginConfig;
|
|
295
305
|
}
|
|
@@ -299,11 +309,11 @@
|
|
|
299
309
|
// MARK: - Selector Actions
|
|
300
310
|
|
|
301
311
|
- (void)doneButtonPressed:(id)sender {
|
|
302
|
-
[self.scanView.
|
|
312
|
+
[self.scanView.viewPlugin stop];
|
|
303
313
|
|
|
304
314
|
__weak __block typeof(self) weakSelf = self;
|
|
305
315
|
[self dismissViewControllerAnimated:YES completion:^{
|
|
306
|
-
weakSelf.callback(nil, @"Canceled");
|
|
316
|
+
weakSelf.callback(nil, [NSError errorWithDomain:@"ALReactDomain" code:-1 userInfo:@{NSLocalizedDescriptionKey: @"Canceled"}]);
|
|
307
317
|
}];
|
|
308
318
|
}
|
|
309
319
|
|
|
@@ -356,25 +366,23 @@
|
|
|
356
366
|
|
|
357
367
|
// assume that pluginConfig carries the updated scanMode or whatever value that you wish to refresh.
|
|
358
368
|
- (BOOL)updatePluginConfig:(ALPluginConfig *)pluginConfig error:(NSError * _Nullable * _Nullable)error {
|
|
359
|
-
|
|
360
|
-
ALScanViewPluginConfig *scanViewPluginConfig = [ALScanViewPluginConfig withPluginConfig:pluginConfig
|
|
361
|
-
cutoutConfig:origSVPConfig.cutoutConfig
|
|
362
|
-
scanFeedbackConfig:origSVPConfig.scanFeedbackConfig];
|
|
363
|
-
ALScanViewPlugin *newScanViewPlugin = [[ALScanViewPlugin alloc] initWithConfig:scanViewPluginConfig error:error];
|
|
364
|
-
if (!newScanViewPlugin) {
|
|
365
|
-
return NO;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
newScanViewPlugin.scanPlugin.delegate = self;
|
|
369
|
+
ALViewPluginConfig *origSVPConfig = ((ALScanViewPlugin *)self.scanView.viewPlugin).scanViewPluginConfig;
|
|
369
370
|
|
|
370
|
-
|
|
371
|
+
origSVPConfig.pluginConfig = pluginConfig;
|
|
372
|
+
BOOL success = [self.scanView setViewPluginConfig:origSVPConfig error:error];
|
|
371
373
|
if (!success) {
|
|
374
|
+
if([self showErrorAlertIfNeeded:*error]){
|
|
375
|
+
[self dismissOnError:*error];
|
|
376
|
+
}
|
|
372
377
|
return NO;
|
|
373
378
|
}
|
|
374
379
|
|
|
375
|
-
success = [
|
|
380
|
+
success = [self.scanView.viewPlugin startWithError:error];
|
|
376
381
|
if (!success) {
|
|
377
382
|
// check error
|
|
383
|
+
if([self showErrorAlertIfNeeded:*error]){
|
|
384
|
+
[self dismissOnError:*error];
|
|
385
|
+
}
|
|
378
386
|
return NO;
|
|
379
387
|
}
|
|
380
388
|
return YES;
|
|
@@ -429,7 +437,18 @@
|
|
|
429
437
|
// MARK: - Miscellaneous
|
|
430
438
|
|
|
431
439
|
- (BOOL)showErrorAlertIfNeeded:(NSError *)error {
|
|
432
|
-
|
|
440
|
+
if (!error) {
|
|
441
|
+
return NO;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
return YES;
|
|
433
445
|
}
|
|
434
446
|
|
|
447
|
+
-(void)dismissOnError:(NSError *)error{
|
|
448
|
+
[self dismissViewControllerAnimated:YES completion:^{
|
|
449
|
+
self.callback(nil, error);
|
|
450
|
+
}];
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
|
|
435
454
|
@end
|
package/ios/AnylineReact.podspec
CHANGED
|
@@ -18,7 +18,7 @@ Pod::Spec.new do |s|
|
|
|
18
18
|
s.source = { :git => "https://github.com/Anyline/anyline-ocr-react-native-module.git", :tag => "#{s.version}" }
|
|
19
19
|
|
|
20
20
|
s.source_files = "*.{h,m}"
|
|
21
|
-
s.dependency "Anyline", "~>
|
|
21
|
+
s.dependency "Anyline", "~> 53"
|
|
22
22
|
s.dependency "React"
|
|
23
23
|
|
|
24
24
|
end
|
package/ios/AnylineSDKPlugin.m
CHANGED
|
@@ -10,7 +10,7 @@ ALWrapperConfig *wrapperConfig = nil;
|
|
|
10
10
|
|
|
11
11
|
@interface AnylineSDKPlugin()
|
|
12
12
|
|
|
13
|
-
@property (nonatomic, strong)
|
|
13
|
+
@property (nonatomic, strong) ALViewPluginConfig *conf;
|
|
14
14
|
|
|
15
15
|
@property (nonatomic, copy) NSString *callbackId;
|
|
16
16
|
@property (nonatomic, copy) NSString *appKey;
|
|
@@ -83,7 +83,7 @@ RCT_EXPORT_METHOD(setupAnylineSDKWithCacheConfig:(NSString *)licenseKey
|
|
|
83
83
|
if (!success) {
|
|
84
84
|
NSLog(@"error: %@", error.localizedDescription);
|
|
85
85
|
errorString = @"Unable to initialize the Anyline SDK. Please check your license key.";
|
|
86
|
-
[self returnError:errorString];
|
|
86
|
+
[self returnError:[NSError errorWithDomain:@"ALReactDomain" code:100 userInfo:@{@"Error reason": errorString}]];
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -127,7 +127,7 @@ RCT_EXPORT_METHOD(exportCachedEvents:(RCTPromiseResolveBlock)resolve rejecter:(R
|
|
|
127
127
|
|
|
128
128
|
if (!exportPath) {
|
|
129
129
|
NSString *errorString = @"Event cache is empty.";
|
|
130
|
-
[self returnError:errorString];
|
|
130
|
+
[self returnError:[NSError errorWithDomain:@"ALReactDomain" code:100 userInfo:@{@"Error reason": errorString}]];
|
|
131
131
|
} else {
|
|
132
132
|
[self returnSuccess:exportPath];
|
|
133
133
|
}
|
|
@@ -158,7 +158,7 @@ RCT_EXPORT_METHOD(exportCachedEvents:(RCTPromiseResolveBlock)resolve rejecter:(R
|
|
|
158
158
|
self.nativeBarcodeScanning = nativeBarcodeScanning ? nativeBarcodeScanning : NO;
|
|
159
159
|
|
|
160
160
|
self.jsonUIConf = [[ALJSONUIConfiguration alloc] initWithDictionary:optionsDictionary];
|
|
161
|
-
self.conf = [[
|
|
161
|
+
self.conf = [[ALViewPluginConfig alloc] initWithJSONDictionary:optionsDictionary error:&error];
|
|
162
162
|
self.ocrConfigDict = [dictionary objectForKey:@"ocr"];
|
|
163
163
|
|
|
164
164
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
@@ -172,8 +172,8 @@ RCT_EXPORT_METHOD(exportCachedEvents:(RCTPromiseResolveBlock)resolve rejecter:(R
|
|
|
172
172
|
ALNFCScanViewController *nfcScanViewController = [[ALNFCScanViewController alloc] initWithLicensekey:self.appKey
|
|
173
173
|
configuration:dictionary
|
|
174
174
|
uiConfig:self.jsonUIConf
|
|
175
|
-
finished:^(
|
|
176
|
-
[self returnCallback:callbackObj
|
|
175
|
+
finished:^(NSDictionary * _Nullable callbackObj, NSError * _Nullable error) {
|
|
176
|
+
[self returnCallback:callbackObj andError:error];
|
|
177
177
|
}];
|
|
178
178
|
|
|
179
179
|
if (nfcScanViewController != nil){
|
|
@@ -181,17 +181,18 @@ RCT_EXPORT_METHOD(exportCachedEvents:(RCTPromiseResolveBlock)resolve rejecter:(R
|
|
|
181
181
|
[[[UIApplication sharedApplication] keyWindow].rootViewController presentViewController:nfcScanViewController animated:YES completion:nil];
|
|
182
182
|
}
|
|
183
183
|
} else {
|
|
184
|
-
[self returnError:@"NFC passport reading is not supported on this device or app."];
|
|
184
|
+
[self returnError:[NSError errorWithDomain:@"ALReactDomain" code:100 userInfo:@{@"Error reason": @"NFC passport reading is not supported on this device or app."}]];
|
|
185
185
|
}
|
|
186
186
|
} else {
|
|
187
|
-
[self returnError:@"NFC passport reading is only supported on iOS 13 and later."];
|
|
187
|
+
[self returnError:[NSError errorWithDomain:@"ALReactDomain" code:100 userInfo:@{@"Error reason": @"NFC passport reading is only supported on iOS 13 and later."}]];
|
|
188
|
+
|
|
188
189
|
}
|
|
189
190
|
} else {
|
|
190
191
|
ALPluginScanViewController *pluginScanViewController =
|
|
191
192
|
[[ALPluginScanViewController alloc] initWithLicensekey:self.appKey
|
|
192
193
|
configuration:dictionary
|
|
193
|
-
uiConfiguration:self.jsonUIConf finished:^(
|
|
194
|
-
[self returnCallback:callbackObj
|
|
194
|
+
uiConfiguration:self.jsonUIConf finished:^(NSDictionary * _Nullable callbackObj, NSError * _Nullable error) {
|
|
195
|
+
[self returnCallback:callbackObj andError:error];
|
|
195
196
|
}];
|
|
196
197
|
|
|
197
198
|
if (pluginScanViewController != nil){
|
|
@@ -203,8 +204,8 @@ RCT_EXPORT_METHOD(exportCachedEvents:(RCTPromiseResolveBlock)resolve rejecter:(R
|
|
|
203
204
|
ALPluginScanViewController *pluginScanViewController =
|
|
204
205
|
[[ALPluginScanViewController alloc] initWithLicensekey:self.appKey
|
|
205
206
|
configuration:dictionary
|
|
206
|
-
uiConfiguration:self.jsonUIConf finished:^(
|
|
207
|
-
[self returnCallback:callbackObj
|
|
207
|
+
uiConfiguration:self.jsonUIConf finished:^(NSDictionary * _Nullable callbackObj, NSError * _Nullable error) {
|
|
208
|
+
[self returnCallback:callbackObj andError:error];
|
|
208
209
|
}];
|
|
209
210
|
|
|
210
211
|
if (pluginScanViewController != nil){
|
|
@@ -235,11 +236,11 @@ RCT_EXPORT_METHOD(exportCachedEvents:(RCTPromiseResolveBlock)resolve rejecter:(R
|
|
|
235
236
|
}
|
|
236
237
|
|
|
237
238
|
- (void)pluginScanViewController:(nonnull ALPluginScanViewController *)pluginScanViewController didStopScanning:(nonnull id)sender {
|
|
238
|
-
[self returnError:
|
|
239
|
+
[self returnError: [NSError errorWithDomain:@"ALReactDomain" code:100 userInfo:@{@"Error reason": @"Canceled"}]];
|
|
239
240
|
}
|
|
240
241
|
|
|
241
242
|
- (void)pluginScanViewController:(ALPluginScanViewController *)pluginScanViewController didStopScanning:(id)sender error:(NSError *)error {
|
|
242
|
-
[self returnError:error
|
|
243
|
+
[self returnError:error];
|
|
243
244
|
}
|
|
244
245
|
|
|
245
246
|
- (BOOL)scanModeIndex:(NSString *)scanMode{
|
|
@@ -251,20 +252,20 @@ RCT_EXPORT_METHOD(exportCachedEvents:(RCTPromiseResolveBlock)resolve rejecter:(R
|
|
|
251
252
|
|
|
252
253
|
}
|
|
253
254
|
|
|
254
|
-
- (void)returnCallback:(id _Nullable)callbackObj
|
|
255
|
+
- (void)returnCallback:(id _Nullable)callbackObj andError:(NSError * _Nullable)error {
|
|
255
256
|
NSString *resultStr;
|
|
256
|
-
NSError *
|
|
257
|
-
if (
|
|
258
|
-
|
|
257
|
+
NSError *errorObj;
|
|
258
|
+
if (error) {
|
|
259
|
+
[self returnError:error];
|
|
259
260
|
} else if ([NSJSONSerialization isValidJSONObject:callbackObj]) {
|
|
260
|
-
resultStr = [(NSDictionary *)callbackObj toJSONStringPretty:YES error:&
|
|
261
|
-
if (
|
|
262
|
-
[self returnError:
|
|
261
|
+
resultStr = [(NSDictionary *)callbackObj toJSONStringPretty:YES error:&errorObj];
|
|
262
|
+
if (errorObj) {
|
|
263
|
+
[self returnError:errorObj];
|
|
263
264
|
}
|
|
264
265
|
[self returnSuccess:resultStr];
|
|
265
266
|
} else {
|
|
266
267
|
resultStr = @"callback object should be of JSON type";
|
|
267
|
-
[self returnError:resultStr];
|
|
268
|
+
[self returnError:[NSError errorWithDomain:@"ALReactDomain" code:100 userInfo:@{NSLocalizedDescriptionKey: resultStr}]];
|
|
268
269
|
}
|
|
269
270
|
}
|
|
270
271
|
|
|
@@ -276,11 +277,11 @@ RCT_EXPORT_METHOD(exportCachedEvents:(RCTPromiseResolveBlock)resolve rejecter:(R
|
|
|
276
277
|
}
|
|
277
278
|
}
|
|
278
279
|
|
|
279
|
-
- (void)returnError:(
|
|
280
|
+
- (void)returnError:(NSError *)error {
|
|
280
281
|
if ([self.returnMethod isEqualToString:@"callback"]) {
|
|
281
282
|
self.onErrorCallback(@[error]);
|
|
282
283
|
} else if ([self.returnMethod isEqualToString:@"promise"]) {
|
|
283
|
-
_rejectBlock(@"ANYLINE_ERROR", error,
|
|
284
|
+
_rejectBlock(@"ANYLINE_ERROR", error.localizedDescription, error);
|
|
284
285
|
}
|
|
285
286
|
}
|
|
286
287
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_from": "anyline-ocr-react-native-module@^
|
|
3
|
-
"_id": "anyline-ocr-react-native-module@^
|
|
2
|
+
"_from": "anyline-ocr-react-native-module@^53.0.0",
|
|
3
|
+
"_id": "anyline-ocr-react-native-module@^53.0.0",
|
|
4
4
|
"_inBundle": false,
|
|
5
5
|
"_integrity": "sha512-BGi9zNkSsoxXywDBIqzgBRvKUBniQOJHDKBrozZubKthZNRBAj8Ry5tW0Me0yLXt/fauME//hbC0wsenfPJZqw==",
|
|
6
6
|
"_location": "/anyline-ocr-react-native-module",
|
|
@@ -8,19 +8,19 @@
|
|
|
8
8
|
"_requested": {
|
|
9
9
|
"type": "range",
|
|
10
10
|
"registry": true,
|
|
11
|
-
"raw": "anyline-ocr-react-native-module@^
|
|
11
|
+
"raw": "anyline-ocr-react-native-module@^53.0.0",
|
|
12
12
|
"name": "anyline-ocr-react-native-module",
|
|
13
13
|
"escapedName": "anyline-ocr-react-native-module",
|
|
14
|
-
"rawSpec": "^
|
|
14
|
+
"rawSpec": "^53.0.0",
|
|
15
15
|
"saveSpec": null,
|
|
16
|
-
"fetchSpec": "^
|
|
16
|
+
"fetchSpec": "^53.0.0"
|
|
17
17
|
},
|
|
18
18
|
"_requiredBy": [
|
|
19
19
|
"/"
|
|
20
20
|
],
|
|
21
|
-
"_resolved": "https://registry.npmjs.org/anyline-ocr-react-native-module/-/anyline-ocr-react-native-module-
|
|
21
|
+
"_resolved": "https://registry.npmjs.org/anyline-ocr-react-native-module/-/anyline-ocr-react-native-module-53.0.0.tgz",
|
|
22
22
|
"_shasum": "bacbcd260cc662244f59393ed81a6edba009b52c",
|
|
23
|
-
"_spec": "anyline-ocr-react-native-module@^
|
|
23
|
+
"_spec": "anyline-ocr-react-native-module@^53.0.0",
|
|
24
24
|
"_where": "/Users/amiransari/Projects/anyline-ocr-react-native-module1/example/RNExampleApp",
|
|
25
25
|
"bugs": {
|
|
26
26
|
"url": "https://github.com/Anyline/anyline-ocr-react-native-module/issues"
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"type": "git",
|
|
48
48
|
"url": "git+https://github.com/Anyline/anyline-ocr-react-native-module.git"
|
|
49
49
|
},
|
|
50
|
-
"version": "
|
|
50
|
+
"version": "53.0.0"
|
|
51
51
|
}
|