@onekeyfe/react-native-qr-scanner 6.8.0-alpha.545 → 6.8.0-alpha.546
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/android/src/main/java/com/margelo/nitro/qrscanner/HybridQrCameraList.kt +100 -0
- package/android/src/main/java/com/margelo/nitro/qrscanner/QrCameraCatalog.kt +26 -0
- package/android/src/main/java/com/margelo/nitro/qrscanner/QrScanner.kt +42 -8
- package/android/src/test/java/com/margelo/nitro/qrscanner/QrCameraCatalogTest.kt +37 -0
- package/ios/HybridQrCameraList.swift +54 -0
- package/ios/QrCameraControl.swift +42 -0
- package/ios/QrScanner.swift +82 -23
- package/lib/module/QrCameraList.nitro.js +4 -0
- package/lib/module/QrCameraList.nitro.js.map +1 -0
- package/lib/module/QrScanner.js +2 -0
- package/lib/module/QrScanner.js.map +1 -1
- package/lib/module/cameras.js +33 -0
- package/lib/module/cameras.js.map +1 -0
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/web/cameras.js +33 -0
- package/lib/module/web/cameras.js.map +1 -0
- package/lib/module/web/index.js +1 -0
- package/lib/module/web/index.js.map +1 -1
- package/lib/module/web/scanner.js +22 -5
- package/lib/module/web/scanner.js.map +1 -1
- package/lib/nitrogen/generated/android/c++/JFunc_void.hpp +75 -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++/JHybridQrScannerSpec.cpp +11 -2
- package/lib/nitrogen/generated/android/c++/JHybridQrScannerSpec.hpp +2 -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++/views/JHybridQrScannerStateUpdater.cpp +5 -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/HybridQrCameraListSpec.kt +66 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/HybridQrScannerSpec.kt +6 -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/qrscanner+autolinking.cmake +2 -0
- package/lib/nitrogen/generated/android/qrscannerOnLoad.cpp +18 -0
- package/lib/nitrogen/generated/ios/QrScanner-Swift-Cxx-Bridge.cpp +37 -4
- package/lib/nitrogen/generated/ios/QrScanner-Swift-Cxx-Bridge.hpp +146 -22
- package/lib/nitrogen/generated/ios/QrScanner-Swift-Cxx-Umbrella.hpp +12 -0
- package/lib/nitrogen/generated/ios/QrScannerAutolinking.mm +8 -0
- package/lib/nitrogen/generated/ios/QrScannerAutolinking.swift +12 -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++/HybridQrScannerSpecSwift.hpp +9 -2
- package/lib/nitrogen/generated/ios/c++/views/HybridQrScannerComponent.mm +6 -0
- package/lib/nitrogen/generated/ios/swift/Func_void.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/HybridQrScannerSpec.swift +1 -0
- package/lib/nitrogen/generated/ios/swift/HybridQrScannerSpec_cxx.swift +24 -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/shared/c++/HybridQrCameraListSpec.cpp +22 -0
- package/lib/nitrogen/generated/shared/c++/HybridQrCameraListSpec.hpp +68 -0
- package/lib/nitrogen/generated/shared/c++/HybridQrScannerSpec.cpp +2 -0
- package/lib/nitrogen/generated/shared/c++/HybridQrScannerSpec.hpp +4 -2
- 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++/views/HybridQrScannerComponent.cpp +2 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridQrScannerComponent.hpp +5 -2
- package/lib/nitrogen/generated/shared/json/QrScannerConfig.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/QrScanner.d.ts +6 -1
- package/lib/typescript/src/QrScanner.d.ts.map +1 -1
- package/lib/typescript/src/QrScanner.nitro.d.ts +6 -0
- package/lib/typescript/src/QrScanner.nitro.d.ts.map +1 -1
- package/lib/typescript/src/cameras.d.ts +11 -0
- package/lib/typescript/src/cameras.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- 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/index.d.ts +2 -0
- package/lib/typescript/src/web/index.d.ts.map +1 -1
- package/lib/typescript/src/web/scanner.d.ts +7 -0
- package/lib/typescript/src/web/scanner.d.ts.map +1 -1
- package/nitro.json +4 -0
- package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
- package/nitrogen/generated/android/c++/JHybridQrCameraListSpec.cpp +91 -0
- package/nitrogen/generated/android/c++/JHybridQrCameraListSpec.hpp +64 -0
- package/nitrogen/generated/android/c++/JHybridQrScannerSpec.cpp +11 -2
- package/nitrogen/generated/android/c++/JHybridQrScannerSpec.hpp +2 -0
- package/nitrogen/generated/android/c++/JQrCameraInfo.hpp +67 -0
- package/nitrogen/generated/android/c++/JQrCameraPosition.hpp +61 -0
- package/nitrogen/generated/android/c++/views/JHybridQrScannerStateUpdater.cpp +5 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/Func_void.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/HybridQrScannerSpec.kt +6 -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/qrscanner+autolinking.cmake +2 -0
- package/nitrogen/generated/android/qrscannerOnLoad.cpp +18 -0
- package/nitrogen/generated/ios/QrScanner-Swift-Cxx-Bridge.cpp +37 -4
- package/nitrogen/generated/ios/QrScanner-Swift-Cxx-Bridge.hpp +146 -22
- package/nitrogen/generated/ios/QrScanner-Swift-Cxx-Umbrella.hpp +12 -0
- package/nitrogen/generated/ios/QrScannerAutolinking.mm +8 -0
- package/nitrogen/generated/ios/QrScannerAutolinking.swift +12 -0
- package/nitrogen/generated/ios/c++/HybridQrCameraListSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridQrCameraListSpecSwift.hpp +97 -0
- package/nitrogen/generated/ios/c++/HybridQrScannerSpecSwift.hpp +9 -2
- package/nitrogen/generated/ios/c++/views/HybridQrScannerComponent.mm +6 -0
- package/nitrogen/generated/ios/swift/Func_void.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/HybridQrScannerSpec.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridQrScannerSpec_cxx.swift +24 -0
- package/nitrogen/generated/ios/swift/QrCameraInfo.swift +39 -0
- package/nitrogen/generated/ios/swift/QrCameraPosition.swift +44 -0
- package/nitrogen/generated/shared/c++/HybridQrCameraListSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridQrCameraListSpec.hpp +68 -0
- package/nitrogen/generated/shared/c++/HybridQrScannerSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridQrScannerSpec.hpp +4 -2
- package/nitrogen/generated/shared/c++/QrCameraInfo.hpp +93 -0
- package/nitrogen/generated/shared/c++/QrCameraPosition.hpp +80 -0
- package/nitrogen/generated/shared/c++/views/HybridQrScannerComponent.cpp +2 -0
- package/nitrogen/generated/shared/c++/views/HybridQrScannerComponent.hpp +5 -2
- package/nitrogen/generated/shared/json/QrScannerConfig.json +1 -0
- package/package.json +1 -1
- package/src/QrCameraList.nitro.ts +24 -0
- package/src/QrScanner.nitro.ts +6 -0
- package/src/QrScanner.tsx +9 -1
- package/src/cameras.ts +36 -0
- package/src/index.tsx +2 -0
- package/src/web/cameras.ts +36 -0
- package/src/web/index.ts +6 -0
- package/src/web/scanner.ts +28 -4
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridQrCameraListSpec_cxx.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A class implementation that bridges HybridQrCameraListSpec over to C++.
|
|
12
|
+
* In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
|
|
13
|
+
*
|
|
14
|
+
* Also, some Swift types need to be bridged with special handling:
|
|
15
|
+
* - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
|
|
16
|
+
* - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
|
|
17
|
+
* - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
|
|
18
|
+
*/
|
|
19
|
+
open class HybridQrCameraListSpec_cxx {
|
|
20
|
+
/**
|
|
21
|
+
* The Swift <> C++ bridge's namespace (`margelo::nitro::qrscanner::bridge::swift`)
|
|
22
|
+
* from `QrScanner-Swift-Cxx-Bridge.hpp`.
|
|
23
|
+
* This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
|
|
24
|
+
*/
|
|
25
|
+
public typealias bridge = margelo.nitro.qrscanner.bridge.swift
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Holds an instance of the `HybridQrCameraListSpec` Swift protocol.
|
|
29
|
+
*/
|
|
30
|
+
private var __implementation: any HybridQrCameraListSpec
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Holds a weak pointer to the C++ class that wraps the Swift class.
|
|
34
|
+
*/
|
|
35
|
+
private var __cxxPart: bridge.std__weak_ptr_HybridQrCameraListSpec_
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Create a new `HybridQrCameraListSpec_cxx` that wraps the given `HybridQrCameraListSpec`.
|
|
39
|
+
* All properties and methods bridge to C++ types.
|
|
40
|
+
*/
|
|
41
|
+
public init(_ implementation: any HybridQrCameraListSpec) {
|
|
42
|
+
self.__implementation = implementation
|
|
43
|
+
self.__cxxPart = .init()
|
|
44
|
+
/* no base class */
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Get the actual `HybridQrCameraListSpec` instance this class wraps.
|
|
49
|
+
*/
|
|
50
|
+
@inline(__always)
|
|
51
|
+
public func getHybridQrCameraListSpec() -> any HybridQrCameraListSpec {
|
|
52
|
+
return __implementation
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
57
|
+
* This acquires one additional strong reference on the object!
|
|
58
|
+
*/
|
|
59
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
60
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Casts an unsafe pointer to a `HybridQrCameraListSpec_cxx`.
|
|
65
|
+
* The pointer has to be a retained opaque `Unmanaged<HybridQrCameraListSpec_cxx>`.
|
|
66
|
+
* This removes one strong reference from the object!
|
|
67
|
+
*/
|
|
68
|
+
public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridQrCameraListSpec_cxx {
|
|
69
|
+
return Unmanaged<HybridQrCameraListSpec_cxx>.fromOpaque(pointer).takeRetainedValue()
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Gets (or creates) the C++ part of this Hybrid Object.
|
|
74
|
+
* The C++ part is a `std::shared_ptr<HybridQrCameraListSpec>`.
|
|
75
|
+
*/
|
|
76
|
+
public func getCxxPart() -> bridge.std__shared_ptr_HybridQrCameraListSpec_ {
|
|
77
|
+
let cachedCxxPart = self.__cxxPart.lock()
|
|
78
|
+
if Bool(fromCxx: cachedCxxPart) {
|
|
79
|
+
return cachedCxxPart
|
|
80
|
+
} else {
|
|
81
|
+
let newCxxPart = bridge.create_std__shared_ptr_HybridQrCameraListSpec_(self.toUnsafe())
|
|
82
|
+
__cxxPart = bridge.weakify_std__shared_ptr_HybridQrCameraListSpec_(newCxxPart)
|
|
83
|
+
return newCxxPart
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Get the memory size of the Swift class (plus size of any other allocations)
|
|
91
|
+
* so the JS VM can properly track it and garbage-collect the JS object if needed.
|
|
92
|
+
*/
|
|
93
|
+
@inline(__always)
|
|
94
|
+
public var memorySize: Int {
|
|
95
|
+
return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Compares this object with the given [other] object for reference equality.
|
|
100
|
+
*/
|
|
101
|
+
@inline(__always)
|
|
102
|
+
public func equals(other: HybridQrCameraListSpec_cxx) -> Bool {
|
|
103
|
+
return self.__implementation === other.__implementation
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Call dispose() on the Swift class.
|
|
108
|
+
* This _may_ be called manually from JS.
|
|
109
|
+
*/
|
|
110
|
+
@inline(__always)
|
|
111
|
+
public func dispose() {
|
|
112
|
+
self.__implementation.dispose()
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Call toString() on the Swift class.
|
|
117
|
+
*/
|
|
118
|
+
@inline(__always)
|
|
119
|
+
public func toString() -> String {
|
|
120
|
+
return self.__implementation.toString()
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Properties
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
// Methods
|
|
127
|
+
@inline(__always)
|
|
128
|
+
public final func listCameras() -> bridge.Result_std__shared_ptr_Promise_std__vector_QrCameraInfo____ {
|
|
129
|
+
do {
|
|
130
|
+
let __result = try self.__implementation.listCameras()
|
|
131
|
+
let __resultCpp = { () -> bridge.std__shared_ptr_Promise_std__vector_QrCameraInfo___ in
|
|
132
|
+
let __promise = bridge.create_std__shared_ptr_Promise_std__vector_QrCameraInfo___()
|
|
133
|
+
let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_std__vector_QrCameraInfo___(__promise)
|
|
134
|
+
__result
|
|
135
|
+
.then({ __result in __promiseHolder.resolve({ () -> bridge.std__vector_QrCameraInfo_ in
|
|
136
|
+
var __vector = bridge.create_std__vector_QrCameraInfo_(__result.count)
|
|
137
|
+
for __item in __result {
|
|
138
|
+
__vector.push_back(__item)
|
|
139
|
+
}
|
|
140
|
+
return __vector
|
|
141
|
+
}()) })
|
|
142
|
+
.catch({ __error in __promiseHolder.reject(__error.toCpp()) })
|
|
143
|
+
return __promise
|
|
144
|
+
}()
|
|
145
|
+
return bridge.create_Result_std__shared_ptr_Promise_std__vector_QrCameraInfo____(__resultCpp)
|
|
146
|
+
} catch (let __error) {
|
|
147
|
+
let __exceptionPtr = __error.toCpp()
|
|
148
|
+
return bridge.create_Result_std__shared_ptr_Promise_std__vector_QrCameraInfo____(__exceptionPtr)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@inline(__always)
|
|
153
|
+
public final func setOnChange(listener: bridge.std__optional_std__function_void____) -> bridge.Result_void_ {
|
|
154
|
+
do {
|
|
155
|
+
try self.__implementation.setOnChange(listener: { () -> (() -> Void)? in
|
|
156
|
+
if bridge.has_value_std__optional_std__function_void____(listener) {
|
|
157
|
+
let __unwrapped = bridge.get_std__optional_std__function_void____(listener)
|
|
158
|
+
return { () -> () -> Void in
|
|
159
|
+
let __wrappedFunction = bridge.wrap_Func_void(__unwrapped)
|
|
160
|
+
return { () -> Void in
|
|
161
|
+
__wrappedFunction.call()
|
|
162
|
+
}
|
|
163
|
+
}()
|
|
164
|
+
} else {
|
|
165
|
+
return nil
|
|
166
|
+
}
|
|
167
|
+
}())
|
|
168
|
+
return bridge.create_Result_void_()
|
|
169
|
+
} catch (let __error) {
|
|
170
|
+
let __exceptionPtr = __error.toCpp()
|
|
171
|
+
return bridge.create_Result_void_(__exceptionPtr)
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
@@ -11,6 +11,7 @@ import NitroModules
|
|
|
11
11
|
public protocol HybridQrScannerSpec_protocol: HybridObject, HybridView {
|
|
12
12
|
// Properties
|
|
13
13
|
var active: Bool { get set }
|
|
14
|
+
var cameraId: String? { get set }
|
|
14
15
|
var onReady: ((_ generation: Double) -> Void)? { get set }
|
|
15
16
|
var onFrameText: ((_ text: String, _ generation: Double) -> Void)? { get set }
|
|
16
17
|
var onError: ((_ code: String, _ message: String, _ generation: Double) -> Void)? { get set }
|
|
@@ -132,6 +132,30 @@ open class HybridQrScannerSpec_cxx {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
public final var cameraId: bridge.std__optional_std__string_ {
|
|
136
|
+
@inline(__always)
|
|
137
|
+
get {
|
|
138
|
+
return { () -> bridge.std__optional_std__string_ in
|
|
139
|
+
if let __unwrappedValue = self.__implementation.cameraId {
|
|
140
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
141
|
+
} else {
|
|
142
|
+
return .init()
|
|
143
|
+
}
|
|
144
|
+
}()
|
|
145
|
+
}
|
|
146
|
+
@inline(__always)
|
|
147
|
+
set {
|
|
148
|
+
self.__implementation.cameraId = { () -> String? in
|
|
149
|
+
if bridge.has_value_std__optional_std__string_(newValue) {
|
|
150
|
+
let __unwrapped = bridge.get_std__optional_std__string_(newValue)
|
|
151
|
+
return String(__unwrapped)
|
|
152
|
+
} else {
|
|
153
|
+
return nil
|
|
154
|
+
}
|
|
155
|
+
}()
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
135
159
|
public final var onReady: bridge.std__optional_std__function_void_double____generation______ {
|
|
136
160
|
@inline(__always)
|
|
137
161
|
get {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// QrCameraInfo.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `QrCameraInfo`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias QrCameraInfo = margelo.nitro.qrscanner.QrCameraInfo
|
|
14
|
+
|
|
15
|
+
public extension QrCameraInfo {
|
|
16
|
+
private typealias bridge = margelo.nitro.qrscanner.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `QrCameraInfo`.
|
|
20
|
+
*/
|
|
21
|
+
init(id: String, position: QrCameraPosition, label: String) {
|
|
22
|
+
self.init(std.string(id), position, std.string(label))
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@inline(__always)
|
|
26
|
+
var id: String {
|
|
27
|
+
return String(self.__id)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@inline(__always)
|
|
31
|
+
var position: QrCameraPosition {
|
|
32
|
+
return self.__position
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@inline(__always)
|
|
36
|
+
var label: String {
|
|
37
|
+
return String(self.__label)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// QrCameraPosition.swift
|
|
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
|
+
/**
|
|
9
|
+
* Represents the JS union `QrCameraPosition`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias QrCameraPosition = margelo.nitro.qrscanner.QrCameraPosition
|
|
12
|
+
|
|
13
|
+
public extension QrCameraPosition {
|
|
14
|
+
/**
|
|
15
|
+
* Get a QrCameraPosition for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "back":
|
|
21
|
+
self = .back
|
|
22
|
+
case "front":
|
|
23
|
+
self = .front
|
|
24
|
+
case "external":
|
|
25
|
+
self = .external
|
|
26
|
+
default:
|
|
27
|
+
return nil
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get the String value this QrCameraPosition represents.
|
|
33
|
+
*/
|
|
34
|
+
var stringValue: String {
|
|
35
|
+
switch self {
|
|
36
|
+
case .back:
|
|
37
|
+
return "back"
|
|
38
|
+
case .front:
|
|
39
|
+
return "front"
|
|
40
|
+
case .external:
|
|
41
|
+
return "external"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridQrCameraListSpec.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 "HybridQrCameraListSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::qrscanner {
|
|
11
|
+
|
|
12
|
+
void HybridQrCameraListSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("listCameras", &HybridQrCameraListSpec::listCameras);
|
|
18
|
+
prototype.registerHybridMethod("setOnChange", &HybridQrCameraListSpec::setOnChange);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
} // namespace margelo::nitro::qrscanner
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridQrCameraListSpec.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
|
+
// Forward declaration of `QrCameraInfo` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::qrscanner { struct QrCameraInfo; }
|
|
18
|
+
|
|
19
|
+
#include "QrCameraInfo.hpp"
|
|
20
|
+
#include <vector>
|
|
21
|
+
#include <NitroModules/Promise.hpp>
|
|
22
|
+
#include <functional>
|
|
23
|
+
#include <optional>
|
|
24
|
+
|
|
25
|
+
namespace margelo::nitro::qrscanner {
|
|
26
|
+
|
|
27
|
+
using namespace margelo::nitro;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* An abstract base class for `QrCameraList`
|
|
31
|
+
* Inherit this class to create instances of `HybridQrCameraListSpec` in C++.
|
|
32
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
33
|
+
* @example
|
|
34
|
+
* ```cpp
|
|
35
|
+
* class HybridQrCameraList: public HybridQrCameraListSpec {
|
|
36
|
+
* public:
|
|
37
|
+
* HybridQrCameraList(...): HybridObject(TAG) { ... }
|
|
38
|
+
* // ...
|
|
39
|
+
* };
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
class HybridQrCameraListSpec: public virtual HybridObject {
|
|
43
|
+
public:
|
|
44
|
+
// Constructor
|
|
45
|
+
explicit HybridQrCameraListSpec(): HybridObject(TAG) { }
|
|
46
|
+
|
|
47
|
+
// Destructor
|
|
48
|
+
~HybridQrCameraListSpec() override = default;
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
// Properties
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
// Methods
|
|
56
|
+
virtual std::shared_ptr<Promise<std::vector<QrCameraInfo>>> listCameras() = 0;
|
|
57
|
+
virtual void setOnChange(const std::optional<std::function<void()>>& listener) = 0;
|
|
58
|
+
|
|
59
|
+
protected:
|
|
60
|
+
// Hybrid Setup
|
|
61
|
+
void loadHybridMethods() override;
|
|
62
|
+
|
|
63
|
+
protected:
|
|
64
|
+
// Tag for logging
|
|
65
|
+
static constexpr auto TAG = "QrCameraList";
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
} // namespace margelo::nitro::qrscanner
|
|
@@ -16,6 +16,8 @@ namespace margelo::nitro::qrscanner {
|
|
|
16
16
|
registerHybrids(this, [](Prototype& prototype) {
|
|
17
17
|
prototype.registerHybridGetter("active", &HybridQrScannerSpec::getActive);
|
|
18
18
|
prototype.registerHybridSetter("active", &HybridQrScannerSpec::setActive);
|
|
19
|
+
prototype.registerHybridGetter("cameraId", &HybridQrScannerSpec::getCameraId);
|
|
20
|
+
prototype.registerHybridSetter("cameraId", &HybridQrScannerSpec::setCameraId);
|
|
19
21
|
prototype.registerHybridGetter("onReady", &HybridQrScannerSpec::getOnReady);
|
|
20
22
|
prototype.registerHybridSetter("onReady", &HybridQrScannerSpec::setOnReady);
|
|
21
23
|
prototype.registerHybridGetter("onFrameText", &HybridQrScannerSpec::getOnFrameText);
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
#include <functional>
|
|
19
|
-
#include <optional>
|
|
20
18
|
#include <string>
|
|
19
|
+
#include <optional>
|
|
20
|
+
#include <functional>
|
|
21
21
|
|
|
22
22
|
namespace margelo::nitro::qrscanner {
|
|
23
23
|
|
|
@@ -48,6 +48,8 @@ namespace margelo::nitro::qrscanner {
|
|
|
48
48
|
// Properties
|
|
49
49
|
virtual bool getActive() = 0;
|
|
50
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;
|
|
51
53
|
virtual std::optional<std::function<void(double /* generation */)>> getOnReady() = 0;
|
|
52
54
|
virtual void setOnReady(const std::optional<std::function<void(double /* generation */)>>& onReady) = 0;
|
|
53
55
|
virtual std::optional<std::function<void(const std::string& /* text */, double /* generation */)>> getOnFrameText() = 0;
|
|
@@ -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
|
|
@@ -21,6 +21,7 @@ namespace margelo::nitro::qrscanner::views {
|
|
|
21
21
|
const react::RawProps& rawProps):
|
|
22
22
|
react::ViewProps(context, sourceProps, rawProps, filterObjectKeys),
|
|
23
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)),
|
|
24
25
|
onReady(nitro::ReactProp<std::optional<std::function<void(double /* generation */)>>>::fromRawValue("QrScanner", "onReady", rawProps, sourceProps.onReady)),
|
|
25
26
|
onFrameText(nitro::ReactProp<std::optional<std::function<void(const std::string& /* text */, double /* generation */)>>>::fromRawValue("QrScanner", "onFrameText", rawProps, sourceProps.onFrameText)),
|
|
26
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)),
|
|
@@ -29,6 +30,7 @@ namespace margelo::nitro::qrscanner::views {
|
|
|
29
30
|
bool HybridQrScannerProps::filterObjectKeys(const std::string& propName) {
|
|
30
31
|
switch (hashString(propName)) {
|
|
31
32
|
case hashString("active"): return true;
|
|
33
|
+
case hashString("cameraId"): return true;
|
|
32
34
|
case hashString("onReady"): return true;
|
|
33
35
|
case hashString("onFrameText"): return true;
|
|
34
36
|
case hashString("onError"): return true;
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
|
|
18
18
|
#include <string>
|
|
19
19
|
|
|
20
|
-
#include <functional>
|
|
21
|
-
#include <optional>
|
|
22
20
|
#include <string>
|
|
21
|
+
#include <optional>
|
|
22
|
+
#include <functional>
|
|
23
23
|
#include <memory>
|
|
24
24
|
#include "HybridQrScannerSpec.hpp"
|
|
25
25
|
|
|
@@ -44,6 +44,7 @@ namespace margelo::nitro::qrscanner::views {
|
|
|
44
44
|
|
|
45
45
|
public:
|
|
46
46
|
nitro::ReactProp<bool> active;
|
|
47
|
+
nitro::ReactProp<std::optional<std::string>> cameraId;
|
|
47
48
|
nitro::ReactProp<std::optional<std::function<void(double /* generation */)>>> onReady;
|
|
48
49
|
nitro::ReactProp<std::optional<std::function<void(const std::string& /* text */, double /* generation */)>>> onFrameText;
|
|
49
50
|
nitro::ReactProp<std::optional<std::function<void(const std::string& /* code */, const std::string& /* message */, double /* generation */)>>> onError;
|
|
@@ -52,6 +53,7 @@ namespace margelo::nitro::qrscanner::views {
|
|
|
52
53
|
[[nodiscard]]
|
|
53
54
|
bool hasSameProps(const HybridQrScannerProps& other) const noexcept {
|
|
54
55
|
return active.hasSameValue(other.active) &&
|
|
56
|
+
cameraId.hasSameValue(other.cameraId) &&
|
|
55
57
|
onReady.hasSameValue(other.onReady) &&
|
|
56
58
|
onFrameText.hasSameValue(other.onFrameText) &&
|
|
57
59
|
onError.hasSameValue(other.onError) &&
|
|
@@ -61,6 +63,7 @@ namespace margelo::nitro::qrscanner::views {
|
|
|
61
63
|
[[nodiscard]]
|
|
62
64
|
bool hasAnyProvidedProps() const noexcept {
|
|
63
65
|
return active.isProvided() ||
|
|
66
|
+
cameraId.isProvided() ||
|
|
64
67
|
onReady.isProvided() ||
|
|
65
68
|
onFrameText.isProvided() ||
|
|
66
69
|
onError.isProvided() ||
|