@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.
Files changed (240) hide show
  1. package/LICENSE +21 -0
  2. package/QrScanner.podspec +42 -0
  3. package/README.md +74 -2
  4. package/android/CMakeLists.txt +23 -0
  5. package/android/build.gradle +147 -0
  6. package/android/src/main/AndroidManifest.xml +4 -0
  7. package/android/src/main/cpp/cpp-adapter.cpp +8 -0
  8. package/android/src/main/java/com/margelo/nitro/qrscanner/HybridQrImageDecoder.kt +66 -0
  9. package/android/src/main/java/com/margelo/nitro/qrscanner/QrEngines.kt +53 -0
  10. package/android/src/main/java/com/margelo/nitro/qrscanner/QrFrameTextGate.kt +44 -0
  11. package/android/src/main/java/com/margelo/nitro/qrscanner/QrImageDecodingPipeline.kt +169 -0
  12. package/android/src/main/java/com/margelo/nitro/qrscanner/QrScanner.kt +227 -0
  13. package/android/src/main/java/com/margelo/nitro/qrscanner/QrScannerPackage.kt +31 -0
  14. package/android/src/test/java/com/margelo/nitro/qrscanner/QrFrameTextGateTest.kt +69 -0
  15. package/android/src/test/java/com/margelo/nitro/qrscanner/QrImageDecodingPipelineTest.kt +97 -0
  16. package/ios/HybridQrImageDecoder.swift +58 -0
  17. package/ios/QrFrameTextGate.swift +66 -0
  18. package/ios/QrImageDecodingPipeline.swift +159 -0
  19. package/ios/QrScanner.swift +248 -0
  20. package/ios/QrZXingReader.h +15 -0
  21. package/ios/QrZXingReader.mm +46 -0
  22. package/lib/module/QrImageDecoder.nitro.js +4 -0
  23. package/lib/module/QrImageDecoder.nitro.js.map +1 -0
  24. package/lib/module/QrScanner.js +84 -0
  25. package/lib/module/QrScanner.js.map +1 -0
  26. package/lib/module/QrScanner.nitro.js +4 -0
  27. package/lib/module/QrScanner.nitro.js.map +1 -0
  28. package/lib/module/decodeQrImage.constants.js +5 -0
  29. package/lib/module/decodeQrImage.constants.js.map +1 -0
  30. package/lib/module/decodeQrImage.js +27 -0
  31. package/lib/module/decodeQrImage.js.map +1 -0
  32. package/lib/module/errors.js +31 -0
  33. package/lib/module/errors.js.map +1 -0
  34. package/lib/module/index.js +7 -0
  35. package/lib/module/index.js.map +1 -0
  36. package/lib/module/package.json +1 -0
  37. package/lib/module/ur/assembler.js +152 -0
  38. package/lib/module/ur/assembler.js.map +1 -0
  39. package/lib/module/ur/index.js +6 -0
  40. package/lib/module/ur/index.js.map +1 -0
  41. package/lib/module/ur/limits.js +207 -0
  42. package/lib/module/ur/limits.js.map +1 -0
  43. package/lib/module/ur/session.js +74 -0
  44. package/lib/module/ur/session.js.map +1 -0
  45. package/lib/module/ur/types.js +2 -0
  46. package/lib/module/ur/types.js.map +1 -0
  47. package/lib/module/web/decodeQrImage.js +62 -0
  48. package/lib/module/web/decodeQrImage.js.map +1 -0
  49. package/lib/module/web/engines.js +154 -0
  50. package/lib/module/web/engines.js.map +1 -0
  51. package/lib/module/web/imageOps.js +81 -0
  52. package/lib/module/web/imageOps.js.map +1 -0
  53. package/lib/module/web/index.js +11 -0
  54. package/lib/module/web/index.js.map +1 -0
  55. package/lib/module/web/scanner.js +230 -0
  56. package/lib/module/web/scanner.js.map +1 -0
  57. package/lib/module/web/zxing.worker.js +11 -0
  58. package/lib/module/web/zxing.worker.js.map +1 -0
  59. package/lib/module/web/zxingWorkerProtocol.js +67 -0
  60. package/lib/module/web/zxingWorkerProtocol.js.map +1 -0
  61. package/lib/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
  62. package/lib/nitrogen/generated/android/c++/JFunc_void_std__string_double.hpp +76 -0
  63. package/lib/nitrogen/generated/android/c++/JFunc_void_std__string_std__string_double.hpp +76 -0
  64. package/lib/nitrogen/generated/android/c++/JHybridQrImageDecoderSpec.cpp +78 -0
  65. package/lib/nitrogen/generated/android/c++/JHybridQrImageDecoderSpec.hpp +63 -0
  66. package/lib/nitrogen/generated/android/c++/JHybridQrScannerSpec.cpp +114 -0
  67. package/lib/nitrogen/generated/android/c++/JHybridQrScannerSpec.hpp +70 -0
  68. package/lib/nitrogen/generated/android/c++/JQrDecodeEngine.hpp +61 -0
  69. package/lib/nitrogen/generated/android/c++/JQrDecodePass.hpp +64 -0
  70. package/lib/nitrogen/generated/android/c++/JQrImageDecodeResult.hpp +70 -0
  71. package/lib/nitrogen/generated/android/c++/views/JHybridQrScannerStateUpdater.cpp +89 -0
  72. package/lib/nitrogen/generated/android/c++/views/JHybridQrScannerStateUpdater.hpp +54 -0
  73. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/Func_void_double.kt +78 -0
  74. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/Func_void_std__string_double.kt +78 -0
  75. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/Func_void_std__string_std__string_double.kt +78 -0
  76. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/HybridQrImageDecoderSpec.kt +57 -0
  77. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/HybridQrScannerSpec.kt +101 -0
  78. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/QrDecodeEngine.kt +24 -0
  79. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/QrDecodePass.kt +25 -0
  80. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/QrImageDecodeResult.kt +61 -0
  81. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/qrscannerOnLoad.kt +35 -0
  82. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/views/HybridQrScannerManager.kt +96 -0
  83. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/views/HybridQrScannerStateUpdater.kt +23 -0
  84. package/lib/nitrogen/generated/android/qrscanner+autolinking.cmake +85 -0
  85. package/lib/nitrogen/generated/android/qrscanner+autolinking.gradle +27 -0
  86. package/lib/nitrogen/generated/android/qrscannerOnLoad.cpp +78 -0
  87. package/lib/nitrogen/generated/android/qrscannerOnLoad.hpp +34 -0
  88. package/lib/nitrogen/generated/ios/QrScanner+autolinking.rb +62 -0
  89. package/lib/nitrogen/generated/ios/QrScanner-Swift-Cxx-Bridge.cpp +90 -0
  90. package/lib/nitrogen/generated/ios/QrScanner-Swift-Cxx-Bridge.hpp +294 -0
  91. package/lib/nitrogen/generated/ios/QrScanner-Swift-Cxx-Umbrella.hpp +61 -0
  92. package/lib/nitrogen/generated/ios/QrScannerAutolinking.mm +41 -0
  93. package/lib/nitrogen/generated/ios/QrScannerAutolinking.swift +38 -0
  94. package/lib/nitrogen/generated/ios/c++/HybridQrImageDecoderSpecSwift.cpp +11 -0
  95. package/lib/nitrogen/generated/ios/c++/HybridQrImageDecoderSpecSwift.hpp +92 -0
  96. package/lib/nitrogen/generated/ios/c++/HybridQrScannerSpecSwift.cpp +11 -0
  97. package/lib/nitrogen/generated/ios/c++/HybridQrScannerSpecSwift.hpp +103 -0
  98. package/lib/nitrogen/generated/ios/c++/views/HybridQrScannerComponent.mm +162 -0
  99. package/lib/nitrogen/generated/ios/swift/Func_void_QrImageDecodeResult.swift +46 -0
  100. package/lib/nitrogen/generated/ios/swift/Func_void_double.swift +46 -0
  101. package/lib/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  102. package/lib/nitrogen/generated/ios/swift/Func_void_std__string_double.swift +46 -0
  103. package/lib/nitrogen/generated/ios/swift/Func_void_std__string_std__string_double.swift +46 -0
  104. package/lib/nitrogen/generated/ios/swift/HybridQrImageDecoderSpec.swift +55 -0
  105. package/lib/nitrogen/generated/ios/swift/HybridQrImageDecoderSpec_cxx.swift +145 -0
  106. package/lib/nitrogen/generated/ios/swift/HybridQrScannerSpec.swift +58 -0
  107. package/lib/nitrogen/generated/ios/swift/HybridQrScannerSpec_cxx.swift +252 -0
  108. package/lib/nitrogen/generated/ios/swift/QrDecodeEngine.swift +44 -0
  109. package/lib/nitrogen/generated/ios/swift/QrDecodePass.swift +48 -0
  110. package/lib/nitrogen/generated/ios/swift/QrImageDecodeResult.swift +64 -0
  111. package/lib/nitrogen/generated/shared/c++/HybridQrImageDecoderSpec.cpp +21 -0
  112. package/lib/nitrogen/generated/shared/c++/HybridQrImageDecoderSpec.hpp +65 -0
  113. package/lib/nitrogen/generated/shared/c++/HybridQrScannerSpec.cpp +28 -0
  114. package/lib/nitrogen/generated/shared/c++/HybridQrScannerSpec.hpp +71 -0
  115. package/lib/nitrogen/generated/shared/c++/QrDecodeEngine.hpp +80 -0
  116. package/lib/nitrogen/generated/shared/c++/QrDecodePass.hpp +84 -0
  117. package/lib/nitrogen/generated/shared/c++/QrImageDecodeResult.hpp +97 -0
  118. package/lib/nitrogen/generated/shared/c++/views/HybridQrScannerComponent.cpp +40 -0
  119. package/lib/nitrogen/generated/shared/c++/views/HybridQrScannerComponent.hpp +94 -0
  120. package/lib/nitrogen/generated/shared/json/QrScannerConfig.json +13 -0
  121. package/lib/typescript/package.json +1 -0
  122. package/lib/typescript/src/QrImageDecoder.nitro.d.ts +26 -0
  123. package/lib/typescript/src/QrImageDecoder.nitro.d.ts.map +1 -0
  124. package/lib/typescript/src/QrScanner.d.ts +31 -0
  125. package/lib/typescript/src/QrScanner.d.ts.map +1 -0
  126. package/lib/typescript/src/QrScanner.nitro.d.ts +29 -0
  127. package/lib/typescript/src/QrScanner.nitro.d.ts.map +1 -0
  128. package/lib/typescript/src/decodeQrImage.constants.d.ts +3 -0
  129. package/lib/typescript/src/decodeQrImage.constants.d.ts.map +1 -0
  130. package/lib/typescript/src/decodeQrImage.d.ts +13 -0
  131. package/lib/typescript/src/decodeQrImage.d.ts.map +1 -0
  132. package/lib/typescript/src/errors.d.ts +13 -0
  133. package/lib/typescript/src/errors.d.ts.map +1 -0
  134. package/lib/typescript/src/index.d.ts +9 -0
  135. package/lib/typescript/src/index.d.ts.map +1 -0
  136. package/lib/typescript/src/ur/assembler.d.ts +5 -0
  137. package/lib/typescript/src/ur/assembler.d.ts.map +1 -0
  138. package/lib/typescript/src/ur/index.d.ts +5 -0
  139. package/lib/typescript/src/ur/index.d.ts.map +1 -0
  140. package/lib/typescript/src/ur/limits.d.ts +40 -0
  141. package/lib/typescript/src/ur/limits.d.ts.map +1 -0
  142. package/lib/typescript/src/ur/session.d.ts +11 -0
  143. package/lib/typescript/src/ur/session.d.ts.map +1 -0
  144. package/lib/typescript/src/ur/types.d.ts +61 -0
  145. package/lib/typescript/src/ur/types.d.ts.map +1 -0
  146. package/lib/typescript/src/web/decodeQrImage.d.ts +8 -0
  147. package/lib/typescript/src/web/decodeQrImage.d.ts.map +1 -0
  148. package/lib/typescript/src/web/engines.d.ts +32 -0
  149. package/lib/typescript/src/web/engines.d.ts.map +1 -0
  150. package/lib/typescript/src/web/imageOps.d.ts +37 -0
  151. package/lib/typescript/src/web/imageOps.d.ts.map +1 -0
  152. package/lib/typescript/src/web/index.d.ts +11 -0
  153. package/lib/typescript/src/web/index.d.ts.map +1 -0
  154. package/lib/typescript/src/web/scanner.d.ts +43 -0
  155. package/lib/typescript/src/web/scanner.d.ts.map +1 -0
  156. package/lib/typescript/src/web/zxing.worker.d.ts +2 -0
  157. package/lib/typescript/src/web/zxing.worker.d.ts.map +1 -0
  158. package/lib/typescript/src/web/zxingWorkerProtocol.d.ts +36 -0
  159. package/lib/typescript/src/web/zxingWorkerProtocol.d.ts.map +1 -0
  160. package/nitro.json +27 -0
  161. package/nitrogen/generated/android/c++/JFunc_void_double.hpp +75 -0
  162. package/nitrogen/generated/android/c++/JFunc_void_std__string_double.hpp +76 -0
  163. package/nitrogen/generated/android/c++/JFunc_void_std__string_std__string_double.hpp +76 -0
  164. package/nitrogen/generated/android/c++/JHybridQrImageDecoderSpec.cpp +78 -0
  165. package/nitrogen/generated/android/c++/JHybridQrImageDecoderSpec.hpp +63 -0
  166. package/nitrogen/generated/android/c++/JHybridQrScannerSpec.cpp +114 -0
  167. package/nitrogen/generated/android/c++/JHybridQrScannerSpec.hpp +70 -0
  168. package/nitrogen/generated/android/c++/JQrDecodeEngine.hpp +61 -0
  169. package/nitrogen/generated/android/c++/JQrDecodePass.hpp +64 -0
  170. package/nitrogen/generated/android/c++/JQrImageDecodeResult.hpp +70 -0
  171. package/nitrogen/generated/android/c++/views/JHybridQrScannerStateUpdater.cpp +89 -0
  172. package/nitrogen/generated/android/c++/views/JHybridQrScannerStateUpdater.hpp +54 -0
  173. package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/Func_void_double.kt +78 -0
  174. package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/Func_void_std__string_double.kt +78 -0
  175. package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/Func_void_std__string_std__string_double.kt +78 -0
  176. package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/HybridQrImageDecoderSpec.kt +57 -0
  177. package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/HybridQrScannerSpec.kt +101 -0
  178. package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/QrDecodeEngine.kt +24 -0
  179. package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/QrDecodePass.kt +25 -0
  180. package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/QrImageDecodeResult.kt +61 -0
  181. package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/qrscannerOnLoad.kt +35 -0
  182. package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/views/HybridQrScannerManager.kt +96 -0
  183. package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/views/HybridQrScannerStateUpdater.kt +23 -0
  184. package/nitrogen/generated/android/qrscanner+autolinking.cmake +85 -0
  185. package/nitrogen/generated/android/qrscanner+autolinking.gradle +27 -0
  186. package/nitrogen/generated/android/qrscannerOnLoad.cpp +78 -0
  187. package/nitrogen/generated/android/qrscannerOnLoad.hpp +34 -0
  188. package/nitrogen/generated/ios/QrScanner+autolinking.rb +62 -0
  189. package/nitrogen/generated/ios/QrScanner-Swift-Cxx-Bridge.cpp +90 -0
  190. package/nitrogen/generated/ios/QrScanner-Swift-Cxx-Bridge.hpp +294 -0
  191. package/nitrogen/generated/ios/QrScanner-Swift-Cxx-Umbrella.hpp +61 -0
  192. package/nitrogen/generated/ios/QrScannerAutolinking.mm +41 -0
  193. package/nitrogen/generated/ios/QrScannerAutolinking.swift +38 -0
  194. package/nitrogen/generated/ios/c++/HybridQrImageDecoderSpecSwift.cpp +11 -0
  195. package/nitrogen/generated/ios/c++/HybridQrImageDecoderSpecSwift.hpp +92 -0
  196. package/nitrogen/generated/ios/c++/HybridQrScannerSpecSwift.cpp +11 -0
  197. package/nitrogen/generated/ios/c++/HybridQrScannerSpecSwift.hpp +103 -0
  198. package/nitrogen/generated/ios/c++/views/HybridQrScannerComponent.mm +162 -0
  199. package/nitrogen/generated/ios/swift/Func_void_QrImageDecodeResult.swift +46 -0
  200. package/nitrogen/generated/ios/swift/Func_void_double.swift +46 -0
  201. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  202. package/nitrogen/generated/ios/swift/Func_void_std__string_double.swift +46 -0
  203. package/nitrogen/generated/ios/swift/Func_void_std__string_std__string_double.swift +46 -0
  204. package/nitrogen/generated/ios/swift/HybridQrImageDecoderSpec.swift +55 -0
  205. package/nitrogen/generated/ios/swift/HybridQrImageDecoderSpec_cxx.swift +145 -0
  206. package/nitrogen/generated/ios/swift/HybridQrScannerSpec.swift +58 -0
  207. package/nitrogen/generated/ios/swift/HybridQrScannerSpec_cxx.swift +252 -0
  208. package/nitrogen/generated/ios/swift/QrDecodeEngine.swift +44 -0
  209. package/nitrogen/generated/ios/swift/QrDecodePass.swift +48 -0
  210. package/nitrogen/generated/ios/swift/QrImageDecodeResult.swift +64 -0
  211. package/nitrogen/generated/shared/c++/HybridQrImageDecoderSpec.cpp +21 -0
  212. package/nitrogen/generated/shared/c++/HybridQrImageDecoderSpec.hpp +65 -0
  213. package/nitrogen/generated/shared/c++/HybridQrScannerSpec.cpp +28 -0
  214. package/nitrogen/generated/shared/c++/HybridQrScannerSpec.hpp +71 -0
  215. package/nitrogen/generated/shared/c++/QrDecodeEngine.hpp +80 -0
  216. package/nitrogen/generated/shared/c++/QrDecodePass.hpp +84 -0
  217. package/nitrogen/generated/shared/c++/QrImageDecodeResult.hpp +97 -0
  218. package/nitrogen/generated/shared/c++/views/HybridQrScannerComponent.cpp +40 -0
  219. package/nitrogen/generated/shared/c++/views/HybridQrScannerComponent.hpp +94 -0
  220. package/nitrogen/generated/shared/json/QrScannerConfig.json +13 -0
  221. package/package.json +191 -4
  222. package/src/QrImageDecoder.nitro.ts +27 -0
  223. package/src/QrScanner.nitro.ts +34 -0
  224. package/src/QrScanner.tsx +109 -0
  225. package/src/decodeQrImage.constants.ts +2 -0
  226. package/src/decodeQrImage.ts +39 -0
  227. package/src/errors.ts +52 -0
  228. package/src/index.tsx +15 -0
  229. package/src/ur/assembler.ts +174 -0
  230. package/src/ur/index.ts +15 -0
  231. package/src/ur/limits.ts +214 -0
  232. package/src/ur/session.ts +57 -0
  233. package/src/ur/types.ts +64 -0
  234. package/src/web/decodeQrImage.ts +59 -0
  235. package/src/web/engines.ts +192 -0
  236. package/src/web/imageOps.ts +102 -0
  237. package/src/web/index.ts +12 -0
  238. package/src/web/scanner.ts +271 -0
  239. package/src/web/zxing.worker.ts +17 -0
  240. package/src/web/zxingWorkerProtocol.ts +79 -0
