react-native-scanbot-barcode-scanner-sdk 4.2.0-beta.1 → 4.2.0-beta.3
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/ios/ScanbotBarcodeSdk.m +28 -15
- package/package.json +1 -1
package/ios/ScanbotBarcodeSdk.m
CHANGED
|
@@ -40,13 +40,15 @@ RCT_EXPORT_METHOD(startBarcodeScanner:(NSDictionary*)configuration
|
|
|
40
40
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
41
41
|
withRejecter:(RCTPromiseRejectBlock)reject) {
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
runOnMainThread(^{
|
|
44
|
+
UIViewController *presentedViewController = RCTPresentedViewController();
|
|
45
|
+
|
|
46
|
+
if (presentedViewController == NULL) {
|
|
47
|
+
reject(@"", @"No active view controller", nil);
|
|
48
|
+
} else {
|
|
49
|
+
[SBBWrapperOperations startBarcodeScannerWithParentViewController:presentedViewController configurationAsDictionary:configuration resultDelegate:[self createResultDelegate:resolve reject:reject]];
|
|
50
|
+
}
|
|
51
|
+
});
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
RCT_EXPORT_METHOD(closeBarcodeScanner:
|
|
@@ -60,13 +62,15 @@ RCT_EXPORT_METHOD(startBatchBarcodeScanner:(NSDictionary*)configuration
|
|
|
60
62
|
withResolver:(RCTPromiseResolveBlock)resolve
|
|
61
63
|
withRejecter:(RCTPromiseRejectBlock)reject) {
|
|
62
64
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
runOnMainThread(^{
|
|
66
|
+
UIViewController *presentedViewController = RCTPresentedViewController();
|
|
67
|
+
|
|
68
|
+
if (presentedViewController == NULL) {
|
|
69
|
+
reject(@"", @"No active view controller", nil);
|
|
70
|
+
} else {
|
|
71
|
+
[SBBWrapperOperations startBatchBarcodeScannerWithParentViewController:presentedViewController configurationAsDictionary:configuration resultDelegate:[self createResultDelegate:resolve reject:reject]];
|
|
72
|
+
}
|
|
73
|
+
});
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
RCT_EXPORT_METHOD(closeBatchBarcodeScanner:
|
|
@@ -96,7 +100,16 @@ RCT_EXPORT_METHOD(extractImagesFromPDF:(NSDictionary *)args
|
|
|
96
100
|
|
|
97
101
|
+ (BOOL)requiresMainQueueSetup
|
|
98
102
|
{
|
|
99
|
-
|
|
103
|
+
return NO;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
void runOnMainThread(void (^block)(void))
|
|
107
|
+
{
|
|
108
|
+
if ([NSThread isMainThread]) {
|
|
109
|
+
block();
|
|
110
|
+
} else {
|
|
111
|
+
dispatch_async(dispatch_get_main_queue(), block);
|
|
112
|
+
}
|
|
100
113
|
}
|
|
101
114
|
|
|
102
115
|
@end
|