react-native-scanbot-barcode-scanner-sdk 4.0.4-beta.3 → 4.0.4-beta.4
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/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraView.java +4 -0
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/components/barcodecameraview/ScanbotBarcodeCameraViewConfiguration.java +13 -0
- package/ios/Components/BarcodeCameraView/NewArchitecture/RTNScanbotBarcodeCameraView.mm +5 -1
- package/ios/Components/BarcodeCameraView/OldArchitecture/RNScanbotBarcodeCameraView.h +1 -0
- package/ios/Components/BarcodeCameraView/OldArchitecture/RNScanbotBarcodeCameraView.mm +6 -1
- package/js/RTNScanbotBarcodeCameraViewNativeComponent.tsx +6 -1
- package/package.json +1 -1
- package/src/components/barcode-camera-view/scanbot-barcode-camera-view-types.tsx +5 -0
|
@@ -39,6 +39,7 @@ public class ScanbotBarcodeCameraViewConfiguration {
|
|
|
39
39
|
private float finderBackgroundOpacity = 0.66f;
|
|
40
40
|
private float cameraZoomFactor = -1;
|
|
41
41
|
private boolean flashEnabled = false;
|
|
42
|
+
private boolean scanningEnabled = true;
|
|
42
43
|
|
|
43
44
|
private AspectRatio finderAspectRatio = new AspectRatio(1, 1);
|
|
44
45
|
|
|
@@ -74,6 +75,10 @@ public class ScanbotBarcodeCameraViewConfiguration {
|
|
|
74
75
|
this.flashEnabled = flashEnabled;
|
|
75
76
|
}
|
|
76
77
|
|
|
78
|
+
public void setScanningEnabled(boolean enabled) {
|
|
79
|
+
this.scanningEnabled = enabled;
|
|
80
|
+
}
|
|
81
|
+
|
|
77
82
|
public boolean shouldUseFinderView() {
|
|
78
83
|
return shouldUseFinderView;
|
|
79
84
|
}
|
|
@@ -106,6 +111,10 @@ public class ScanbotBarcodeCameraViewConfiguration {
|
|
|
106
111
|
return finderAspectRatio;
|
|
107
112
|
}
|
|
108
113
|
|
|
114
|
+
public boolean isScanningEnabled() {
|
|
115
|
+
return scanningEnabled;
|
|
116
|
+
}
|
|
117
|
+
|
|
109
118
|
/**
|
|
110
119
|
* Checks if finder inset available, then populates the finder inset from readable map(json) object
|
|
111
120
|
*
|
|
@@ -171,6 +180,10 @@ public class ScanbotBarcodeCameraViewConfiguration {
|
|
|
171
180
|
nativeConfig.barcodeFilter = JSONUtils.extractBarcodeFilter(jsonConfig);
|
|
172
181
|
}
|
|
173
182
|
|
|
183
|
+
if (jsonConfig.hasKey("scanningEnabled")) {
|
|
184
|
+
nativeConfig.setScanningEnabled(jsonConfig.getBoolean("scanningEnabled"));
|
|
185
|
+
}
|
|
186
|
+
|
|
174
187
|
nativeConfig.additionalConfiguration = JSONUtils.extractBarcodeScannerAdditionalConfig(jsonConfig);
|
|
175
188
|
nativeConfig.engineMode = JSONUtils.extractEngineMode(jsonConfig);
|
|
176
189
|
|
|
@@ -36,6 +36,7 @@ static inline bool isUndefined(facebook::react::Float value) {
|
|
|
36
36
|
@property(nonatomic, strong) SBSDKUIBarcodeFilter *barcodeFilter;
|
|
37
37
|
@property(nonatomic) CGFloat userDefinedCameraZoomFactor;
|
|
38
38
|
@property(nonatomic) BOOL isFirstLaunch;
|
|
39
|
+
@property(nonatomic) BOOL scanningEnabled;
|
|
39
40
|
@end
|
|
40
41
|
|
|
41
42
|
@implementation RTNScanbotBarcodeCameraView
|
|
@@ -54,6 +55,7 @@ static inline bool isUndefined(facebook::react::Float value) {
|
|
|
54
55
|
|
|
55
56
|
self.barcodes = [[NSMutableArray alloc] init];
|
|
56
57
|
_userDefinedCameraZoomFactor = -1;
|
|
58
|
+
_scanningEnabled = true;
|
|
57
59
|
}
|
|
58
60
|
return self;
|
|
59
61
|
}
|
|
@@ -294,6 +296,8 @@ static inline bool isUndefined(facebook::react::Float value) {
|
|
|
294
296
|
if (forceUpdate || oldViewProps.configuration.barcodeFilter != newViewProps.configuration.barcodeFilter) {
|
|
295
297
|
_barcodeFilter = extractBarcodeFilter(toNSString(newViewProps.configuration.barcodeFilter));
|
|
296
298
|
}
|
|
299
|
+
|
|
300
|
+
_scanningEnabled = newViewProps.configuration.scanningEnabled;
|
|
297
301
|
}
|
|
298
302
|
|
|
299
303
|
- (void)updateProps:(const facebook::react::Props::Shared &)props oldProps:(const facebook::react::Props::Shared &)oldProps {
|
|
@@ -328,7 +332,7 @@ static inline bool isUndefined(facebook::react::Float value) {
|
|
|
328
332
|
}
|
|
329
333
|
|
|
330
334
|
- (BOOL)barcodeScannerControllerShouldDetectBarcodes:(SBSDKBarcodeScannerViewController *)controller {
|
|
331
|
-
return
|
|
335
|
+
return _scanningEnabled;
|
|
332
336
|
}
|
|
333
337
|
|
|
334
338
|
- (void)barcodeScannerController:(nonnull SBSDKBarcodeScannerViewController *)controller didDetectBarcodes:(nonnull NSArray<SBSDKBarcodeScannerResult *> *)codes {
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
@property (nonatomic) UIColor* _Nonnull finderBackgroundColor;
|
|
44
44
|
@property (nonatomic) CGFloat finderBackgroundOpacity;
|
|
45
45
|
@property (nonatomic) SBSDKAspectRatio* _Nonnull finderAspectRatio;
|
|
46
|
+
@property (nonatomic) BOOL scanningEnabled;
|
|
46
47
|
|
|
47
48
|
// Nullable Properties (-1 for enums)
|
|
48
49
|
@property (nonatomic, copy) NSNumber* _Nullable shouldUseFinderView;
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
@property(nonatomic, strong) SBSDKBarcodeScannerViewController* viewController;
|
|
20
20
|
@property(nonatomic, strong) RNScanbotCameraViewConfiguration* mCameraViewConfiguration;
|
|
21
21
|
@property(nonatomic) CGFloat mUserDefinedCameraZoomFactor;
|
|
22
|
+
@property(nonatomic) BOOL scanningEnabled;
|
|
22
23
|
@end
|
|
23
24
|
|
|
24
25
|
@implementation RNScanbotBarcodeCameraView
|
|
@@ -30,6 +31,7 @@
|
|
|
30
31
|
_shouldUseFinderView = false;
|
|
31
32
|
_mCameraViewConfiguration = [[RNScanbotCameraViewConfiguration alloc] init];
|
|
32
33
|
_mUserDefinedCameraZoomFactor = -1;
|
|
34
|
+
_scanningEnabled = true;
|
|
33
35
|
}
|
|
34
36
|
return self;
|
|
35
37
|
}
|
|
@@ -162,6 +164,8 @@
|
|
|
162
164
|
self.viewController.flashLightEnabled = [self.mCameraViewConfiguration.flashEnabled boolValue];
|
|
163
165
|
}
|
|
164
166
|
}
|
|
167
|
+
|
|
168
|
+
_scanningEnabled = self.mCameraViewConfiguration.scanningEnabled;
|
|
165
169
|
}
|
|
166
170
|
|
|
167
171
|
|
|
@@ -233,7 +237,7 @@
|
|
|
233
237
|
}
|
|
234
238
|
|
|
235
239
|
- (BOOL)barcodeScannerControllerShouldDetectBarcodes:(SBSDKBarcodeScannerViewController *)controller {
|
|
236
|
-
return
|
|
240
|
+
return _scanningEnabled;
|
|
237
241
|
}
|
|
238
242
|
|
|
239
243
|
- (void)barcodeScannerController:(nonnull SBSDKBarcodeScannerViewController *)controller didDetectBarcodes:(nonnull NSArray<SBSDKBarcodeScannerResult *> *)codes {
|
|
@@ -279,6 +283,7 @@
|
|
|
279
283
|
self.engineMode = SBSDKBarcodeEngineModeNextGen;
|
|
280
284
|
self.flashEnabled = nil;
|
|
281
285
|
self.finderInset = UIEdgeInsetsMake(32, 32, 32, 32);
|
|
286
|
+
self.scanningEnabled = true;
|
|
282
287
|
}
|
|
283
288
|
return self;
|
|
284
289
|
}
|
|
@@ -62,7 +62,12 @@ export interface ScanbotBarcodeCameraViewConfiguration extends FinderConfig, Bar
|
|
|
62
62
|
/**
|
|
63
63
|
* Use a filter to determine which type of barcode can be detected; see `BarcodeFilter`
|
|
64
64
|
*/
|
|
65
|
-
barcodeFilter?: string; // TODO: Should be BarcodeFilter
|
|
65
|
+
barcodeFilter?: string; // TODO: Should be BarcodeFilter,
|
|
66
|
+
/**
|
|
67
|
+
* Enable or disable barcode detecting. If disabled, camera preview will be active but not barcodes will be scanned.
|
|
68
|
+
* Default is enabled.
|
|
69
|
+
*/
|
|
70
|
+
scanningEnabled?: boolean;
|
|
66
71
|
}
|
|
67
72
|
|
|
68
73
|
export type NativeComponentBarcodeFormat =
|
package/package.json
CHANGED
|
@@ -64,6 +64,11 @@ export interface ScanbotBarcodeCameraViewConfiguration extends FinderConfig, Bar
|
|
|
64
64
|
* Use a filter to determine which type of barcode can be detected; see `BarcodeFilter`
|
|
65
65
|
*/
|
|
66
66
|
barcodeFilter?: BarcodeFilter;
|
|
67
|
+
/**
|
|
68
|
+
* Enable or disable barcode detecting. If disabled, camera preview will be active but not barcodes will be scanned.
|
|
69
|
+
* Default is enabled.
|
|
70
|
+
*/
|
|
71
|
+
scanningEnabled?: boolean;
|
|
67
72
|
}
|
|
68
73
|
|
|
69
74
|
/**
|