react-native-vision-camera-spoof-detector 1.1.0 → 1.1.8
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.
Potentially problematic release.
This version of react-native-vision-camera-spoof-detector might be problematic. Click here for more details.
- package/.npmignore +16 -0
- package/android/CMakeLists.txt +29 -0
- package/android/build.gradle +26 -10
- package/android/fix-prefab.gradle +4 -0
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/cpp/CMakeLists.txt +18 -86
- package/android/src/main/cpp/FaceAntiSpoofJSI.cpp +80 -6
- package/android/src/main/cpp/cpp-adapter.cpp +9 -0
- package/android/src/main/java/com/faceantispoof/FaceAntiSpoofModule.kt +55 -103
- package/android/src/main/java/com/faceantispoof/FaceAntiSpoofPackage.kt +15 -8
- package/android/src/main/java/com/margelo/nitro/camera/spoofdetector/HybridSpoofDetectorFactory.kt +15 -0
- package/android/src/main/java/com/margelo/nitro/camera/spoofdetector/HybridSpoofDetectorOutput.kt +107 -0
- package/index.js +23 -42
- package/nitro.json +20 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/VisionCameraSpoofDetector+autolinking.cmake +81 -0
- package/nitrogen/generated/android/VisionCameraSpoofDetector+autolinking.gradle +27 -0
- package/nitrogen/generated/android/VisionCameraSpoofDetectorOnLoad.cpp +58 -0
- package/nitrogen/generated/android/VisionCameraSpoofDetectorOnLoad.hpp +34 -0
- package/nitrogen/generated/android/c++/JAntiSpoofingResult.hpp +77 -0
- package/nitrogen/generated/android/c++/JFunc_void_AntiSpoofingResult.hpp +78 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__exception_ptr.hpp +76 -0
- package/nitrogen/generated/android/c++/JHybridSpoofDetectorFactorySpec.cpp +75 -0
- package/nitrogen/generated/android/c++/JHybridSpoofDetectorFactorySpec.hpp +63 -0
- package/nitrogen/generated/android/c++/JSize.hpp +61 -0
- package/nitrogen/generated/android/c++/JSpoofDetectorOutputOptions.hpp +91 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/spoofdetector/AntiSpoofingResult.kt +76 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/spoofdetector/Func_void_AntiSpoofingResult.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/spoofdetector/Func_void_std__exception_ptr.kt +78 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/spoofdetector/HybridSpoofDetectorFactorySpec.kt +57 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/spoofdetector/Size.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/spoofdetector/SpoofDetectorOutputOptions.kt +65 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/camera/spoofdetector/VisionCameraSpoofDetectorOnLoad.kt +35 -0
- package/nitrogen/generated/shared/c++/AntiSpoofingResult.hpp +103 -0
- package/nitrogen/generated/shared/c++/HybridSpoofDetectorFactorySpec.cpp +21 -0
- package/nitrogen/generated/shared/c++/HybridSpoofDetectorFactorySpec.hpp +67 -0
- package/nitrogen/generated/shared/c++/Size.hpp +87 -0
- package/nitrogen/generated/shared/c++/SpoofDetectorOutputOptions.hpp +98 -0
- package/package.json +10 -8
- package/src/specs/SpoofDetectorFactory.nitro.ts +23 -0
- package/android/src/main/assets/spoof_model_scale_2_7.tflite +0 -0
- package/android/src/main/assets/spoof_model_scale_4_0.tflite +0 -0
- /package/{android/src/main → lib}/assets/FaceAntiSpoofing.tflite +0 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridSpoofDetectorFactorySpec.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 "JHybridSpoofDetectorFactorySpec.hpp"
|
|
9
|
+
|
|
10
|
+
// Forward declaration of `HybridCameraOutputSpec` to properly resolve imports.
|
|
11
|
+
namespace margelo::nitro::camera { class HybridCameraOutputSpec; }
|
|
12
|
+
// Forward declaration of `SpoofDetectorOutputOptions` to properly resolve imports.
|
|
13
|
+
namespace margelo::nitro::camera::spoofdetector { struct SpoofDetectorOutputOptions; }
|
|
14
|
+
// Forward declaration of `Size` to properly resolve imports.
|
|
15
|
+
namespace margelo::nitro::camera::spoofdetector { struct Size; }
|
|
16
|
+
// Forward declaration of `AntiSpoofingResult` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::camera::spoofdetector { struct AntiSpoofingResult; }
|
|
18
|
+
|
|
19
|
+
#include <memory>
|
|
20
|
+
#include <VisionCamera/HybridCameraOutputSpec.hpp>
|
|
21
|
+
#include <VisionCamera/JHybridCameraOutputSpec.hpp>
|
|
22
|
+
#include "SpoofDetectorOutputOptions.hpp"
|
|
23
|
+
#include "JSpoofDetectorOutputOptions.hpp"
|
|
24
|
+
#include "Size.hpp"
|
|
25
|
+
#include <optional>
|
|
26
|
+
#include "JSize.hpp"
|
|
27
|
+
#include "AntiSpoofingResult.hpp"
|
|
28
|
+
#include <functional>
|
|
29
|
+
#include "JFunc_void_AntiSpoofingResult.hpp"
|
|
30
|
+
#include <NitroModules/JNICallable.hpp>
|
|
31
|
+
#include "JAntiSpoofingResult.hpp"
|
|
32
|
+
#include <string>
|
|
33
|
+
#include <exception>
|
|
34
|
+
#include "JFunc_void_std__exception_ptr.hpp"
|
|
35
|
+
|
|
36
|
+
namespace margelo::nitro::camera::spoofdetector {
|
|
37
|
+
|
|
38
|
+
std::shared_ptr<JHybridSpoofDetectorFactorySpec> JHybridSpoofDetectorFactorySpec::JavaPart::getJHybridSpoofDetectorFactorySpec() {
|
|
39
|
+
auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
|
|
40
|
+
auto castHybridObject = std::dynamic_pointer_cast<JHybridSpoofDetectorFactorySpec>(hybridObject);
|
|
41
|
+
if (castHybridObject == nullptr) [[unlikely]] {
|
|
42
|
+
throw std::runtime_error("Failed to downcast JHybridObject to JHybridSpoofDetectorFactorySpec!");
|
|
43
|
+
}
|
|
44
|
+
return castHybridObject;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
jni::local_ref<JHybridSpoofDetectorFactorySpec::CxxPart::jhybriddata> JHybridSpoofDetectorFactorySpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
48
|
+
return makeCxxInstance(jThis);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
std::shared_ptr<JHybridObject> JHybridSpoofDetectorFactorySpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
|
|
52
|
+
auto castJavaPart = jni::dynamic_ref_cast<JHybridSpoofDetectorFactorySpec::JavaPart>(javaPart);
|
|
53
|
+
if (castJavaPart == nullptr) [[unlikely]] {
|
|
54
|
+
throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridSpoofDetectorFactorySpec::JavaPart!");
|
|
55
|
+
}
|
|
56
|
+
return std::make_shared<JHybridSpoofDetectorFactorySpec>(castJavaPart);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
void JHybridSpoofDetectorFactorySpec::CxxPart::registerNatives() {
|
|
60
|
+
registerHybrid({
|
|
61
|
+
makeNativeMethod("initHybrid", JHybridSpoofDetectorFactorySpec::CxxPart::initHybrid),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Properties
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
// Methods
|
|
69
|
+
std::shared_ptr<margelo::nitro::camera::HybridCameraOutputSpec> JHybridSpoofDetectorFactorySpec::createSpoofDetectorOutput(const SpoofDetectorOutputOptions& options) {
|
|
70
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<margelo::nitro::camera::JHybridCameraOutputSpec::JavaPart>(jni::alias_ref<JSpoofDetectorOutputOptions> /* options */)>("createSpoofDetectorOutput");
|
|
71
|
+
auto __result = method(_javaPart, JSpoofDetectorOutputOptions::fromCpp(options));
|
|
72
|
+
return __result->getJHybridCameraOutputSpec();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
} // namespace margelo::nitro::camera::spoofdetector
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridSpoofDetectorFactorySpec.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 <NitroModules/JHybridObject.hpp>
|
|
11
|
+
#include <fbjni/fbjni.h>
|
|
12
|
+
#include "HybridSpoofDetectorFactorySpec.hpp"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::camera::spoofdetector {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
class JHybridSpoofDetectorFactorySpec: public virtual HybridSpoofDetectorFactorySpec, public virtual JHybridObject {
|
|
22
|
+
public:
|
|
23
|
+
struct JavaPart: public jni::JavaClass<JavaPart, JHybridObject::JavaPart> {
|
|
24
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/camera/spoofdetector/HybridSpoofDetectorFactorySpec;";
|
|
25
|
+
std::shared_ptr<JHybridSpoofDetectorFactorySpec> getJHybridSpoofDetectorFactorySpec();
|
|
26
|
+
};
|
|
27
|
+
struct CxxPart: public jni::HybridClass<CxxPart, JHybridObject::CxxPart> {
|
|
28
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/camera/spoofdetector/HybridSpoofDetectorFactorySpec$CxxPart;";
|
|
29
|
+
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
|
|
30
|
+
static void registerNatives();
|
|
31
|
+
using HybridBase::HybridBase;
|
|
32
|
+
protected:
|
|
33
|
+
std::shared_ptr<JHybridObject> createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) override;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
public:
|
|
37
|
+
explicit JHybridSpoofDetectorFactorySpec(const jni::local_ref<JHybridSpoofDetectorFactorySpec::JavaPart>& javaPart):
|
|
38
|
+
HybridObject(HybridSpoofDetectorFactorySpec::TAG),
|
|
39
|
+
JHybridObject(javaPart),
|
|
40
|
+
_javaPart(jni::make_global(javaPart)) {}
|
|
41
|
+
~JHybridSpoofDetectorFactorySpec() override {
|
|
42
|
+
// Hermes GC can destroy JS objects on a non-JNI Thread.
|
|
43
|
+
jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
inline const jni::global_ref<JHybridSpoofDetectorFactorySpec::JavaPart>& getJavaPart() const noexcept {
|
|
48
|
+
return _javaPart;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
// Properties
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
// Methods
|
|
57
|
+
std::shared_ptr<margelo::nitro::camera::HybridCameraOutputSpec> createSpoofDetectorOutput(const SpoofDetectorOutputOptions& options) override;
|
|
58
|
+
|
|
59
|
+
private:
|
|
60
|
+
jni::global_ref<JHybridSpoofDetectorFactorySpec::JavaPart> _javaPart;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
} // namespace margelo::nitro::camera::spoofdetector
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JSize.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 "Size.hpp"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::camera::spoofdetector {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "Size" and the Kotlin data class "Size".
|
|
21
|
+
*/
|
|
22
|
+
struct JSize final: public jni::JavaClass<JSize> {
|
|
23
|
+
public:
|
|
24
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/camera/spoofdetector/Size;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct Size by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
Size toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldWidth = clazz->getField<double>("width");
|
|
35
|
+
double width = this->getFieldValue(fieldWidth);
|
|
36
|
+
static const auto fieldHeight = clazz->getField<double>("height");
|
|
37
|
+
double height = this->getFieldValue(fieldHeight);
|
|
38
|
+
return Size(
|
|
39
|
+
width,
|
|
40
|
+
height
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public:
|
|
45
|
+
/**
|
|
46
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
47
|
+
*/
|
|
48
|
+
[[maybe_unused]]
|
|
49
|
+
static jni::local_ref<JSize::javaobject> fromCpp(const Size& value) {
|
|
50
|
+
using JSignature = JSize(double, double);
|
|
51
|
+
static const auto clazz = javaClassStatic();
|
|
52
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
53
|
+
return create(
|
|
54
|
+
clazz,
|
|
55
|
+
value.width,
|
|
56
|
+
value.height
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
} // namespace margelo::nitro::camera::spoofdetector
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JSpoofDetectorOutputOptions.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 "SpoofDetectorOutputOptions.hpp"
|
|
12
|
+
|
|
13
|
+
#include "AntiSpoofingResult.hpp"
|
|
14
|
+
#include "JAntiSpoofingResult.hpp"
|
|
15
|
+
#include "JFunc_void_AntiSpoofingResult.hpp"
|
|
16
|
+
#include "JFunc_void_std__exception_ptr.hpp"
|
|
17
|
+
#include "JSize.hpp"
|
|
18
|
+
#include "Size.hpp"
|
|
19
|
+
#include <NitroModules/JNICallable.hpp>
|
|
20
|
+
#include <exception>
|
|
21
|
+
#include <functional>
|
|
22
|
+
#include <optional>
|
|
23
|
+
#include <string>
|
|
24
|
+
|
|
25
|
+
namespace margelo::nitro::camera::spoofdetector {
|
|
26
|
+
|
|
27
|
+
using namespace facebook;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The C++ JNI bridge between the C++ struct "SpoofDetectorOutputOptions" and the Kotlin data class "SpoofDetectorOutputOptions".
|
|
31
|
+
*/
|
|
32
|
+
struct JSpoofDetectorOutputOptions final: public jni::JavaClass<JSpoofDetectorOutputOptions> {
|
|
33
|
+
public:
|
|
34
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/camera/spoofdetector/SpoofDetectorOutputOptions;";
|
|
35
|
+
|
|
36
|
+
public:
|
|
37
|
+
/**
|
|
38
|
+
* Convert this Java/Kotlin-based struct to the C++ struct SpoofDetectorOutputOptions by copying all values to C++.
|
|
39
|
+
*/
|
|
40
|
+
[[maybe_unused]]
|
|
41
|
+
[[nodiscard]]
|
|
42
|
+
SpoofDetectorOutputOptions toCpp() const {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
static const auto fieldTargetResolution = clazz->getField<JSize>("targetResolution");
|
|
45
|
+
jni::local_ref<JSize> targetResolution = this->getFieldValue(fieldTargetResolution);
|
|
46
|
+
static const auto fieldOnResult = clazz->getField<JFunc_void_AntiSpoofingResult::javaobject>("onResult");
|
|
47
|
+
jni::local_ref<JFunc_void_AntiSpoofingResult::javaobject> onResult = this->getFieldValue(fieldOnResult);
|
|
48
|
+
static const auto fieldOnError = clazz->getField<JFunc_void_std__exception_ptr::javaobject>("onError");
|
|
49
|
+
jni::local_ref<JFunc_void_std__exception_ptr::javaobject> onError = this->getFieldValue(fieldOnError);
|
|
50
|
+
return SpoofDetectorOutputOptions(
|
|
51
|
+
targetResolution != nullptr ? std::make_optional(targetResolution->toCpp()) : std::nullopt,
|
|
52
|
+
[&]() -> std::function<void(const AntiSpoofingResult& /* result */)> {
|
|
53
|
+
if (onResult->isInstanceOf(JFunc_void_AntiSpoofingResult_cxx::javaClassStatic())) [[likely]] {
|
|
54
|
+
auto downcast = jni::static_ref_cast<JFunc_void_AntiSpoofingResult_cxx::javaobject>(onResult);
|
|
55
|
+
return downcast->cthis()->getFunction();
|
|
56
|
+
} else {
|
|
57
|
+
auto onResultRef = jni::make_global(onResult);
|
|
58
|
+
return JNICallable<JFunc_void_AntiSpoofingResult, void(AntiSpoofingResult)>(std::move(onResultRef));
|
|
59
|
+
}
|
|
60
|
+
}(),
|
|
61
|
+
onError != nullptr ? std::make_optional([&]() -> std::function<void(const std::exception_ptr& /* error */)> {
|
|
62
|
+
if (onError->isInstanceOf(JFunc_void_std__exception_ptr_cxx::javaClassStatic())) [[likely]] {
|
|
63
|
+
auto downcast = jni::static_ref_cast<JFunc_void_std__exception_ptr_cxx::javaobject>(onError);
|
|
64
|
+
return downcast->cthis()->getFunction();
|
|
65
|
+
} else {
|
|
66
|
+
auto onErrorRef = jni::make_global(onError);
|
|
67
|
+
return JNICallable<JFunc_void_std__exception_ptr, void(std::exception_ptr)>(std::move(onErrorRef));
|
|
68
|
+
}
|
|
69
|
+
}()) : std::nullopt
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public:
|
|
74
|
+
/**
|
|
75
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
76
|
+
*/
|
|
77
|
+
[[maybe_unused]]
|
|
78
|
+
static jni::local_ref<JSpoofDetectorOutputOptions::javaobject> fromCpp(const SpoofDetectorOutputOptions& value) {
|
|
79
|
+
using JSignature = JSpoofDetectorOutputOptions(jni::alias_ref<JSize>, jni::alias_ref<JFunc_void_AntiSpoofingResult::javaobject>, jni::alias_ref<JFunc_void_std__exception_ptr::javaobject>);
|
|
80
|
+
static const auto clazz = javaClassStatic();
|
|
81
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
82
|
+
return create(
|
|
83
|
+
clazz,
|
|
84
|
+
value.targetResolution.has_value() ? JSize::fromCpp(value.targetResolution.value()) : nullptr,
|
|
85
|
+
JFunc_void_AntiSpoofingResult_cxx::fromCpp(value.onResult),
|
|
86
|
+
value.onError.has_value() ? JFunc_void_std__exception_ptr_cxx::fromCpp(value.onError.value()) : nullptr
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
} // namespace margelo::nitro::camera::spoofdetector
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AntiSpoofingResult.kt
|
|
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
|
+
package com.margelo.nitro.camera.spoofdetector
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import java.util.Objects
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "AntiSpoofingResult".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class AntiSpoofingResult(
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
val isLive: Boolean,
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val label: String,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val neuralNetworkScore: Double,
|
|
30
|
+
@DoNotStrip
|
|
31
|
+
@Keep
|
|
32
|
+
val laplacianScore: Double,
|
|
33
|
+
@DoNotStrip
|
|
34
|
+
@Keep
|
|
35
|
+
val combinedScore: Double,
|
|
36
|
+
@DoNotStrip
|
|
37
|
+
@Keep
|
|
38
|
+
val confidence: Double
|
|
39
|
+
) {
|
|
40
|
+
/* primary constructor */
|
|
41
|
+
|
|
42
|
+
override fun equals(other: Any?): Boolean {
|
|
43
|
+
if (this === other) return true
|
|
44
|
+
if (other !is AntiSpoofingResult) return false
|
|
45
|
+
return Objects.deepEquals(this.isLive, other.isLive)
|
|
46
|
+
&& Objects.deepEquals(this.label, other.label)
|
|
47
|
+
&& Objects.deepEquals(this.neuralNetworkScore, other.neuralNetworkScore)
|
|
48
|
+
&& Objects.deepEquals(this.laplacianScore, other.laplacianScore)
|
|
49
|
+
&& Objects.deepEquals(this.combinedScore, other.combinedScore)
|
|
50
|
+
&& Objects.deepEquals(this.confidence, other.confidence)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
override fun hashCode(): Int {
|
|
54
|
+
return arrayOf<Any?>(
|
|
55
|
+
isLive,
|
|
56
|
+
label,
|
|
57
|
+
neuralNetworkScore,
|
|
58
|
+
laplacianScore,
|
|
59
|
+
combinedScore,
|
|
60
|
+
confidence
|
|
61
|
+
).contentDeepHashCode()
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
companion object {
|
|
65
|
+
/**
|
|
66
|
+
* Constructor called from C++
|
|
67
|
+
*/
|
|
68
|
+
@DoNotStrip
|
|
69
|
+
@Keep
|
|
70
|
+
@Suppress("unused")
|
|
71
|
+
@JvmStatic
|
|
72
|
+
private fun fromCpp(isLive: Boolean, label: String, neuralNetworkScore: Double, laplacianScore: Double, combinedScore: Double, confidence: Double): AntiSpoofingResult {
|
|
73
|
+
return AntiSpoofingResult(isLive, label, neuralNetworkScore, laplacianScore, combinedScore, confidence)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_AntiSpoofingResult.kt
|
|
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
|
+
package com.margelo.nitro.camera.spoofdetector
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript callback `(result: struct) => void`.
|
|
17
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
18
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
23
|
+
fun interface Func_void_AntiSpoofingResult: (AntiSpoofingResult) -> Unit {
|
|
24
|
+
/**
|
|
25
|
+
* Call the given JS callback.
|
|
26
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
27
|
+
*/
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
@Keep
|
|
30
|
+
override fun invoke(result: AntiSpoofingResult): Unit
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the JavaScript callback `(result: struct) => void`.
|
|
35
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
36
|
+
* The callback might be coming from JS.
|
|
37
|
+
*/
|
|
38
|
+
@DoNotStrip
|
|
39
|
+
@Keep
|
|
40
|
+
@Suppress(
|
|
41
|
+
"KotlinJniMissingFunction", "unused",
|
|
42
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
43
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
44
|
+
)
|
|
45
|
+
class Func_void_AntiSpoofingResult_cxx: Func_void_AntiSpoofingResult {
|
|
46
|
+
@DoNotStrip
|
|
47
|
+
@Keep
|
|
48
|
+
private val mHybridData: HybridData
|
|
49
|
+
|
|
50
|
+
@DoNotStrip
|
|
51
|
+
@Keep
|
|
52
|
+
private constructor(hybridData: HybridData) {
|
|
53
|
+
mHybridData = hybridData
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
override fun invoke(result: AntiSpoofingResult): Unit
|
|
59
|
+
= invoke_cxx(result)
|
|
60
|
+
|
|
61
|
+
private external fun invoke_cxx(result: AntiSpoofingResult): Unit
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Represents the JavaScript callback `(result: struct) => void`.
|
|
66
|
+
* This is implemented in Java/Kotlin, via a `(AntiSpoofingResult) -> Unit`.
|
|
67
|
+
* The callback is always coming from native.
|
|
68
|
+
*/
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
72
|
+
class Func_void_AntiSpoofingResult_java(private val function: (AntiSpoofingResult) -> Unit): Func_void_AntiSpoofingResult {
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
override fun invoke(result: AntiSpoofingResult): Unit {
|
|
76
|
+
return this.function(result)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__exception_ptr.kt
|
|
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
|
+
package com.margelo.nitro.camera.spoofdetector
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript callback `(error: error) => void`.
|
|
17
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
18
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
23
|
+
fun interface Func_void_std__exception_ptr: (Throwable) -> Unit {
|
|
24
|
+
/**
|
|
25
|
+
* Call the given JS callback.
|
|
26
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
27
|
+
*/
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
@Keep
|
|
30
|
+
override fun invoke(error: Throwable): Unit
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Represents the JavaScript callback `(error: error) => void`.
|
|
35
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
36
|
+
* The callback might be coming from JS.
|
|
37
|
+
*/
|
|
38
|
+
@DoNotStrip
|
|
39
|
+
@Keep
|
|
40
|
+
@Suppress(
|
|
41
|
+
"KotlinJniMissingFunction", "unused",
|
|
42
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
43
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
44
|
+
)
|
|
45
|
+
class Func_void_std__exception_ptr_cxx: Func_void_std__exception_ptr {
|
|
46
|
+
@DoNotStrip
|
|
47
|
+
@Keep
|
|
48
|
+
private val mHybridData: HybridData
|
|
49
|
+
|
|
50
|
+
@DoNotStrip
|
|
51
|
+
@Keep
|
|
52
|
+
private constructor(hybridData: HybridData) {
|
|
53
|
+
mHybridData = hybridData
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@DoNotStrip
|
|
57
|
+
@Keep
|
|
58
|
+
override fun invoke(error: Throwable): Unit
|
|
59
|
+
= invoke_cxx(error)
|
|
60
|
+
|
|
61
|
+
private external fun invoke_cxx(error: Throwable): Unit
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Represents the JavaScript callback `(error: error) => void`.
|
|
66
|
+
* This is implemented in Java/Kotlin, via a `(Throwable) -> Unit`.
|
|
67
|
+
* The callback is always coming from native.
|
|
68
|
+
*/
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
72
|
+
class Func_void_std__exception_ptr_java(private val function: (Throwable) -> Unit): Func_void_std__exception_ptr {
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
override fun invoke(error: Throwable): Unit {
|
|
76
|
+
return this.function(error)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridSpoofDetectorFactorySpec.kt
|
|
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
|
+
package com.margelo.nitro.camera.spoofdetector
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import dalvik.annotation.optimization.FastNative
|
|
14
|
+
import com.margelo.nitro.camera.HybridCameraOutputSpec
|
|
15
|
+
import com.margelo.nitro.core.HybridObject
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A Kotlin class representing the SpoofDetectorFactory HybridObject.
|
|
19
|
+
* Implement this abstract class to create Kotlin-based instances of SpoofDetectorFactory.
|
|
20
|
+
*/
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
@Suppress(
|
|
24
|
+
"KotlinJniMissingFunction", "unused",
|
|
25
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
26
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
27
|
+
)
|
|
28
|
+
abstract class HybridSpoofDetectorFactorySpec: HybridObject() {
|
|
29
|
+
// Properties
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
// Methods
|
|
33
|
+
@DoNotStrip
|
|
34
|
+
@Keep
|
|
35
|
+
abstract fun createSpoofDetectorOutput(options: SpoofDetectorOutputOptions): com.margelo.nitro.camera.HybridCameraOutputSpec
|
|
36
|
+
|
|
37
|
+
// Default implementation of `HybridObject.toString()`
|
|
38
|
+
override fun toString(): String {
|
|
39
|
+
return "[HybridObject SpoofDetectorFactory]"
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// C++ backing class
|
|
43
|
+
@DoNotStrip
|
|
44
|
+
@Keep
|
|
45
|
+
protected open class CxxPart(javaPart: HybridSpoofDetectorFactorySpec): HybridObject.CxxPart(javaPart) {
|
|
46
|
+
// C++ JHybridSpoofDetectorFactorySpec::CxxPart::initHybrid(...)
|
|
47
|
+
@FastNative
|
|
48
|
+
external override fun initHybrid(): HybridData
|
|
49
|
+
}
|
|
50
|
+
override fun createCxxPart(): CxxPart {
|
|
51
|
+
return CxxPart(this)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
companion object {
|
|
55
|
+
protected const val TAG = "HybridSpoofDetectorFactorySpec"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Size.kt
|
|
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
|
+
package com.margelo.nitro.camera.spoofdetector
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import java.util.Objects
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "Size".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class Size(
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
val width: Double,
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val height: Double
|
|
27
|
+
) {
|
|
28
|
+
/* primary constructor */
|
|
29
|
+
|
|
30
|
+
override fun equals(other: Any?): Boolean {
|
|
31
|
+
if (this === other) return true
|
|
32
|
+
if (other !is Size) return false
|
|
33
|
+
return Objects.deepEquals(this.width, other.width)
|
|
34
|
+
&& Objects.deepEquals(this.height, other.height)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
override fun hashCode(): Int {
|
|
38
|
+
return arrayOf<Any?>(
|
|
39
|
+
width,
|
|
40
|
+
height
|
|
41
|
+
).contentDeepHashCode()
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
companion object {
|
|
45
|
+
/**
|
|
46
|
+
* Constructor called from C++
|
|
47
|
+
*/
|
|
48
|
+
@DoNotStrip
|
|
49
|
+
@Keep
|
|
50
|
+
@Suppress("unused")
|
|
51
|
+
@JvmStatic
|
|
52
|
+
private fun fromCpp(width: Double, height: Double): Size {
|
|
53
|
+
return Size(width, height)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|