@onekeyfe/react-native-qr-scanner 6.8.0-alpha.540 → 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/QrCameraZoom.kt +15 -0
- package/android/src/main/java/com/margelo/nitro/qrscanner/QrScanner.kt +135 -10
- package/android/src/test/java/com/margelo/nitro/qrscanner/QrCameraCatalogTest.kt +37 -0
- package/android/src/test/java/com/margelo/nitro/qrscanner/QrCameraZoomTest.kt +24 -0
- package/ios/HybridQrCameraList.swift +54 -0
- package/ios/QrCameraControl.swift +99 -0
- package/ios/QrScanner.swift +207 -24
- 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
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
#include <fbjni/fbjni.h>
|
|
16
16
|
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
17
17
|
|
|
18
|
+
#include "JHybridQrCameraListSpec.hpp"
|
|
19
|
+
#include "JFunc_void.hpp"
|
|
18
20
|
#include "JHybridQrImageDecoderSpec.hpp"
|
|
19
21
|
#include "JHybridQrScannerSpec.hpp"
|
|
20
22
|
#include "JFunc_void_double.hpp"
|
|
@@ -47,12 +49,22 @@ struct JHybridQrImageDecoderSpecImpl: public jni::JavaClass<JHybridQrImageDecode
|
|
|
47
49
|
return javaPart->getJHybridQrImageDecoderSpec();
|
|
48
50
|
}
|
|
49
51
|
};
|
|
52
|
+
struct JHybridQrCameraListSpecImpl: public jni::JavaClass<JHybridQrCameraListSpecImpl, JHybridQrCameraListSpec::JavaPart> {
|
|
53
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/qrscanner/HybridQrCameraList;";
|
|
54
|
+
static std::shared_ptr<JHybridQrCameraListSpec> create() {
|
|
55
|
+
static const auto constructorFn = javaClassStatic()->getConstructor<JHybridQrCameraListSpecImpl::javaobject()>();
|
|
56
|
+
jni::local_ref<JHybridQrCameraListSpec::JavaPart> javaPart = javaClassStatic()->newObject(constructorFn);
|
|
57
|
+
return javaPart->getJHybridQrCameraListSpec();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
50
60
|
|
|
51
61
|
void registerAllNatives() {
|
|
52
62
|
using namespace margelo::nitro;
|
|
53
63
|
using namespace margelo::nitro::qrscanner;
|
|
54
64
|
|
|
55
65
|
// Register native JNI methods
|
|
66
|
+
margelo::nitro::qrscanner::JHybridQrCameraListSpec::CxxPart::registerNatives();
|
|
67
|
+
margelo::nitro::qrscanner::JFunc_void_cxx::registerNatives();
|
|
56
68
|
margelo::nitro::qrscanner::JHybridQrImageDecoderSpec::CxxPart::registerNatives();
|
|
57
69
|
margelo::nitro::qrscanner::JHybridQrScannerSpec::CxxPart::registerNatives();
|
|
58
70
|
margelo::nitro::qrscanner::JFunc_void_double_cxx::registerNatives();
|
|
@@ -73,6 +85,12 @@ void registerAllNatives() {
|
|
|
73
85
|
return JHybridQrImageDecoderSpecImpl::create();
|
|
74
86
|
}
|
|
75
87
|
);
|
|
88
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
89
|
+
"QrCameraList",
|
|
90
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
91
|
+
return JHybridQrCameraListSpecImpl::create();
|
|
92
|
+
}
|
|
93
|
+
);
|
|
76
94
|
}
|
|
77
95
|
|
|
78
96
|
} // namespace margelo::nitro::qrscanner
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
#include "QrScanner-Swift-Cxx-Bridge.hpp"
|
|
9
9
|
|
|
10
10
|
// Include C++ implementation defined types
|
|
11
|
+
#include "HybridQrCameraListSpecSwift.hpp"
|
|
11
12
|
#include "HybridQrImageDecoderSpecSwift.hpp"
|
|
12
13
|
#include "HybridQrScannerSpecSwift.hpp"
|
|
13
14
|
#include "QrScanner-Swift-Cxx-Umbrella.hpp"
|
|
@@ -15,10 +16,10 @@
|
|
|
15
16
|
|
|
16
17
|
namespace margelo::nitro::qrscanner::bridge::swift {
|
|
17
18
|
|
|
18
|
-
// pragma MARK: std::function<void(const
|
|
19
|
-
|
|
20
|
-
auto swiftClosure = QrScanner::
|
|
21
|
-
return [swiftClosure = std::move(swiftClosure)](const
|
|
19
|
+
// pragma MARK: std::function<void(const std::vector<QrCameraInfo>& /* result */)>
|
|
20
|
+
Func_void_std__vector_QrCameraInfo_ create_Func_void_std__vector_QrCameraInfo_(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
21
|
+
auto swiftClosure = QrScanner::Func_void_std__vector_QrCameraInfo_::fromUnsafe(swiftClosureWrapper);
|
|
22
|
+
return [swiftClosure = std::move(swiftClosure)](const std::vector<QrCameraInfo>& result) mutable -> void {
|
|
22
23
|
swiftClosure.call(result);
|
|
23
24
|
};
|
|
24
25
|
}
|
|
@@ -31,6 +32,38 @@ namespace margelo::nitro::qrscanner::bridge::swift {
|
|
|
31
32
|
};
|
|
32
33
|
}
|
|
33
34
|
|
|
35
|
+
// pragma MARK: std::function<void()>
|
|
36
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
37
|
+
auto swiftClosure = QrScanner::Func_void::fromUnsafe(swiftClosureWrapper);
|
|
38
|
+
return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
|
|
39
|
+
swiftClosure.call();
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// pragma MARK: std::shared_ptr<HybridQrCameraListSpec>
|
|
44
|
+
std::shared_ptr<HybridQrCameraListSpec> create_std__shared_ptr_HybridQrCameraListSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
45
|
+
QrScanner::HybridQrCameraListSpec_cxx swiftPart = QrScanner::HybridQrCameraListSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
46
|
+
return std::make_shared<margelo::nitro::qrscanner::HybridQrCameraListSpecSwift>(swiftPart);
|
|
47
|
+
}
|
|
48
|
+
void* NON_NULL get_std__shared_ptr_HybridQrCameraListSpec_(std__shared_ptr_HybridQrCameraListSpec_ cppType) {
|
|
49
|
+
std::shared_ptr<margelo::nitro::qrscanner::HybridQrCameraListSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::qrscanner::HybridQrCameraListSpecSwift>(cppType);
|
|
50
|
+
#ifdef NITRO_DEBUG
|
|
51
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
52
|
+
throw std::runtime_error("Class \"HybridQrCameraListSpec\" is not implemented in Swift!");
|
|
53
|
+
}
|
|
54
|
+
#endif
|
|
55
|
+
QrScanner::HybridQrCameraListSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
56
|
+
return swiftPart.toUnsafe();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// pragma MARK: std::function<void(const QrImageDecodeResult& /* result */)>
|
|
60
|
+
Func_void_QrImageDecodeResult create_Func_void_QrImageDecodeResult(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
61
|
+
auto swiftClosure = QrScanner::Func_void_QrImageDecodeResult::fromUnsafe(swiftClosureWrapper);
|
|
62
|
+
return [swiftClosure = std::move(swiftClosure)](const QrImageDecodeResult& result) mutable -> void {
|
|
63
|
+
swiftClosure.call(result);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
34
67
|
// pragma MARK: std::shared_ptr<HybridQrImageDecoderSpec>
|
|
35
68
|
std::shared_ptr<HybridQrImageDecoderSpec> create_std__shared_ptr_HybridQrImageDecoderSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
36
69
|
QrScanner::HybridQrImageDecoderSpec_cxx swiftPart = QrScanner::HybridQrImageDecoderSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
@@ -8,10 +8,16 @@
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridQrCameraListSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::qrscanner { class HybridQrCameraListSpec; }
|
|
11
13
|
// Forward declaration of `HybridQrImageDecoderSpec` to properly resolve imports.
|
|
12
14
|
namespace margelo::nitro::qrscanner { class HybridQrImageDecoderSpec; }
|
|
13
15
|
// Forward declaration of `HybridQrScannerSpec` to properly resolve imports.
|
|
14
16
|
namespace margelo::nitro::qrscanner { class HybridQrScannerSpec; }
|
|
17
|
+
// Forward declaration of `QrCameraInfo` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::qrscanner { struct QrCameraInfo; }
|
|
19
|
+
// Forward declaration of `QrCameraPosition` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::qrscanner { enum class QrCameraPosition; }
|
|
15
21
|
// Forward declaration of `QrDecodeEngine` to properly resolve imports.
|
|
16
22
|
namespace margelo::nitro::qrscanner { enum class QrDecodeEngine; }
|
|
17
23
|
// Forward declaration of `QrDecodePass` to properly resolve imports.
|
|
@@ -20,14 +26,19 @@ namespace margelo::nitro::qrscanner { enum class QrDecodePass; }
|
|
|
20
26
|
namespace margelo::nitro::qrscanner { struct QrImageDecodeResult; }
|
|
21
27
|
|
|
22
28
|
// Forward declarations of Swift defined types
|
|
29
|
+
// Forward declaration of `HybridQrCameraListSpec_cxx` to properly resolve imports.
|
|
30
|
+
namespace QrScanner { class HybridQrCameraListSpec_cxx; }
|
|
23
31
|
// Forward declaration of `HybridQrImageDecoderSpec_cxx` to properly resolve imports.
|
|
24
32
|
namespace QrScanner { class HybridQrImageDecoderSpec_cxx; }
|
|
25
33
|
// Forward declaration of `HybridQrScannerSpec_cxx` to properly resolve imports.
|
|
26
34
|
namespace QrScanner { class HybridQrScannerSpec_cxx; }
|
|
27
35
|
|
|
28
36
|
// Include C++ defined types
|
|
37
|
+
#include "HybridQrCameraListSpec.hpp"
|
|
29
38
|
#include "HybridQrImageDecoderSpec.hpp"
|
|
30
39
|
#include "HybridQrScannerSpec.hpp"
|
|
40
|
+
#include "QrCameraInfo.hpp"
|
|
41
|
+
#include "QrCameraPosition.hpp"
|
|
31
42
|
#include "QrDecodeEngine.hpp"
|
|
32
43
|
#include "QrDecodePass.hpp"
|
|
33
44
|
#include "QrImageDecodeResult.hpp"
|
|
@@ -39,6 +50,7 @@ namespace QrScanner { class HybridQrScannerSpec_cxx; }
|
|
|
39
50
|
#include <memory>
|
|
40
51
|
#include <optional>
|
|
41
52
|
#include <string>
|
|
53
|
+
#include <vector>
|
|
42
54
|
|
|
43
55
|
/**
|
|
44
56
|
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
@@ -46,6 +58,140 @@ namespace QrScanner { class HybridQrScannerSpec_cxx; }
|
|
|
46
58
|
*/
|
|
47
59
|
namespace margelo::nitro::qrscanner::bridge::swift {
|
|
48
60
|
|
|
61
|
+
// pragma MARK: std::vector<QrCameraInfo>
|
|
62
|
+
/**
|
|
63
|
+
* Specialized version of `std::vector<QrCameraInfo>`.
|
|
64
|
+
*/
|
|
65
|
+
using std__vector_QrCameraInfo_ = std::vector<QrCameraInfo>;
|
|
66
|
+
inline std::vector<QrCameraInfo> create_std__vector_QrCameraInfo_(size_t size) noexcept {
|
|
67
|
+
std::vector<QrCameraInfo> vector;
|
|
68
|
+
vector.reserve(size);
|
|
69
|
+
return vector;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// pragma MARK: std::shared_ptr<Promise<std::vector<QrCameraInfo>>>
|
|
73
|
+
/**
|
|
74
|
+
* Specialized version of `std::shared_ptr<Promise<std::vector<QrCameraInfo>>>`.
|
|
75
|
+
*/
|
|
76
|
+
using std__shared_ptr_Promise_std__vector_QrCameraInfo___ = std::shared_ptr<Promise<std::vector<QrCameraInfo>>>;
|
|
77
|
+
inline std::shared_ptr<Promise<std::vector<QrCameraInfo>>> create_std__shared_ptr_Promise_std__vector_QrCameraInfo___() noexcept {
|
|
78
|
+
return Promise<std::vector<QrCameraInfo>>::create();
|
|
79
|
+
}
|
|
80
|
+
inline PromiseHolder<std::vector<QrCameraInfo>> wrap_std__shared_ptr_Promise_std__vector_QrCameraInfo___(std::shared_ptr<Promise<std::vector<QrCameraInfo>>> promise) noexcept {
|
|
81
|
+
return PromiseHolder<std::vector<QrCameraInfo>>(std::move(promise));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// pragma MARK: std::function<void(const std::vector<QrCameraInfo>& /* result */)>
|
|
85
|
+
/**
|
|
86
|
+
* Specialized version of `std::function<void(const std::vector<QrCameraInfo>&)>`.
|
|
87
|
+
*/
|
|
88
|
+
using Func_void_std__vector_QrCameraInfo_ = std::function<void(const std::vector<QrCameraInfo>& /* result */)>;
|
|
89
|
+
/**
|
|
90
|
+
* Wrapper class for a `std::function<void(const std::vector<QrCameraInfo>& / * result * /)>`, this can be used from Swift.
|
|
91
|
+
*/
|
|
92
|
+
class Func_void_std__vector_QrCameraInfo__Wrapper final {
|
|
93
|
+
public:
|
|
94
|
+
explicit Func_void_std__vector_QrCameraInfo__Wrapper(std::function<void(const std::vector<QrCameraInfo>& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::vector<QrCameraInfo>& /* result */)>>(std::move(func))) {}
|
|
95
|
+
inline void call(std::vector<QrCameraInfo> result) const noexcept {
|
|
96
|
+
_function->operator()(result);
|
|
97
|
+
}
|
|
98
|
+
private:
|
|
99
|
+
std::unique_ptr<std::function<void(const std::vector<QrCameraInfo>& /* result */)>> _function;
|
|
100
|
+
} SWIFT_NONCOPYABLE;
|
|
101
|
+
Func_void_std__vector_QrCameraInfo_ create_Func_void_std__vector_QrCameraInfo_(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
102
|
+
inline Func_void_std__vector_QrCameraInfo__Wrapper wrap_Func_void_std__vector_QrCameraInfo_(Func_void_std__vector_QrCameraInfo_ value) noexcept {
|
|
103
|
+
return Func_void_std__vector_QrCameraInfo__Wrapper(std::move(value));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
107
|
+
/**
|
|
108
|
+
* Specialized version of `std::function<void(const std::exception_ptr&)>`.
|
|
109
|
+
*/
|
|
110
|
+
using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
|
|
111
|
+
/**
|
|
112
|
+
* Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
|
|
113
|
+
*/
|
|
114
|
+
class Func_void_std__exception_ptr_Wrapper final {
|
|
115
|
+
public:
|
|
116
|
+
explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
|
|
117
|
+
inline void call(std::exception_ptr error) const noexcept {
|
|
118
|
+
_function->operator()(error);
|
|
119
|
+
}
|
|
120
|
+
private:
|
|
121
|
+
std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
|
|
122
|
+
} SWIFT_NONCOPYABLE;
|
|
123
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
124
|
+
inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
|
|
125
|
+
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// pragma MARK: std::function<void()>
|
|
129
|
+
/**
|
|
130
|
+
* Specialized version of `std::function<void()>`.
|
|
131
|
+
*/
|
|
132
|
+
using Func_void = std::function<void()>;
|
|
133
|
+
/**
|
|
134
|
+
* Wrapper class for a `std::function<void()>`, this can be used from Swift.
|
|
135
|
+
*/
|
|
136
|
+
class Func_void_Wrapper final {
|
|
137
|
+
public:
|
|
138
|
+
explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {}
|
|
139
|
+
inline void call() const noexcept {
|
|
140
|
+
_function->operator()();
|
|
141
|
+
}
|
|
142
|
+
private:
|
|
143
|
+
std::unique_ptr<std::function<void()>> _function;
|
|
144
|
+
} SWIFT_NONCOPYABLE;
|
|
145
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
146
|
+
inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
|
|
147
|
+
return Func_void_Wrapper(std::move(value));
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// pragma MARK: std::optional<std::function<void()>>
|
|
151
|
+
/**
|
|
152
|
+
* Specialized version of `std::optional<std::function<void()>>`.
|
|
153
|
+
*/
|
|
154
|
+
using std__optional_std__function_void____ = std::optional<std::function<void()>>;
|
|
155
|
+
inline std::optional<std::function<void()>> create_std__optional_std__function_void____(const std::function<void()>& value) noexcept {
|
|
156
|
+
return std::optional<std::function<void()>>(value);
|
|
157
|
+
}
|
|
158
|
+
inline bool has_value_std__optional_std__function_void____(const std::optional<std::function<void()>>& optional) noexcept {
|
|
159
|
+
return optional.has_value();
|
|
160
|
+
}
|
|
161
|
+
inline std::function<void()> get_std__optional_std__function_void____(const std::optional<std::function<void()>>& optional) noexcept {
|
|
162
|
+
return optional.value();
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// pragma MARK: std::shared_ptr<HybridQrCameraListSpec>
|
|
166
|
+
/**
|
|
167
|
+
* Specialized version of `std::shared_ptr<HybridQrCameraListSpec>`.
|
|
168
|
+
*/
|
|
169
|
+
using std__shared_ptr_HybridQrCameraListSpec_ = std::shared_ptr<HybridQrCameraListSpec>;
|
|
170
|
+
std::shared_ptr<HybridQrCameraListSpec> create_std__shared_ptr_HybridQrCameraListSpec_(void* NON_NULL swiftUnsafePointer) noexcept;
|
|
171
|
+
void* NON_NULL get_std__shared_ptr_HybridQrCameraListSpec_(std__shared_ptr_HybridQrCameraListSpec_ cppType);
|
|
172
|
+
|
|
173
|
+
// pragma MARK: std::weak_ptr<HybridQrCameraListSpec>
|
|
174
|
+
using std__weak_ptr_HybridQrCameraListSpec_ = std::weak_ptr<HybridQrCameraListSpec>;
|
|
175
|
+
inline std__weak_ptr_HybridQrCameraListSpec_ weakify_std__shared_ptr_HybridQrCameraListSpec_(const std::shared_ptr<HybridQrCameraListSpec>& strong) noexcept { return strong; }
|
|
176
|
+
|
|
177
|
+
// pragma MARK: Result<std::shared_ptr<Promise<std::vector<QrCameraInfo>>>>
|
|
178
|
+
using Result_std__shared_ptr_Promise_std__vector_QrCameraInfo____ = Result<std::shared_ptr<Promise<std::vector<QrCameraInfo>>>>;
|
|
179
|
+
inline Result_std__shared_ptr_Promise_std__vector_QrCameraInfo____ create_Result_std__shared_ptr_Promise_std__vector_QrCameraInfo____(const std::shared_ptr<Promise<std::vector<QrCameraInfo>>>& value) noexcept {
|
|
180
|
+
return Result<std::shared_ptr<Promise<std::vector<QrCameraInfo>>>>::withValue(value);
|
|
181
|
+
}
|
|
182
|
+
inline Result_std__shared_ptr_Promise_std__vector_QrCameraInfo____ create_Result_std__shared_ptr_Promise_std__vector_QrCameraInfo____(const std::exception_ptr& error) noexcept {
|
|
183
|
+
return Result<std::shared_ptr<Promise<std::vector<QrCameraInfo>>>>::withError(error);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// pragma MARK: Result<void>
|
|
187
|
+
using Result_void_ = Result<void>;
|
|
188
|
+
inline Result_void_ create_Result_void_() noexcept {
|
|
189
|
+
return Result<void>::withValue();
|
|
190
|
+
}
|
|
191
|
+
inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
|
|
192
|
+
return Result<void>::withError(error);
|
|
193
|
+
}
|
|
194
|
+
|
|
49
195
|
// pragma MARK: std::optional<std::string>
|
|
50
196
|
/**
|
|
51
197
|
* Specialized version of `std::optional<std::string>`.
|
|
@@ -125,28 +271,6 @@ namespace margelo::nitro::qrscanner::bridge::swift {
|
|
|
125
271
|
return Func_void_QrImageDecodeResult_Wrapper(std::move(value));
|
|
126
272
|
}
|
|
127
273
|
|
|
128
|
-
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
129
|
-
/**
|
|
130
|
-
* Specialized version of `std::function<void(const std::exception_ptr&)>`.
|
|
131
|
-
*/
|
|
132
|
-
using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
|
|
133
|
-
/**
|
|
134
|
-
* Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
|
|
135
|
-
*/
|
|
136
|
-
class Func_void_std__exception_ptr_Wrapper final {
|
|
137
|
-
public:
|
|
138
|
-
explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
|
|
139
|
-
inline void call(std::exception_ptr error) const noexcept {
|
|
140
|
-
_function->operator()(error);
|
|
141
|
-
}
|
|
142
|
-
private:
|
|
143
|
-
std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
|
|
144
|
-
} SWIFT_NONCOPYABLE;
|
|
145
|
-
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
146
|
-
inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
|
|
147
|
-
return Func_void_std__exception_ptr_Wrapper(std::move(value));
|
|
148
|
-
}
|
|
149
|
-
|
|
150
274
|
// pragma MARK: std::shared_ptr<HybridQrImageDecoderSpec>
|
|
151
275
|
/**
|
|
152
276
|
* Specialized version of `std::shared_ptr<HybridQrImageDecoderSpec>`.
|
|
@@ -8,10 +8,16 @@
|
|
|
8
8
|
#pragma once
|
|
9
9
|
|
|
10
10
|
// Forward declarations of C++ defined types
|
|
11
|
+
// Forward declaration of `HybridQrCameraListSpec` to properly resolve imports.
|
|
12
|
+
namespace margelo::nitro::qrscanner { class HybridQrCameraListSpec; }
|
|
11
13
|
// Forward declaration of `HybridQrImageDecoderSpec` to properly resolve imports.
|
|
12
14
|
namespace margelo::nitro::qrscanner { class HybridQrImageDecoderSpec; }
|
|
13
15
|
// Forward declaration of `HybridQrScannerSpec` to properly resolve imports.
|
|
14
16
|
namespace margelo::nitro::qrscanner { class HybridQrScannerSpec; }
|
|
17
|
+
// Forward declaration of `QrCameraInfo` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::qrscanner { struct QrCameraInfo; }
|
|
19
|
+
// Forward declaration of `QrCameraPosition` to properly resolve imports.
|
|
20
|
+
namespace margelo::nitro::qrscanner { enum class QrCameraPosition; }
|
|
15
21
|
// Forward declaration of `QrDecodeEngine` to properly resolve imports.
|
|
16
22
|
namespace margelo::nitro::qrscanner { enum class QrDecodeEngine; }
|
|
17
23
|
// Forward declaration of `QrDecodePass` to properly resolve imports.
|
|
@@ -20,8 +26,11 @@ namespace margelo::nitro::qrscanner { enum class QrDecodePass; }
|
|
|
20
26
|
namespace margelo::nitro::qrscanner { struct QrImageDecodeResult; }
|
|
21
27
|
|
|
22
28
|
// Include C++ defined types
|
|
29
|
+
#include "HybridQrCameraListSpec.hpp"
|
|
23
30
|
#include "HybridQrImageDecoderSpec.hpp"
|
|
24
31
|
#include "HybridQrScannerSpec.hpp"
|
|
32
|
+
#include "QrCameraInfo.hpp"
|
|
33
|
+
#include "QrCameraPosition.hpp"
|
|
25
34
|
#include "QrDecodeEngine.hpp"
|
|
26
35
|
#include "QrDecodePass.hpp"
|
|
27
36
|
#include "QrImageDecodeResult.hpp"
|
|
@@ -32,6 +41,7 @@ namespace margelo::nitro::qrscanner { struct QrImageDecodeResult; }
|
|
|
32
41
|
#include <memory>
|
|
33
42
|
#include <optional>
|
|
34
43
|
#include <string>
|
|
44
|
+
#include <vector>
|
|
35
45
|
|
|
36
46
|
// C++ helpers for Swift
|
|
37
47
|
#include "QrScanner-Swift-Cxx-Bridge.hpp"
|
|
@@ -43,6 +53,8 @@ namespace margelo::nitro::qrscanner { struct QrImageDecodeResult; }
|
|
|
43
53
|
#include <NitroModules/DateToChronoDate.hpp>
|
|
44
54
|
|
|
45
55
|
// Forward declarations of Swift defined types
|
|
56
|
+
// Forward declaration of `HybridQrCameraListSpec_cxx` to properly resolve imports.
|
|
57
|
+
namespace QrScanner { class HybridQrCameraListSpec_cxx; }
|
|
46
58
|
// Forward declaration of `HybridQrImageDecoderSpec_cxx` to properly resolve imports.
|
|
47
59
|
namespace QrScanner { class HybridQrImageDecoderSpec_cxx; }
|
|
48
60
|
// Forward declaration of `HybridQrScannerSpec_cxx` to properly resolve imports.
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
#include "HybridQrScannerSpecSwift.hpp"
|
|
14
14
|
#include "HybridQrImageDecoderSpecSwift.hpp"
|
|
15
|
+
#include "HybridQrCameraListSpecSwift.hpp"
|
|
15
16
|
|
|
16
17
|
@interface QrScannerAutolinking : NSObject
|
|
17
18
|
@end
|
|
@@ -36,6 +37,13 @@
|
|
|
36
37
|
return hybridObject;
|
|
37
38
|
}
|
|
38
39
|
);
|
|
40
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
41
|
+
"QrCameraList",
|
|
42
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
43
|
+
std::shared_ptr<HybridQrCameraListSpec> hybridObject = QrScanner::QrScannerAutolinking::createQrCameraList();
|
|
44
|
+
return hybridObject;
|
|
45
|
+
}
|
|
46
|
+
);
|
|
39
47
|
}
|
|
40
48
|
|
|
41
49
|
@end
|
|
@@ -35,4 +35,16 @@ public final class QrScannerAutolinking {
|
|
|
35
35
|
public static func isQrImageDecoderRecyclable() -> Bool {
|
|
36
36
|
return HybridQrImageDecoder.self is any RecyclableView.Type
|
|
37
37
|
}
|
|
38
|
+
|
|
39
|
+
public static func createQrCameraList() -> bridge.std__shared_ptr_HybridQrCameraListSpec_ {
|
|
40
|
+
let hybridObject = HybridQrCameraList()
|
|
41
|
+
return { () -> bridge.std__shared_ptr_HybridQrCameraListSpec_ in
|
|
42
|
+
let __cxxWrapped = hybridObject.getCxxWrapper()
|
|
43
|
+
return __cxxWrapped.getCxxPart()
|
|
44
|
+
}()
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public static func isQrCameraListRecyclable() -> Bool {
|
|
48
|
+
return HybridQrCameraList.self is any RecyclableView.Type
|
|
49
|
+
}
|
|
38
50
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridQrCameraListSpecSwift.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 "HybridQrCameraListSpecSwift.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::qrscanner {
|
|
11
|
+
} // namespace margelo::nitro::qrscanner
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridQrCameraListSpecSwift.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 "HybridQrCameraListSpec.hpp"
|
|
11
|
+
|
|
12
|
+
// Forward declaration of `HybridQrCameraListSpec_cxx` to properly resolve imports.
|
|
13
|
+
namespace QrScanner { class HybridQrCameraListSpec_cxx; }
|
|
14
|
+
|
|
15
|
+
// Forward declaration of `QrCameraInfo` to properly resolve imports.
|
|
16
|
+
namespace margelo::nitro::qrscanner { struct QrCameraInfo; }
|
|
17
|
+
// Forward declaration of `QrCameraPosition` to properly resolve imports.
|
|
18
|
+
namespace margelo::nitro::qrscanner { enum class QrCameraPosition; }
|
|
19
|
+
|
|
20
|
+
#include "QrCameraInfo.hpp"
|
|
21
|
+
#include <vector>
|
|
22
|
+
#include <NitroModules/Promise.hpp>
|
|
23
|
+
#include <string>
|
|
24
|
+
#include "QrCameraPosition.hpp"
|
|
25
|
+
#include <functional>
|
|
26
|
+
#include <optional>
|
|
27
|
+
|
|
28
|
+
#include "QrScanner-Swift-Cxx-Umbrella.hpp"
|
|
29
|
+
|
|
30
|
+
namespace margelo::nitro::qrscanner {
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The C++ part of HybridQrCameraListSpec_cxx.swift.
|
|
34
|
+
*
|
|
35
|
+
* HybridQrCameraListSpecSwift (C++) accesses HybridQrCameraListSpec_cxx (Swift), and might
|
|
36
|
+
* contain some additional bridging code for C++ <> Swift interop.
|
|
37
|
+
*
|
|
38
|
+
* Since this obviously introduces an overhead, I hope at some point in
|
|
39
|
+
* the future, HybridQrCameraListSpec_cxx can directly inherit from the C++ class HybridQrCameraListSpec
|
|
40
|
+
* to simplify the whole structure and memory management.
|
|
41
|
+
*/
|
|
42
|
+
class HybridQrCameraListSpecSwift: public virtual HybridQrCameraListSpec {
|
|
43
|
+
public:
|
|
44
|
+
// Constructor from a Swift instance
|
|
45
|
+
explicit HybridQrCameraListSpecSwift(const QrScanner::HybridQrCameraListSpec_cxx& swiftPart):
|
|
46
|
+
HybridObject(HybridQrCameraListSpec::TAG),
|
|
47
|
+
_swiftPart(swiftPart) { }
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
// Get the Swift part
|
|
51
|
+
inline QrScanner::HybridQrCameraListSpec_cxx& getSwiftPart() noexcept {
|
|
52
|
+
return _swiftPart;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
inline size_t getExternalMemorySize() noexcept override {
|
|
57
|
+
return _swiftPart.getMemorySize();
|
|
58
|
+
}
|
|
59
|
+
bool equals(const std::shared_ptr<HybridObject>& other) override {
|
|
60
|
+
if (auto otherCast = std::dynamic_pointer_cast<HybridQrCameraListSpecSwift>(other)) {
|
|
61
|
+
return _swiftPart.equals(otherCast->_swiftPart);
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
void dispose() noexcept override {
|
|
66
|
+
_swiftPart.dispose();
|
|
67
|
+
}
|
|
68
|
+
std::string toString() override {
|
|
69
|
+
return _swiftPart.toString();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public:
|
|
73
|
+
// Properties
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
public:
|
|
77
|
+
// Methods
|
|
78
|
+
inline std::shared_ptr<Promise<std::vector<QrCameraInfo>>> listCameras() override {
|
|
79
|
+
auto __result = _swiftPart.listCameras();
|
|
80
|
+
if (__result.hasError()) [[unlikely]] {
|
|
81
|
+
std::rethrow_exception(__result.error());
|
|
82
|
+
}
|
|
83
|
+
auto __value = std::move(__result.value());
|
|
84
|
+
return __value;
|
|
85
|
+
}
|
|
86
|
+
inline void setOnChange(const std::optional<std::function<void()>>& listener) override {
|
|
87
|
+
auto __result = _swiftPart.setOnChange(listener);
|
|
88
|
+
if (__result.hasError()) [[unlikely]] {
|
|
89
|
+
std::rethrow_exception(__result.error());
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private:
|
|
94
|
+
QrScanner::HybridQrCameraListSpec_cxx _swiftPart;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
} // namespace margelo::nitro::qrscanner
|
|
@@ -14,9 +14,9 @@ namespace QrScanner { class HybridQrScannerSpec_cxx; }
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
#include <functional>
|
|
18
|
-
#include <optional>
|
|
19
17
|
#include <string>
|
|
18
|
+
#include <optional>
|
|
19
|
+
#include <functional>
|
|
20
20
|
|
|
21
21
|
#include "QrScanner-Swift-Cxx-Umbrella.hpp"
|
|
22
22
|
|
|
@@ -70,6 +70,13 @@ namespace margelo::nitro::qrscanner {
|
|
|
70
70
|
inline void setActive(bool active) noexcept override {
|
|
71
71
|
_swiftPart.setActive(std::forward<decltype(active)>(active));
|
|
72
72
|
}
|
|
73
|
+
inline std::optional<std::string> getCameraId() noexcept override {
|
|
74
|
+
auto __result = _swiftPart.getCameraId();
|
|
75
|
+
return __result;
|
|
76
|
+
}
|
|
77
|
+
inline void setCameraId(const std::optional<std::string>& cameraId) noexcept override {
|
|
78
|
+
_swiftPart.setCameraId(cameraId);
|
|
79
|
+
}
|
|
73
80
|
inline std::optional<std::function<void(double /* generation */)>> getOnReady() noexcept override {
|
|
74
81
|
auto __result = _swiftPart.getOnReady();
|
|
75
82
|
return __result;
|
|
@@ -104,6 +104,12 @@ using namespace margelo::nitro::qrscanner::views;
|
|
|
104
104
|
: !newViewProps.active.hasSameValue(oldViewProps->active)) {
|
|
105
105
|
swiftPart.setActive(newViewProps.active.get());
|
|
106
106
|
}
|
|
107
|
+
// cameraId: optional
|
|
108
|
+
if (oldViewProps == nullptr
|
|
109
|
+
? newViewProps.cameraId.isProvided()
|
|
110
|
+
: !newViewProps.cameraId.hasSameValue(oldViewProps->cameraId)) {
|
|
111
|
+
swiftPart.setCameraId(newViewProps.cameraId.get());
|
|
112
|
+
}
|
|
107
113
|
// onReady: optional
|
|
108
114
|
if (oldViewProps == nullptr
|
|
109
115
|
? newViewProps.onReady.isProvided()
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void.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
|
+
* Wraps a Swift `() -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void {
|
|
15
|
+
public typealias bridge = margelo.nitro.qrscanner.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: () -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping () -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call() -> Void {
|
|
25
|
+
self.closure()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void {
|
|
44
|
+
return Unmanaged<Func_void>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__vector_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
|
+
* Wraps a Swift `(_ value: [QrCameraInfo]) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_std__vector_QrCameraInfo_ {
|
|
15
|
+
public typealias bridge = margelo.nitro.qrscanner.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ value: [QrCameraInfo]) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ value: [QrCameraInfo]) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(value: bridge.std__vector_QrCameraInfo_) -> Void {
|
|
25
|
+
self.closure(value.map({ __item in __item }))
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_std__vector_QrCameraInfo_`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__vector_QrCameraInfo_>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__vector_QrCameraInfo_ {
|
|
44
|
+
return Unmanaged<Func_void_std__vector_QrCameraInfo_>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|