react-native-vision-camera-spoof-detector 1.1.10 → 1.1.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/README.md +103 -186
  2. package/VisionCameraSpoofDetector.podspec +41 -0
  3. package/ios/FaceAntiSpoofManager.swift +106 -4
  4. package/ios/FaceAntiSpoofModule.m +38 -51
  5. package/ios/HybridSpoofDetectorFactory.swift +10 -0
  6. package/ios/HybridSpoofDetectorOutput.swift +164 -0
  7. package/nitro.json +4 -0
  8. package/nitrogen/generated/ios/VisionCameraSpoofDetector+autolinking.rb +62 -0
  9. package/nitrogen/generated/ios/VisionCameraSpoofDetector-Swift-Cxx-Bridge.cpp +60 -0
  10. package/nitrogen/generated/ios/VisionCameraSpoofDetector-Swift-Cxx-Bridge.hpp +151 -0
  11. package/nitrogen/generated/ios/VisionCameraSpoofDetector-Swift-Cxx-Umbrella.hpp +60 -0
  12. package/nitrogen/generated/ios/VisionCameraSpoofDetectorAutolinking.mm +33 -0
  13. package/nitrogen/generated/ios/VisionCameraSpoofDetectorAutolinking.swift +26 -0
  14. package/nitrogen/generated/ios/c++/HybridSpoofDetectorFactorySpecSwift.cpp +11 -0
  15. package/nitrogen/generated/ios/c++/HybridSpoofDetectorFactorySpecSwift.hpp +97 -0
  16. package/nitrogen/generated/ios/swift/AntiSpoofingResult.swift +54 -0
  17. package/nitrogen/generated/ios/swift/Func_void_AntiSpoofingResult.swift +46 -0
  18. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  19. package/nitrogen/generated/ios/swift/HybridSpoofDetectorFactorySpec.swift +56 -0
  20. package/nitrogen/generated/ios/swift/HybridSpoofDetectorFactorySpec_cxx.swift +142 -0
  21. package/nitrogen/generated/ios/swift/Size.swift +34 -0
  22. package/nitrogen/generated/ios/swift/SpoofDetectorOutputOptions.swift +74 -0
  23. package/package.json +8 -3
  24. package/src/specs/SpoofDetectorFactory.nitro.ts +1 -0
  25. package/ios/FaceAntiSpoofFrameProcessor.swift +0 -301
  26. package/ios/FaceAntiSpoofJSI.h +0 -12
  27. package/ios/FaceAntiSpoofJSI.mm +0 -92
  28. package/ios/FaceAntiSpoofPluginRegister.m +0 -84
  29. package/ios/models/FaceAntiSpoofing.tflite +0 -0
  30. package/react-native-vision-camera-spoof-detector.podspec +0 -22
  31. /package/{ios/models → lib/assets}/model_spec.json +0 -0
