@onekeyfe/react-native-qr-scanner 6.8.0-31 → 6.8.0-32
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/build.gradle +1 -0
- package/android/src/main/java/com/margelo/nitro/qrscanner/QrCameraPermission.kt +164 -32
- package/android/src/main/java/com/margelo/nitro/qrscanner/QrScanner.kt +15 -11
- package/android/src/test/java/com/margelo/nitro/qrscanner/QrCameraPermissionTest.kt +211 -8
- package/ios/QrScanner.swift +5 -5
- package/lib/module/QrScanner.js +23 -17
- package/lib/module/QrScanner.js.map +1 -1
- package/lib/module/web/scanner.js +52 -15
- package/lib/module/web/scanner.js.map +1 -1
- package/lib/nitrogen/generated/android/c++/JFunc_void_double_std__string.hpp +76 -0
- package/lib/nitrogen/generated/android/c++/JHybridQrScannerSpec.cpp +10 -10
- package/lib/nitrogen/generated/android/c++/JHybridQrScannerSpec.hpp +2 -2
- package/{nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/Func_void_double.kt → lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/Func_void_double_std__string.kt} +14 -14
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/HybridQrScannerSpec.kt +3 -3
- package/lib/nitrogen/generated/android/qrscannerOnLoad.cpp +2 -2
- package/lib/nitrogen/generated/ios/QrScanner-Swift-Cxx-Bridge.cpp +5 -5
- package/lib/nitrogen/generated/ios/QrScanner-Swift-Cxx-Bridge.hpp +19 -19
- package/lib/nitrogen/generated/ios/c++/HybridQrScannerSpecSwift.hpp +2 -2
- package/lib/nitrogen/generated/ios/swift/{Func_void_double.swift → Func_void_double_std__string.swift} +11 -11
- package/lib/nitrogen/generated/ios/swift/HybridQrScannerSpec.swift +1 -1
- package/lib/nitrogen/generated/ios/swift/HybridQrScannerSpec_cxx.swift +12 -12
- package/lib/nitrogen/generated/shared/c++/HybridQrScannerSpec.hpp +2 -2
- package/lib/nitrogen/generated/shared/c++/views/HybridQrScannerComponent.cpp +1 -1
- package/lib/nitrogen/generated/shared/c++/views/HybridQrScannerComponent.hpp +1 -1
- package/lib/typescript/src/QrScanner.d.ts +1 -1
- package/lib/typescript/src/QrScanner.d.ts.map +1 -1
- package/lib/typescript/src/QrScanner.nitro.d.ts +2 -2
- package/lib/typescript/src/QrScanner.nitro.d.ts.map +1 -1
- package/lib/typescript/src/web/scanner.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_double_std__string.hpp +76 -0
- package/nitrogen/generated/android/c++/JHybridQrScannerSpec.cpp +10 -10
- package/nitrogen/generated/android/c++/JHybridQrScannerSpec.hpp +2 -2
- package/{lib/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/Func_void_double.kt → nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/Func_void_double_std__string.kt} +14 -14
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/HybridQrScannerSpec.kt +3 -3
- package/nitrogen/generated/android/qrscannerOnLoad.cpp +2 -2
- package/nitrogen/generated/ios/QrScanner-Swift-Cxx-Bridge.cpp +5 -5
- package/nitrogen/generated/ios/QrScanner-Swift-Cxx-Bridge.hpp +19 -19
- package/nitrogen/generated/ios/c++/HybridQrScannerSpecSwift.hpp +2 -2
- package/nitrogen/generated/ios/swift/{Func_void_double.swift → Func_void_double_std__string.swift} +11 -11
- package/nitrogen/generated/ios/swift/HybridQrScannerSpec.swift +1 -1
- package/nitrogen/generated/ios/swift/HybridQrScannerSpec_cxx.swift +12 -12
- package/nitrogen/generated/shared/c++/HybridQrScannerSpec.hpp +2 -2
- package/nitrogen/generated/shared/c++/views/HybridQrScannerComponent.cpp +1 -1
- package/nitrogen/generated/shared/c++/views/HybridQrScannerComponent.hpp +1 -1
- package/package.json +1 -1
- package/src/QrScanner.nitro.ts +2 -2
- package/src/QrScanner.tsx +32 -19
- package/src/web/scanner.ts +52 -16
- package/lib/nitrogen/generated/android/c++/JFunc_void_double.hpp +0 -75
- package/nitrogen/generated/android/c++/JFunc_void_double.hpp +0 -75
|
@@ -77,11 +77,11 @@ namespace margelo::nitro::qrscanner {
|
|
|
77
77
|
inline void setCameraId(const std::optional<std::string>& cameraId) noexcept override {
|
|
78
78
|
_swiftPart.setCameraId(cameraId);
|
|
79
79
|
}
|
|
80
|
-
inline std::optional<std::function<void(double /* generation */)>> getOnReady() noexcept override {
|
|
80
|
+
inline std::optional<std::function<void(double /* generation */, const std::string& /* cameraId */)>> getOnReady() noexcept override {
|
|
81
81
|
auto __result = _swiftPart.getOnReady();
|
|
82
82
|
return __result;
|
|
83
83
|
}
|
|
84
|
-
inline void setOnReady(const std::optional<std::function<void(double /* generation */)>>& onReady) noexcept override {
|
|
84
|
+
inline void setOnReady(const std::optional<std::function<void(double /* generation */, const std::string& /* cameraId */)>>& onReady) noexcept override {
|
|
85
85
|
_swiftPart.setOnReady(onReady);
|
|
86
86
|
}
|
|
87
87
|
inline std::optional<std::function<void(const std::string& /* text */, double /* generation */)>> getOnFrameText() noexcept override {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// Func_void_double_std__string.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © Marc Rousavy @ Margelo
|
|
@@ -8,21 +8,21 @@
|
|
|
8
8
|
import NitroModules
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Wraps a Swift `(_ generation: Double) -> Void` as a class.
|
|
11
|
+
* Wraps a Swift `(_ generation: Double, _ cameraId: String) -> Void` as a class.
|
|
12
12
|
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
13
|
*/
|
|
14
|
-
public final class
|
|
14
|
+
public final class Func_void_double_std__string {
|
|
15
15
|
public typealias bridge = margelo.nitro.qrscanner.bridge.swift
|
|
16
16
|
|
|
17
|
-
private let closure: (_ generation: Double) -> Void
|
|
17
|
+
private let closure: (_ generation: Double, _ cameraId: String) -> Void
|
|
18
18
|
|
|
19
|
-
public init(_ closure: @escaping (_ generation: Double) -> Void) {
|
|
19
|
+
public init(_ closure: @escaping (_ generation: Double, _ cameraId: String) -> Void) {
|
|
20
20
|
self.closure = closure
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
@inline(__always)
|
|
24
|
-
public func call(generation: Double) -> Void {
|
|
25
|
-
self.closure(generation)
|
|
24
|
+
public func call(generation: Double, cameraId: std.string) -> Void {
|
|
25
|
+
self.closure(generation, String(cameraId))
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -35,12 +35,12 @@ public final class Func_void_double {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
* Casts an unsafe pointer to a `
|
|
39
|
-
* The pointer has to be a retained opaque `Unmanaged<
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_double_std__string`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_double_std__string>`.
|
|
40
40
|
* This removes one strong reference from the object!
|
|
41
41
|
*/
|
|
42
42
|
@inline(__always)
|
|
43
|
-
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) ->
|
|
44
|
-
return Unmanaged<
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_double_std__string {
|
|
44
|
+
return Unmanaged<Func_void_double_std__string>.fromOpaque(pointer).takeRetainedValue()
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -12,7 +12,7 @@ public protocol HybridQrScannerSpec_protocol: HybridObject, HybridView {
|
|
|
12
12
|
// Properties
|
|
13
13
|
var active: Bool { get set }
|
|
14
14
|
var cameraId: String? { get set }
|
|
15
|
-
var onReady: ((_ generation: Double) -> Void)? { get set }
|
|
15
|
+
var onReady: ((_ generation: Double, _ cameraId: String) -> Void)? { get set }
|
|
16
16
|
var onFrameText: ((_ text: String, _ generation: Double) -> Void)? { get set }
|
|
17
17
|
var onError: ((_ code: String, _ message: String, _ generation: Double) -> Void)? { get set }
|
|
18
18
|
|
|
@@ -156,14 +156,14 @@ open class HybridQrScannerSpec_cxx {
|
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
public final var onReady: bridge.
|
|
159
|
+
public final var onReady: bridge.std__optional_std__function_void_double____generation_____const_std__string_____cameraId______ {
|
|
160
160
|
@inline(__always)
|
|
161
161
|
get {
|
|
162
|
-
return { () -> bridge.
|
|
162
|
+
return { () -> bridge.std__optional_std__function_void_double____generation_____const_std__string_____cameraId______ in
|
|
163
163
|
if let __unwrappedValue = self.__implementation.onReady {
|
|
164
|
-
return bridge.
|
|
165
|
-
let __closureWrapper =
|
|
166
|
-
return bridge.
|
|
164
|
+
return bridge.create_std__optional_std__function_void_double____generation_____const_std__string_____cameraId______({ () -> bridge.Func_void_double_std__string in
|
|
165
|
+
let __closureWrapper = Func_void_double_std__string(__unwrappedValue)
|
|
166
|
+
return bridge.create_Func_void_double_std__string(__closureWrapper.toUnsafe())
|
|
167
167
|
}())
|
|
168
168
|
} else {
|
|
169
169
|
return .init()
|
|
@@ -172,13 +172,13 @@ open class HybridQrScannerSpec_cxx {
|
|
|
172
172
|
}
|
|
173
173
|
@inline(__always)
|
|
174
174
|
set {
|
|
175
|
-
self.__implementation.onReady = { () -> ((_ generation: Double) -> Void)? in
|
|
176
|
-
if bridge.
|
|
177
|
-
let __unwrapped = bridge.
|
|
178
|
-
return { () -> (Double) -> Void in
|
|
179
|
-
let __wrappedFunction = bridge.
|
|
180
|
-
return { (__generation: Double) -> Void in
|
|
181
|
-
__wrappedFunction.call(__generation)
|
|
175
|
+
self.__implementation.onReady = { () -> ((_ generation: Double, _ cameraId: String) -> Void)? in
|
|
176
|
+
if bridge.has_value_std__optional_std__function_void_double____generation_____const_std__string_____cameraId______(newValue) {
|
|
177
|
+
let __unwrapped = bridge.get_std__optional_std__function_void_double____generation_____const_std__string_____cameraId______(newValue)
|
|
178
|
+
return { () -> (Double, String) -> Void in
|
|
179
|
+
let __wrappedFunction = bridge.wrap_Func_void_double_std__string(__unwrapped)
|
|
180
|
+
return { (__generation: Double, __cameraId: String) -> Void in
|
|
181
|
+
__wrappedFunction.call(__generation, std.string(__cameraId))
|
|
182
182
|
}
|
|
183
183
|
}()
|
|
184
184
|
} else {
|
|
@@ -50,8 +50,8 @@ namespace margelo::nitro::qrscanner {
|
|
|
50
50
|
virtual void setActive(bool active) = 0;
|
|
51
51
|
virtual std::optional<std::string> getCameraId() = 0;
|
|
52
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;
|
|
53
|
+
virtual std::optional<std::function<void(double /* generation */, const std::string& /* cameraId */)>> getOnReady() = 0;
|
|
54
|
+
virtual void setOnReady(const std::optional<std::function<void(double /* generation */, const std::string& /* cameraId */)>>& onReady) = 0;
|
|
55
55
|
virtual std::optional<std::function<void(const std::string& /* text */, double /* generation */)>> getOnFrameText() = 0;
|
|
56
56
|
virtual void setOnFrameText(const std::optional<std::function<void(const std::string& /* text */, double /* generation */)>>& onFrameText) = 0;
|
|
57
57
|
virtual std::optional<std::function<void(const std::string& /* code */, const std::string& /* message */, double /* generation */)>> getOnError() = 0;
|
|
@@ -22,7 +22,7 @@ namespace margelo::nitro::qrscanner::views {
|
|
|
22
22
|
react::ViewProps(context, sourceProps, rawProps, filterObjectKeys),
|
|
23
23
|
active(nitro::ReactProp<bool>::fromRawValue("QrScanner", "active", rawProps, sourceProps.active)),
|
|
24
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)),
|
|
25
|
+
onReady(nitro::ReactProp<std::optional<std::function<void(double /* generation */, const std::string& /* cameraId */)>>>::fromRawValue("QrScanner", "onReady", rawProps, sourceProps.onReady)),
|
|
26
26
|
onFrameText(nitro::ReactProp<std::optional<std::function<void(const std::string& /* text */, double /* generation */)>>>::fromRawValue("QrScanner", "onFrameText", rawProps, sourceProps.onFrameText)),
|
|
27
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
28
|
hybridRef(nitro::ReactProp<std::optional<std::function<void(const std::shared_ptr<HybridQrScannerSpec>& /* ref */)>>>::fromRawValue("QrScanner", "hybridRef", rawProps, sourceProps.hybridRef)) { }
|
|
@@ -45,7 +45,7 @@ namespace margelo::nitro::qrscanner::views {
|
|
|
45
45
|
public:
|
|
46
46
|
nitro::ReactProp<bool> active;
|
|
47
47
|
nitro::ReactProp<std::optional<std::string>> cameraId;
|
|
48
|
-
nitro::ReactProp<std::optional<std::function<void(double /* generation */)>>> onReady;
|
|
48
|
+
nitro::ReactProp<std::optional<std::function<void(double /* generation */, const std::string& /* cameraId */)>>> onReady;
|
|
49
49
|
nitro::ReactProp<std::optional<std::function<void(const std::string& /* text */, double /* generation */)>>> onFrameText;
|
|
50
50
|
nitro::ReactProp<std::optional<std::function<void(const std::string& /* code */, const std::string& /* message */, double /* generation */)>>> onError;
|
|
51
51
|
nitro::ReactProp<std::optional<std::function<void(const std::shared_ptr<HybridQrScannerSpec>& /* ref */)>>> hybridRef;
|
|
@@ -20,7 +20,7 @@ export interface QrScannerComponentProps {
|
|
|
20
20
|
*/
|
|
21
21
|
sessionKey?: string | number;
|
|
22
22
|
style?: StyleProp<ViewStyle>;
|
|
23
|
-
onReady?: () => void;
|
|
23
|
+
onReady?: (cameraId: string) => void;
|
|
24
24
|
/** UR assembly progress, 0..1 (below 1 until complete). */
|
|
25
25
|
onProgress?: (progress: number) => void;
|
|
26
26
|
/** Fired once per session. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QrScanner.d.ts","sourceRoot":"","sources":["../../../src/QrScanner.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAwB,MAAM,UAAU,CAAC;AAGhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAKzD,eAAO,MAAM,aAAa,wFAGzB,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACtC,uBAAuB;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"QrScanner.d.ts","sourceRoot":"","sources":["../../../src/QrScanner.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAwB,MAAM,UAAU,CAAC;AAGhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAKzD,eAAO,MAAM,aAAa,wFAGzB,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACtC,uBAAuB;IACvB,MAAM,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,2DAA2D;IAC3D,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACxC,gEAAgE;IAChE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,KAAK,IAAI,CAAC;CACvD;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EACxB,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,cAAc,EACd,MAAM,EACN,UAAU,EACV,KAAK,EACL,OAAO,EACP,UAAU,EACV,QAAQ,EACR,OAAO,GACR,EAAE,uBAAuB,+BAgFzB"}
|
|
@@ -16,8 +16,8 @@ export interface QrScannerProps extends HybridViewProps {
|
|
|
16
16
|
* switches cameras in a new capture generation.
|
|
17
17
|
*/
|
|
18
18
|
cameraId?: string;
|
|
19
|
-
/** The
|
|
20
|
-
onReady?: (generation: number) => void;
|
|
19
|
+
/** The capture is ready. The ID identifies the device actually opened. */
|
|
20
|
+
onReady?: (generation: number, cameraId: string) => void;
|
|
21
21
|
/**
|
|
22
22
|
* Text of each QR symbol seen. Repeats of the same text within one
|
|
23
23
|
* generation may be suppressed natively; JS dedupes anyway.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QrScanner.nitro.d.ts","sourceRoot":"","sources":["../../../src/QrScanner.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAEpC;;;;GAIG;AACH,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD;;;OAGG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,
|
|
1
|
+
{"version":3,"file":"QrScanner.nitro.d.ts","sourceRoot":"","sources":["../../../src/QrScanner.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,eAAe,EAChB,MAAM,4BAA4B,CAAC;AAEpC;;;;GAIG;AACH,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD;;;OAGG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;CACvE;AAED,MAAM,WAAW,gBAAiB,SAAQ,iBAAiB;CAAG;AAE9D,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../../../../src/web/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAM3C,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGvE,MAAM,MAAM,aAAa;AACvB,2DAA2D;AACzD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE;AACvC,2EAA2E;GACzE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAExB,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,gBAAgB,CAAC;IACxB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,IAAI,EAAE,QAAQ,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,mEAAmE;IACnE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kGAAkG;IAClG,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACxC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,KAAK,IAAI,CAAC;CACvD;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB;;;;;OAKG;IACH,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,4EAA4E;IAC5E,IAAI,IAAI,IAAI,CAAC;IACb,2DAA2D;IAC3D,YAAY,IAAI,IAAI,CAAC;IACrB,OAAO,IAAI,IAAI,CAAC;CACjB;AAqBD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../../../../src/web/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAM3C,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGvE,MAAM,MAAM,aAAa;AACvB,2DAA2D;AACzD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE;AACvC,2EAA2E;GACzE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAExB,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,gBAAgB,CAAC;IACxB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,IAAI,EAAE,QAAQ,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC3B,mEAAmE;IACnE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kGAAkG;IAClG,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACxC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,GAAG,SAAS,KAAK,IAAI,CAAC;CACvD;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB;;;;;OAKG;IACH,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,4EAA4E;IAC5E,IAAI,IAAI,IAAI,CAAC;IACb,2DAA2D;IAC3D,YAAY,IAAI,IAAI,CAAC;IACrB,OAAO,IAAI,IAAI,CAAC;CACjB;AAqBD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CAgY7E"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_double_std__string.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
#include <functional>
|
|
15
|
+
#include <NitroModules/JNICallable.hpp>
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::qrscanner {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Represents the Java/Kotlin callback `(generation: Double, cameraId: String) -> Unit`.
|
|
23
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
24
|
+
*/
|
|
25
|
+
struct JFunc_void_double_std__string: public jni::JavaClass<JFunc_void_double_std__string> {
|
|
26
|
+
public:
|
|
27
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/qrscanner/Func_void_double_std__string;";
|
|
28
|
+
|
|
29
|
+
public:
|
|
30
|
+
/**
|
|
31
|
+
* Invokes the function this `JFunc_void_double_std__string` instance holds through JNI.
|
|
32
|
+
*/
|
|
33
|
+
void invoke(double generation, const std::string& cameraId) const {
|
|
34
|
+
static const auto method = javaClassStatic()->getMethod<void(double /* generation */, jni::alias_ref<jni::JString> /* cameraId */)>("invoke");
|
|
35
|
+
method(self(), generation, jni::make_jstring(cameraId));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* An implementation of Func_void_double_std__string that is backed by a C++ implementation (using `std::function<...>`)
|
|
41
|
+
*/
|
|
42
|
+
class JFunc_void_double_std__string_cxx final: public jni::HybridClass<JFunc_void_double_std__string_cxx, JFunc_void_double_std__string> {
|
|
43
|
+
public:
|
|
44
|
+
static jni::local_ref<JFunc_void_double_std__string::javaobject> fromCpp(const std::function<void(double /* generation */, const std::string& /* cameraId */)>& func) {
|
|
45
|
+
return JFunc_void_double_std__string_cxx::newObjectCxxArgs(func);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
/**
|
|
50
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_double_std__string_cxx` instance holds.
|
|
51
|
+
*/
|
|
52
|
+
void invoke_cxx(double generation, jni::alias_ref<jni::JString> cameraId) {
|
|
53
|
+
_func(generation, cameraId->toStdString());
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
[[nodiscard]]
|
|
58
|
+
inline const std::function<void(double /* generation */, const std::string& /* cameraId */)>& getFunction() const {
|
|
59
|
+
return _func;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public:
|
|
63
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/qrscanner/Func_void_double_std__string_cxx;";
|
|
64
|
+
static void registerNatives() {
|
|
65
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_double_std__string_cxx::invoke_cxx)});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private:
|
|
69
|
+
explicit JFunc_void_double_std__string_cxx(const std::function<void(double /* generation */, const std::string& /* cameraId */)>& func): _func(func) { }
|
|
70
|
+
|
|
71
|
+
private:
|
|
72
|
+
friend HybridBase;
|
|
73
|
+
std::function<void(double /* generation */, const std::string& /* cameraId */)> _func;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace margelo::nitro::qrscanner
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#include <string>
|
|
13
13
|
#include <optional>
|
|
14
14
|
#include <functional>
|
|
15
|
-
#include "
|
|
15
|
+
#include "JFunc_void_double_std__string.hpp"
|
|
16
16
|
#include <NitroModules/JNICallable.hpp>
|
|
17
17
|
#include "JFunc_void_std__string_double.hpp"
|
|
18
18
|
#include "JFunc_void_std__string_std__string_double.hpp"
|
|
@@ -65,22 +65,22 @@ namespace margelo::nitro::qrscanner {
|
|
|
65
65
|
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* cameraId */)>("setCameraId");
|
|
66
66
|
method(_javaPart, cameraId.has_value() ? jni::make_jstring(cameraId.value()) : nullptr);
|
|
67
67
|
}
|
|
68
|
-
std::optional<std::function<void(double /* generation */)>> JHybridQrScannerSpec::getOnReady() {
|
|
69
|
-
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<
|
|
68
|
+
std::optional<std::function<void(double /* generation */, const std::string& /* cameraId */)>> JHybridQrScannerSpec::getOnReady() {
|
|
69
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JFunc_void_double_std__string::javaobject>()>("getOnReady_cxx");
|
|
70
70
|
auto __result = method(_javaPart);
|
|
71
|
-
return __result != nullptr ? std::make_optional([&]() -> std::function<void(double /* generation */)> {
|
|
72
|
-
if (__result->isInstanceOf(
|
|
73
|
-
auto downcast = jni::static_ref_cast<
|
|
71
|
+
return __result != nullptr ? std::make_optional([&]() -> std::function<void(double /* generation */, const std::string& /* cameraId */)> {
|
|
72
|
+
if (__result->isInstanceOf(JFunc_void_double_std__string_cxx::javaClassStatic())) [[likely]] {
|
|
73
|
+
auto downcast = jni::static_ref_cast<JFunc_void_double_std__string_cxx::javaobject>(__result);
|
|
74
74
|
return downcast->cthis()->getFunction();
|
|
75
75
|
} else {
|
|
76
76
|
auto __resultRef = jni::make_global(__result);
|
|
77
|
-
return JNICallable<
|
|
77
|
+
return JNICallable<JFunc_void_double_std__string, void(double, std::string)>(std::move(__resultRef));
|
|
78
78
|
}
|
|
79
79
|
}()) : std::nullopt;
|
|
80
80
|
}
|
|
81
|
-
void JHybridQrScannerSpec::setOnReady(const std::optional<std::function<void(double /* generation */)>>& onReady) {
|
|
82
|
-
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<
|
|
83
|
-
method(_javaPart, onReady.has_value() ?
|
|
81
|
+
void JHybridQrScannerSpec::setOnReady(const std::optional<std::function<void(double /* generation */, const std::string& /* cameraId */)>>& onReady) {
|
|
82
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_double_std__string::javaobject> /* onReady */)>("setOnReady_cxx");
|
|
83
|
+
method(_javaPart, onReady.has_value() ? JFunc_void_double_std__string_cxx::fromCpp(onReady.value()) : nullptr);
|
|
84
84
|
}
|
|
85
85
|
std::optional<std::function<void(const std::string& /* text */, double /* generation */)>> JHybridQrScannerSpec::getOnFrameText() {
|
|
86
86
|
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JFunc_void_std__string_double::javaobject>()>("getOnFrameText_cxx");
|
|
@@ -54,8 +54,8 @@ namespace margelo::nitro::qrscanner {
|
|
|
54
54
|
void setActive(bool active) override;
|
|
55
55
|
std::optional<std::string> getCameraId() override;
|
|
56
56
|
void setCameraId(const std::optional<std::string>& cameraId) override;
|
|
57
|
-
std::optional<std::function<void(double /* generation */)>> getOnReady() override;
|
|
58
|
-
void setOnReady(const std::optional<std::function<void(double /* generation */)>>& onReady) override;
|
|
57
|
+
std::optional<std::function<void(double /* generation */, const std::string& /* cameraId */)>> getOnReady() override;
|
|
58
|
+
void setOnReady(const std::optional<std::function<void(double /* generation */, const std::string& /* cameraId */)>>& onReady) override;
|
|
59
59
|
std::optional<std::function<void(const std::string& /* text */, double /* generation */)>> getOnFrameText() override;
|
|
60
60
|
void setOnFrameText(const std::optional<std::function<void(const std::string& /* text */, double /* generation */)>>& onFrameText) override;
|
|
61
61
|
std::optional<std::function<void(const std::string& /* code */, const std::string& /* message */, double /* generation */)>> getOnError() override;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// Func_void_double_std__string.kt
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © Marc Rousavy @ Margelo
|
|
@@ -13,25 +13,25 @@ import com.facebook.proguard.annotations.DoNotStrip
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* Represents the JavaScript callback `(generation: number) => void`.
|
|
16
|
+
* Represents the JavaScript callback `(generation: number, cameraId: string) => void`.
|
|
17
17
|
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
18
18
|
* or in Kotlin/Java (in which case it is a native callback).
|
|
19
19
|
*/
|
|
20
20
|
@DoNotStrip
|
|
21
21
|
@Keep
|
|
22
22
|
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
23
|
-
fun interface
|
|
23
|
+
fun interface Func_void_double_std__string: (Double, String) -> Unit {
|
|
24
24
|
/**
|
|
25
25
|
* Call the given JS callback.
|
|
26
26
|
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
27
27
|
*/
|
|
28
28
|
@DoNotStrip
|
|
29
29
|
@Keep
|
|
30
|
-
override fun invoke(generation: Double): Unit
|
|
30
|
+
override fun invoke(generation: Double, cameraId: String): Unit
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
* Represents the JavaScript callback `(generation: number) => void`.
|
|
34
|
+
* Represents the JavaScript callback `(generation: number, cameraId: string) => void`.
|
|
35
35
|
* This is implemented in C++, via a `std::function<...>`.
|
|
36
36
|
* The callback might be coming from JS.
|
|
37
37
|
*/
|
|
@@ -42,7 +42,7 @@ fun interface Func_void_double: (Double) -> Unit {
|
|
|
42
42
|
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
43
43
|
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
44
44
|
)
|
|
45
|
-
class
|
|
45
|
+
class Func_void_double_std__string_cxx: Func_void_double_std__string {
|
|
46
46
|
@DoNotStrip
|
|
47
47
|
@Keep
|
|
48
48
|
private val mHybridData: HybridData
|
|
@@ -55,24 +55,24 @@ class Func_void_double_cxx: Func_void_double {
|
|
|
55
55
|
|
|
56
56
|
@DoNotStrip
|
|
57
57
|
@Keep
|
|
58
|
-
override fun invoke(generation: Double): Unit
|
|
59
|
-
= invoke_cxx(generation)
|
|
58
|
+
override fun invoke(generation: Double, cameraId: String): Unit
|
|
59
|
+
= invoke_cxx(generation,cameraId)
|
|
60
60
|
|
|
61
|
-
private external fun invoke_cxx(generation: Double): Unit
|
|
61
|
+
private external fun invoke_cxx(generation: Double, cameraId: String): Unit
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
|
-
* Represents the JavaScript callback `(generation: number) => void`.
|
|
66
|
-
* This is implemented in Java/Kotlin, via a `(Double) -> Unit`.
|
|
65
|
+
* Represents the JavaScript callback `(generation: number, cameraId: string) => void`.
|
|
66
|
+
* This is implemented in Java/Kotlin, via a `(Double, String) -> Unit`.
|
|
67
67
|
* The callback is always coming from native.
|
|
68
68
|
*/
|
|
69
69
|
@DoNotStrip
|
|
70
70
|
@Keep
|
|
71
71
|
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
72
|
-
class
|
|
72
|
+
class Func_void_double_std__string_java(private val function: (Double, String) -> Unit): Func_void_double_std__string {
|
|
73
73
|
@DoNotStrip
|
|
74
74
|
@Keep
|
|
75
|
-
override fun invoke(generation: Double): Unit {
|
|
76
|
-
return this.function(generation)
|
|
75
|
+
override fun invoke(generation: Double, cameraId: String): Unit {
|
|
76
|
+
return this.function(generation, cameraId)
|
|
77
77
|
}
|
|
78
78
|
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/qrscanner/HybridQrScannerSpec.kt
CHANGED
|
@@ -39,13 +39,13 @@ abstract class HybridQrScannerSpec: HybridView() {
|
|
|
39
39
|
@set:Keep
|
|
40
40
|
abstract var cameraId: String?
|
|
41
41
|
|
|
42
|
-
abstract var onReady: ((generation: Double) -> Unit)?
|
|
42
|
+
abstract var onReady: ((generation: Double, cameraId: String) -> Unit)?
|
|
43
43
|
|
|
44
|
-
private var onReady_cxx:
|
|
44
|
+
private var onReady_cxx: Func_void_double_std__string?
|
|
45
45
|
@Keep
|
|
46
46
|
@DoNotStrip
|
|
47
47
|
get() {
|
|
48
|
-
return onReady?.let {
|
|
48
|
+
return onReady?.let { Func_void_double_std__string_java(it) }
|
|
49
49
|
}
|
|
50
50
|
@Keep
|
|
51
51
|
@DoNotStrip
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
#include "JFunc_void.hpp"
|
|
20
20
|
#include "JHybridQrImageDecoderSpec.hpp"
|
|
21
21
|
#include "JHybridQrScannerSpec.hpp"
|
|
22
|
-
#include "
|
|
22
|
+
#include "JFunc_void_double_std__string.hpp"
|
|
23
23
|
#include "JFunc_void_std__string_double.hpp"
|
|
24
24
|
#include "JFunc_void_std__string_std__string_double.hpp"
|
|
25
25
|
#include "views/JHybridQrScannerStateUpdater.hpp"
|
|
@@ -67,7 +67,7 @@ void registerAllNatives() {
|
|
|
67
67
|
margelo::nitro::qrscanner::JFunc_void_cxx::registerNatives();
|
|
68
68
|
margelo::nitro::qrscanner::JHybridQrImageDecoderSpec::CxxPart::registerNatives();
|
|
69
69
|
margelo::nitro::qrscanner::JHybridQrScannerSpec::CxxPart::registerNatives();
|
|
70
|
-
margelo::nitro::qrscanner::
|
|
70
|
+
margelo::nitro::qrscanner::JFunc_void_double_std__string_cxx::registerNatives();
|
|
71
71
|
margelo::nitro::qrscanner::JFunc_void_std__string_double_cxx::registerNatives();
|
|
72
72
|
margelo::nitro::qrscanner::JFunc_void_std__string_std__string_double_cxx::registerNatives();
|
|
73
73
|
margelo::nitro::qrscanner::views::JHybridQrScannerStateUpdater::registerNatives();
|
|
@@ -80,11 +80,11 @@ namespace margelo::nitro::qrscanner::bridge::swift {
|
|
|
80
80
|
return swiftPart.toUnsafe();
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
// pragma MARK: std::function<void(double /* generation */)>
|
|
84
|
-
|
|
85
|
-
auto swiftClosure = QrScanner::
|
|
86
|
-
return [swiftClosure = std::move(swiftClosure)](double generation) mutable -> void {
|
|
87
|
-
swiftClosure.call(generation);
|
|
83
|
+
// pragma MARK: std::function<void(double /* generation */, const std::string& /* cameraId */)>
|
|
84
|
+
Func_void_double_std__string create_Func_void_double_std__string(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
85
|
+
auto swiftClosure = QrScanner::Func_void_double_std__string::fromUnsafe(swiftClosureWrapper);
|
|
86
|
+
return [swiftClosure = std::move(swiftClosure)](double generation, const std::string& cameraId) mutable -> void {
|
|
87
|
+
swiftClosure.call(generation, cameraId);
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -292,40 +292,40 @@ namespace margelo::nitro::qrscanner::bridge::swift {
|
|
|
292
292
|
return Result<std::shared_ptr<Promise<QrImageDecodeResult>>>::withError(error);
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
-
// pragma MARK: std::function<void(double /* generation */)>
|
|
295
|
+
// pragma MARK: std::function<void(double /* generation */, const std::string& /* cameraId */)>
|
|
296
296
|
/**
|
|
297
|
-
* Specialized version of `std::function<void(double)>`.
|
|
297
|
+
* Specialized version of `std::function<void(double, const std::string&)>`.
|
|
298
298
|
*/
|
|
299
|
-
using
|
|
299
|
+
using Func_void_double_std__string = std::function<void(double /* generation */, const std::string& /* cameraId */)>;
|
|
300
300
|
/**
|
|
301
|
-
* Wrapper class for a `std::function<void(double / * generation * /)>`, this can be used from Swift.
|
|
301
|
+
* Wrapper class for a `std::function<void(double / * generation * /, const std::string& / * cameraId * /)>`, this can be used from Swift.
|
|
302
302
|
*/
|
|
303
|
-
class
|
|
303
|
+
class Func_void_double_std__string_Wrapper final {
|
|
304
304
|
public:
|
|
305
|
-
explicit
|
|
306
|
-
inline void call(double generation) const noexcept {
|
|
307
|
-
_function->operator()(generation);
|
|
305
|
+
explicit Func_void_double_std__string_Wrapper(std::function<void(double /* generation */, const std::string& /* cameraId */)>&& func): _function(std::make_unique<std::function<void(double /* generation */, const std::string& /* cameraId */)>>(std::move(func))) {}
|
|
306
|
+
inline void call(double generation, std::string cameraId) const noexcept {
|
|
307
|
+
_function->operator()(generation, cameraId);
|
|
308
308
|
}
|
|
309
309
|
private:
|
|
310
|
-
std::unique_ptr<std::function<void(double /* generation */)>> _function;
|
|
310
|
+
std::unique_ptr<std::function<void(double /* generation */, const std::string& /* cameraId */)>> _function;
|
|
311
311
|
} SWIFT_NONCOPYABLE;
|
|
312
|
-
|
|
313
|
-
inline
|
|
314
|
-
return
|
|
312
|
+
Func_void_double_std__string create_Func_void_double_std__string(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
313
|
+
inline Func_void_double_std__string_Wrapper wrap_Func_void_double_std__string(Func_void_double_std__string value) noexcept {
|
|
314
|
+
return Func_void_double_std__string_Wrapper(std::move(value));
|
|
315
315
|
}
|
|
316
316
|
|
|
317
|
-
// pragma MARK: std::optional<std::function<void(double /* generation */)>>
|
|
317
|
+
// pragma MARK: std::optional<std::function<void(double /* generation */, const std::string& /* cameraId */)>>
|
|
318
318
|
/**
|
|
319
|
-
* Specialized version of `std::optional<std::function<void(double / * generation * /)>>`.
|
|
319
|
+
* Specialized version of `std::optional<std::function<void(double / * generation * /, const std::string& / * cameraId * /)>>`.
|
|
320
320
|
*/
|
|
321
|
-
using
|
|
322
|
-
inline std::optional<std::function<void(double /* generation */)>>
|
|
323
|
-
return std::optional<std::function<void(double /* generation */)>>(value);
|
|
321
|
+
using std__optional_std__function_void_double____generation_____const_std__string_____cameraId______ = std::optional<std::function<void(double /* generation */, const std::string& /* cameraId */)>>;
|
|
322
|
+
inline std::optional<std::function<void(double /* generation */, const std::string& /* cameraId */)>> create_std__optional_std__function_void_double____generation_____const_std__string_____cameraId______(const std::function<void(double /* generation */, const std::string& /* cameraId */)>& value) noexcept {
|
|
323
|
+
return std::optional<std::function<void(double /* generation */, const std::string& /* cameraId */)>>(value);
|
|
324
324
|
}
|
|
325
|
-
inline bool
|
|
325
|
+
inline bool has_value_std__optional_std__function_void_double____generation_____const_std__string_____cameraId______(const std::optional<std::function<void(double /* generation */, const std::string& /* cameraId */)>>& optional) noexcept {
|
|
326
326
|
return optional.has_value();
|
|
327
327
|
}
|
|
328
|
-
inline std::function<void(double /* generation */)>
|
|
328
|
+
inline std::function<void(double /* generation */, const std::string& /* cameraId */)> get_std__optional_std__function_void_double____generation_____const_std__string_____cameraId______(const std::optional<std::function<void(double /* generation */, const std::string& /* cameraId */)>>& optional) noexcept {
|
|
329
329
|
return optional.value();
|
|
330
330
|
}
|
|
331
331
|
|
|
@@ -77,11 +77,11 @@ namespace margelo::nitro::qrscanner {
|
|
|
77
77
|
inline void setCameraId(const std::optional<std::string>& cameraId) noexcept override {
|
|
78
78
|
_swiftPart.setCameraId(cameraId);
|
|
79
79
|
}
|
|
80
|
-
inline std::optional<std::function<void(double /* generation */)>> getOnReady() noexcept override {
|
|
80
|
+
inline std::optional<std::function<void(double /* generation */, const std::string& /* cameraId */)>> getOnReady() noexcept override {
|
|
81
81
|
auto __result = _swiftPart.getOnReady();
|
|
82
82
|
return __result;
|
|
83
83
|
}
|
|
84
|
-
inline void setOnReady(const std::optional<std::function<void(double /* generation */)>>& onReady) noexcept override {
|
|
84
|
+
inline void setOnReady(const std::optional<std::function<void(double /* generation */, const std::string& /* cameraId */)>>& onReady) noexcept override {
|
|
85
85
|
_swiftPart.setOnReady(onReady);
|
|
86
86
|
}
|
|
87
87
|
inline std::optional<std::function<void(const std::string& /* text */, double /* generation */)>> getOnFrameText() noexcept override {
|
package/nitrogen/generated/ios/swift/{Func_void_double.swift → Func_void_double_std__string.swift}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
///
|
|
2
|
-
///
|
|
2
|
+
/// Func_void_double_std__string.swift
|
|
3
3
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
4
|
/// https://github.com/mrousavy/nitro
|
|
5
5
|
/// Copyright © Marc Rousavy @ Margelo
|
|
@@ -8,21 +8,21 @@
|
|
|
8
8
|
import NitroModules
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* Wraps a Swift `(_ generation: Double) -> Void` as a class.
|
|
11
|
+
* Wraps a Swift `(_ generation: Double, _ cameraId: String) -> Void` as a class.
|
|
12
12
|
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
13
|
*/
|
|
14
|
-
public final class
|
|
14
|
+
public final class Func_void_double_std__string {
|
|
15
15
|
public typealias bridge = margelo.nitro.qrscanner.bridge.swift
|
|
16
16
|
|
|
17
|
-
private let closure: (_ generation: Double) -> Void
|
|
17
|
+
private let closure: (_ generation: Double, _ cameraId: String) -> Void
|
|
18
18
|
|
|
19
|
-
public init(_ closure: @escaping (_ generation: Double) -> Void) {
|
|
19
|
+
public init(_ closure: @escaping (_ generation: Double, _ cameraId: String) -> Void) {
|
|
20
20
|
self.closure = closure
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
@inline(__always)
|
|
24
|
-
public func call(generation: Double) -> Void {
|
|
25
|
-
self.closure(generation)
|
|
24
|
+
public func call(generation: Double, cameraId: std.string) -> Void {
|
|
25
|
+
self.closure(generation, String(cameraId))
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -35,12 +35,12 @@ public final class Func_void_double {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
* Casts an unsafe pointer to a `
|
|
39
|
-
* The pointer has to be a retained opaque `Unmanaged<
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_double_std__string`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_double_std__string>`.
|
|
40
40
|
* This removes one strong reference from the object!
|
|
41
41
|
*/
|
|
42
42
|
@inline(__always)
|
|
43
|
-
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) ->
|
|
44
|
-
return Unmanaged<
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_double_std__string {
|
|
44
|
+
return Unmanaged<Func_void_double_std__string>.fromOpaque(pointer).takeRetainedValue()
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -12,7 +12,7 @@ public protocol HybridQrScannerSpec_protocol: HybridObject, HybridView {
|
|
|
12
12
|
// Properties
|
|
13
13
|
var active: Bool { get set }
|
|
14
14
|
var cameraId: String? { get set }
|
|
15
|
-
var onReady: ((_ generation: Double) -> Void)? { get set }
|
|
15
|
+
var onReady: ((_ generation: Double, _ cameraId: String) -> Void)? { get set }
|
|
16
16
|
var onFrameText: ((_ text: String, _ generation: Double) -> Void)? { get set }
|
|
17
17
|
var onError: ((_ code: String, _ message: String, _ generation: Double) -> Void)? { get set }
|
|
18
18
|
|