react-native-scanbot-barcode-scanner-sdk 3.2.1-beta9 → 3.2.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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- All items and source code Copyright (c) 2022 doo GmbH (https://scanbot.io).
1
+ All items and source code Copyright (c) 2022 Scanbot SDK GmbH (https://scanbot.io).
2
2
 
3
3
  Scanbot Document and Barcode Scanner SDK for React Native is a commercial
4
4
  product and requires a license to be used in a production environment. It will
package/Libraries.txt CHANGED
@@ -1,4 +1,4 @@
1
- Open Source libraries used in the Scanbot Barcode SDK for React Native version 3.1.0
1
+ Open Source libraries used in the Scanbot Barcode SDK for React Native version 3.2.1
2
2
 
3
3
  ------------------------------------------------------------------------------------------------------------------------
4
4
 
@@ -1970,32 +1970,10 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
1970
1970
  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1971
1971
 
1972
1972
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1973
-
1974
1973
  ------------------------------------------------------------------------------------------------------------------------
1975
1974
 
1976
1975
  Open Source libraries used in the Scanbot Barcode Scanner SDK for Android version 3.2.1
1977
1976
 
1978
- Apache Commons Codec
1979
-
1980
- Version 1.9
1981
- (https://github.com/apache/commons-codec)
1982
-
1983
- Copyright (c) The Apache Software Foundation
1984
-
1985
- Licensed under the Apache License, Version 2.0 (the "License");
1986
- you may not use this file except in compliance with the License.
1987
- You may obtain a copy of the License at
1988
-
1989
- http://www.apache.org/licenses/LICENSE-2.0
1990
-
1991
- Unless required by applicable law or agreed to in writing, software
1992
- distributed under the License is distributed on an "AS IS" BASIS,
1993
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1994
- See the License for the specific language governing permissions and
1995
- limitations under the License.
1996
-
1997
-
1998
-
1999
1977
  CWAC-Camera
2000
1978
 
2001
1979
  Version 0.6.42
@@ -2018,49 +1996,6 @@ limitations under the License.
2018
1996
 
2019
1997
 
2020
1998
 
2021
- Android PDF Writer
2022
-
2023
- Version 1.0.10
2024
- (https://github.com/Turbo87/apwlibrary/)
2025
-
2026
- Copyright (c) 2010 - 2013, Javier Santo Domingo (j-a-s-d@coderesearchlabs.com).
2027
- All rights reserved.
2028
-
2029
- Android PDF Writer (APW) is a simple Java library to generate simple PDF documents in
2030
- Google's Android devices distributed under a 2-clause
2031
- BSD license (https://github.com/Turbo87/apwlibrary/blob/master/doc/APW.pdf).
2032
-
2033
- Redistribution and use in source and binary forms, with or without modification,
2034
- are permitted provided that the following conditions are met:
2035
-
2036
- Redistributions of source code must retain the above copyright notice, this list of
2037
- conditions and the following disclaimer.
2038
- Redistributions in binary form must reproduce the above copyright notice, this list of
2039
- conditions and the following disclaimer in the documentation and/or other materials
2040
- provided with the distribution.
2041
-
2042
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
2043
- OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
2044
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
2045
- THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2046
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
2047
- OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2048
- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
2049
- TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
2050
- EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2051
-
2052
- This software includes several classes from the Android Open Source Project Copyright 2010
2053
- The Android Open Source Project. Licensed under the Apache License, Version 2.0
2054
- (the License); you may not use this file except in compliance with the License.
2055
- You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
2056
-
2057
- Unless required by applicable law or agreed to in writing, software distributed under the
2058
- License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
2059
- either express or implied. See the License for the specific language governing
2060
- permissions and limitations under the License.
2061
-
2062
-
2063
-
2064
1999
  Apache Commons IO
2065
2000
 
2066
2001
  Version 2.4
@@ -2085,33 +2020,6 @@ limitations under the License.
2085
2020
 
2086
2021
 
2087
2022
 
2088
- Apache Commons Lang
2089
-
2090
- Version 2.6
2091
- (https://github.com/apache/commons-lang)
2092
-
2093
- Copyright (c) The Apache Software Foundation
2094
-
2095
- This product includes software developed at
2096
- The Apache Software Foundation (http://www.apache.org/).
2097
-
2098
- This product includes software from the Spring Framework,
2099
- under the Apache License 2.0 (see: StringUtils.containsWhitespace())
2100
-
2101
- Licensed under the Apache License, Version 2.0 (the "License");
2102
- you may not use this file except in compliance with the License.
2103
- You may obtain a copy of the License at
2104
-
2105
- http://www.apache.org/licenses/LICENSE-2.0
2106
-
2107
- Unless required by applicable law or agreed to in writing, software
2108
- distributed under the License is distributed on an "AS IS" BASIS,
2109
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2110
- See the License for the specific language governing permissions and
2111
- limitations under the License.
2112
-
2113
-
2114
-
2115
2023
  Kotlin Standard Library
2116
2024
 
2117
2025
  Version 1.4.20
@@ -2148,6 +2056,7 @@ See the License for the specific language governing permissions and
2148
2056
  limitations under the License.
2149
2057
 
2150
2058
 
2059
+
2151
2060
  google-gson
2152
2061
  Version 2.8.6
2153
2062
  (https://github.com/google/gson/blob/gson-parent-2.8.5/LICENSE)
@@ -2167,6 +2076,7 @@ See the License for the specific language governing permissions and
2167
2076
  limitations under the License.
2168
2077
 
2169
2078
 
2079
+
2170
2080
  Dagger
2171
2081
 
2172
2082
  Version 2.35
@@ -2528,40 +2438,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2528
2438
  SOFTWARE.
2529
2439
 
2530
2440
 
2531
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2532
-
2533
- Leptonica
2534
-
2535
- Version 1.82.0
2536
- (https://github.com/DanBloomberg/leptonica)
2537
-
2538
- /*====================================================================*
2539
- - Copyright (C) 2001-2020 Leptonica. All rights reserved.
2540
- -
2541
- - Redistribution and use in source and binary forms, with or without
2542
- - modification, are permitted provided that the following conditions
2543
- - are met:
2544
- - 1. Redistributions of source code must retain the above copyright
2545
- - notice, this list of conditions and the following disclaimer.
2546
- - 2. Redistributions in binary form must reproduce the above
2547
- - copyright notice, this list of conditions and the following
2548
- - disclaimer in the documentation and/or other materials
2549
- - provided with the distribution.
2550
- -
2551
- - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2552
- - ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2553
- - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2554
- - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANY
2555
- - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
2556
- - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
2557
- - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
2558
- - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
2559
- - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
2560
- - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2561
- - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2562
- *====================================================================*/
2563
-
2564
-
2565
2441
 
2566
2442
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
2567
2443
 
@@ -3584,216 +3460,6 @@ By contributing to the BVLC/caffe repository through pull-request, comment,
3584
3460
  or otherwise, the contributor releases their content to the
3585
3461
  license and copyright terms herein.
3586
3462
 
3587
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3588
-
3589
- Tesseract
3590
-
3591
- Version 4.1.3
3592
- (https://github.com/tesseract-ocr/tesseract)
3593
-
3594
-
3595
- Apache License
3596
- Version 2.0, January 2004
3597
- http://www.apache.org/licenses/
3598
-
3599
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
3600
-
3601
- 1. Definitions.
3602
-
3603
- "License" shall mean the terms and conditions for use, reproduction,
3604
- and distribution as defined by Sections 1 through 9 of this document.
3605
-
3606
- "Licensor" shall mean the copyright owner or entity authorized by
3607
- the copyright owner that is granting the License.
3608
-
3609
- "Legal Entity" shall mean the union of the acting entity and all
3610
- other entities that control, are controlled by, or are under common
3611
- control with that entity. For the purposes of this definition,
3612
- "control" means (i) the power, direct or indirect, to cause the
3613
- direction or management of such entity, whether by contract or
3614
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
3615
- outstanding shares, or (iii) beneficial ownership of such entity.
3616
-
3617
- "You" (or "Your") shall mean an individual or Legal Entity
3618
- exercising permissions granted by this License.
3619
-
3620
- "Source" form shall mean the preferred form for making modifications,
3621
- including but not limited to software source code, documentation
3622
- source, and configuration files.
3623
-
3624
- "Object" form shall mean any form resulting from mechanical
3625
- transformation or translation of a Source form, including but
3626
- not limited to compiled object code, generated documentation,
3627
- and conversions to other media types.
3628
-
3629
- "Work" shall mean the work of authorship, whether in Source or
3630
- Object form, made available under the License, as indicated by a
3631
- copyright notice that is included in or attached to the work
3632
- (an example is provided in the Appendix below).
3633
-
3634
- "Derivative Works" shall mean any work, whether in Source or Object
3635
- form, that is based on (or derived from) the Work and for which the
3636
- editorial revisions, annotations, elaborations, or other modifications
3637
- represent, as a whole, an original work of authorship. For the purposes
3638
- of this License, Derivative Works shall not include works that remain
3639
- separable from, or merely link (or bind by name) to the interfaces of,
3640
- the Work and Derivative Works thereof.
3641
-
3642
- "Contribution" shall mean any work of authorship, including
3643
- the original version of the Work and any modifications or additions
3644
- to that Work or Derivative Works thereof, that is intentionally
3645
- submitted to Licensor for inclusion in the Work by the copyright owner
3646
- or by an individual or Legal Entity authorized to submit on behalf of
3647
- the copyright owner. For the purposes of this definition, "submitted"
3648
- means any form of electronic, verbal, or written communication sent
3649
- to the Licensor or its representatives, including but not limited to
3650
- communication on electronic mailing lists, source code control systems,
3651
- and issue tracking systems that are managed by, or on behalf of, the
3652
- Licensor for the purpose of discussing and improving the Work, but
3653
- excluding communication that is conspicuously marked or otherwise
3654
- designated in writing by the copyright owner as "Not a Contribution."
3655
-
3656
- "Contributor" shall mean Licensor and any individual or Legal Entity
3657
- on behalf of whom a Contribution has been received by Licensor and
3658
- subsequently incorporated within the Work.
3659
-
3660
- 2. Grant of Copyright License. Subject to the terms and conditions of
3661
- this License, each Contributor hereby grants to You a perpetual,
3662
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
3663
- copyright license to reproduce, prepare Derivative Works of,
3664
- publicly display, publicly perform, sublicense, and distribute the
3665
- Work and such Derivative Works in Source or Object form.
3666
-
3667
- 3. Grant of Patent License. Subject to the terms and conditions of
3668
- this License, each Contributor hereby grants to You a perpetual,
3669
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
3670
- (except as stated in this section) patent license to make, have made,
3671
- use, offer to sell, sell, import, and otherwise transfer the Work,
3672
- where such license applies only to those patent claims licensable
3673
- by such Contributor that are necessarily infringed by their
3674
- Contribution(s) alone or by combination of their Contribution(s)
3675
- with the Work to which such Contribution(s) was submitted. If You
3676
- institute patent litigation against any entity (including a
3677
- cross-claim or counterclaim in a lawsuit) alleging that the Work
3678
- or a Contribution incorporated within the Work constitutes direct
3679
- or contributory patent infringement, then any patent licenses
3680
- granted to You under this License for that Work shall terminate
3681
- as of the date such litigation is filed.
3682
-
3683
- 4. Redistribution. You may reproduce and distribute copies of the
3684
- Work or Derivative Works thereof in any medium, with or without
3685
- modifications, and in Source or Object form, provided that You
3686
- meet the following conditions:
3687
-
3688
- (a) You must give any other recipients of the Work or
3689
- Derivative Works a copy of this License; and
3690
-
3691
- (b) You must cause any modified files to carry prominent notices
3692
- stating that You changed the files; and
3693
-
3694
- (c) You must retain, in the Source form of any Derivative Works
3695
- that You distribute, all copyright, patent, trademark, and
3696
- attribution notices from the Source form of the Work,
3697
- excluding those notices that do not pertain to any part of
3698
- the Derivative Works; and
3699
-
3700
- (d) If the Work includes a "NOTICE" text file as part of its
3701
- distribution, then any Derivative Works that You distribute must
3702
- include a readable copy of the attribution notices contained
3703
- within such NOTICE file, excluding those notices that do not
3704
- pertain to any part of the Derivative Works, in at least one
3705
- of the following places: within a NOTICE text file distributed
3706
- as part of the Derivative Works; within the Source form or
3707
- documentation, if provided along with the Derivative Works; or,
3708
- within a display generated by the Derivative Works, if and
3709
- wherever such third-party notices normally appear. The contents
3710
- of the NOTICE file are for informational purposes only and
3711
- do not modify the License. You may add Your own attribution
3712
- notices within Derivative Works that You distribute, alongside
3713
- or as an addendum to the NOTICE text from the Work, provided
3714
- that such additional attribution notices cannot be construed
3715
- as modifying the License.
3716
-
3717
- You may add Your own copyright statement to Your modifications and
3718
- may provide additional or different license terms and conditions
3719
- for use, reproduction, or distribution of Your modifications, or
3720
- for any such Derivative Works as a whole, provided Your use,
3721
- reproduction, and distribution of the Work otherwise complies with
3722
- the conditions stated in this License.
3723
-
3724
- 5. Submission of Contributions. Unless You explicitly state otherwise,
3725
- any Contribution intentionally submitted for inclusion in the Work
3726
- by You to the Licensor shall be under the terms and conditions of
3727
- this License, without any additional terms or conditions.
3728
- Notwithstanding the above, nothing herein shall supersede or modify
3729
- the terms of any separate license agreement you may have executed
3730
- with Licensor regarding such Contributions.
3731
-
3732
- 6. Trademarks. This License does not grant permission to use the trade
3733
- names, trademarks, service marks, or product names of the Licensor,
3734
- except as required for reasonable and customary use in describing the
3735
- origin of the Work and reproducing the content of the NOTICE file.
3736
-
3737
- 7. Disclaimer of Warranty. Unless required by applicable law or
3738
- agreed to in writing, Licensor provides the Work (and each
3739
- Contributor provides its Contributions) on an "AS IS" BASIS,
3740
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
3741
- implied, including, without limitation, any warranties or conditions
3742
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
3743
- PARTICULAR PURPOSE. You are solely responsible for determining the
3744
- appropriateness of using or redistributing the Work and assume any
3745
- risks associated with Your exercise of permissions under this License.
3746
-
3747
- 8. Limitation of Liability. In no event and under no legal theory,
3748
- whether in tort (including negligence), contract, or otherwise,
3749
- unless required by applicable law (such as deliberate and grossly
3750
- negligent acts) or agreed to in writing, shall any Contributor be
3751
- liable to You for damages, including any direct, indirect, special,
3752
- incidental, or consequential damages of any character arising as a
3753
- result of this License or out of the use or inability to use the
3754
- Work (including but not limited to damages for loss of goodwill,
3755
- work stoppage, computer failure or malfunction, or any and all
3756
- other commercial damages or losses), even if such Contributor
3757
- has been advised of the possibility of such damages.
3758
-
3759
- 9. Accepting Warranty or Additional Liability. While redistributing
3760
- the Work or Derivative Works thereof, You may choose to offer,
3761
- and charge a fee for, acceptance of support, warranty, indemnity,
3762
- or other liability obligations and/or rights consistent with this
3763
- License. However, in accepting such obligations, You may act only
3764
- on Your own behalf and on Your sole responsibility, not on behalf
3765
- of any other Contributor, and only if You agree to indemnify,
3766
- defend, and hold each Contributor harmless for any liability
3767
- incurred by, or claims asserted against, such Contributor by reason
3768
- of your accepting any such warranty or additional liability.
3769
-
3770
- END OF TERMS AND CONDITIONS
3771
-
3772
- APPENDIX: How to apply the Apache License to your work.
3773
-
3774
- To apply the Apache License to your work, attach the following
3775
- boilerplate notice, with the fields enclosed by brackets "[]"
3776
- replaced with your own identifying information. (Don't include
3777
- the brackets!) The text should be enclosed in the appropriate
3778
- comment syntax for the file format. We also recommend that a
3779
- file or class name and description of purpose be included on the
3780
- same "printed page" as the copyright notice for easier
3781
- identification within third-party archives.
3782
-
3783
- Copyright [yyyy] [name of copyright owner]
3784
-
3785
- Licensed under the Apache License, Version 2.0 (the "License");
3786
- you may not use this file except in compliance with the License.
3787
- You may obtain a copy of the License at
3788
-
3789
- http://www.apache.org/licenses/LICENSE-2.0
3790
-
3791
- Unless required by applicable law or agreed to in writing, software
3792
- distributed under the License is distributed on an "AS IS" BASIS,
3793
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3794
- See the License for the specific language governing permissions and
3795
- limitations under the License.
3796
-
3797
3463
 
3798
3464
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
3799
3465
 
@@ -4155,4 +3821,6 @@ Version 1.1.0
4155
3821
  distributed under the License is distributed on an "AS IS" BASIS,
4156
3822
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4157
3823
  See the License for the specific language governing permissions and
4158
- limitations under the License.
3824
+ limitations under the License.
3825
+
3826
+
@@ -18,12 +18,15 @@ import com.facebook.react.bridge.ReactApplicationContext;
18
18
  import com.facebook.react.bridge.ReactContext;
19
19
  import com.facebook.react.bridge.ReactContextBaseJavaModule;
20
20
  import com.facebook.react.bridge.ReactMethod;
21
+ import com.facebook.react.bridge.ReadableArray;
21
22
  import com.facebook.react.bridge.ReadableMap;
22
23
  import com.facebook.react.bridge.WritableArray;
23
24
  import com.facebook.react.bridge.WritableMap;
24
25
 
25
26
  import org.jetbrains.annotations.Contract;
26
27
  import org.jetbrains.annotations.NotNull;
28
+ import org.json.JSONArray;
29
+ import org.json.JSONException;
27
30
 
28
31
  import java.io.File;
29
32
  import java.io.IOException;
@@ -182,19 +185,22 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
182
185
 
183
186
  detector.modifyConfig(new ScanbotBarcodeDetectorConfigBuilder(options));
184
187
 
185
- final BarcodeScanningResult result = detector.detectFromBitmap(bitmap, 0);
186
188
  WritableMap jsonResult;
187
-
188
- final boolean shouldFilterBarcodes = options.hasKey("barcodeFilter");
189
- if (shouldFilterBarcodes) {
190
- final BarcodeFilter barcodeFilter = JSONUtils.extractBarcodeFilter(options);
191
- if (barcodeFilter == null) {
192
- throw new IllegalArgumentException("Invalid Barcode Filter specified in JSON configuration: " + options.getString("barcodeFilter"));
193
- }
194
- final List<BarcodeItem> barcodeItems = JSONUtils.getBarcodeItemsFromResultWithFilter(result, barcodeFilter);
195
- jsonResult = jsonResultFromBarcodeScannerResult(barcodeItems);
189
+ final BarcodeScanningResult result = detector.detectFromBitmap(bitmap, 0);
190
+ if (result == null) {
191
+ jsonResult = JSONUtils.jsonResultFromBarcodeItems(new ArrayList<>());
196
192
  } else {
197
- jsonResult = jsonResultFromBarcodeScannerResult(result);
193
+ final boolean shouldFilterBarcodes = options.hasKey("barcodeFilter");
194
+ if (shouldFilterBarcodes) {
195
+ final BarcodeFilter barcodeFilter = JSONUtils.extractBarcodeFilter(options);
196
+ if (barcodeFilter == null) {
197
+ throw new IllegalArgumentException("Invalid Barcode Filter specified in JSON configuration: " + options.getString("barcodeFilter"));
198
+ }
199
+ final List<BarcodeItem> barcodeItems = JSONUtils.getBarcodeItemsFromResultWithFilter(result, barcodeFilter);
200
+ jsonResult = JSONUtils.jsonResultFromBarcodeItems(barcodeItems);
201
+ } else {
202
+ jsonResult = JSONUtils.jsonResultFromBarcodeResult(result);
203
+ }
198
204
  }
199
205
 
200
206
  jsonResult.putString("imageFileUri", imageUri);
@@ -349,7 +355,7 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
349
355
  final BarcodeScannerActivity.Result barcodeResult = BarcodeScannerActivity.extractResult(resultCode, intent);
350
356
 
351
357
  if (barcodeResult.getResultOk()) {
352
- final WritableMap result = jsonResultFromBarcodeScannerResult(barcodeResult.getResult());
358
+ final WritableMap result = JSONUtils.jsonResultFromBarcodeResult(barcodeResult.getResult());
353
359
 
354
360
  String imagePath = intent.getStringExtra(BarcodeScannerActivity.SCANNED_BARCODE_IMAGE_PATH_EXTRA);
355
361
  if (imagePath == null) {
@@ -378,27 +384,6 @@ public class ScanbotBarcodeSdkModule extends ReactContextBaseJavaModule implemen
378
384
  }
379
385
  }
380
386
 
381
- private static WritableMap jsonResultFromBarcodeScannerResult(List<BarcodeItem> barcodeItems) {
382
- final WritableArray barcodes = Arguments.createArray();
383
- for (BarcodeItem barcodeItem : barcodeItems) {
384
- final WritableMap barcode = Arguments.createMap();
385
- barcode.putString("type", barcodeItem.getBarcodeFormat().name());
386
- barcode.putString("text", barcodeItem.getText());
387
- barcode.putString("textWithExtension", barcodeItem.getTextWithExtension());
388
- barcodes.pushMap(barcode);
389
- }
390
- final WritableMap result = Arguments.createMap();
391
- result.putString("status", "OK");
392
- result.putArray("barcodes", barcodes);
393
- return result;
394
- }
395
-
396
- private static WritableMap jsonResultFromBarcodeScannerResult(BarcodeScanningResult barcodeResult) {
397
- return jsonResultFromBarcodeScannerResult(
398
- barcodeResult != null ? barcodeResult.getBarcodeItems() : new ArrayList<>()
399
- );
400
- }
401
-
402
387
  @NotNull
403
388
  @Contract(pure = true)
404
389
  private static String descriptionFromLicenseStatus(@NotNull io.scanbot.sap.Status status) {
@@ -207,22 +207,7 @@ public class RNScanbotBarcodeCameraComponent extends RNScanbotNativeComponent im
207
207
  return;
208
208
  }
209
209
 
210
- final WritableArray barcodes = new WritableNativeArray();
211
-
212
- for (BarcodeItem item: barcodeItems) {
213
- final WritableMap barcode = new JSONUtils.WritableMapBuilder()
214
- .putString("text", item.getText())
215
- .putString("type", item.getBarcodeFormat().name())
216
- .putString("textWithExtension", item.getTextWithExtension())
217
- .build();
218
- barcodes.pushMap(barcode);
219
- }
220
-
221
- final WritableMap result = new JSONUtils.WritableMapBuilder()
222
- .putString("status", "OK")
223
- .putArray("barcodes", barcodes)
224
- .build();
225
-
210
+ final ReadableMap result = JSONUtils.jsonResultFromBarcodeItems(barcodeItems);
226
211
  final WritableMap data = new JSONUtils.WritableMapBuilder()
227
212
  .putMap("result", result)
228
213
  .build();
@@ -294,4 +294,39 @@ public final class JSONUtils {
294
294
  }
295
295
  return map.getBoolean(key);
296
296
  }
297
+
298
+ public static WritableMap jsonResultFromBarcodeResult(BarcodeScanningResult barcodeResult) {
299
+ return jsonResultFromBarcodeItems(
300
+ barcodeResult != null ? barcodeResult.getBarcodeItems() : new ArrayList<>()
301
+ );
302
+ }
303
+
304
+ public static WritableMap jsonResultFromBarcodeItems(List<BarcodeItem> barcodeItems) {
305
+ final WritableArray barcodes = Arguments.createArray();
306
+ for (BarcodeItem barcodeItem : barcodeItems) {
307
+ final WritableMap barcode = Arguments.createMap();
308
+ barcode.putString("type", barcodeItem.getBarcodeFormat().name());
309
+ barcode.putString("text", barcodeItem.getText());
310
+ barcode.putString("textWithExtension", barcodeItem.getTextWithExtension());
311
+ barcode.putArray("rawBytes", jsonFromRawBytes(barcodeItem.getRawBytes()));
312
+ barcodes.pushMap(barcode);
313
+ }
314
+ final WritableMap result = Arguments.createMap();
315
+ result.putString("status", "OK");
316
+ result.putArray("barcodes", barcodes);
317
+ return result;
318
+ }
319
+
320
+ public static ReadableArray jsonFromRawBytes(byte[] rawBytes) {
321
+ final WritableArray jsonArray = Arguments.createArray();
322
+ if (rawBytes.length == 0) {
323
+ return jsonArray;
324
+ }
325
+
326
+ for (byte b: rawBytes) {
327
+ jsonArray.pushInt(b);
328
+ }
329
+
330
+ return jsonArray;
331
+ }
297
332
  }
package/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import { BarcodeScannerConfiguration, BatchBarcodeScannerConfiguration, DetectBa
3
3
  import { BarcodeDocumentFormat, BarcodeFormat, EngineMode } from "./src/enum";
4
4
  import { BarcodeResult, BarcodeScannerResult, BatchBarcodeScannerResult } from "./src/result";
5
5
  import { ScanbotBarcodeCameraView } from "./src/components/barcode-camera-view/scanbot-barcode-camera-view";
6
- import { ScanbotBarcodeCameraViewConfiguration, ScanbotBarcodeCameraViewResult} from "./src/components/barcode-camera-view/scanbot-barcode-camera-view-types";
6
+ import { ScanbotBarcodeCameraViewConfiguration} from "./src/components/barcode-camera-view/scanbot-barcode-camera-view-types";
7
7
 
8
8
  export {
9
9
  BarcodeScannerConfiguration,
@@ -15,7 +15,6 @@ export {
15
15
  BatchBarcodeScannerResult,
16
16
  ScanbotBarcodeCameraView,
17
17
  ScanbotBarcodeCameraViewConfiguration,
18
- ScanbotBarcodeCameraViewResult,
19
18
  EngineMode
20
19
  }
21
20
 
@@ -178,20 +178,10 @@
178
178
  results = filterBarcodeResults(results, _cameraViewConfiguration.barcodeFilter);
179
179
  }
180
180
 
181
- NSMutableArray* jsonBarcodes = [[NSMutableArray alloc] init];
182
-
183
- for (SBSDKBarcodeScannerResult* result in results) {
184
- [jsonBarcodes addObject:@{
185
- @"text": result.rawTextString,
186
- @"type": result.type.name,
187
- @"textWithExtension": result.rawTextStringWithExtension,
188
- }];
189
- }
190
-
191
181
  NSDictionary* outResult = @{
192
182
  @"result": @{
193
183
  @"status": @"OK",
194
- @"barcodes": jsonBarcodes
184
+ @"barcodes": jsonFromBarcodeResults(results)
195
185
  }
196
186
  };
197
187
 
@@ -267,9 +267,13 @@ RCT_EXPORT_METHOD(detectBarcodesOnImage:(NSDictionary *)configuration
267
267
  }
268
268
  NSArray<SBSDKBarcodeScannerResult *> *barcodeResults = [barcodeScanner detectBarCodesOnImage:image];
269
269
 
270
- SBSDKUIBarcodeFilter* barcodeFilter = extractBarcodeFilter(configuration);
271
- if (barcodeFilter != nil) {
272
- barcodeResults = filterBarcodeResults(barcodeResults, barcodeFilter);
270
+ if (barcodeResults) {
271
+ SBSDKUIBarcodeFilter* barcodeFilter = extractBarcodeFilter(configuration);
272
+ if (barcodeFilter != nil) {
273
+ barcodeResults = filterBarcodeResults(barcodeResults, barcodeFilter);
274
+ }
275
+ } else {
276
+ barcodeResults = [[NSArray alloc] init];
273
277
  }
274
278
 
275
279
  resolve(@{
@@ -44,6 +44,17 @@ static inline SBSDKBarcodeDocumentType* barcodeDocumentTypeFromString(NSString*
44
44
  return nil;
45
45
  }
46
46
 
47
+ static inline NSArray<NSNumber*>* jsonFromRawBytes(NSData* rawBytes) {
48
+ NSMutableArray<NSNumber*>* byteArray = [[NSMutableArray alloc] init];
49
+ uint8_t* bytePtr = (uint8_t*)[rawBytes bytes];
50
+ NSInteger totalData = [rawBytes length] / sizeof(uint8_t);
51
+ for (int i=0 ; i<totalData; i++) {
52
+ uint8_t current = bytePtr[i];
53
+ [byteArray addObject:[[NSNumber alloc] initWithUnsignedChar:current]];
54
+ }
55
+ return byteArray;
56
+ }
57
+
47
58
  static inline NSString* stringFromBarcodeType(SBSDKBarcodeType* type) {
48
59
  if ([type.name isEqualToString:@"QRCode"]) {
49
60
  return @"QR_CODE";
@@ -60,11 +71,11 @@ static inline NSString* stringFromBarcodeType(SBSDKBarcodeType* type) {
60
71
  }
61
72
 
62
73
  static inline NSDictionary<NSString*, NSObject*>* jsonFromBarcodeResult(SBSDKBarcodeScannerResult *result) {
63
-
64
74
  NSMutableDictionary* x = @{
65
75
  @"type": stringFromBarcodeType(result.type),
66
76
  @"text": result.rawTextString,
67
77
  @"textWithExtension": result.rawTextStringWithExtension,
78
+ @"rawBytes": jsonFromRawBytes(result.rawBytes)
68
79
  }.mutableCopy;
69
80
  return x.copy;
70
81
  }
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.2.1-beta9",
4
+ "version": "3.2.1",
5
5
  "description": "Scanbot Barcode Scanner SDK React Native Plugin for Android and iOS",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -37,7 +37,7 @@
37
37
  "android",
38
38
  "ios"
39
39
  ],
40
- "author": "Scanbot / doo GmbH",
40
+ "author": "Scanbot SDK GmbH",
41
41
  "license": "Commercial",
42
42
  "readmeFilename": "README.md",
43
43
  "homepage": "https://scanbot.io",
@@ -1,4 +1,5 @@
1
1
  import { StyleProp, ViewStyle } from 'react-native';
2
+ import { BarcodeResult } from 'react-native-scanbot-barcode-scanner-sdk';
2
3
  import {
3
4
  BarcodeDocumentFormat,
4
5
  BarcodeFilter,
@@ -9,7 +10,7 @@ import {
9
10
  import { FinderAspectRatio } from '../../model';
10
11
 
11
12
  export interface ScanbotBarcodeCameraViewProperties {
12
- onBarcodeScannerResult?: (result: ScanbotBarcodeCameraViewResult) => void;
13
+ onBarcodeScannerResult?: (result: BarcodeResult) => void;
13
14
  requestComponentReload?: () => void;
14
15
  configuration?: ScanbotBarcodeCameraViewConfiguration;
15
16
  style: StyleProp<ViewStyle>;
@@ -21,11 +22,6 @@ export interface ScanbotBarcodeCameraViewBarcode {
21
22
  type: string;
22
23
  }
23
24
 
24
- export type ScanbotBarcodeCameraViewResult = {
25
- status: 'OK' | 'CANCELED';
26
- barcodes: ScanbotBarcodeCameraViewBarcode[];
27
- };
28
-
29
25
  export interface ScanbotBarcodeCameraViewConfiguration {
30
26
  /**
31
27
  * The finder view is a rectangular overlay view that clips the camera view,
package/src/result.ts CHANGED
@@ -15,11 +15,16 @@ export interface BarcodeResultField {
15
15
  * The raw text encoded in the barcode that also includes the extension, if detected
16
16
  */
17
17
  textWithExtension: string;
18
+
19
+ /**
20
+ * The array of raw bytes contained in the barcode.
21
+ */
22
+ rawBytes: number[];
18
23
  }
19
24
 
20
25
  export interface BarcodeResult {
21
26
  status: Status;
22
- barcodes?: BarcodeResultField[];
27
+ barcodes: BarcodeResultField[];
23
28
  }
24
29
 
25
30
  export type BarcodeScannerResult = BarcodeResult & {