@@ -0,0 +1,33 @@
1
+ ///
2
+ /// VisionCameraSpoofDetectorAutolinking.mm
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 <Foundation/Foundation.h>
9
+ #import <NitroModules/HybridObjectRegistry.hpp>
10
+ #import "VisionCameraSpoofDetector-Swift-Cxx-Umbrella.hpp"
11
+ #import <type_traits>
12
+
13
+ #include "HybridSpoofDetectorFactorySpecSwift.hpp"
14
+
15
+ @interface VisionCameraSpoofDetectorAutolinking : NSObject
16
+ @end
17
+
18
+ @implementation VisionCameraSpoofDetectorAutolinking
19
+
20
+ + (void) load {
21
+ using namespace margelo::nitro;
22
+ using namespace margelo::nitro::camera::spoofdetector;
23
+
24
+ HybridObjectRegistry::registerHybridObjectConstructor(
25
+ "SpoofDetectorFactory",
26
+ []() -> std::shared_ptr<HybridObject> {
27
+ std::shared_ptr<HybridSpoofDetectorFactorySpec> hybridObject = VisionCameraSpoofDetector::VisionCameraSpoofDetectorAutolinking::createSpoofDetectorFactory();
28
+ return hybridObject;
29
+ }
30
+ );
31
+ }
32
+
33
+ @end
@@ -0,0 +1,26 @@
1
+ ///
2
+ /// VisionCameraSpoofDetectorAutolinking.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
+ // TODO: Use empty enums once Swift supports exporting them as namespaces
11
+ // See: https://github.com/swiftlang/swift/pull/83616
12
+ public final class VisionCameraSpoofDetectorAutolinking {
13
+ public typealias bridge = margelo.nitro.camera.spoofdetector.bridge.swift
14
+
15
+ public static func createSpoofDetectorFactory() -> bridge.std__shared_ptr_HybridSpoofDetectorFactorySpec_ {
16
+ let hybridObject = HybridSpoofDetectorFactory()
17
+ return { () -> bridge.std__shared_ptr_HybridSpoofDetectorFactorySpec_ in
18
+ let __cxxWrapped = hybridObject.getCxxWrapper()
19
+ return __cxxWrapped.getCxxPart()
20
+ }()
21
+ }
22
+
23
+ public static func isSpoofDetectorFactoryRecyclable() -> Bool {
24
+ return HybridSpoofDetectorFactory.self is any RecyclableView.Type
25
+ }
26
+ }
@@ -0,0 +1,11 @@
1
+ ///
2
+ /// HybridSpoofDetectorFactorySpecSwift.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 "HybridSpoofDetectorFactorySpecSwift.hpp"
9
+
10
+ namespace margelo::nitro::camera::spoofdetector {
11
+ } // namespace margelo::nitro::camera::spoofdetector
@@ -0,0 +1,97 @@
1
+ ///
2
+ /// HybridSpoofDetectorFactorySpecSwift.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 "HybridSpoofDetectorFactorySpec.hpp"
11
+
12
+ // Forward declaration of `HybridSpoofDetectorFactorySpec_cxx` to properly resolve imports.
13
+ namespace VisionCameraSpoofDetector { class HybridSpoofDetectorFactorySpec_cxx; }
14
+
15
+ // Forward declaration of `HybridCameraOutputSpec` to properly resolve imports.
16
+ namespace margelo::nitro::camera { class HybridCameraOutputSpec; }
17
+ // Forward declaration of `SpoofDetectorOutputOptions` to properly resolve imports.
18
+ namespace margelo::nitro::camera::spoofdetector { struct SpoofDetectorOutputOptions; }
19
+ // Forward declaration of `Size` to properly resolve imports.
20
+ namespace margelo::nitro::camera::spoofdetector { struct Size; }
21
+ // Forward declaration of `AntiSpoofingResult` to properly resolve imports.
22
+ namespace margelo::nitro::camera::spoofdetector { struct AntiSpoofingResult; }
23
+
24
+ #include <memory>
25
+ #include <VisionCamera/HybridCameraOutputSpec.hpp>
26
+ #include "SpoofDetectorOutputOptions.hpp"
27
+ #include "Size.hpp"
28
+ #include <optional>
29
+ #include "AntiSpoofingResult.hpp"
30
+ #include <functional>
31
+ #include <string>
32
+ #include <exception>
33
+
34
+ #include "VisionCameraSpoofDetector-Swift-Cxx-Umbrella.hpp"
35
+
36
+ namespace margelo::nitro::camera::spoofdetector {
37
+
38
+ /**
39
+ * The C++ part of HybridSpoofDetectorFactorySpec_cxx.swift.
40
+ *
41
+ * HybridSpoofDetectorFactorySpecSwift (C++) accesses HybridSpoofDetectorFactorySpec_cxx (Swift), and might
42
+ * contain some additional bridging code for C++ <> Swift interop.
43
+ *
44
+ * Since this obviously introduces an overhead, I hope at some point in
45
+ * the future, HybridSpoofDetectorFactorySpec_cxx can directly inherit from the C++ class HybridSpoofDetectorFactorySpec
46
+ * to simplify the whole structure and memory management.
47
+ */
48
+ class HybridSpoofDetectorFactorySpecSwift: public virtual HybridSpoofDetectorFactorySpec {
49
+ public:
50
+ // Constructor from a Swift instance
51
+ explicit HybridSpoofDetectorFactorySpecSwift(const VisionCameraSpoofDetector::HybridSpoofDetectorFactorySpec_cxx& swiftPart):
52
+ HybridObject(HybridSpoofDetectorFactorySpec::TAG),
53
+ _swiftPart(swiftPart) { }
54
+
55
+ public:
56
+ // Get the Swift part
57
+ inline VisionCameraSpoofDetector::HybridSpoofDetectorFactorySpec_cxx& getSwiftPart() noexcept {
58
+ return _swiftPart;
59
+ }
60
+
61
+ public:
62
+ inline size_t getExternalMemorySize() noexcept override {
63
+ return _swiftPart.getMemorySize();
64
+ }
65
+ bool equals(const std::shared_ptr<HybridObject>& other) override {
66
+ if (auto otherCast = std::dynamic_pointer_cast<HybridSpoofDetectorFactorySpecSwift>(other)) {
67
+ return _swiftPart.equals(otherCast->_swiftPart);
68
+ }
69
+ return false;
70
+ }
71
+ void dispose() noexcept override {
72
+ _swiftPart.dispose();
73
+ }
74
+ std::string toString() override {
75
+ return _swiftPart.toString();
76
+ }
77
+
78
+ public:
79
+ // Properties
80
+
81
+
82
+ public:
83
+ // Methods
84
+ inline std::shared_ptr<margelo::nitro::camera::HybridCameraOutputSpec> createSpoofDetectorOutput(const SpoofDetectorOutputOptions& options) override {
85
+ auto __result = _swiftPart.createSpoofDetectorOutput(std::forward<decltype(options)>(options));
86
+ if (__result.hasError()) [[unlikely]] {
87
+ std::rethrow_exception(__result.error());
88
+ }
89
+ auto __value = std::move(__result.value());
90
+ return __value;
91
+ }
92
+
93
+ private:
94
+ VisionCameraSpoofDetector::HybridSpoofDetectorFactorySpec_cxx _swiftPart;
95
+ };
96
+
97
+ } // namespace margelo::nitro::camera::spoofdetector
@@ -0,0 +1,54 @@
1
+ ///
2
+ /// AntiSpoofingResult.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 `AntiSpoofingResult`, backed by a C++ struct.
12
+ */
13
+ public typealias AntiSpoofingResult = margelo.nitro.camera.spoofdetector.AntiSpoofingResult
14
+
15
+ public extension AntiSpoofingResult {
16
+ private typealias bridge = margelo.nitro.camera.spoofdetector.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `AntiSpoofingResult`.
20
+ */
21
+ init(isLive: Bool, label: String, neuralNetworkScore: Double, laplacianScore: Double, combinedScore: Double, confidence: Double) {
22
+ self.init(isLive, std.string(label), neuralNetworkScore, laplacianScore, combinedScore, confidence)
23
+ }
24
+
25
+ @inline(__always)
26
+ var isLive: Bool {
27
+ return self.__isLive
28
+ }
29
+
30
+ @inline(__always)
31
+ var label: String {
32
+ return String(self.__label)
33
+ }
34
+
35
+ @inline(__always)
36
+ var neuralNetworkScore: Double {
37
+ return self.__neuralNetworkScore
38
+ }
39
+
40
+ @inline(__always)
41
+ var laplacianScore: Double {
42
+ return self.__laplacianScore
43
+ }
44
+
45
+ @inline(__always)
46
+ var combinedScore: Double {
47
+ return self.__combinedScore
48
+ }
49
+
50
+ @inline(__always)
51
+ var confidence: Double {
52
+ return self.__confidence
53
+ }
54
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// Func_void_AntiSpoofingResult.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 `(_ result: AntiSpoofingResult) -> 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_AntiSpoofingResult {
15
+ public typealias bridge = margelo.nitro.camera.spoofdetector.bridge.swift
16
+
17
+ private let closure: (_ result: AntiSpoofingResult) -> Void
18
+
19
+ public init(_ closure: @escaping (_ result: AntiSpoofingResult) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(result: AntiSpoofingResult) -> Void {
25
+ self.closure(result)
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_AntiSpoofingResult`.
39
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_AntiSpoofingResult>`.
40
+ * This removes one strong reference from the object!
41
+ */
42
+ @inline(__always)
43
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_AntiSpoofingResult {
44
+ return Unmanaged<Func_void_AntiSpoofingResult>.fromOpaque(pointer).takeRetainedValue()
45
+ }
46
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// Func_void_std__exception_ptr.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 `(_ error: Error) -> 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__exception_ptr {
15
+ public typealias bridge = margelo.nitro.camera.spoofdetector.bridge.swift
16
+
17
+ private let closure: (_ error: Error) -> Void
18
+
19
+ public init(_ closure: @escaping (_ error: Error) -> Void) {
20
+ self.closure = closure
21
+ }
22
+
23
+ @inline(__always)
24
+ public func call(error: std.exception_ptr) -> Void {
25
+ self.closure(RuntimeError.from(cppError: error))
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__exception_ptr`.
39
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_std__exception_ptr>`.
40
+ * This removes one strong reference from the object!
41
+ */
42
+ @inline(__always)
43
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
44
+ return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
45
+ }
46
+ }
@@ -0,0 +1,56 @@
1
+ ///
2
+ /// HybridSpoofDetectorFactorySpec.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 VisionCamera
9
+ import NitroModules
10
+
11
+ /// See ``HybridSpoofDetectorFactorySpec``
12
+ public protocol HybridSpoofDetectorFactorySpec_protocol: HybridObject {
13
+ // Properties
14
+
15
+
16
+ // Methods
17
+ func createSpoofDetectorOutput(options: SpoofDetectorOutputOptions) throws -> (any HybridCameraOutputSpec)
18
+ }
19
+
20
+ public extension HybridSpoofDetectorFactorySpec_protocol {
21
+ /// Default implementation of ``HybridObject.toString``
22
+ func toString() -> String {
23
+ return "[HybridObject SpoofDetectorFactory]"
24
+ }
25
+ }
26
+
27
+ /// See ``HybridSpoofDetectorFactorySpec``
28
+ open class HybridSpoofDetectorFactorySpec_base {
29
+ private weak var cxxWrapper: HybridSpoofDetectorFactorySpec_cxx? = nil
30
+ public init() { }
31
+ public func getCxxWrapper() -> HybridSpoofDetectorFactorySpec_cxx {
32
+ #if DEBUG
33
+ guard self is any HybridSpoofDetectorFactorySpec else {
34
+ fatalError("`self` is not a `HybridSpoofDetectorFactorySpec`! Did you accidentally inherit from `HybridSpoofDetectorFactorySpec_base` instead of `HybridSpoofDetectorFactorySpec`?")
35
+ }
36
+ #endif
37
+ if let cxxWrapper = self.cxxWrapper {
38
+ return cxxWrapper
39
+ } else {
40
+ let cxxWrapper = HybridSpoofDetectorFactorySpec_cxx(self as! any HybridSpoofDetectorFactorySpec)
41
+ self.cxxWrapper = cxxWrapper
42
+ return cxxWrapper
43
+ }
44
+ }
45
+ }
46
+
47
+ /**
48
+ * A Swift base-protocol representing the SpoofDetectorFactory HybridObject.
49
+ * Implement this protocol to create Swift-based instances of SpoofDetectorFactory.
50
+ * ```swift
51
+ * class HybridSpoofDetectorFactory : HybridSpoofDetectorFactorySpec {
52
+ * // ...
53
+ * }
54
+ * ```
55
+ */
56
+ public typealias HybridSpoofDetectorFactorySpec = HybridSpoofDetectorFactorySpec_protocol & HybridSpoofDetectorFactorySpec_base
@@ -0,0 +1,142 @@
1
+ ///
2
+ /// HybridSpoofDetectorFactorySpec_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
+ import VisionCamera
10
+
11
+ /**
12
+ * A class implementation that bridges HybridSpoofDetectorFactorySpec over to C++.
13
+ * In C++, we cannot use Swift protocols - so we need to wrap it in a class to make it strongly defined.
14
+ *
15
+ * Also, some Swift types need to be bridged with special handling:
16
+ * - Enums need to be wrapped in Structs, otherwise they cannot be accessed bi-directionally (Swift bug: https://github.com/swiftlang/swift/issues/75330)
17
+ * - Other HybridObjects need to be wrapped/unwrapped from the Swift TCxx wrapper
18
+ * - Throwing methods need to be wrapped with a Result<T, Error> type, as exceptions cannot be propagated to C++
19
+ */
20
+ open class HybridSpoofDetectorFactorySpec_cxx {
21
+ /**
22
+ * The Swift <> C++ bridge's namespace (`margelo::nitro::camera::spoofdetector::bridge::swift`)
23
+ * from `VisionCameraSpoofDetector-Swift-Cxx-Bridge.hpp`.
24
+ * This contains specialized C++ templates, and C++ helper functions that can be accessed from Swift.
25
+ */
26
+ public typealias bridge = margelo.nitro.camera.spoofdetector.bridge.swift
27
+
28
+ /**
29
+ * Holds an instance of the `HybridSpoofDetectorFactorySpec` Swift protocol.
30
+ */
31
+ private var __implementation: any HybridSpoofDetectorFactorySpec
32
+
33
+ /**
34
+ * Holds a weak pointer to the C++ class that wraps the Swift class.
35
+ */
36
+ private var __cxxPart: bridge.std__weak_ptr_HybridSpoofDetectorFactorySpec_
37
+
38
+ /**
39
+ * Create a new `HybridSpoofDetectorFactorySpec_cxx` that wraps the given `HybridSpoofDetectorFactorySpec`.
40
+ * All properties and methods bridge to C++ types.
41
+ */
42
+ public init(_ implementation: any HybridSpoofDetectorFactorySpec) {
43
+ self.__implementation = implementation
44
+ self.__cxxPart = .init()
45
+ /* no base class */
46
+ }
47
+
48
+ /**
49
+ * Get the actual `HybridSpoofDetectorFactorySpec` instance this class wraps.
50
+ */
51
+ @inline(__always)
52
+ public func getHybridSpoofDetectorFactorySpec() -> any HybridSpoofDetectorFactorySpec {
53
+ return __implementation
54
+ }
55
+
56
+ /**
57
+ * Casts this instance to a retained unsafe raw pointer.
58
+ * This acquires one additional strong reference on the object!
59
+ */
60
+ public func toUnsafe() -> UnsafeMutableRawPointer {
61
+ return Unmanaged.passRetained(self).toOpaque()
62
+ }
63
+
64
+ /**
65
+ * Casts an unsafe pointer to a `HybridSpoofDetectorFactorySpec_cxx`.
66
+ * The pointer has to be a retained opaque `Unmanaged<HybridSpoofDetectorFactorySpec_cxx>`.
67
+ * This removes one strong reference from the object!
68
+ */
69
+ public class func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> HybridSpoofDetectorFactorySpec_cxx {
70
+ return Unmanaged<HybridSpoofDetectorFactorySpec_cxx>.fromOpaque(pointer).takeRetainedValue()
71
+ }
72
+
73
+ /**
74
+ * Gets (or creates) the C++ part of this Hybrid Object.
75
+ * The C++ part is a `std::shared_ptr<HybridSpoofDetectorFactorySpec>`.
76
+ */
77
+ public func getCxxPart() -> bridge.std__shared_ptr_HybridSpoofDetectorFactorySpec_ {
78
+ let cachedCxxPart = self.__cxxPart.lock()
79
+ if Bool(fromCxx: cachedCxxPart) {
80
+ return cachedCxxPart
81
+ } else {
82
+ let newCxxPart = bridge.create_std__shared_ptr_HybridSpoofDetectorFactorySpec_(self.toUnsafe())
83
+ __cxxPart = bridge.weakify_std__shared_ptr_HybridSpoofDetectorFactorySpec_(newCxxPart)
84
+ return newCxxPart
85
+ }
86
+ }
87
+
88
+
89
+
90
+ /**
91
+ * Get the memory size of the Swift class (plus size of any other allocations)
92
+ * so the JS VM can properly track it and garbage-collect the JS object if needed.
93
+ */
94
+ @inline(__always)
95
+ public var memorySize: Int {
96
+ return MemoryHelper.getSizeOf(self.__implementation) + self.__implementation.memorySize
97
+ }
98
+
99
+ /**
100
+ * Compares this object with the given [other] object for reference equality.
101
+ */
102
+ @inline(__always)
103
+ public func equals(other: HybridSpoofDetectorFactorySpec_cxx) -> Bool {
104
+ return self.__implementation === other.__implementation
105
+ }
106
+
107
+ /**
108
+ * Call dispose() on the Swift class.
109
+ * This _may_ be called manually from JS.
110
+ */
111
+ @inline(__always)
112
+ public func dispose() {
113
+ self.__implementation.dispose()
114
+ }
115
+
116
+ /**
117
+ * Call toString() on the Swift class.
118
+ */
119
+ @inline(__always)
120
+ public func toString() -> String {
121
+ return self.__implementation.toString()
122
+ }
123
+
124
+ // Properties
125
+
126
+
127
+ // Methods
128
+ @inline(__always)
129
+ public final func createSpoofDetectorOutput(options: SpoofDetectorOutputOptions) -> bridge.Result_std__shared_ptr_margelo__nitro__camera__HybridCameraOutputSpec__ {
130
+ do {
131
+ let __result = try self.__implementation.createSpoofDetectorOutput(options: options)
132
+ let __resultCpp = { () -> bridge.std__shared_ptr_margelo__nitro__camera__HybridCameraOutputSpec_ in
133
+ let __cxxWrapped = __result.getCxxWrapper()
134
+ return __cxxWrapped.getCxxPart()
135
+ }()
136
+ return bridge.create_Result_std__shared_ptr_margelo__nitro__camera__HybridCameraOutputSpec__(__resultCpp)
137
+ } catch (let __error) {
138
+ let __exceptionPtr = __error.toCpp()
139
+ return bridge.create_Result_std__shared_ptr_margelo__nitro__camera__HybridCameraOutputSpec__(__exceptionPtr)
140
+ }
141
+ }
142
+ }
@@ -0,0 +1,34 @@
1
+ ///
2
+ /// Size.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 `Size`, backed by a C++ struct.
12
+ */
13
+ public typealias Size = margelo.nitro.camera.spoofdetector.Size
14
+
15
+ public extension Size {
16
+ private typealias bridge = margelo.nitro.camera.spoofdetector.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `Size`.
20
+ */
21
+ init(width: Double, height: Double) {
22
+ self.init(width, height)
23
+ }
24
+
25
+ @inline(__always)
26
+ var width: Double {
27
+ return self.__width
28
+ }
29
+
30
+ @inline(__always)
31
+ var height: Double {
32
+ return self.__height
33
+ }
34
+ }
@@ -0,0 +1,74 @@
1
+ ///
2
+ /// SpoofDetectorOutputOptions.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 `SpoofDetectorOutputOptions`, backed by a C++ struct.
12
+ */
13
+ public typealias SpoofDetectorOutputOptions = margelo.nitro.camera.spoofdetector.SpoofDetectorOutputOptions
14
+
15
+ public extension SpoofDetectorOutputOptions {
16
+ private typealias bridge = margelo.nitro.camera.spoofdetector.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `SpoofDetectorOutputOptions`.
20
+ */
21
+ init(targetResolution: Size?, onResult: @escaping (_ result: AntiSpoofingResult) -> Void, onError: ((_ error: Error) -> Void)?) {
22
+ self.init({ () -> bridge.std__optional_Size_ in
23
+ if let __unwrappedValue = targetResolution {
24
+ return bridge.create_std__optional_Size_(__unwrappedValue)
25
+ } else {
26
+ return .init()
27
+ }
28
+ }(), { () -> bridge.Func_void_AntiSpoofingResult in
29
+ let __closureWrapper = Func_void_AntiSpoofingResult(onResult)
30
+ return bridge.create_Func_void_AntiSpoofingResult(__closureWrapper.toUnsafe())
31
+ }(), { () -> bridge.std__optional_std__function_void_const_std__exception_ptr_____error______ in
32
+ if let __unwrappedValue = onError {
33
+ return bridge.create_std__optional_std__function_void_const_std__exception_ptr_____error______({ () -> bridge.Func_void_std__exception_ptr in
34
+ let __closureWrapper = Func_void_std__exception_ptr(__unwrappedValue)
35
+ return bridge.create_Func_void_std__exception_ptr(__closureWrapper.toUnsafe())
36
+ }())
37
+ } else {
38
+ return .init()
39
+ }
40
+ }())
41
+ }
42
+
43
+ @inline(__always)
44
+ var targetResolution: Size? {
45
+ return self.__targetResolution.value
46
+ }
47
+
48
+ @inline(__always)
49
+ var onResult: (_ result: AntiSpoofingResult) -> Void {
50
+ return { () -> (AntiSpoofingResult) -> Void in
51
+ let __wrappedFunction = bridge.wrap_Func_void_AntiSpoofingResult(self.__onResult)
52
+ return { (__result: AntiSpoofingResult) -> Void in
53
+ __wrappedFunction.call(__result)
54
+ }
55
+ }()
56
+ }
57
+
58
+ @inline(__always)
59
+ var onError: ((_ error: Error) -> Void)? {
60
+ return { () -> ((_ error: Error) -> Void)? in
61
+ if bridge.has_value_std__optional_std__function_void_const_std__exception_ptr_____error______(self.__onError) {
62
+ let __unwrapped = bridge.get_std__optional_std__function_void_const_std__exception_ptr_____error______(self.__onError)
63
+ return { () -> (Error) -> Void in
64
+ let __wrappedFunction = bridge.wrap_Func_void_std__exception_ptr(__unwrapped)
65
+ return { (__error: Error) -> Void in
66
+ __wrappedFunction.call(__error.toCpp())
67
+ }
68
+ }()
69
+ } else {
70
+ return nil
71
+ }
72
+ }()
73
+ }
74
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-vision-camera-spoof-detector",
3
- "version": "1.1.10",
3
+ "version": "1.1.15",
4
4
  "description": "High-performance face anti-spoofing and liveness detection module for React Native Vision Camera. Uses TensorFlow Lite with GPU acceleration and optimized YUV processing.",
5
5
  "homepage": "https://github.com/dpraful/react-native-vision-camera-spoof-detector",
6
6
  "repository": {
@@ -27,18 +27,22 @@
27
27
  "react-native": "index.js",
28
28
  "types": "index.d.ts",
29
29
  "files": [
30
- "android/",
30
+ "android/build.gradle",
31
+ "android/CMakeLists.txt",
32
+ "android/fix-prefab.gradle",
33
+ "android/src/",
31
34
  "lib/",
32
35
  "src/",
33
36
  "nitrogen/",
34
37
  "nitro.json",
35
38
  "ios/",
36
39
  ".npmignore",
40
+ ".gitignore",
37
41
  "CHANGELOG.md",
38
42
  "index.d.ts",
39
43
  "index.js",
40
44
  "LICENSE",
41
- "react-native-vision-camera-spoof-detector.podspec",
45
+ "VisionCameraSpoofDetector.podspec",
42
46
  "README.md"
43
47
  ],
44
48
  "keywords": [
@@ -63,6 +67,7 @@
63
67
  "react-native": ">=0.60.0",
64
68
  "react-native-vision-camera": "^5.0.0",
65
69
  "react-native-vision-camera-worklets": "^5.0.0",
70
+ "react-native-nitro-modules": "^0.37.1",
66
71
  "react-native-worklets": "^0.12.0"
67
72
  },
68
73
  "peerDependenciesMeta": {
@@ -17,6 +17,7 @@ export interface SpoofDetectorOutputOptions {
17
17
  }
18
18
 
19
19
  export interface SpoofDetectorFactory extends HybridObject<{
20
+ ios: 'swift'
20
21
  android: 'kotlin'
21
22
  }> {
22
23
  createSpoofDetectorOutput(options: SpoofDetectorOutputOptions): CameraOutput