react-native-scanbot-barcode-scanner-sdk 3.1.0 → 3.2.0-beta1
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/RNScanbotBarcodeSDK.podspec +1 -1
- package/android/build.gradle +1 -1
- package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkModule.java +40 -55
- package/android/src/main/res/drawable/ic_baseline_arrow_back_24.xml +10 -0
- package/package.json +1 -1
- package/src/configuration.ts +12 -0
- package/android/.gradle/7.0-rc-1/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.0-rc-1/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.0-rc-1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.0-rc-1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.0-rc-1/gc.properties +0 -0
package/android/build.gradle
CHANGED
|
@@ -15,7 +15,7 @@ def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3'
|
|
|
15
15
|
def DEFAULT_MIN_SDK_VERSION = 21
|
|
16
16
|
def DEFAULT_TARGET_SDK_VERSION = 29
|
|
17
17
|
|
|
18
|
-
def sdkVersion = '3.1
|
|
18
|
+
def sdkVersion = '3.2.1'
|
|
19
19
|
|
|
20
20
|
def safeExtGet(prop, fallback) {
|
|
21
21
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
package/android/src/main/java/io/scanbot/barcodesdk/plugin/reactnative/ScanbotBarcodeSdkModule.java
CHANGED
|
@@ -10,6 +10,7 @@ import android.content.Intent;
|
|
|
10
10
|
import android.graphics.Bitmap;
|
|
11
11
|
import android.net.Uri;
|
|
12
12
|
import android.provider.MediaStore;
|
|
13
|
+
|
|
13
14
|
import com.facebook.react.bridge.ActivityEventListener;
|
|
14
15
|
import com.facebook.react.bridge.Arguments;
|
|
15
16
|
import com.facebook.react.bridge.Promise;
|
|
@@ -20,8 +21,10 @@ import com.facebook.react.bridge.ReactMethod;
|
|
|
20
21
|
import com.facebook.react.bridge.ReadableMap;
|
|
21
22
|
import com.facebook.react.bridge.WritableArray;
|
|
22
23
|
import com.facebook.react.bridge.WritableMap;
|
|
24
|
+
|
|
23
25
|
import org.jetbrains.annotations.Contract;
|
|
24
26
|
import org.jetbrains.annotations.NotNull;
|
|
27
|
+
|
|
25
28
|
import java.io.File;
|
|
26
29
|
import java.io.IOException;
|
|
27
30
|
import java.util.ArrayList;
|
|
@@ -29,6 +32,7 @@ import java.util.HashMap;
|
|
|
29
32
|
import java.util.Map;
|
|
30
33
|
import java.util.concurrent.ExecutorService;
|
|
31
34
|
import java.util.concurrent.Executors;
|
|
35
|
+
|
|
32
36
|
import io.scanbot.sap.SdkLicenseInfo;
|
|
33
37
|
import io.scanbot.sdk.barcode.ScanbotBarcodeDetector;
|
|
34
38
|
import io.scanbot.sdk.barcode.entity.BarcodeDocumentFormat;
|
|
@@ -47,6 +51,7 @@ import io.scanbot.sdk.ui.view.barcode.configuration.BarcodeScannerConfiguration;
|
|
|
47
51
|
import io.scanbot.sdk.ui.view.base.configuration.CameraOrientationMode;
|
|
48
52
|
import kotlin.Unit;
|
|
49
53
|
import kotlin.jvm.functions.Function1;
|
|
54
|
+
|
|
50
55
|
import android.app.Activity;
|
|
51
56
|
|
|
52
57
|
|
|
@@ -132,8 +137,7 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
|
|
|
132
137
|
} else {
|
|
133
138
|
ResponseUtils.errorMessageJson(descriptionFromLicenseStatus(licenseInfo.getStatus()), promise);
|
|
134
139
|
}
|
|
135
|
-
}
|
|
136
|
-
catch (Exception ex) {
|
|
140
|
+
} catch (Exception ex) {
|
|
137
141
|
promise.reject(ex);
|
|
138
142
|
}
|
|
139
143
|
}
|
|
@@ -153,8 +157,7 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
|
|
|
153
157
|
result.putString("licenseStatus", licenseInfo.getStatus().name());
|
|
154
158
|
result.putString("licenseStatusMessage", descriptionFromLicenseStatus(licenseInfo.getStatus()));
|
|
155
159
|
promise.resolve(result);
|
|
156
|
-
}
|
|
157
|
-
catch (Exception ex) {
|
|
160
|
+
} catch (Exception ex) {
|
|
158
161
|
promise.reject(ex);
|
|
159
162
|
}
|
|
160
163
|
}
|
|
@@ -237,35 +240,13 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
|
|
|
237
240
|
|
|
238
241
|
safeMap(options, configuration, promise);
|
|
239
242
|
|
|
240
|
-
|
|
241
|
-
if (orientationMode != null) {
|
|
242
|
-
configuration.setOrientationLockMode(orientationMode);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
final ArrayList<BarcodeFormat> formats = JSONUtils.extractBarcodeFormats(options);
|
|
246
|
-
if (!formats.isEmpty()) {
|
|
247
|
-
configuration.setBarcodeFormatsFilter(formats);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
final ArrayList<BarcodeDocumentFormat> documentFormats = JSONUtils.extractBarcodeDocumentFormats(options);
|
|
251
|
-
if (!documentFormats.isEmpty()) {
|
|
252
|
-
configuration.setAcceptedDocumentFormats(documentFormats);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
final BarcodeScannerAdditionalConfiguration additionalConfiguration =
|
|
256
|
-
JSONUtils.extractBarcodeScannerAdditionalConfiguration(options);
|
|
257
|
-
if (additionalConfiguration != null) {
|
|
258
|
-
configuration.setAdditionalDetectionParameters(additionalConfiguration);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
configuration.setEngineMode(JSONUtils.extractEngineMode(options));
|
|
243
|
+
this.setCustomBarcodeScannerConfiguration(options, configuration);
|
|
262
244
|
|
|
263
245
|
final Intent intent = BarcodeScannerActivity.newIntent(this.getReactApplicationContext(), configuration);
|
|
264
246
|
activityCallbackPromise = promise;
|
|
265
247
|
context.addActivityEventListener(this);
|
|
266
248
|
context.startActivityForResult(intent, REQUEST_SB_BARCODE_SCANNER, null);
|
|
267
|
-
}
|
|
268
|
-
catch (final Exception e) {
|
|
249
|
+
} catch (final Exception e) {
|
|
269
250
|
promise.reject("Error starting barcode scanner.", e);
|
|
270
251
|
}
|
|
271
252
|
}
|
|
@@ -286,31 +267,7 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
|
|
|
286
267
|
|
|
287
268
|
ObjectMapper.map(configuration, nativeConfig);
|
|
288
269
|
|
|
289
|
-
|
|
290
|
-
final BarcodeScannerAdditionalConfiguration additionalConfiguration =
|
|
291
|
-
JSONUtils.extractBarcodeScannerAdditionalConfiguration(configuration);
|
|
292
|
-
if(additionalConfiguration != null) {
|
|
293
|
-
nativeConfig.setAdditionalDetectionParameters(additionalConfiguration);
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
CameraOrientationMode orientationMode = JSONUtils.extractCameraOrientationMode(configuration);
|
|
297
|
-
if (orientationMode != null) {
|
|
298
|
-
nativeConfig.setOrientationLockMode(orientationMode);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
// Barcode Format Filters
|
|
302
|
-
ArrayList<BarcodeFormat> formats = JSONUtils.extractBarcodeFormats(configuration);
|
|
303
|
-
if (!formats.isEmpty()) {
|
|
304
|
-
nativeConfig.setBarcodeFormatsFilter(formats);
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
// Document Format Filters
|
|
308
|
-
ArrayList<BarcodeDocumentFormat> documentFormats = JSONUtils.extractBarcodeDocumentFormats(configuration);
|
|
309
|
-
if (!documentFormats.isEmpty()) {
|
|
310
|
-
nativeConfig.setAcceptedDocumentFormats(documentFormats);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
nativeConfig.setEngineMode(JSONUtils.extractEngineMode(configuration));
|
|
270
|
+
this.setCustomBarcodeScannerConfiguration(configuration, nativeConfig);
|
|
314
271
|
|
|
315
272
|
Intent startIntent = BatchBarcodeScannerActivity.newIntent(context, nativeConfig, null);
|
|
316
273
|
|
|
@@ -322,6 +279,35 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
|
|
|
322
279
|
}
|
|
323
280
|
}
|
|
324
281
|
|
|
282
|
+
private void setCustomBarcodeScannerConfiguration(final ReadableMap options, BarcodeScannerConfiguration configuration) {
|
|
283
|
+
CameraOrientationMode orientationMode = JSONUtils.extractCameraOrientationMode(options);
|
|
284
|
+
if (orientationMode != null) {
|
|
285
|
+
configuration.setOrientationLockMode(orientationMode);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
final ArrayList<BarcodeFormat> formats = JSONUtils.extractBarcodeFormats(options);
|
|
289
|
+
if (!formats.isEmpty()) {
|
|
290
|
+
configuration.setBarcodeFormatsFilter(formats);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
final ArrayList<BarcodeDocumentFormat> documentFormats = JSONUtils.extractBarcodeDocumentFormats(options);
|
|
294
|
+
if (!documentFormats.isEmpty()) {
|
|
295
|
+
configuration.setAcceptedDocumentFormats(documentFormats);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
final BarcodeScannerAdditionalConfiguration additionalConfiguration =
|
|
299
|
+
JSONUtils.extractBarcodeScannerAdditionalConfiguration(options);
|
|
300
|
+
if (additionalConfiguration != null) {
|
|
301
|
+
configuration.setAdditionalDetectionParameters(additionalConfiguration);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
configuration.setEngineMode(JSONUtils.extractEngineMode(options));
|
|
305
|
+
|
|
306
|
+
if (options.hasKey("replaceCancelButtonWithIcon") && options.getBoolean("replaceCancelButtonWithIcon")) {
|
|
307
|
+
configuration.setCancelButtonIcon(R.drawable.ic_baseline_arrow_back_24);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
325
311
|
@ReactMethod
|
|
326
312
|
public void closeBatchBarcodeScanner(final Promise promise) {
|
|
327
313
|
final ReactContext context = getReactApplicationContext();
|
|
@@ -345,8 +331,7 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
|
|
|
345
331
|
debugLog("Cleaning plugin storage folder ...");
|
|
346
332
|
StorageUtils.cleanupPluginStorageDirectory(getReactApplicationContext());
|
|
347
333
|
ResponseUtils.successMessageJson("Cleanup successfully done.", promise);
|
|
348
|
-
}
|
|
349
|
-
catch (final Exception e) {
|
|
334
|
+
} catch (final Exception e) {
|
|
350
335
|
ResponseUtils.errorMessageJson(e.getLocalizedMessage(), promise);
|
|
351
336
|
}
|
|
352
337
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
2
|
+
android:width="24dp"
|
|
3
|
+
android:height="24dp"
|
|
4
|
+
android:viewportWidth="24"
|
|
5
|
+
android:viewportHeight="24"
|
|
6
|
+
android:tint="?attr/colorControlNormal">
|
|
7
|
+
<path
|
|
8
|
+
android:fillColor="@android:color/white"
|
|
9
|
+
android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
|
|
10
|
+
</vector>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-scanbot-barcode-scanner-sdk",
|
|
3
3
|
"title": "Scanbot Barcode Scanner SDK for React Native",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.2.0-beta1",
|
|
5
5
|
"description": "React Native plugin for the Scanbot Barcode Scanner SDK on Android and iOS",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|
package/src/configuration.ts
CHANGED
|
@@ -152,6 +152,12 @@ export interface BarcodeScannerConfiguration {
|
|
|
152
152
|
* Android only.
|
|
153
153
|
*/
|
|
154
154
|
lowPowerMode?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* If `true`, replaces the cancel button in the top bar with a back arrow icon
|
|
157
|
+
* The default is `false`.
|
|
158
|
+
* Android only.
|
|
159
|
+
*/
|
|
160
|
+
replaceCancelButtonWithIcon?: boolean;
|
|
155
161
|
}
|
|
156
162
|
|
|
157
163
|
export interface BatchBarcodeScannerConfiguration {
|
|
@@ -325,6 +331,12 @@ export interface BatchBarcodeScannerConfiguration {
|
|
|
325
331
|
* Android only.
|
|
326
332
|
*/
|
|
327
333
|
lowPowerMode?: boolean;
|
|
334
|
+
/**
|
|
335
|
+
* If `true`, replaces the cancel button in the top bar with a back arrow icon
|
|
336
|
+
* The default is `false`.
|
|
337
|
+
* Android only.
|
|
338
|
+
*/
|
|
339
|
+
replaceCancelButtonWithIcon?: boolean;
|
|
328
340
|
}
|
|
329
341
|
|
|
330
342
|
interface InternalBarcodeDetectionCommonParameters {
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|