@onekeyfe/react-native-qr-scanner 0.0.0-stage → 6.8.0-alpha.540
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 +21 -0
- package/QrScanner.podspec +42 -0
- package/README.md +74 -2
- package/android/CMakeLists.txt +23 -0
- package/android/build.gradle +147 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/cpp/cpp-adapter.cpp +8 -0
- package/android/src/main/java/com/margelo/nitro/qrscanner/HybridQrImageDecoder.kt +66 -0
- package/android/src/main/java/com/margelo/nitro/qrscanner/QrEngines.kt +53 -0
- package/android/src/main/java/com/margelo/nitro/qrscanner/QrFrameTextGate.kt +44 -0
- package/android/src/main/java/com/margelo/nitro/qrscanner/QrImageDecodingPipeline.kt +169 -0
- package/android/src/main/java/com/margelo/nitro/qrscanner/QrScanner.kt +227 -0
- package/android/src/main/java/com/margelo/nitro/qrscanner/QrScannerPackage.kt +31 -0
- package/android/src/test/java/com/margelo/nitro/qrscanner/QrFrameTextGateTest.kt +69 -0
- package/android/src/test/java/com/margelo/nitro/qrscanner/QrImageDecodingPipelineTest.kt +97 -0
- package/ios/HybridQrImageDecoder.swift +58 -0
- package/ios/QrFrameTextGate.swift +66 -0
- package/ios/QrImageDecodingPipeline.swift +159 -0
- package/ios/QrScanner.swift +248 -0
- package/ios/QrZXingReader.h +15 -0
- package/ios/QrZXingReader.mm +46 -0
- package/lib/module/QrImageDecoder.nitro.js +4 -0
- package/lib/module/QrImageDecoder.nitro.js.map +1 -0
- package/lib/module/QrScanner.js +84 -0
- package/lib/module/QrScanner.js.map +1 -0
- package/lib/module/QrScanner.nitro.js +4 -0
- package/lib/module/QrScanner.nitro.js.map +1 -0
- package/lib/module/decodeQrImage.constants.js +5 -0
- package/lib/module/decodeQrImage.constants.js.map +1 -0
- package/lib/module/decodeQrImage.js +27 -0
- package/lib/module/decodeQrImage.js.map +1 -0
- package/lib/module/errors.js +31 -0
- package/lib/module/errors.js.map +1 -0
- package/lib/module/index.js +7 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/ur/assembler.js +152 -0
- package/lib/module/ur/assembler.js.map +1 -0
- package/lib/module/ur/index.js +6 -0
- package/lib/module/ur/index.js.map +1 -0
- package/lib/module/ur/limits.js +207 -0
- package/lib/module/ur/limits.js.map +1 -0
- package/lib/module/ur/session.js +74 -0
- package/lib/module/ur/session.js.map +1 -0
- package/lib/module/ur/types.js +2 -0
- package/lib/module/ur/types.js.map +1 -0
- package/lib/module/web/decodeQrImage.js +62 -0
- package/lib/module/web/decodeQrImage.js.map +1 -0
- package/lib/module/web/engines.js +154 -0
- package/lib/module/web/engines.js.map +1 -0
- package/lib/module/web/imageOps.js +81 -0
- package/lib/module/web/imageOps.js.map +1 -0
- package/lib/module/web/index.js +11 -0
- package/lib/module/web/index.js.map +1 -0
- package/lib/module/web/scanner.js +230 -0
- package/lib/module/web/scanner.js.map +1 -0
- package/lib/module/web/zxing.worker.js +11 -0
- package/lib/module/web/zxing.worker.js.map +1 -0
- package/lib/module/web/zxingWorkerProtocol.js +67 -0
- package/lib/module/web/zxingWorkerProtocol.js.map +1 -0
- package/lib/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
- package/lib/nitrogen/generated/android/c++/JFunc_void_std__string_double.hpp +76 -0
- package/lib/nitrogen/generated/android/c++/JFunc_void_std__string_std__string_double.hpp +76 -0
- package/lib/nitrogen/generated/android/c++/JHybridQrImageDecoderSpec.cpp +78 -0
- package/lib/nitrogen/generated/android/c++/JHybridQrImageDecoderSpec.hpp +63 -0
- package/lib/nitrogen/generated/android/c++/JHybridQrScannerSpec.cpp +114 -0
- package/lib/nitrogen/generated/android/c++/JHybridQrScannerSpec.hpp +70 -0
- package/lib/nitrogen/generated/android/c++/JQrDecodeEngine.hpp +61 -0
- package/lib/nitrogen/generated/android/c++/JQrDecodePass.hpp +64 -0
- package/lib/nitrogen/generated/android/c++/JQrImageDecodeResult.hpp +70 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridQrScannerStateUpdater.cpp +89 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridQrScannerStateUpdater.hpp +54 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/Func_void_double.kt +78 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/Func_void_std__string_double.kt +78 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/Func_void_std__string_std__string_double.kt +78 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/HybridQrImageDecoderSpec.kt +57 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/HybridQrScannerSpec.kt +101 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/QrDecodeEngine.kt +24 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/QrDecodePass.kt +25 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/QrImageDecodeResult.kt +61 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/qrscannerOnLoad.kt +35 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/views/HybridQrScannerManager.kt +96 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/views/HybridQrScannerStateUpdater.kt +23 -0
- package/lib/nitrogen/generated/android/qrscanner+autolinking.cmake +85 -0
- package/lib/nitrogen/generated/android/qrscanner+autolinking.gradle +27 -0
- package/lib/nitrogen/generated/android/qrscannerOnLoad.cpp +78 -0
- package/lib/nitrogen/generated/android/qrscannerOnLoad.hpp +34 -0
- package/lib/nitrogen/generated/ios/QrScanner+autolinking.rb +62 -0
- package/lib/nitrogen/generated/ios/QrScanner-Swift-Cxx-Bridge.cpp +90 -0
- package/lib/nitrogen/generated/ios/QrScanner-Swift-Cxx-Bridge.hpp +294 -0
- package/lib/nitrogen/generated/ios/QrScanner-Swift-Cxx-Umbrella.hpp +61 -0
- package/lib/nitrogen/generated/ios/QrScannerAutolinking.mm +41 -0
- package/lib/nitrogen/generated/ios/QrScannerAutolinking.swift +38 -0
- package/lib/nitrogen/generated/ios/c++/HybridQrImageDecoderSpecSwift.cpp +11 -0
- package/lib/nitrogen/generated/ios/c++/HybridQrImageDecoderSpecSwift.hpp +92 -0
- package/lib/nitrogen/generated/ios/c++/HybridQrScannerSpecSwift.cpp +11 -0
- package/lib/nitrogen/generated/ios/c++/HybridQrScannerSpecSwift.hpp +103 -0
- package/lib/nitrogen/generated/ios/c++/views/HybridQrScannerComponent.mm +162 -0
- package/lib/nitrogen/generated/ios/swift/Func_void_QrImageDecodeResult.swift +46 -0
- package/lib/nitrogen/generated/ios/swift/Func_void_double.swift +46 -0
- package/lib/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/lib/nitrogen/generated/ios/swift/Func_void_std__string_double.swift +46 -0
- package/lib/nitrogen/generated/ios/swift/Func_void_std__string_std__string_double.swift +46 -0
- package/lib/nitrogen/generated/ios/swift/HybridQrImageDecoderSpec.swift +55 -0
- package/lib/nitrogen/generated/ios/swift/HybridQrImageDecoderSpec_cxx.swift +145 -0
- package/lib/nitrogen/generated/ios/swift/HybridQrScannerSpec.swift +58 -0
- package/lib/nitrogen/generated/ios/swift/HybridQrScannerSpec_cxx.swift +252 -0
- package/lib/nitrogen/generated/ios/swift/QrDecodeEngine.swift +44 -0
- package/lib/nitrogen/generated/ios/swift/QrDecodePass.swift +48 -0
- package/lib/nitrogen/generated/ios/swift/QrImageDecodeResult.swift +64 -0
- package/lib/nitrogen/generated/shared/c++/HybridQrImageDecoderSpec.cpp +21 -0
- package/lib/nitrogen/generated/shared/c++/HybridQrImageDecoderSpec.hpp +65 -0
- package/lib/nitrogen/generated/shared/c++/HybridQrScannerSpec.cpp +28 -0
- package/lib/nitrogen/generated/shared/c++/HybridQrScannerSpec.hpp +71 -0
- package/lib/nitrogen/generated/shared/c++/QrDecodeEngine.hpp +80 -0
- package/lib/nitrogen/generated/shared/c++/QrDecodePass.hpp +84 -0
- package/lib/nitrogen/generated/shared/c++/QrImageDecodeResult.hpp +97 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridQrScannerComponent.cpp +40 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridQrScannerComponent.hpp +94 -0
- package/lib/nitrogen/generated/shared/json/QrScannerConfig.json +13 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/QrImageDecoder.nitro.d.ts +26 -0
- package/lib/typescript/src/QrImageDecoder.nitro.d.ts.map +1 -0
- package/lib/typescript/src/QrScanner.d.ts +31 -0
- package/lib/typescript/src/QrScanner.d.ts.map +1 -0
- package/lib/typescript/src/QrScanner.nitro.d.ts +29 -0
- package/lib/typescript/src/QrScanner.nitro.d.ts.map +1 -0
- package/lib/typescript/src/decodeQrImage.constants.d.ts +3 -0
- package/lib/typescript/src/decodeQrImage.constants.d.ts.map +1 -0
- package/lib/typescript/src/decodeQrImage.d.ts +13 -0
- package/lib/typescript/src/decodeQrImage.d.ts.map +1 -0
- package/lib/typescript/src/errors.d.ts +13 -0
- package/lib/typescript/src/errors.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +9 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/ur/assembler.d.ts +5 -0
- package/lib/typescript/src/ur/assembler.d.ts.map +1 -0
- package/lib/typescript/src/ur/index.d.ts +5 -0
- package/lib/typescript/src/ur/index.d.ts.map +1 -0
- package/lib/typescript/src/ur/limits.d.ts +40 -0
- package/lib/typescript/src/ur/limits.d.ts.map +1 -0
- package/lib/typescript/src/ur/session.d.ts +11 -0
- package/lib/typescript/src/ur/session.d.ts.map +1 -0
- package/lib/typescript/src/ur/types.d.ts +61 -0
- package/lib/typescript/src/ur/types.d.ts.map +1 -0
- package/lib/typescript/src/web/decodeQrImage.d.ts +8 -0
- package/lib/typescript/src/web/decodeQrImage.d.ts.map +1 -0
- package/lib/typescript/src/web/engines.d.ts +32 -0
- package/lib/typescript/src/web/engines.d.ts.map +1 -0
- package/lib/typescript/src/web/imageOps.d.ts +37 -0
- package/lib/typescript/src/web/imageOps.d.ts.map +1 -0
- package/lib/typescript/src/web/index.d.ts +11 -0
- package/lib/typescript/src/web/index.d.ts.map +1 -0
- package/lib/typescript/src/web/scanner.d.ts +43 -0
- package/lib/typescript/src/web/scanner.d.ts.map +1 -0
- package/lib/typescript/src/web/zxing.worker.d.ts +2 -0
- package/lib/typescript/src/web/zxing.worker.d.ts.map +1 -0
- package/lib/typescript/src/web/zxingWorkerProtocol.d.ts +36 -0
- package/lib/typescript/src/web/zxingWorkerProtocol.d.ts.map +1 -0
- package/nitro.json +27 -0
- package/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string_double.hpp +76 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string_std__string_double.hpp +76 -0
- package/nitrogen/generated/android/c++/JHybridQrImageDecoderSpec.cpp +78 -0
- package/nitrogen/generated/android/c++/JHybridQrImageDecoderSpec.hpp +63 -0
- package/nitrogen/generated/android/c++/JHybridQrScannerSpec.cpp +114 -0
- package/nitrogen/generated/android/c++/JHybridQrScannerSpec.hpp +70 -0
- package/nitrogen/generated/android/c++/JQrDecodeEngine.hpp +61 -0
- package/nitrogen/generated/android/c++/JQrDecodePass.hpp +64 -0
- package/nitrogen/generated/android/c++/JQrImageDecodeResult.hpp +70 -0
- package/nitrogen/generated/android/c++/views/JHybridQrScannerStateUpdater.cpp +89 -0
- package/nitrogen/generated/android/c++/views/JHybridQrScannerStateUpdater.hpp +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/Func_void_double.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/Func_void_std__string_double.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/Func_void_std__string_std__string_double.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/HybridQrImageDecoderSpec.kt +57 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/HybridQrScannerSpec.kt +101 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/QrDecodeEngine.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/QrDecodePass.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/QrImageDecodeResult.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/qrscannerOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/views/HybridQrScannerManager.kt +96 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/views/HybridQrScannerStateUpdater.kt +23 -0
- package/nitrogen/generated/android/qrscanner+autolinking.cmake +85 -0
- package/nitrogen/generated/android/qrscanner+autolinking.gradle +27 -0
- package/nitrogen/generated/android/qrscannerOnLoad.cpp +78 -0
- package/nitrogen/generated/android/qrscannerOnLoad.hpp +34 -0
- package/nitrogen/generated/ios/QrScanner+autolinking.rb +62 -0
- package/nitrogen/generated/ios/QrScanner-Swift-Cxx-Bridge.cpp +90 -0
- package/nitrogen/generated/ios/QrScanner-Swift-Cxx-Bridge.hpp +294 -0
- package/nitrogen/generated/ios/QrScanner-Swift-Cxx-Umbrella.hpp +61 -0
- package/nitrogen/generated/ios/QrScannerAutolinking.mm +41 -0
- package/nitrogen/generated/ios/QrScannerAutolinking.swift +38 -0
- package/nitrogen/generated/ios/c++/HybridQrImageDecoderSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridQrImageDecoderSpecSwift.hpp +92 -0
- package/nitrogen/generated/ios/c++/HybridQrScannerSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridQrScannerSpecSwift.hpp +103 -0
- package/nitrogen/generated/ios/c++/views/HybridQrScannerComponent.mm +162 -0
- package/nitrogen/generated/ios/swift/Func_void_QrImageDecodeResult.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string_double.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string_std__string_double.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridQrImageDecoderSpec.swift +55 -0
- package/nitrogen/generated/ios/swift/HybridQrImageDecoderSpec_cxx.swift +145 -0
- package/nitrogen/generated/ios/swift/HybridQrScannerSpec.swift +58 -0
- package/nitrogen/generated/ios/swift/HybridQrScannerSpec_cxx.swift +252 -0
- package/nitrogen/generated/ios/swift/QrDecodeEngine.swift +44 -0
- package/nitrogen/generated/ios/swift/QrDecodePass.swift +48 -0
- package/nitrogen/generated/ios/swift/QrImageDecodeResult.swift +64 -0
- package/nitrogen/generated/shared/c++/HybridQrImageDecoderSpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridQrImageDecoderSpec.hpp +65 -0
- package/nitrogen/generated/shared/c++/HybridQrScannerSpec.cpp +28 -0
- package/nitrogen/generated/shared/c++/HybridQrScannerSpec.hpp +71 -0
- package/nitrogen/generated/shared/c++/QrDecodeEngine.hpp +80 -0
- package/nitrogen/generated/shared/c++/QrDecodePass.hpp +84 -0
- package/nitrogen/generated/shared/c++/QrImageDecodeResult.hpp +97 -0
- package/nitrogen/generated/shared/c++/views/HybridQrScannerComponent.cpp +40 -0
- package/nitrogen/generated/shared/c++/views/HybridQrScannerComponent.hpp +94 -0
- package/nitrogen/generated/shared/json/QrScannerConfig.json +13 -0
- package/package.json +191 -4
- package/src/QrImageDecoder.nitro.ts +27 -0
- package/src/QrScanner.nitro.ts +34 -0
- package/src/QrScanner.tsx +109 -0
- package/src/decodeQrImage.constants.ts +2 -0
- package/src/decodeQrImage.ts +39 -0
- package/src/errors.ts +52 -0
- package/src/index.tsx +15 -0
- package/src/ur/assembler.ts +174 -0
- package/src/ur/index.ts +15 -0
- package/src/ur/limits.ts +214 -0
- package/src/ur/session.ts +57 -0
- package/src/ur/types.ts +64 -0
- package/src/web/decodeQrImage.ts +59 -0
- package/src/web/engines.ts +192 -0
- package/src/web/imageOps.ts +102 -0
- package/src/web/index.ts +12 -0
- package/src/web/scanner.ts +271 -0
- package/src/web/zxing.worker.ts +17 -0
- package/src/web/zxingWorkerProtocol.ts +79 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JQrDecodePass.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "QrDecodePass.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::qrscanner {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "QrDecodePass" and the Kotlin enum "QrDecodePass".
|
|
19
|
+
*/
|
|
20
|
+
struct JQrDecodePass final: public jni::JavaClass<JQrDecodePass> {
|
|
21
|
+
public:
|
|
22
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/qrscanner/QrDecodePass;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum QrDecodePass.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
QrDecodePass toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<QrDecodePass>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JQrDecodePass> fromCpp(QrDecodePass value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
switch (value) {
|
|
45
|
+
case QrDecodePass::ORIGINAL:
|
|
46
|
+
static const auto fieldORIGINAL = clazz->getStaticField<JQrDecodePass>("ORIGINAL");
|
|
47
|
+
return clazz->getStaticFieldValue(fieldORIGINAL);
|
|
48
|
+
case QrDecodePass::PADDED:
|
|
49
|
+
static const auto fieldPADDED = clazz->getStaticField<JQrDecodePass>("PADDED");
|
|
50
|
+
return clazz->getStaticFieldValue(fieldPADDED);
|
|
51
|
+
case QrDecodePass::GRAYSCALE:
|
|
52
|
+
static const auto fieldGRAYSCALE = clazz->getStaticField<JQrDecodePass>("GRAYSCALE");
|
|
53
|
+
return clazz->getStaticFieldValue(fieldGRAYSCALE);
|
|
54
|
+
case QrDecodePass::INVERTED:
|
|
55
|
+
static const auto fieldINVERTED = clazz->getStaticField<JQrDecodePass>("INVERTED");
|
|
56
|
+
return clazz->getStaticFieldValue(fieldINVERTED);
|
|
57
|
+
default:
|
|
58
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
59
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
} // namespace margelo::nitro::qrscanner
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JQrImageDecodeResult.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "QrImageDecodeResult.hpp"
|
|
12
|
+
|
|
13
|
+
#include "JQrDecodeEngine.hpp"
|
|
14
|
+
#include "JQrDecodePass.hpp"
|
|
15
|
+
#include "QrDecodeEngine.hpp"
|
|
16
|
+
#include "QrDecodePass.hpp"
|
|
17
|
+
#include <optional>
|
|
18
|
+
#include <string>
|
|
19
|
+
|
|
20
|
+
namespace margelo::nitro::qrscanner {
|
|
21
|
+
|
|
22
|
+
using namespace facebook;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The C++ JNI bridge between the C++ struct "QrImageDecodeResult" and the Kotlin data class "QrImageDecodeResult".
|
|
26
|
+
*/
|
|
27
|
+
struct JQrImageDecodeResult final: public jni::JavaClass<JQrImageDecodeResult> {
|
|
28
|
+
public:
|
|
29
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/qrscanner/QrImageDecodeResult;";
|
|
30
|
+
|
|
31
|
+
public:
|
|
32
|
+
/**
|
|
33
|
+
* Convert this Java/Kotlin-based struct to the C++ struct QrImageDecodeResult by copying all values to C++.
|
|
34
|
+
*/
|
|
35
|
+
[[maybe_unused]]
|
|
36
|
+
[[nodiscard]]
|
|
37
|
+
QrImageDecodeResult toCpp() const {
|
|
38
|
+
static const auto clazz = javaClassStatic();
|
|
39
|
+
static const auto fieldText = clazz->getField<jni::JString>("text");
|
|
40
|
+
jni::local_ref<jni::JString> text = this->getFieldValue(fieldText);
|
|
41
|
+
static const auto fieldEngine = clazz->getField<JQrDecodeEngine>("engine");
|
|
42
|
+
jni::local_ref<JQrDecodeEngine> engine = this->getFieldValue(fieldEngine);
|
|
43
|
+
static const auto fieldPass = clazz->getField<JQrDecodePass>("pass");
|
|
44
|
+
jni::local_ref<JQrDecodePass> pass = this->getFieldValue(fieldPass);
|
|
45
|
+
return QrImageDecodeResult(
|
|
46
|
+
text != nullptr ? std::make_optional(text->toStdString()) : std::nullopt,
|
|
47
|
+
engine != nullptr ? std::make_optional(engine->toCpp()) : std::nullopt,
|
|
48
|
+
pass != nullptr ? std::make_optional(pass->toCpp()) : std::nullopt
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
/**
|
|
54
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
55
|
+
*/
|
|
56
|
+
[[maybe_unused]]
|
|
57
|
+
static jni::local_ref<JQrImageDecodeResult::javaobject> fromCpp(const QrImageDecodeResult& value) {
|
|
58
|
+
using JSignature = JQrImageDecodeResult(jni::alias_ref<jni::JString>, jni::alias_ref<JQrDecodeEngine>, jni::alias_ref<JQrDecodePass>);
|
|
59
|
+
static const auto clazz = javaClassStatic();
|
|
60
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
61
|
+
return create(
|
|
62
|
+
clazz,
|
|
63
|
+
value.text.has_value() ? jni::make_jstring(value.text.value()) : nullptr,
|
|
64
|
+
value.engine.has_value() ? JQrDecodeEngine::fromCpp(value.engine.value()) : nullptr,
|
|
65
|
+
value.pass.has_value() ? JQrDecodePass::fromCpp(value.pass.value()) : nullptr
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
} // namespace margelo::nitro::qrscanner
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridQrScannerStateUpdater.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "JHybridQrScannerStateUpdater.hpp"
|
|
9
|
+
#include "views/HybridQrScannerComponent.hpp"
|
|
10
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
11
|
+
#include <react/fabric/StateWrapperImpl.h>
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::qrscanner::views {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
using ConcreteStateData = react::ConcreteState<HybridQrScannerState>;
|
|
17
|
+
|
|
18
|
+
std::shared_ptr<const HybridQrScannerProps> JHybridQrScannerStateUpdater::getPropsFromStateWrapper(
|
|
19
|
+
jni::alias_ref<JStateWrapper::javaobject> stateWrapper) {
|
|
20
|
+
if (stateWrapper.get() == nullptr) {
|
|
21
|
+
return nullptr;
|
|
22
|
+
}
|
|
23
|
+
// Get concrete StateWrapperImpl from passed StateWrapper interface object
|
|
24
|
+
jobject rawStateWrapper = stateWrapper.get();
|
|
25
|
+
if (!stateWrapper->isInstanceOf(react::StateWrapperImpl::javaClassStatic())) [[unlikely]] {
|
|
26
|
+
throw std::runtime_error("StateWrapper is not a StateWrapperImpl");
|
|
27
|
+
}
|
|
28
|
+
auto stateWrapperImpl = jni::alias_ref<react::StateWrapperImpl::javaobject>{
|
|
29
|
+
static_cast<react::StateWrapperImpl::javaobject>(rawStateWrapper)
|
|
30
|
+
};
|
|
31
|
+
std::shared_ptr<const react::State> state = stateWrapperImpl->cthis()->getState();
|
|
32
|
+
if (state == nullptr) {
|
|
33
|
+
return nullptr;
|
|
34
|
+
}
|
|
35
|
+
auto concreteState = std::static_pointer_cast<const ConcreteStateData>(state);
|
|
36
|
+
const HybridQrScannerState& data = concreteState->getData();
|
|
37
|
+
const std::shared_ptr<const HybridQrScannerProps>& props = data.getProps();
|
|
38
|
+
if (props == nullptr) [[unlikely]] {
|
|
39
|
+
throw std::runtime_error("HybridQrScannerState's data doesn't contain any props!");
|
|
40
|
+
}
|
|
41
|
+
return props;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
void JHybridQrScannerStateUpdater::updateViewProps(jni::alias_ref<jni::JClass> /* class */,
|
|
45
|
+
jni::alias_ref<JHybridQrScannerSpec::JavaPart> javaView,
|
|
46
|
+
jni::alias_ref<JStateWrapper::javaobject> newState,
|
|
47
|
+
jni::alias_ref<JStateWrapper::javaobject> oldState) {
|
|
48
|
+
std::shared_ptr<JHybridQrScannerSpec> hybridView = javaView->getJHybridQrScannerSpec();
|
|
49
|
+
std::shared_ptr<const HybridQrScannerProps> newProps = getPropsFromStateWrapper(newState);
|
|
50
|
+
std::shared_ptr<const HybridQrScannerProps> oldProps = getPropsFromStateWrapper(oldState);
|
|
51
|
+
if (newProps == nullptr) [[unlikely]] {
|
|
52
|
+
throw std::runtime_error("Current StateWrapper doesn't contain any props!");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Update only props that differ from the previous State snapshot.
|
|
56
|
+
if (oldProps == nullptr
|
|
57
|
+
? newProps->active.isProvided()
|
|
58
|
+
: !newProps->active.hasSameValue(oldProps->active)) {
|
|
59
|
+
hybridView->setActive(newProps->active.get());
|
|
60
|
+
}
|
|
61
|
+
if (oldProps == nullptr
|
|
62
|
+
? newProps->onReady.isProvided()
|
|
63
|
+
: !newProps->onReady.hasSameValue(oldProps->onReady)) {
|
|
64
|
+
hybridView->setOnReady(newProps->onReady.get());
|
|
65
|
+
}
|
|
66
|
+
if (oldProps == nullptr
|
|
67
|
+
? newProps->onFrameText.isProvided()
|
|
68
|
+
: !newProps->onFrameText.hasSameValue(oldProps->onFrameText)) {
|
|
69
|
+
hybridView->setOnFrameText(newProps->onFrameText.get());
|
|
70
|
+
}
|
|
71
|
+
if (oldProps == nullptr
|
|
72
|
+
? newProps->onError.isProvided()
|
|
73
|
+
: !newProps->onError.hasSameValue(oldProps->onError)) {
|
|
74
|
+
hybridView->setOnError(newProps->onError.get());
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Update hybridRef if it changed
|
|
78
|
+
if (oldProps == nullptr
|
|
79
|
+
? newProps->hybridRef.isProvided()
|
|
80
|
+
: !newProps->hybridRef.hasSameValue(oldProps->hybridRef)) {
|
|
81
|
+
// hybridRef changed - call it with new this
|
|
82
|
+
const auto& maybeFunc = newProps->hybridRef.get();
|
|
83
|
+
if (maybeFunc.has_value()) {
|
|
84
|
+
maybeFunc.value()(hybridView);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
} // namespace margelo::nitro::qrscanner::views
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridQrScannerStateUpdater.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#ifndef RN_SERIALIZABLE_STATE
|
|
11
|
+
#error qrscanner was compiled without the 'RN_SERIALIZABLE_STATE' flag. This flag is required for Nitro Views - set it in your CMakeLists!
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
#include <fbjni/fbjni.h>
|
|
15
|
+
#include <react/fabric/CoreComponentsRegistry.h>
|
|
16
|
+
#include <react/fabric/StateWrapperImpl.h>
|
|
17
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
18
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
19
|
+
#include <NitroModules/JStateWrapper.hpp>
|
|
20
|
+
#include "JHybridQrScannerSpec.hpp"
|
|
21
|
+
#include "views/HybridQrScannerComponent.hpp"
|
|
22
|
+
|
|
23
|
+
namespace margelo::nitro::qrscanner::views {
|
|
24
|
+
|
|
25
|
+
using namespace facebook;
|
|
26
|
+
|
|
27
|
+
class JHybridQrScannerStateUpdater final: public jni::JavaClass<JHybridQrScannerStateUpdater> {
|
|
28
|
+
public:
|
|
29
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/qrscanner/views/HybridQrScannerStateUpdater;";
|
|
30
|
+
|
|
31
|
+
public:
|
|
32
|
+
static void updateViewProps(jni::alias_ref<jni::JClass> /* class */,
|
|
33
|
+
jni::alias_ref<JHybridQrScannerSpec::JavaPart> view,
|
|
34
|
+
jni::alias_ref<JStateWrapper::javaobject> newState,
|
|
35
|
+
jni::alias_ref<JStateWrapper::javaobject> oldState);
|
|
36
|
+
|
|
37
|
+
private:
|
|
38
|
+
static std::shared_ptr<const HybridQrScannerProps> getPropsFromStateWrapper(
|
|
39
|
+
jni::alias_ref<JStateWrapper::javaobject> stateWrapper);
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
static void registerNatives() {
|
|
43
|
+
// Register JNI calls
|
|
44
|
+
javaClassStatic()->registerNatives({
|
|
45
|
+
makeNativeMethod("updateViewProps", JHybridQrScannerStateUpdater::updateViewProps),
|
|
46
|
+
});
|
|
47
|
+
// Register React Native view component descriptor
|
|
48
|
+
auto provider = react::concreteComponentDescriptorProvider<HybridQrScannerComponentDescriptor>();
|
|
49
|
+
auto providerRegistry = react::CoreComponentsRegistry::sharedProviderRegistry();
|
|
50
|
+
providerRegistry->add(provider);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
} // namespace margelo::nitro::qrscanner::views
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_double.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.qrscanner
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript callback `(generation: number) => void`.
|
|
17
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
18
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
23
|
+
fun interface Func_void_double: (Double) -> Unit {
|
|
24
|
+
/**
|
|
25
|
+
* Call the given JS callback.
|
|
26
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
27
|
+
*/
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
@Keep
|
|
30
|
+
override fun invoke(generation: Double): Unit
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the JavaScript callback `(generation: number) => void`.
|
|
35
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
36
|
+
* The callback might be coming from JS.
|
|
37
|
+
*/
|
|
38
|
+
@DoNotStrip
|
|
39
|
+
@Keep
|
|
40
|
+
@Suppress(
|
|
41
|
+
"KotlinJniMissingFunction", "unused",
|
|
42
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
43
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
44
|
+
)
|
|
45
|
+
class Func_void_double_cxx: Func_void_double {
|
|
46
|
+
@DoNotStrip
|
|
47
|
+
@Keep
|
|
48
|
+
private val mHybridData: HybridData
|
|
49
|
+
|
|
50
|
+
@DoNotStrip
|
|
51
|
+
@Keep
|
|
52
|
+
private constructor(hybridData: HybridData) {
|
|
53
|
+
mHybridData = hybridData
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
override fun invoke(generation: Double): Unit
|
|
59
|
+
= invoke_cxx(generation)
|
|
60
|
+
|
|
61
|
+
private external fun invoke_cxx(generation: Double): Unit
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Represents the JavaScript callback `(generation: number) => void`.
|
|
66
|
+
* This is implemented in Java/Kotlin, via a `(Double) -> Unit`.
|
|
67
|
+
* The callback is always coming from native.
|
|
68
|
+
*/
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
72
|
+
class Func_void_double_java(private val function: (Double) -> Unit): Func_void_double {
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
override fun invoke(generation: Double): Unit {
|
|
76
|
+
return this.function(generation)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__string_double.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.qrscanner
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript callback `(text: string, generation: number) => void`.
|
|
17
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
18
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
23
|
+
fun interface Func_void_std__string_double: (String, Double) -> Unit {
|
|
24
|
+
/**
|
|
25
|
+
* Call the given JS callback.
|
|
26
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
27
|
+
*/
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
@Keep
|
|
30
|
+
override fun invoke(text: String, generation: Double): Unit
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the JavaScript callback `(text: string, generation: number) => void`.
|
|
35
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
36
|
+
* The callback might be coming from JS.
|
|
37
|
+
*/
|
|
38
|
+
@DoNotStrip
|
|
39
|
+
@Keep
|
|
40
|
+
@Suppress(
|
|
41
|
+
"KotlinJniMissingFunction", "unused",
|
|
42
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
43
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
44
|
+
)
|
|
45
|
+
class Func_void_std__string_double_cxx: Func_void_std__string_double {
|
|
46
|
+
@DoNotStrip
|
|
47
|
+
@Keep
|
|
48
|
+
private val mHybridData: HybridData
|
|
49
|
+
|
|
50
|
+
@DoNotStrip
|
|
51
|
+
@Keep
|
|
52
|
+
private constructor(hybridData: HybridData) {
|
|
53
|
+
mHybridData = hybridData
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
override fun invoke(text: String, generation: Double): Unit
|
|
59
|
+
= invoke_cxx(text,generation)
|
|
60
|
+
|
|
61
|
+
private external fun invoke_cxx(text: String, generation: Double): Unit
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Represents the JavaScript callback `(text: string, generation: number) => void`.
|
|
66
|
+
* This is implemented in Java/Kotlin, via a `(String, Double) -> Unit`.
|
|
67
|
+
* The callback is always coming from native.
|
|
68
|
+
*/
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
72
|
+
class Func_void_std__string_double_java(private val function: (String, Double) -> Unit): Func_void_std__string_double {
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
override fun invoke(text: String, generation: Double): Unit {
|
|
76
|
+
return this.function(text, generation)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__string_std__string_double.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.qrscanner
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript callback `(code: string, message: string, generation: number) => void`.
|
|
17
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
18
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
23
|
+
fun interface Func_void_std__string_std__string_double: (String, String, Double) -> Unit {
|
|
24
|
+
/**
|
|
25
|
+
* Call the given JS callback.
|
|
26
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
27
|
+
*/
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
@Keep
|
|
30
|
+
override fun invoke(code: String, message: String, generation: Double): Unit
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the JavaScript callback `(code: string, message: string, generation: number) => void`.
|
|
35
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
36
|
+
* The callback might be coming from JS.
|
|
37
|
+
*/
|
|
38
|
+
@DoNotStrip
|
|
39
|
+
@Keep
|
|
40
|
+
@Suppress(
|
|
41
|
+
"KotlinJniMissingFunction", "unused",
|
|
42
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
43
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
44
|
+
)
|
|
45
|
+
class Func_void_std__string_std__string_double_cxx: Func_void_std__string_std__string_double {
|
|
46
|
+
@DoNotStrip
|
|
47
|
+
@Keep
|
|
48
|
+
private val mHybridData: HybridData
|
|
49
|
+
|
|
50
|
+
@DoNotStrip
|
|
51
|
+
@Keep
|
|
52
|
+
private constructor(hybridData: HybridData) {
|
|
53
|
+
mHybridData = hybridData
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
override fun invoke(code: String, message: String, generation: Double): Unit
|
|
59
|
+
= invoke_cxx(code,message,generation)
|
|
60
|
+
|
|
61
|
+
private external fun invoke_cxx(code: String, message: String, generation: Double): Unit
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Represents the JavaScript callback `(code: string, message: string, generation: number) => void`.
|
|
66
|
+
* This is implemented in Java/Kotlin, via a `(String, String, Double) -> Unit`.
|
|
67
|
+
* The callback is always coming from native.
|
|
68
|
+
*/
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
72
|
+
class Func_void_std__string_std__string_double_java(private val function: (String, String, Double) -> Unit): Func_void_std__string_std__string_double {
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
override fun invoke(code: String, message: String, generation: Double): Unit {
|
|
76
|
+
return this.function(code, message, generation)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridQrImageDecoderSpec.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.qrscanner
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import dalvik.annotation.optimization.FastNative
|
|
14
|
+
import com.margelo.nitro.core.Promise
|
|
15
|
+
import com.margelo.nitro.core.HybridObject
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A Kotlin class representing the QrImageDecoder HybridObject.
|
|
19
|
+
* Implement this abstract class to create Kotlin-based instances of QrImageDecoder.
|
|
20
|
+
*/
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
@Suppress(
|
|
24
|
+
"KotlinJniMissingFunction", "unused",
|
|
25
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
26
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
27
|
+
)
|
|
28
|
+
abstract class HybridQrImageDecoderSpec: HybridObject() {
|
|
29
|
+
// Properties
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
// Methods
|
|
33
|
+
@DoNotStrip
|
|
34
|
+
@Keep
|
|
35
|
+
abstract fun decodeImage(uri: String, maxPixels: Double): Promise<QrImageDecodeResult>
|
|
36
|
+
|
|
37
|
+
// Default implementation of `HybridObject.toString()`
|
|
38
|
+
override fun toString(): String {
|
|
39
|
+
return "[HybridObject QrImageDecoder]"
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// C++ backing class
|
|
43
|
+
@DoNotStrip
|
|
44
|
+
@Keep
|
|
45
|
+
protected open class CxxPart(javaPart: HybridQrImageDecoderSpec): HybridObject.CxxPart(javaPart) {
|
|
46
|
+
// C++ JHybridQrImageDecoderSpec::CxxPart::initHybrid(...)
|
|
47
|
+
@FastNative
|
|
48
|
+
external override fun initHybrid(): HybridData
|
|
49
|
+
}
|
|
50
|
+
override fun createCxxPart(): CxxPart {
|
|
51
|
+
return CxxPart(this)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
companion object {
|
|
55
|
+
protected const val TAG = "HybridQrImageDecoderSpec"
|
|
56
|
+
}
|
|
57
|
+
}
|
package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/HybridQrScannerSpec.kt
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridQrScannerSpec.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.qrscanner
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import dalvik.annotation.optimization.FastNative
|
|
14
|
+
import com.margelo.nitro.core.HybridObject
|
|
15
|
+
import com.margelo.nitro.views.HybridView
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A Kotlin class representing the QrScanner HybridObject.
|
|
19
|
+
* Implement this abstract class to create Kotlin-based instances of QrScanner.
|
|
20
|
+
*/
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
@Suppress(
|
|
24
|
+
"KotlinJniMissingFunction", "unused",
|
|
25
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
26
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
27
|
+
)
|
|
28
|
+
abstract class HybridQrScannerSpec: HybridView() {
|
|
29
|
+
// Properties
|
|
30
|
+
@get:DoNotStrip
|
|
31
|
+
@get:Keep
|
|
32
|
+
@set:DoNotStrip
|
|
33
|
+
@set:Keep
|
|
34
|
+
abstract var active: Boolean
|
|
35
|
+
|
|
36
|
+
abstract var onReady: ((generation: Double) -> Unit)?
|
|
37
|
+
|
|
38
|
+
private var onReady_cxx: Func_void_double?
|
|
39
|
+
@Keep
|
|
40
|
+
@DoNotStrip
|
|
41
|
+
get() {
|
|
42
|
+
return onReady?.let { Func_void_double_java(it) }
|
|
43
|
+
}
|
|
44
|
+
@Keep
|
|
45
|
+
@DoNotStrip
|
|
46
|
+
set(value) {
|
|
47
|
+
onReady = value?.let { it }
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
abstract var onFrameText: ((text: String, generation: Double) -> Unit)?
|
|
51
|
+
|
|
52
|
+
private var onFrameText_cxx: Func_void_std__string_double?
|
|
53
|
+
@Keep
|
|
54
|
+
@DoNotStrip
|
|
55
|
+
get() {
|
|
56
|
+
return onFrameText?.let { Func_void_std__string_double_java(it) }
|
|
57
|
+
}
|
|
58
|
+
@Keep
|
|
59
|
+
@DoNotStrip
|
|
60
|
+
set(value) {
|
|
61
|
+
onFrameText = value?.let { it }
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
abstract var onError: ((code: String, message: String, generation: Double) -> Unit)?
|
|
65
|
+
|
|
66
|
+
private var onError_cxx: Func_void_std__string_std__string_double?
|
|
67
|
+
@Keep
|
|
68
|
+
@DoNotStrip
|
|
69
|
+
get() {
|
|
70
|
+
return onError?.let { Func_void_std__string_std__string_double_java(it) }
|
|
71
|
+
}
|
|
72
|
+
@Keep
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
set(value) {
|
|
75
|
+
onError = value?.let { it }
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Methods
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
// Default implementation of `HybridObject.toString()`
|
|
82
|
+
override fun toString(): String {
|
|
83
|
+
return "[HybridObject QrScanner]"
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// C++ backing class
|
|
87
|
+
@DoNotStrip
|
|
88
|
+
@Keep
|
|
89
|
+
protected open class CxxPart(javaPart: HybridQrScannerSpec): HybridObject.CxxPart(javaPart) {
|
|
90
|
+
// C++ JHybridQrScannerSpec::CxxPart::initHybrid(...)
|
|
91
|
+
@FastNative
|
|
92
|
+
external override fun initHybrid(): HybridData
|
|
93
|
+
}
|
|
94
|
+
override fun createCxxPart(): CxxPart {
|
|
95
|
+
return CxxPart(this)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
companion object {
|
|
99
|
+
protected const val TAG = "HybridQrScannerSpec"
|
|
100
|
+
}
|
|
101
|
+
}
|