dynamsoft-capture-vision-react-native 1.1.1 → 1.1.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/README.md +278 -278
- package/android/build.gradle +54 -54
- package/android/src/main/AndroidManifest.xml +5 -5
- package/android/src/main/java/com/dynamsoft/reactlibrary/Constants.java +23 -23
- package/android/src/main/java/com/dynamsoft/reactlibrary/RNDCECameraView.java +19 -2
- package/android/src/main/java/com/dynamsoft/reactlibrary/RNDCECameraViewManager.java +18 -6
- package/android/src/main/java/com/dynamsoft/reactlibrary/RNDynamsoftBarcodeReaderModule.java +284 -282
- package/android/src/main/java/com/dynamsoft/reactlibrary/RNDynamsoftCaptrueVisionPackage.java +35 -38
- package/dynamsoft-capture-vision-react-native.podspec +22 -22
- package/ios/RNDynamsoftCaptureVision/DYSCameraView.m +8 -4
- package/js/BarcodeResult.d.ts +25 -25
- package/js/BarcodeResult.js +2 -2
- package/js/BasicStructures.d.ts +20 -20
- package/js/BasicStructures.js +2 -2
- package/js/CameraSettings.d.ts +11 -11
- package/js/CameraSettings.js +8 -8
- package/js/DynamsoftBarcodeReader.js +75 -75
- package/package.json +38 -38
package/android/src/main/java/com/dynamsoft/reactlibrary/RNDynamsoftBarcodeReaderModule.java
CHANGED
|
@@ -1,282 +1,284 @@
|
|
|
1
|
-
|
|
2
|
-
package com.dynamsoft.reactlibrary;
|
|
3
|
-
|
|
4
|
-
import android.app.Activity;
|
|
5
|
-
import android.util.Log;
|
|
6
|
-
|
|
7
|
-
import com.dynamsoft.dbr.BarcodeReader;
|
|
8
|
-
import com.dynamsoft.dbr.BarcodeReaderException;
|
|
9
|
-
import com.dynamsoft.dbr.DBRLicenseVerificationListener;
|
|
10
|
-
import com.dynamsoft.dbr.EnumBarcodeFormat_2;
|
|
11
|
-
import com.dynamsoft.dbr.EnumConflictMode;
|
|
12
|
-
import com.dynamsoft.dbr.EnumPresetTemplate;
|
|
13
|
-
import com.dynamsoft.dbr.ImageData;
|
|
14
|
-
import com.dynamsoft.dbr.LocalizationResult;
|
|
15
|
-
import com.dynamsoft.dbr.Point;
|
|
16
|
-
import com.dynamsoft.dbr.PublicRuntimeSettings;
|
|
17
|
-
import com.dynamsoft.dbr.TextResult;
|
|
18
|
-
import com.dynamsoft.dbr.TextResultListener;
|
|
19
|
-
import com.dynamsoft.dce.CameraEnhancer;
|
|
20
|
-
import com.facebook.react.bridge.Arguments;
|
|
21
|
-
import com.facebook.react.bridge.Promise;
|
|
22
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
23
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
24
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
25
|
-
import com.facebook.react.bridge.ReadableMap;
|
|
26
|
-
import com.facebook.react.bridge.WritableArray;
|
|
27
|
-
import com.facebook.react.bridge.WritableMap;
|
|
28
|
-
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
29
|
-
|
|
30
|
-
import java.util.
|
|
31
|
-
import java.util.
|
|
32
|
-
import
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
public
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
promise.
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
settings
|
|
156
|
-
settings.
|
|
157
|
-
settings.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
promise.resolve(
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
settingsMap.putInt("
|
|
216
|
-
settingsMap.putInt("
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
serializedBarcode.putString("barcodeFormatString", barcode.
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
location.
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
quadrilateral.
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
pointMap.
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
1
|
+
|
|
2
|
+
package com.dynamsoft.reactlibrary;
|
|
3
|
+
|
|
4
|
+
import android.app.Activity;
|
|
5
|
+
import android.util.Log;
|
|
6
|
+
|
|
7
|
+
import com.dynamsoft.dbr.BarcodeReader;
|
|
8
|
+
import com.dynamsoft.dbr.BarcodeReaderException;
|
|
9
|
+
import com.dynamsoft.dbr.DBRLicenseVerificationListener;
|
|
10
|
+
import com.dynamsoft.dbr.EnumBarcodeFormat_2;
|
|
11
|
+
import com.dynamsoft.dbr.EnumConflictMode;
|
|
12
|
+
import com.dynamsoft.dbr.EnumPresetTemplate;
|
|
13
|
+
import com.dynamsoft.dbr.ImageData;
|
|
14
|
+
import com.dynamsoft.dbr.LocalizationResult;
|
|
15
|
+
import com.dynamsoft.dbr.Point;
|
|
16
|
+
import com.dynamsoft.dbr.PublicRuntimeSettings;
|
|
17
|
+
import com.dynamsoft.dbr.TextResult;
|
|
18
|
+
import com.dynamsoft.dbr.TextResultListener;
|
|
19
|
+
import com.dynamsoft.dce.CameraEnhancer;
|
|
20
|
+
import com.facebook.react.bridge.Arguments;
|
|
21
|
+
import com.facebook.react.bridge.Promise;
|
|
22
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
23
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
24
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
25
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
26
|
+
import com.facebook.react.bridge.WritableArray;
|
|
27
|
+
import com.facebook.react.bridge.WritableMap;
|
|
28
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
29
|
+
|
|
30
|
+
import java.util.Collections;
|
|
31
|
+
import java.util.HashMap;
|
|
32
|
+
import java.util.Map;
|
|
33
|
+
|
|
34
|
+
import javax.annotation.Nullable;
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
public class RNDynamsoftBarcodeReaderModule extends ReactContextBaseJavaModule {
|
|
38
|
+
|
|
39
|
+
private final ReactApplicationContext mReactContext;
|
|
40
|
+
|
|
41
|
+
public BarcodeReader mReader;
|
|
42
|
+
public boolean mIsCameraAttached;
|
|
43
|
+
public CameraEnhancer mCamera;
|
|
44
|
+
|
|
45
|
+
public RNDynamsoftBarcodeReaderModule(ReactApplicationContext reactContext) {
|
|
46
|
+
super(reactContext);
|
|
47
|
+
mReactContext = reactContext;
|
|
48
|
+
mIsCameraAttached = false;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@Override
|
|
52
|
+
public String getName() {
|
|
53
|
+
return "RNDynamsoftBarcodeReader";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@Nullable
|
|
57
|
+
@Override
|
|
58
|
+
public Map<String, Object> getConstants() {
|
|
59
|
+
return Collections.unmodifiableMap(new HashMap<String, Object>() {
|
|
60
|
+
{
|
|
61
|
+
put("TorchState", getFlashModeConstants());
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
private Map<String, Object> getFlashModeConstants() {
|
|
65
|
+
return Collections.unmodifiableMap(new HashMap<String, Object>() {
|
|
66
|
+
{
|
|
67
|
+
put("off", Constants.TORCH_OFF);
|
|
68
|
+
put("on", Constants.TORCH_ON);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@ReactMethod
|
|
77
|
+
public void initLicense(String license, final Promise promise) {
|
|
78
|
+
BarcodeReader.initLicense(license, new DBRLicenseVerificationListener() {
|
|
79
|
+
@Override
|
|
80
|
+
public void DBRLicenseVerificationCallback(boolean b, Exception e) {
|
|
81
|
+
if (b) {
|
|
82
|
+
promise.resolve(true);
|
|
83
|
+
} else {
|
|
84
|
+
BarcodeReaderException be = (BarcodeReaderException) e;
|
|
85
|
+
promise.reject(be.getErrorCode() + "", e);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@ReactMethod
|
|
92
|
+
public void createInstance() {
|
|
93
|
+
if(mReader == null) {
|
|
94
|
+
try {
|
|
95
|
+
mReader = new BarcodeReader();
|
|
96
|
+
} catch (BarcodeReaderException e) {
|
|
97
|
+
e.printStackTrace();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (mCamera != null && !mIsCameraAttached) {
|
|
101
|
+
mIsCameraAttached = true;
|
|
102
|
+
mReader.setCameraEnhancer(mCamera);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@ReactMethod
|
|
107
|
+
public void getVersion(Promise promise) {
|
|
108
|
+
promise.resolve(mReader.getVersion());
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@ReactMethod
|
|
112
|
+
public void addResultListener() {
|
|
113
|
+
mReader.setTextResultListener(new TextResultListener() {
|
|
114
|
+
@Override
|
|
115
|
+
public void textResultCallback(int i, ImageData imageData, final TextResult[] textResults) {
|
|
116
|
+
WritableArray results = serializeResults(textResults);
|
|
117
|
+
mReactContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit(
|
|
118
|
+
"resultEvent",
|
|
119
|
+
results);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@ReactMethod
|
|
125
|
+
public void addListener(String eventName) {
|
|
126
|
+
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
@ReactMethod
|
|
130
|
+
public void removeListeners(Integer count) {
|
|
131
|
+
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@ReactMethod
|
|
135
|
+
public void startBarcodeScanning() {
|
|
136
|
+
if (mCamera != null && !mIsCameraAttached) {
|
|
137
|
+
mReader.setCameraEnhancer(mCamera);
|
|
138
|
+
mIsCameraAttached = true;
|
|
139
|
+
}
|
|
140
|
+
mReader.startScanning();
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@ReactMethod
|
|
144
|
+
public void stopBarcodeScanning() {
|
|
145
|
+
mReader.stopScanning();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@ReactMethod
|
|
149
|
+
public void updateSettingsFromDictionary(ReadableMap map, Promise promise) {
|
|
150
|
+
if (map == null) {
|
|
151
|
+
promise.resolve(false);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
try {
|
|
155
|
+
PublicRuntimeSettings settings = mReader.getRuntimeSettings();
|
|
156
|
+
settings.barcodeFormatIds = map.getInt("barcodeFormatIds");
|
|
157
|
+
settings.barcodeFormatIds_2 = map.getInt("barcodeFormatIds_2");
|
|
158
|
+
settings.expectedBarcodesCount = map.getInt("expectedBarcodesCount");
|
|
159
|
+
settings.timeout = map.getInt("timeout");
|
|
160
|
+
mReader.updateRuntimeSettings(settings);
|
|
161
|
+
promise.resolve(true);
|
|
162
|
+
} catch (BarcodeReaderException e) {
|
|
163
|
+
e.printStackTrace();
|
|
164
|
+
promise.resolve(false);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@ReactMethod
|
|
169
|
+
public void updateSettingsFromNumber(int PresetTpl, Promise promise) {
|
|
170
|
+
if (PresetTpl >= 0 && PresetTpl <= 6) {
|
|
171
|
+
mReader.updateRuntimeSettings(EnumPresetTemplate.fromValue(PresetTpl));
|
|
172
|
+
promise.resolve(true);
|
|
173
|
+
} else {
|
|
174
|
+
promise.resolve(false);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
@ReactMethod
|
|
179
|
+
public void updateSettingsFromString(String settingsStr, Promise promise) {
|
|
180
|
+
try {
|
|
181
|
+
mReader.initRuntimeSettingsWithString(settingsStr, EnumConflictMode.CM_OVERWRITE);
|
|
182
|
+
promise.resolve(true);
|
|
183
|
+
} catch (BarcodeReaderException e) {
|
|
184
|
+
e.printStackTrace();
|
|
185
|
+
promise.resolve(false);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@ReactMethod
|
|
190
|
+
public void resetSettings(Promise promise) {
|
|
191
|
+
try {
|
|
192
|
+
mReader.resetRuntimeSettings();
|
|
193
|
+
} catch (BarcodeReaderException e) {
|
|
194
|
+
e.printStackTrace();
|
|
195
|
+
promise.resolve(false);
|
|
196
|
+
}
|
|
197
|
+
promise.resolve(true);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
@ReactMethod
|
|
201
|
+
public void outputSettings(Promise promise) {
|
|
202
|
+
try {
|
|
203
|
+
promise.resolve(mReader.outputSettingsToString(""));
|
|
204
|
+
} catch (BarcodeReaderException e) {
|
|
205
|
+
e.printStackTrace();
|
|
206
|
+
promise.reject(e.getErrorCode() + "", e.getCause());
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
@ReactMethod
|
|
211
|
+
public void getSettings(Promise promise) {
|
|
212
|
+
WritableMap settingsMap = Arguments.createMap();
|
|
213
|
+
try {
|
|
214
|
+
PublicRuntimeSettings settings = mReader.getRuntimeSettings();
|
|
215
|
+
settingsMap.putInt("barcodeFormatIds", settings.barcodeFormatIds);
|
|
216
|
+
settingsMap.putInt("barcodeFormatIds_2", settings.barcodeFormatIds_2);
|
|
217
|
+
settingsMap.putInt("expectedBarcodesCount", settings.expectedBarcodesCount);
|
|
218
|
+
settingsMap.putInt("timeout", settings.timeout);
|
|
219
|
+
} catch (BarcodeReaderException e) {
|
|
220
|
+
e.printStackTrace();
|
|
221
|
+
promise.reject(e.getErrorCode() + "", e.getCause());
|
|
222
|
+
}
|
|
223
|
+
promise.resolve(settingsMap);
|
|
224
|
+
// return settingsMap;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
private WritableArray serializeResults(TextResult[] barcodes) {
|
|
228
|
+
WritableArray barcodeList = Arguments.createArray();
|
|
229
|
+
|
|
230
|
+
for (int i = 0; i < barcodes.length; i++) {
|
|
231
|
+
TextResult barcode = barcodes[i];
|
|
232
|
+
WritableMap serializedBarcode = Arguments.createMap();
|
|
233
|
+
|
|
234
|
+
if (barcode.barcodeFormat_2 != EnumBarcodeFormat_2.BF2_NULL) {
|
|
235
|
+
serializedBarcode.putString("barcodeFormatString", barcode.barcodeFormatString_2);
|
|
236
|
+
} else {
|
|
237
|
+
serializedBarcode.putString("barcodeFormatString", barcode.barcodeFormatString);
|
|
238
|
+
}
|
|
239
|
+
serializedBarcode.putString("barcodeText", barcode.barcodeText);
|
|
240
|
+
serializedBarcode.putMap("barcodeLocation", handleLocationResult(barcode.localizationResult));
|
|
241
|
+
barcodeList.pushMap(serializedBarcode);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return barcodeList;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
private WritableMap handleLocationResult(LocalizationResult result) {
|
|
248
|
+
if (result == null) {
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
251
|
+
WritableMap location = Arguments.createMap();
|
|
252
|
+
location.putInt("angle", result.angle);
|
|
253
|
+
location.putMap("quadrilateral", handleQuadrilateral(result.resultPoints));
|
|
254
|
+
return location;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
private WritableMap handleQuadrilateral(Point[] points) {
|
|
258
|
+
if (points == null) {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
WritableMap quadrilateral = Arguments.createMap();
|
|
262
|
+
|
|
263
|
+
quadrilateral.putArray("points", handlePoints(points));
|
|
264
|
+
return quadrilateral;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
private WritableArray handlePoints(Point[] points) {
|
|
268
|
+
if (points == null) {
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
WritableArray pointArray = Arguments.createArray();
|
|
272
|
+
for (int i = 0; i < 4; i++) {
|
|
273
|
+
pointArray.pushMap(handleSinglePoint(points[i]));
|
|
274
|
+
}
|
|
275
|
+
return pointArray;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
private WritableMap handleSinglePoint(Point point) {
|
|
279
|
+
WritableMap pointMap = Arguments.createMap();
|
|
280
|
+
pointMap.putInt("x", point.x);
|
|
281
|
+
pointMap.putInt("y", point.y);
|
|
282
|
+
return pointMap;
|
|
283
|
+
}
|
|
284
|
+
}
|
package/android/src/main/java/com/dynamsoft/reactlibrary/RNDynamsoftCaptrueVisionPackage.java
CHANGED
|
@@ -1,39 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
package com.dynamsoft.reactlibrary;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import java.util.Arrays;
|
|
6
|
-
import java.util.Collections;
|
|
7
|
-
import java.util.List;
|
|
8
|
-
|
|
9
|
-
import com.dynamsoft.dce.CameraEnhancer;
|
|
10
|
-
import com.facebook.react.ReactPackage;
|
|
11
|
-
import com.facebook.react.bridge.NativeModule;
|
|
12
|
-
import com.facebook.react.bridge.ReactApplicationContext;
|
|
13
|
-
import com.facebook.react.uimanager.ViewManager;
|
|
14
|
-
import com.facebook.react.bridge.JavaScriptModule;
|
|
15
|
-
public class RNDynamsoftCaptrueVisionPackage implements ReactPackage {
|
|
16
|
-
CameraEnhancer mCamera;
|
|
17
|
-
RNDynamsoftBarcodeReaderModule mDbrModule;
|
|
18
|
-
RNDCECameraViewManager mDCEViewManager;
|
|
19
|
-
|
|
20
|
-
@Override
|
|
21
|
-
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
|
22
|
-
mDbrModule = new RNDynamsoftBarcodeReaderModule(reactContext);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
mDCEViewManager = new RNDCECameraViewManager(reactContext, mDbrModule);
|
|
37
|
-
return Arrays.<ViewManager>asList(mDCEViewManager);
|
|
38
|
-
}
|
|
1
|
+
|
|
2
|
+
package com.dynamsoft.reactlibrary;
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
import java.util.Arrays;
|
|
6
|
+
import java.util.Collections;
|
|
7
|
+
import java.util.List;
|
|
8
|
+
|
|
9
|
+
import com.dynamsoft.dce.CameraEnhancer;
|
|
10
|
+
import com.facebook.react.ReactPackage;
|
|
11
|
+
import com.facebook.react.bridge.NativeModule;
|
|
12
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
13
|
+
import com.facebook.react.uimanager.ViewManager;
|
|
14
|
+
import com.facebook.react.bridge.JavaScriptModule;
|
|
15
|
+
public class RNDynamsoftCaptrueVisionPackage implements ReactPackage {
|
|
16
|
+
CameraEnhancer mCamera;
|
|
17
|
+
RNDynamsoftBarcodeReaderModule mDbrModule;
|
|
18
|
+
RNDCECameraViewManager mDCEViewManager;
|
|
19
|
+
|
|
20
|
+
@Override
|
|
21
|
+
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
|
|
22
|
+
mDbrModule = new RNDynamsoftBarcodeReaderModule(reactContext);
|
|
23
|
+
return Arrays.<NativeModule>asList(mDbrModule);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Deprecated from RN 0.47
|
|
27
|
+
public List<Class<? extends JavaScriptModule>> createJSModules() {
|
|
28
|
+
return Collections.emptyList();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Override
|
|
32
|
+
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
|
33
|
+
mDCEViewManager = new RNDCECameraViewManager(reactContext, mDbrModule);
|
|
34
|
+
return Arrays.<ViewManager>asList(mDCEViewManager);
|
|
35
|
+
}
|
|
39
36
|
}
|