@@ -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
+ }
@@ -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
+ }
@@ -0,0 +1,85 @@
1
+ #
2
+ # qrscanner+autolinking.cmake
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
+ # This is a CMake file that adds all files generated by Nitrogen
9
+ # to the current CMake project.
10
+ #
11
+ # To use it, add this to your CMakeLists.txt:
12
+ # ```cmake
13
+ # include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/qrscanner+autolinking.cmake)
14
+ # ```
15
+
16
+ # Define a flag to check if we are building properly
17
+ add_definitions(-DBUILDING_QRSCANNER_WITH_GENERATED_CMAKE_PROJECT)
18
+
19
+ # Enable Raw Props parsing in react-native (for Nitro Views)
20
+ add_definitions(-DRN_SERIALIZABLE_STATE)
21
+
22
+ # Add all headers that were generated by Nitrogen
23
+ include_directories(
24
+ "../nitrogen/generated/shared/c++"
25
+ "../nitrogen/generated/android/c++"
26
+ "../nitrogen/generated/android/"
27
+ )
28
+
29
+ # Add all .cpp sources that were generated by Nitrogen
30
+ target_sources(
31
+ # CMake project name (Android C++ library name)
32
+ qrscanner PRIVATE
33
+ # Autolinking Setup
34
+ ../nitrogen/generated/android/qrscannerOnLoad.cpp
35
+ # Shared Nitrogen C++ sources
36
+ ../nitrogen/generated/shared/c++/HybridQrImageDecoderSpec.cpp
37
+ ../nitrogen/generated/shared/c++/HybridQrScannerSpec.cpp
38
+ ../nitrogen/generated/shared/c++/views/HybridQrScannerComponent.cpp
39
+ # Android-specific Nitrogen C++ sources
40
+ ../nitrogen/generated/android/c++/JHybridQrImageDecoderSpec.cpp
41
+ ../nitrogen/generated/android/c++/JHybridQrScannerSpec.cpp
42
+ ../nitrogen/generated/android/c++/views/JHybridQrScannerStateUpdater.cpp
43
+ )
44
+
45
+ # From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
46
+ # Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
47
+ target_compile_definitions(
48
+ qrscanner PRIVATE
49
+ -DFOLLY_NO_CONFIG=1
50
+ -DFOLLY_HAVE_CLOCK_GETTIME=1
51
+ -DFOLLY_USE_LIBCPP=1
52
+ -DFOLLY_CFG_NO_COROUTINES=1
53
+ -DFOLLY_MOBILE=1
54
+ -DFOLLY_HAVE_RECVMMSG=1
55
+ -DFOLLY_HAVE_PTHREAD=1
56
+ # Once we target android-23 above, we can comment
57
+ # the following line. NDK uses GNU style stderror_r() after API 23.
58
+ -DFOLLY_HAVE_XSI_STRERROR_R=1
59
+ )
60
+
61
+ # Add all libraries required by the generated specs
62
+ find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
63
+ find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
64
+ find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
65
+
66
+ # Link all libraries together
67
+ target_link_libraries(
68
+ qrscanner
69
+ fbjni::fbjni # <-- Facebook C++ JNI helpers
70
+ ReactAndroid::jsi # <-- RN: JSI
71
+ react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
72
+ )
73
+
74
+ # Link react-native (different prefab between RN 0.75 and RN 0.76)
75
+ if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
76
+ target_link_libraries(
77
+ qrscanner
78
+ ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
79
+ )
80
+ else()
81
+ target_link_libraries(
82
+ qrscanner
83
+ ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
84
+ )
85
+ endif()