@onekeyfe/react-native-qr-scanner 0.0.0-stage → 6.8.0-alpha.545
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/QrCameraZoom.kt +15 -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 +318 -0
- package/android/src/main/java/com/margelo/nitro/qrscanner/QrScannerPackage.kt +31 -0
- package/android/src/test/java/com/margelo/nitro/qrscanner/QrCameraZoomTest.kt +24 -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/QrCameraControl.swift +57 -0
- package/ios/QrFrameTextGate.swift +66 -0
- package/ios/QrImageDecodingPipeline.swift +159 -0
- package/ios/QrScanner.swift +372 -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,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
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/HybridQrImageDecoderSpec.kt
ADDED
|
@@ -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
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// QrDecodeEngine.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.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "QrDecodeEngine".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class QrDecodeEngine(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
VISION(0),
|
|
20
|
+
MLKIT(1),
|
|
21
|
+
ZXING(2);
|
|
22
|
+
|
|
23
|
+
companion object
|
|
24
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// QrDecodePass.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.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "QrDecodePass".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class QrDecodePass(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
ORIGINAL(0),
|
|
20
|
+
PADDED(1),
|
|
21
|
+
GRAYSCALE(2),
|
|
22
|
+
INVERTED(3);
|
|
23
|
+
|
|
24
|
+
companion object
|
|
25
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// QrImageDecodeResult.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.proguard.annotations.DoNotStrip
|
|
12
|
+
import java.util.Objects
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "QrImageDecodeResult".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class QrImageDecodeResult(
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
val text: String?,
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val engine: QrDecodeEngine?,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val pass: QrDecodePass?
|
|
30
|
+
) {
|
|
31
|
+
/* primary constructor */
|
|
32
|
+
|
|
33
|
+
override fun equals(other: Any?): Boolean {
|
|
34
|
+
if (this === other) return true
|
|
35
|
+
if (other !is QrImageDecodeResult) return false
|
|
36
|
+
return Objects.deepEquals(this.text, other.text)
|
|
37
|
+
&& Objects.deepEquals(this.engine, other.engine)
|
|
38
|
+
&& Objects.deepEquals(this.pass, other.pass)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
override fun hashCode(): Int {
|
|
42
|
+
return arrayOf<Any?>(
|
|
43
|
+
text,
|
|
44
|
+
engine,
|
|
45
|
+
pass
|
|
46
|
+
).contentDeepHashCode()
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
companion object {
|
|
50
|
+
/**
|
|
51
|
+
* Constructor called from C++
|
|
52
|
+
*/
|
|
53
|
+
@DoNotStrip
|
|
54
|
+
@Keep
|
|
55
|
+
@Suppress("unused")
|
|
56
|
+
@JvmStatic
|
|
57
|
+
private fun fromCpp(text: String?, engine: QrDecodeEngine?, pass: QrDecodePass?): QrImageDecodeResult {
|
|
58
|
+
return QrImageDecodeResult(text, engine, pass)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// qrscannerOnLoad.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 android.util.Log
|
|
11
|
+
|
|
12
|
+
internal class qrscannerOnLoad {
|
|
13
|
+
companion object {
|
|
14
|
+
private const val TAG = "qrscannerOnLoad"
|
|
15
|
+
private var didLoad = false
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the native part of "qrscanner".
|
|
18
|
+
* This method is idempotent and can be called more than once.
|
|
19
|
+
*/
|
|
20
|
+
@JvmStatic
|
|
21
|
+
fun initializeNative() {
|
|
22
|
+
if (didLoad) return
|
|
23
|
+
try {
|
|
24
|
+
Log.i(TAG, "Loading qrscanner C++ library...")
|
|
25
|
+
System.loadLibrary("qrscanner")
|
|
26
|
+
Log.i(TAG, "Successfully loaded qrscanner C++ library!")
|
|
27
|
+
didLoad = true
|
|
28
|
+
} catch (e: Error) {
|
|
29
|
+
Log.e(TAG, "Failed to load qrscanner C++ library! Is it properly installed and linked? " +
|
|
30
|
+
"Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
|
|
31
|
+
throw e
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridQrScannerManager.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.views
|
|
9
|
+
|
|
10
|
+
import android.view.View
|
|
11
|
+
import com.facebook.react.uimanager.ReactStylesDiffMap
|
|
12
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
13
|
+
import com.facebook.react.uimanager.StateWrapper
|
|
14
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
15
|
+
import com.margelo.nitro.R.id.associated_hybrid_view_tag
|
|
16
|
+
import com.margelo.nitro.views.RecyclableView
|
|
17
|
+
import com.margelo.nitro.qrscanner.*
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Represents the React Native `ViewManager` for the "QrScanner" Nitro HybridView.
|
|
21
|
+
*/
|
|
22
|
+
public class HybridQrScannerManager: SimpleViewManager<View>() {
|
|
23
|
+
/**
|
|
24
|
+
* Represents the View and its last state snapshot (mutable)
|
|
25
|
+
*/
|
|
26
|
+
private class HybridViewHolder(
|
|
27
|
+
val hybridView: HybridQrScanner,
|
|
28
|
+
var lastState: StateWrapper? = null,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
init {
|
|
32
|
+
if (RecyclableView::class.java.isAssignableFrom(HybridQrScanner::class.java)) {
|
|
33
|
+
// Enable view recycling
|
|
34
|
+
super.setupViewRecycling()
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
override fun getName(): String {
|
|
39
|
+
return "QrScanner"
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
override fun createViewInstance(reactContext: ThemedReactContext): View {
|
|
43
|
+
val hybridView = HybridQrScanner(reactContext)
|
|
44
|
+
val view = hybridView.view
|
|
45
|
+
view.setTag(associated_hybrid_view_tag, HybridViewHolder(hybridView))
|
|
46
|
+
return view
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
override fun updateState(view: View, props: ReactStylesDiffMap, stateWrapper: StateWrapper): Any? {
|
|
50
|
+
val holder = getHybridViewHolder(view)
|
|
51
|
+
?: throw Error("Couldn't find view $view in local views table!")
|
|
52
|
+
val hybridView = holder.hybridView
|
|
53
|
+
val oldState = holder.lastState
|
|
54
|
+
val newState = stateWrapper
|
|
55
|
+
|
|
56
|
+
// 1. Update each prop individually
|
|
57
|
+
hybridView.beforeUpdate()
|
|
58
|
+
HybridQrScannerStateUpdater.updateViewProps(hybridView, newState, oldState)
|
|
59
|
+
hybridView.afterUpdate()
|
|
60
|
+
holder.lastState = newState
|
|
61
|
+
|
|
62
|
+
// 2. Continue in base View props
|
|
63
|
+
return super.updateState(view, props, newState)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
override fun onDropViewInstance(view: View) {
|
|
67
|
+
val holder = getHybridViewHolder(view)
|
|
68
|
+
holder?.lastState = null
|
|
69
|
+
holder?.hybridView?.onDropView()
|
|
70
|
+
return super.onDropViewInstance(view)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
protected override fun prepareToRecycleView(reactContext: ThemedReactContext, view: View): View? {
|
|
74
|
+
val preparedView = super.prepareToRecycleView(reactContext, view)
|
|
75
|
+
?: return null
|
|
76
|
+
val holder = getHybridViewHolder(preparedView)
|
|
77
|
+
?: return null
|
|
78
|
+
val hybridView = holder.hybridView
|
|
79
|
+
holder.lastState = null
|
|
80
|
+
|
|
81
|
+
@Suppress("USELESS_IS_CHECK")
|
|
82
|
+
if (hybridView is RecyclableView) {
|
|
83
|
+
// Recycle in it's implementation
|
|
84
|
+
hybridView.prepareForRecycle()
|
|
85
|
+
|
|
86
|
+
// Maybe update the view if it changed
|
|
87
|
+
return hybridView.view
|
|
88
|
+
} else {
|
|
89
|
+
return null
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private fun getHybridViewHolder(view: View): HybridViewHolder? {
|
|
94
|
+
return view.getTag(associated_hybrid_view_tag) as? HybridViewHolder
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridQrScannerStateUpdater.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.views
|
|
9
|
+
|
|
10
|
+
import com.facebook.react.uimanager.StateWrapper
|
|
11
|
+
import com.margelo.nitro.qrscanner.*
|
|
12
|
+
|
|
13
|
+
internal class HybridQrScannerStateUpdater {
|
|
14
|
+
companion object {
|
|
15
|
+
/**
|
|
16
|
+
* Updates the props for [view] through C++.
|
|
17
|
+
* The [newState] prop is expected to contain [view]'s props as wrapped Fabric state.
|
|
18
|
+
*/
|
|
19
|
+
@Suppress("KotlinJniMissingFunction")
|
|
20
|
+
@JvmStatic
|
|
21
|
+
external fun updateViewProps(view: HybridQrScannerSpec, newState: StateWrapper, oldState: StateWrapper?)
|
|
22
|
+
}
|
|
23
|
+
}
|