@onekeyfe/react-native-qr-scanner 0.0.0-stage → 6.8.0-28
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 +78 -2
- package/android/CMakeLists.txt +23 -0
- package/android/build.gradle +147 -0
- package/android/src/main/AndroidManifest.xml +6 -0
- package/android/src/main/cpp/cpp-adapter.cpp +8 -0
- package/android/src/main/java/com/margelo/nitro/qrscanner/HybridQrCameraList.kt +101 -0
- package/android/src/main/java/com/margelo/nitro/qrscanner/HybridQrImageDecoder.kt +66 -0
- package/android/src/main/java/com/margelo/nitro/qrscanner/QrCameraCatalog.kt +26 -0
- package/android/src/main/java/com/margelo/nitro/qrscanner/QrCameraPermission.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 +45 -0
- package/android/src/main/java/com/margelo/nitro/qrscanner/QrImageDecodingPipeline.kt +190 -0
- package/android/src/main/java/com/margelo/nitro/qrscanner/QrScanner.kt +492 -0
- package/android/src/main/java/com/margelo/nitro/qrscanner/QrScannerPackage.kt +31 -0
- package/android/src/test/java/com/margelo/nitro/qrscanner/QrCameraCatalogTest.kt +37 -0
- package/android/src/test/java/com/margelo/nitro/qrscanner/QrCameraPermissionTest.kt +82 -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/HybridQrCameraList.swift +54 -0
- package/ios/HybridQrImageDecoder.swift +58 -0
- package/ios/QrCameraControl.swift +99 -0
- package/ios/QrFrameTextGate.swift +67 -0
- package/ios/QrImageDecodingPipeline.swift +171 -0
- package/ios/QrScanner.swift +484 -0
- package/ios/QrZXingReader.h +15 -0
- package/ios/QrZXingReader.mm +46 -0
- package/lib/module/QrCameraList.nitro.js +4 -0
- package/lib/module/QrCameraList.nitro.js.map +1 -0
- package/lib/module/QrImageDecoder.nitro.js +4 -0
- package/lib/module/QrImageDecoder.nitro.js.map +1 -0
- package/lib/module/QrScanner.js +102 -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/cameras.js +34 -0
- package/lib/module/cameras.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 +8 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/ur/assembler.js +130 -0
- package/lib/module/ur/assembler.js.map +1 -0
- package/lib/module/ur/fountain.js +139 -0
- package/lib/module/ur/fountain.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 +219 -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/cameras.js +34 -0
- package/lib/module/web/cameras.js.map +1 -0
- package/lib/module/web/decodeQrImage.js +115 -0
- package/lib/module/web/decodeQrImage.js.map +1 -0
- package/lib/module/web/engines.js +189 -0
- package/lib/module/web/engines.js.map +1 -0
- package/lib/module/web/imageDimensions.js +176 -0
- package/lib/module/web/imageDimensions.js.map +1 -0
- package/lib/module/web/imageOps.js +112 -0
- package/lib/module/web/imageOps.js.map +1 -0
- package/lib/module/web/index.js +12 -0
- package/lib/module/web/index.js.map +1 -0
- package/lib/module/web/scanner.js +374 -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 +63 -0
- package/lib/module/web/zxingWorkerProtocol.js.map +1 -0
- package/lib/nitrogen/generated/android/c++/JFunc_void.hpp +75 -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++/JHybridQrCameraListSpec.cpp +91 -0
- package/lib/nitrogen/generated/android/c++/JHybridQrCameraListSpec.hpp +64 -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 +123 -0
- package/lib/nitrogen/generated/android/c++/JHybridQrScannerSpec.hpp +72 -0
- package/lib/nitrogen/generated/android/c++/JQrCameraInfo.hpp +67 -0
- package/lib/nitrogen/generated/android/c++/JQrCameraPosition.hpp +61 -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 +94 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridQrScannerStateUpdater.hpp +54 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/Func_void.kt +78 -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/HybridQrCameraListSpec.kt +66 -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 +107 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/QrCameraInfo.kt +61 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/QrCameraPosition.kt +24 -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 +87 -0
- package/lib/nitrogen/generated/android/qrscanner+autolinking.gradle +27 -0
- package/lib/nitrogen/generated/android/qrscannerOnLoad.cpp +96 -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 +123 -0
- package/lib/nitrogen/generated/ios/QrScanner-Swift-Cxx-Bridge.hpp +418 -0
- package/lib/nitrogen/generated/ios/QrScanner-Swift-Cxx-Umbrella.hpp +73 -0
- package/lib/nitrogen/generated/ios/QrScannerAutolinking.mm +49 -0
- package/lib/nitrogen/generated/ios/QrScannerAutolinking.swift +50 -0
- package/lib/nitrogen/generated/ios/c++/HybridQrCameraListSpecSwift.cpp +11 -0
- package/lib/nitrogen/generated/ios/c++/HybridQrCameraListSpecSwift.hpp +97 -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 +110 -0
- package/lib/nitrogen/generated/ios/c++/views/HybridQrScannerComponent.mm +168 -0
- package/lib/nitrogen/generated/ios/swift/Func_void.swift +46 -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/Func_void_std__vector_QrCameraInfo_.swift +46 -0
- package/lib/nitrogen/generated/ios/swift/HybridQrCameraListSpec.swift +56 -0
- package/lib/nitrogen/generated/ios/swift/HybridQrCameraListSpec_cxx.swift +174 -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 +59 -0
- package/lib/nitrogen/generated/ios/swift/HybridQrScannerSpec_cxx.swift +276 -0
- package/lib/nitrogen/generated/ios/swift/QrCameraInfo.swift +39 -0
- package/lib/nitrogen/generated/ios/swift/QrCameraPosition.swift +44 -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++/HybridQrCameraListSpec.cpp +22 -0
- package/lib/nitrogen/generated/shared/c++/HybridQrCameraListSpec.hpp +68 -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 +30 -0
- package/lib/nitrogen/generated/shared/c++/HybridQrScannerSpec.hpp +73 -0
- package/lib/nitrogen/generated/shared/c++/QrCameraInfo.hpp +93 -0
- package/lib/nitrogen/generated/shared/c++/QrCameraPosition.hpp +80 -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 +42 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridQrScannerComponent.hpp +97 -0
- package/lib/nitrogen/generated/shared/json/QrScannerConfig.json +14 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/QrCameraList.nitro.d.ts +24 -0
- package/lib/typescript/src/QrCameraList.nitro.d.ts.map +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 +36 -0
- package/lib/typescript/src/QrScanner.d.ts.map +1 -0
- package/lib/typescript/src/QrScanner.nitro.d.ts +35 -0
- package/lib/typescript/src/QrScanner.nitro.d.ts.map +1 -0
- package/lib/typescript/src/cameras.d.ts +11 -0
- package/lib/typescript/src/cameras.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 +11 -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/fountain.d.ts +17 -0
- package/lib/typescript/src/ur/fountain.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 +43 -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/cameras.d.ts +12 -0
- package/lib/typescript/src/web/cameras.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 +31 -0
- package/lib/typescript/src/web/engines.d.ts.map +1 -0
- package/lib/typescript/src/web/imageDimensions.d.ts +10 -0
- package/lib/typescript/src/web/imageDimensions.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 +13 -0
- package/lib/typescript/src/web/index.d.ts.map +1 -0
- package/lib/typescript/src/web/scanner.d.ts +50 -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 +31 -0
- package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -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++/JHybridQrCameraListSpec.cpp +91 -0
- package/nitrogen/generated/android/c++/JHybridQrCameraListSpec.hpp +64 -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 +123 -0
- package/nitrogen/generated/android/c++/JHybridQrScannerSpec.hpp +72 -0
- package/nitrogen/generated/android/c++/JQrCameraInfo.hpp +67 -0
- package/nitrogen/generated/android/c++/JQrCameraPosition.hpp +61 -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 +94 -0
- package/nitrogen/generated/android/c++/views/JHybridQrScannerStateUpdater.hpp +54 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/Func_void.kt +78 -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/HybridQrCameraListSpec.kt +66 -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 +107 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/QrCameraInfo.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/QrCameraPosition.kt +24 -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 +87 -0
- package/nitrogen/generated/android/qrscanner+autolinking.gradle +27 -0
- package/nitrogen/generated/android/qrscannerOnLoad.cpp +96 -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 +123 -0
- package/nitrogen/generated/ios/QrScanner-Swift-Cxx-Bridge.hpp +418 -0
- package/nitrogen/generated/ios/QrScanner-Swift-Cxx-Umbrella.hpp +73 -0
- package/nitrogen/generated/ios/QrScannerAutolinking.mm +49 -0
- package/nitrogen/generated/ios/QrScannerAutolinking.swift +50 -0
- package/nitrogen/generated/ios/c++/HybridQrCameraListSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridQrCameraListSpecSwift.hpp +97 -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 +110 -0
- package/nitrogen/generated/ios/c++/views/HybridQrScannerComponent.mm +168 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +46 -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/Func_void_std__vector_QrCameraInfo_.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridQrCameraListSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridQrCameraListSpec_cxx.swift +174 -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 +59 -0
- package/nitrogen/generated/ios/swift/HybridQrScannerSpec_cxx.swift +276 -0
- package/nitrogen/generated/ios/swift/QrCameraInfo.swift +39 -0
- package/nitrogen/generated/ios/swift/QrCameraPosition.swift +44 -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++/HybridQrCameraListSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridQrCameraListSpec.hpp +68 -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 +30 -0
- package/nitrogen/generated/shared/c++/HybridQrScannerSpec.hpp +73 -0
- package/nitrogen/generated/shared/c++/QrCameraInfo.hpp +93 -0
- package/nitrogen/generated/shared/c++/QrCameraPosition.hpp +80 -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 +42 -0
- package/nitrogen/generated/shared/c++/views/HybridQrScannerComponent.hpp +97 -0
- package/nitrogen/generated/shared/json/QrScannerConfig.json +14 -0
- package/package.json +191 -4
- package/src/QrCameraList.nitro.ts +24 -0
- package/src/QrImageDecoder.nitro.ts +27 -0
- package/src/QrScanner.nitro.ts +40 -0
- package/src/QrScanner.tsx +129 -0
- package/src/cameras.ts +37 -0
- package/src/decodeQrImage.constants.ts +2 -0
- package/src/decodeQrImage.ts +39 -0
- package/src/errors.ts +52 -0
- package/src/index.tsx +17 -0
- package/src/ur/assembler.ts +131 -0
- package/src/ur/fountain.ts +152 -0
- package/src/ur/index.ts +15 -0
- package/src/ur/limits.ts +222 -0
- package/src/ur/session.ts +57 -0
- package/src/ur/types.ts +64 -0
- package/src/web/cameras.ts +37 -0
- package/src/web/decodeQrImage.ts +107 -0
- package/src/web/engines.ts +234 -0
- package/src/web/imageDimensions.ts +157 -0
- package/src/web/imageOps.ts +128 -0
- package/src/web/index.ts +18 -0
- package/src/web/scanner.ts +421 -0
- package/src/web/zxing.worker.ts +17 -0
- package/src/web/zxingWorkerProtocol.ts +73 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridQrScannerSpec.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 "HybridQrScannerSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::qrscanner {
|
|
11
|
+
|
|
12
|
+
void HybridQrScannerSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridGetter("active", &HybridQrScannerSpec::getActive);
|
|
18
|
+
prototype.registerHybridSetter("active", &HybridQrScannerSpec::setActive);
|
|
19
|
+
prototype.registerHybridGetter("cameraId", &HybridQrScannerSpec::getCameraId);
|
|
20
|
+
prototype.registerHybridSetter("cameraId", &HybridQrScannerSpec::setCameraId);
|
|
21
|
+
prototype.registerHybridGetter("onReady", &HybridQrScannerSpec::getOnReady);
|
|
22
|
+
prototype.registerHybridSetter("onReady", &HybridQrScannerSpec::setOnReady);
|
|
23
|
+
prototype.registerHybridGetter("onFrameText", &HybridQrScannerSpec::getOnFrameText);
|
|
24
|
+
prototype.registerHybridSetter("onFrameText", &HybridQrScannerSpec::setOnFrameText);
|
|
25
|
+
prototype.registerHybridGetter("onError", &HybridQrScannerSpec::getOnError);
|
|
26
|
+
prototype.registerHybridSetter("onError", &HybridQrScannerSpec::setOnError);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
} // namespace margelo::nitro::qrscanner
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridQrScannerSpec.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
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
#include <string>
|
|
19
|
+
#include <optional>
|
|
20
|
+
#include <functional>
|
|
21
|
+
|
|
22
|
+
namespace margelo::nitro::qrscanner {
|
|
23
|
+
|
|
24
|
+
using namespace margelo::nitro;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* An abstract base class for `QrScanner`
|
|
28
|
+
* Inherit this class to create instances of `HybridQrScannerSpec` in C++.
|
|
29
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
30
|
+
* @example
|
|
31
|
+
* ```cpp
|
|
32
|
+
* class HybridQrScanner: public HybridQrScannerSpec {
|
|
33
|
+
* public:
|
|
34
|
+
* HybridQrScanner(...): HybridObject(TAG) { ... }
|
|
35
|
+
* // ...
|
|
36
|
+
* };
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
class HybridQrScannerSpec: public virtual HybridObject {
|
|
40
|
+
public:
|
|
41
|
+
// Constructor
|
|
42
|
+
explicit HybridQrScannerSpec(): HybridObject(TAG) { }
|
|
43
|
+
|
|
44
|
+
// Destructor
|
|
45
|
+
~HybridQrScannerSpec() override = default;
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
// Properties
|
|
49
|
+
virtual bool getActive() = 0;
|
|
50
|
+
virtual void setActive(bool active) = 0;
|
|
51
|
+
virtual std::optional<std::string> getCameraId() = 0;
|
|
52
|
+
virtual void setCameraId(const std::optional<std::string>& cameraId) = 0;
|
|
53
|
+
virtual std::optional<std::function<void(double /* generation */)>> getOnReady() = 0;
|
|
54
|
+
virtual void setOnReady(const std::optional<std::function<void(double /* generation */)>>& onReady) = 0;
|
|
55
|
+
virtual std::optional<std::function<void(const std::string& /* text */, double /* generation */)>> getOnFrameText() = 0;
|
|
56
|
+
virtual void setOnFrameText(const std::optional<std::function<void(const std::string& /* text */, double /* generation */)>>& onFrameText) = 0;
|
|
57
|
+
virtual std::optional<std::function<void(const std::string& /* code */, const std::string& /* message */, double /* generation */)>> getOnError() = 0;
|
|
58
|
+
virtual void setOnError(const std::optional<std::function<void(const std::string& /* code */, const std::string& /* message */, double /* generation */)>>& onError) = 0;
|
|
59
|
+
|
|
60
|
+
public:
|
|
61
|
+
// Methods
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
protected:
|
|
65
|
+
// Hybrid Setup
|
|
66
|
+
void loadHybridMethods() override;
|
|
67
|
+
|
|
68
|
+
protected:
|
|
69
|
+
// Tag for logging
|
|
70
|
+
static constexpr auto TAG = "QrScanner";
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
} // namespace margelo::nitro::qrscanner
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// QrCameraInfo.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
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `QrCameraPosition` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::qrscanner { enum class QrCameraPosition; }
|
|
33
|
+
|
|
34
|
+
#include <string>
|
|
35
|
+
#include "QrCameraPosition.hpp"
|
|
36
|
+
|
|
37
|
+
namespace margelo::nitro::qrscanner {
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A struct which can be represented as a JavaScript object (QrCameraInfo).
|
|
41
|
+
*/
|
|
42
|
+
struct QrCameraInfo final {
|
|
43
|
+
public:
|
|
44
|
+
std::string id SWIFT_PRIVATE;
|
|
45
|
+
QrCameraPosition position SWIFT_PRIVATE;
|
|
46
|
+
std::string label SWIFT_PRIVATE;
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
QrCameraInfo() = default;
|
|
50
|
+
explicit QrCameraInfo(std::string id, QrCameraPosition position, std::string label): id(id), position(position), label(label) {}
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
friend bool operator==(const QrCameraInfo& lhs, const QrCameraInfo& rhs) = default;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
} // namespace margelo::nitro::qrscanner
|
|
57
|
+
|
|
58
|
+
namespace margelo::nitro {
|
|
59
|
+
|
|
60
|
+
// C++ QrCameraInfo <> JS QrCameraInfo (object)
|
|
61
|
+
template <>
|
|
62
|
+
struct JSIConverter<margelo::nitro::qrscanner::QrCameraInfo> final {
|
|
63
|
+
static inline margelo::nitro::qrscanner::QrCameraInfo fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
64
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
65
|
+
return margelo::nitro::qrscanner::QrCameraInfo(
|
|
66
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id"))),
|
|
67
|
+
JSIConverter<margelo::nitro::qrscanner::QrCameraPosition>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "position"))),
|
|
68
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "label")))
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::qrscanner::QrCameraInfo& arg) {
|
|
72
|
+
jsi::Object obj(runtime);
|
|
73
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "id"), JSIConverter<std::string>::toJSI(runtime, arg.id));
|
|
74
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "position"), JSIConverter<margelo::nitro::qrscanner::QrCameraPosition>::toJSI(runtime, arg.position));
|
|
75
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "label"), JSIConverter<std::string>::toJSI(runtime, arg.label));
|
|
76
|
+
return obj;
|
|
77
|
+
}
|
|
78
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
79
|
+
if (!value.isObject()) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
jsi::Object obj = value.getObject(runtime);
|
|
83
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "id")))) return false;
|
|
87
|
+
if (!JSIConverter<margelo::nitro::qrscanner::QrCameraPosition>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "position")))) return false;
|
|
88
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "label")))) return false;
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// QrCameraPosition.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
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::qrscanner {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (QrCameraPosition).
|
|
30
|
+
*/
|
|
31
|
+
enum class QrCameraPosition {
|
|
32
|
+
BACK SWIFT_NAME(back) = 0,
|
|
33
|
+
FRONT SWIFT_NAME(front) = 1,
|
|
34
|
+
EXTERNAL SWIFT_NAME(external) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::qrscanner
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ QrCameraPosition <> JS QrCameraPosition (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::qrscanner::QrCameraPosition> final {
|
|
44
|
+
static inline margelo::nitro::qrscanner::QrCameraPosition fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
46
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
47
|
+
case hashString("back"): return margelo::nitro::qrscanner::QrCameraPosition::BACK;
|
|
48
|
+
case hashString("front"): return margelo::nitro::qrscanner::QrCameraPosition::FRONT;
|
|
49
|
+
case hashString("external"): return margelo::nitro::qrscanner::QrCameraPosition::EXTERNAL;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum QrCameraPosition - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::qrscanner::QrCameraPosition arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::qrscanner::QrCameraPosition::BACK: return JSIConverter<std::string>::toJSI(runtime, "back");
|
|
57
|
+
case margelo::nitro::qrscanner::QrCameraPosition::FRONT: return JSIConverter<std::string>::toJSI(runtime, "front");
|
|
58
|
+
case margelo::nitro::qrscanner::QrCameraPosition::EXTERNAL: return JSIConverter<std::string>::toJSI(runtime, "external");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert QrCameraPosition to JS - invalid value: "
|
|
61
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
65
|
+
if (!value.isString()) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
69
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
70
|
+
case hashString("back"):
|
|
71
|
+
case hashString("front"):
|
|
72
|
+
case hashString("external"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// QrDecodeEngine.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
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::qrscanner {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (QrDecodeEngine).
|
|
30
|
+
*/
|
|
31
|
+
enum class QrDecodeEngine {
|
|
32
|
+
VISION SWIFT_NAME(vision) = 0,
|
|
33
|
+
MLKIT SWIFT_NAME(mlkit) = 1,
|
|
34
|
+
ZXING SWIFT_NAME(zxing) = 2,
|
|
35
|
+
} CLOSED_ENUM;
|
|
36
|
+
|
|
37
|
+
} // namespace margelo::nitro::qrscanner
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro {
|
|
40
|
+
|
|
41
|
+
// C++ QrDecodeEngine <> JS QrDecodeEngine (union)
|
|
42
|
+
template <>
|
|
43
|
+
struct JSIConverter<margelo::nitro::qrscanner::QrDecodeEngine> final {
|
|
44
|
+
static inline margelo::nitro::qrscanner::QrDecodeEngine fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
45
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
46
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
47
|
+
case hashString("vision"): return margelo::nitro::qrscanner::QrDecodeEngine::VISION;
|
|
48
|
+
case hashString("mlkit"): return margelo::nitro::qrscanner::QrDecodeEngine::MLKIT;
|
|
49
|
+
case hashString("zxing"): return margelo::nitro::qrscanner::QrDecodeEngine::ZXING;
|
|
50
|
+
default: [[unlikely]]
|
|
51
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum QrDecodeEngine - invalid value!");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::qrscanner::QrDecodeEngine arg) {
|
|
55
|
+
switch (arg) {
|
|
56
|
+
case margelo::nitro::qrscanner::QrDecodeEngine::VISION: return JSIConverter<std::string>::toJSI(runtime, "vision");
|
|
57
|
+
case margelo::nitro::qrscanner::QrDecodeEngine::MLKIT: return JSIConverter<std::string>::toJSI(runtime, "mlkit");
|
|
58
|
+
case margelo::nitro::qrscanner::QrDecodeEngine::ZXING: return JSIConverter<std::string>::toJSI(runtime, "zxing");
|
|
59
|
+
default: [[unlikely]]
|
|
60
|
+
throw std::invalid_argument("Cannot convert QrDecodeEngine to JS - invalid value: "
|
|
61
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
65
|
+
if (!value.isString()) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
69
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
70
|
+
case hashString("vision"):
|
|
71
|
+
case hashString("mlkit"):
|
|
72
|
+
case hashString("zxing"):
|
|
73
|
+
return true;
|
|
74
|
+
default:
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// QrDecodePass.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
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::qrscanner {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (QrDecodePass).
|
|
30
|
+
*/
|
|
31
|
+
enum class QrDecodePass {
|
|
32
|
+
ORIGINAL SWIFT_NAME(original) = 0,
|
|
33
|
+
PADDED SWIFT_NAME(padded) = 1,
|
|
34
|
+
GRAYSCALE SWIFT_NAME(grayscale) = 2,
|
|
35
|
+
INVERTED SWIFT_NAME(inverted) = 3,
|
|
36
|
+
} CLOSED_ENUM;
|
|
37
|
+
|
|
38
|
+
} // namespace margelo::nitro::qrscanner
|
|
39
|
+
|
|
40
|
+
namespace margelo::nitro {
|
|
41
|
+
|
|
42
|
+
// C++ QrDecodePass <> JS QrDecodePass (union)
|
|
43
|
+
template <>
|
|
44
|
+
struct JSIConverter<margelo::nitro::qrscanner::QrDecodePass> final {
|
|
45
|
+
static inline margelo::nitro::qrscanner::QrDecodePass fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
46
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
47
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
48
|
+
case hashString("original"): return margelo::nitro::qrscanner::QrDecodePass::ORIGINAL;
|
|
49
|
+
case hashString("padded"): return margelo::nitro::qrscanner::QrDecodePass::PADDED;
|
|
50
|
+
case hashString("grayscale"): return margelo::nitro::qrscanner::QrDecodePass::GRAYSCALE;
|
|
51
|
+
case hashString("inverted"): return margelo::nitro::qrscanner::QrDecodePass::INVERTED;
|
|
52
|
+
default: [[unlikely]]
|
|
53
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum QrDecodePass - invalid value!");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::qrscanner::QrDecodePass arg) {
|
|
57
|
+
switch (arg) {
|
|
58
|
+
case margelo::nitro::qrscanner::QrDecodePass::ORIGINAL: return JSIConverter<std::string>::toJSI(runtime, "original");
|
|
59
|
+
case margelo::nitro::qrscanner::QrDecodePass::PADDED: return JSIConverter<std::string>::toJSI(runtime, "padded");
|
|
60
|
+
case margelo::nitro::qrscanner::QrDecodePass::GRAYSCALE: return JSIConverter<std::string>::toJSI(runtime, "grayscale");
|
|
61
|
+
case margelo::nitro::qrscanner::QrDecodePass::INVERTED: return JSIConverter<std::string>::toJSI(runtime, "inverted");
|
|
62
|
+
default: [[unlikely]]
|
|
63
|
+
throw std::invalid_argument("Cannot convert QrDecodePass to JS - invalid value: "
|
|
64
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
68
|
+
if (!value.isString()) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
72
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
73
|
+
case hashString("original"):
|
|
74
|
+
case hashString("padded"):
|
|
75
|
+
case hashString("grayscale"):
|
|
76
|
+
case hashString("inverted"):
|
|
77
|
+
return true;
|
|
78
|
+
default:
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// QrImageDecodeResult.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
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `QrDecodeEngine` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::qrscanner { enum class QrDecodeEngine; }
|
|
33
|
+
// Forward declaration of `QrDecodePass` to properly resolve imports.
|
|
34
|
+
namespace margelo::nitro::qrscanner { enum class QrDecodePass; }
|
|
35
|
+
|
|
36
|
+
#include <string>
|
|
37
|
+
#include <optional>
|
|
38
|
+
#include "QrDecodeEngine.hpp"
|
|
39
|
+
#include "QrDecodePass.hpp"
|
|
40
|
+
|
|
41
|
+
namespace margelo::nitro::qrscanner {
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A struct which can be represented as a JavaScript object (QrImageDecodeResult).
|
|
45
|
+
*/
|
|
46
|
+
struct QrImageDecodeResult final {
|
|
47
|
+
public:
|
|
48
|
+
std::optional<std::string> text SWIFT_PRIVATE;
|
|
49
|
+
std::optional<QrDecodeEngine> engine SWIFT_PRIVATE;
|
|
50
|
+
std::optional<QrDecodePass> pass SWIFT_PRIVATE;
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
QrImageDecodeResult() = default;
|
|
54
|
+
explicit QrImageDecodeResult(std::optional<std::string> text, std::optional<QrDecodeEngine> engine, std::optional<QrDecodePass> pass): text(text), engine(engine), pass(pass) {}
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
friend bool operator==(const QrImageDecodeResult& lhs, const QrImageDecodeResult& rhs) = default;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
} // namespace margelo::nitro::qrscanner
|
|
61
|
+
|
|
62
|
+
namespace margelo::nitro {
|
|
63
|
+
|
|
64
|
+
// C++ QrImageDecodeResult <> JS QrImageDecodeResult (object)
|
|
65
|
+
template <>
|
|
66
|
+
struct JSIConverter<margelo::nitro::qrscanner::QrImageDecodeResult> final {
|
|
67
|
+
static inline margelo::nitro::qrscanner::QrImageDecodeResult fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
68
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
69
|
+
return margelo::nitro::qrscanner::QrImageDecodeResult(
|
|
70
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text"))),
|
|
71
|
+
JSIConverter<std::optional<margelo::nitro::qrscanner::QrDecodeEngine>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "engine"))),
|
|
72
|
+
JSIConverter<std::optional<margelo::nitro::qrscanner::QrDecodePass>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pass")))
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::qrscanner::QrImageDecodeResult& arg) {
|
|
76
|
+
jsi::Object obj(runtime);
|
|
77
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "text"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.text));
|
|
78
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "engine"), JSIConverter<std::optional<margelo::nitro::qrscanner::QrDecodeEngine>>::toJSI(runtime, arg.engine));
|
|
79
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "pass"), JSIConverter<std::optional<margelo::nitro::qrscanner::QrDecodePass>>::toJSI(runtime, arg.pass));
|
|
80
|
+
return obj;
|
|
81
|
+
}
|
|
82
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
83
|
+
if (!value.isObject()) {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
jsi::Object obj = value.getObject(runtime);
|
|
87
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "text")))) return false;
|
|
91
|
+
if (!JSIConverter<std::optional<margelo::nitro::qrscanner::QrDecodeEngine>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "engine")))) return false;
|
|
92
|
+
if (!JSIConverter<std::optional<margelo::nitro::qrscanner::QrDecodePass>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "pass")))) return false;
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridQrScannerComponent.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 "HybridQrScannerComponent.hpp"
|
|
9
|
+
|
|
10
|
+
#include <NitroModules/NitroHash.hpp>
|
|
11
|
+
#include <NitroModules/ReactProp.hpp>
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::qrscanner::views {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
extern const char HybridQrScannerComponentName[] = "QrScanner";
|
|
18
|
+
|
|
19
|
+
HybridQrScannerProps::HybridQrScannerProps(const react::PropsParserContext& context,
|
|
20
|
+
const HybridQrScannerProps& sourceProps,
|
|
21
|
+
const react::RawProps& rawProps):
|
|
22
|
+
react::ViewProps(context, sourceProps, rawProps, filterObjectKeys),
|
|
23
|
+
active(nitro::ReactProp<bool>::fromRawValue("QrScanner", "active", rawProps, sourceProps.active)),
|
|
24
|
+
cameraId(nitro::ReactProp<std::optional<std::string>>::fromRawValue("QrScanner", "cameraId", rawProps, sourceProps.cameraId)),
|
|
25
|
+
onReady(nitro::ReactProp<std::optional<std::function<void(double /* generation */)>>>::fromRawValue("QrScanner", "onReady", rawProps, sourceProps.onReady)),
|
|
26
|
+
onFrameText(nitro::ReactProp<std::optional<std::function<void(const std::string& /* text */, double /* generation */)>>>::fromRawValue("QrScanner", "onFrameText", rawProps, sourceProps.onFrameText)),
|
|
27
|
+
onError(nitro::ReactProp<std::optional<std::function<void(const std::string& /* code */, const std::string& /* message */, double /* generation */)>>>::fromRawValue("QrScanner", "onError", rawProps, sourceProps.onError)),
|
|
28
|
+
hybridRef(nitro::ReactProp<std::optional<std::function<void(const std::shared_ptr<HybridQrScannerSpec>& /* ref */)>>>::fromRawValue("QrScanner", "hybridRef", rawProps, sourceProps.hybridRef)) { }
|
|
29
|
+
|
|
30
|
+
bool HybridQrScannerProps::filterObjectKeys(const std::string& propName) {
|
|
31
|
+
switch (hashString(propName)) {
|
|
32
|
+
case hashString("active"): return true;
|
|
33
|
+
case hashString("cameraId"): return true;
|
|
34
|
+
case hashString("onReady"): return true;
|
|
35
|
+
case hashString("onFrameText"): return true;
|
|
36
|
+
case hashString("onError"): return true;
|
|
37
|
+
case hashString("hybridRef"): return true;
|
|
38
|
+
default: return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
} // namespace margelo::nitro::qrscanner::views
|