dynamsoft-capture-vision-react-native 1.1.0 → 1.1.1
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/com/dynamsoft/reactlibrary/Constants.java +2 -2
- package/android/src/main/java/com/dynamsoft/reactlibrary/RNDCECameraViewManager.java +12 -12
- package/ios/RNDynamsoftCaptureVision/DYSCameraView.m +2 -2
- package/ios/RNDynamsoftCaptureVision/DYSCameraViewManager.m +0 -10
- package/ios/RNDynamsoftCaptureVision/RCTDynamsoftBarcodeReader.m +10 -0
- package/js/CameraSettings.d.ts +2 -2
- package/js/CameraSettings.js +2 -2
- package/package.json +1 -1
|
@@ -31,12 +31,15 @@ public class RNDCECameraViewManager extends ViewGroupManager<RNDCECameraView> {
|
|
|
31
31
|
|
|
32
32
|
ReactApplicationContext mReactApplicationContext;
|
|
33
33
|
CameraEnhancer mCamera;
|
|
34
|
-
|
|
34
|
+
RNDynamsoftBarcodeReaderModule mDbrModule;
|
|
35
35
|
|
|
36
36
|
public RNDCECameraViewManager(ReactApplicationContext reactContext, RNDynamsoftBarcodeReaderModule dbrModule) {
|
|
37
37
|
mReactApplicationContext = reactContext;
|
|
38
|
-
|
|
39
|
-
dbrModule.
|
|
38
|
+
mDbrModule = dbrModule;
|
|
39
|
+
if (dbrModule.getActivity() != null) {
|
|
40
|
+
mCamera = new CameraEnhancer(dbrModule.getActivity());
|
|
41
|
+
dbrModule.mCamera = mCamera;
|
|
42
|
+
}
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
private static final String REACT_CLASS = "DYSCameraView";
|
|
@@ -48,6 +51,10 @@ public class RNDCECameraViewManager extends ViewGroupManager<RNDCECameraView> {
|
|
|
48
51
|
|
|
49
52
|
@Override
|
|
50
53
|
protected RNDCECameraView createViewInstance(ThemedReactContext reactContext) {
|
|
54
|
+
if (mCamera == null) {
|
|
55
|
+
mCamera = new CameraEnhancer(mDbrModule.getActivity());
|
|
56
|
+
mDbrModule.mCamera = mCamera;
|
|
57
|
+
}
|
|
51
58
|
return new RNDCECameraView(reactContext, mReactApplicationContext, mCamera);
|
|
52
59
|
}
|
|
53
60
|
|
|
@@ -81,11 +88,11 @@ public class RNDCECameraViewManager extends ViewGroupManager<RNDCECameraView> {
|
|
|
81
88
|
if (location != null) {
|
|
82
89
|
int x = (location.hasKey("x") && !location.isNull("x")) ? location.getInt("x") : 25;
|
|
83
90
|
int y = (location.hasKey("y") && !location.isNull("y")) ? location.getInt("y") : 100;
|
|
84
|
-
startPoint = new Point(x,y);
|
|
91
|
+
startPoint = new Point(x, y);
|
|
85
92
|
width = (location.hasKey("width") && !location.isNull("width")) ? location.getInt("width") : 45;
|
|
86
93
|
height = (location.hasKey("height") && !location.isNull("height")) ? location.getInt("height") : 45;
|
|
87
94
|
} else {
|
|
88
|
-
//Default location. Unit is dp.
|
|
95
|
+
// Default location. Unit is dp.
|
|
89
96
|
startPoint = new Point(25, 100);
|
|
90
97
|
width = 45;
|
|
91
98
|
height = 45;
|
|
@@ -132,13 +139,6 @@ public class RNDCECameraViewManager extends ViewGroupManager<RNDCECameraView> {
|
|
|
132
139
|
}
|
|
133
140
|
}
|
|
134
141
|
|
|
135
|
-
// @Nullable
|
|
136
|
-
// @Override
|
|
137
|
-
// public Map<String, Object> getExportedViewConstants() {
|
|
138
|
-
// return super.getExportedViewConstants();
|
|
139
|
-
// }
|
|
140
|
-
|
|
141
|
-
|
|
142
142
|
@ReactProp(name = "scanRegionVisible")
|
|
143
143
|
public void setScanRegionVisible(RNDCECameraView view, boolean isVisible) {
|
|
144
144
|
mCamera.setScanRegionVisible(isVisible);
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
- (void)setTorchState:(int)torchState{
|
|
47
|
-
if (torchState ==
|
|
47
|
+
if (torchState == 1) {
|
|
48
48
|
[[StaticClass instance].dce turnOnTorch];
|
|
49
|
-
}else if (torchState ==
|
|
49
|
+
}else if (torchState == 0){
|
|
50
50
|
[[StaticClass instance].dce turnOffTorch];
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -33,16 +33,6 @@ RCT_EXPORT_MODULE(DYSCameraView)
|
|
|
33
33
|
return [[DYSCameraView alloc] init];
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
- (NSDictionary *)constantsToExport
|
|
37
|
-
{
|
|
38
|
-
return @{
|
|
39
|
-
@"TorchState": @{
|
|
40
|
-
@"off": @1,
|
|
41
|
-
@"on": @0
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
36
|
RCT_EXPORT_VIEW_PROPERTY(scanRegionVisible, BOOL)
|
|
47
37
|
RCT_EXPORT_VIEW_PROPERTY(overlayVisible, BOOL)
|
|
48
38
|
RCT_EXPORT_VIEW_PROPERTY(torchState, int)
|
package/js/CameraSettings.d.ts
CHANGED
package/js/CameraSettings.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.EnumTorchState = void 0;
|
|
4
4
|
var EnumTorchState;
|
|
5
5
|
(function (EnumTorchState) {
|
|
6
|
-
EnumTorchState[EnumTorchState["
|
|
7
|
-
EnumTorchState[EnumTorchState["
|
|
6
|
+
EnumTorchState[EnumTorchState["OFF"] = 0] = "OFF";
|
|
7
|
+
EnumTorchState[EnumTorchState["ON"] = 1] = "ON";
|
|
8
8
|
})(EnumTorchState = exports.EnumTorchState || (exports.EnumTorchState = {}));
|
|
9
9
|
//# sourceMappingURL=CameraSettings.js.map
|
package/package.json
CHANGED