react-native-vision-camera-spoof-detector 1.1.11 → 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 (30) hide show
  1. package/VisionCameraSpoofDetector.podspec +41 -0
  2. package/ios/FaceAntiSpoofManager.swift +106 -4
  3. package/ios/FaceAntiSpoofModule.m +38 -51
  4. package/ios/HybridSpoofDetectorFactory.swift +10 -0
  5. package/ios/HybridSpoofDetectorOutput.swift +164 -0
  6. package/nitro.json +4 -0
  7. package/nitrogen/generated/ios/VisionCameraSpoofDetector+autolinking.rb +62 -0
  8. package/nitrogen/generated/ios/VisionCameraSpoofDetector-Swift-Cxx-Bridge.cpp +60 -0
  9. package/nitrogen/generated/ios/VisionCameraSpoofDetector-Swift-Cxx-Bridge.hpp +151 -0
  10. package/nitrogen/generated/ios/VisionCameraSpoofDetector-Swift-Cxx-Umbrella.hpp +60 -0
  11. package/nitrogen/generated/ios/VisionCameraSpoofDetectorAutolinking.mm +33 -0
  12. package/nitrogen/generated/ios/VisionCameraSpoofDetectorAutolinking.swift +26 -0
  13. package/nitrogen/generated/ios/c++/HybridSpoofDetectorFactorySpecSwift.cpp +11 -0
  14. package/nitrogen/generated/ios/c++/HybridSpoofDetectorFactorySpecSwift.hpp +97 -0
  15. package/nitrogen/generated/ios/swift/AntiSpoofingResult.swift +54 -0
  16. package/nitrogen/generated/ios/swift/Func_void_AntiSpoofingResult.swift +46 -0
  17. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +46 -0
  18. package/nitrogen/generated/ios/swift/HybridSpoofDetectorFactorySpec.swift +56 -0
  19. package/nitrogen/generated/ios/swift/HybridSpoofDetectorFactorySpec_cxx.swift +142 -0
  20. package/nitrogen/generated/ios/swift/Size.swift +34 -0
  21. package/nitrogen/generated/ios/swift/SpoofDetectorOutputOptions.swift +74 -0
  22. package/package.json +8 -3
  23. package/src/specs/SpoofDetectorFactory.nitro.ts +1 -0
  24. package/ios/FaceAntiSpoofFrameProcessor.swift +0 -301
  25. package/ios/FaceAntiSpoofJSI.h +0 -12
  26. package/ios/FaceAntiSpoofJSI.mm +0 -92
  27. package/ios/FaceAntiSpoofPluginRegister.m +0 -84
  28. package/ios/models/FaceAntiSpoofing.tflite +0 -0
  29. package/react-native-vision-camera-spoof-detector.podspec +0 -22
  30. /package/{ios/models → lib/assets}/model_spec.json +0 -0
@@ -1,92 +0,0 @@
1
- // Objective-C++ JSI registration for FaceAntiSpoof
2
- #import "FaceAntiSpoofJSI.h"
3
- #import <Foundation/Foundation.h>
4
- #import <objc/runtime.h>
5
- #import <objc/message.h>
6
-
7
- #ifdef __cplusplus
8
- #include <jsi/jsi.h>
9
- using namespace facebook;
10
- #endif
11
-
12
- // Helper to call +[FaceAntiSpoofManager isModelLoaded]
13
- static bool FaceAntiSpoofManager_isModelLoaded() {
14
- Class managerClass = objc_getClass("FaceAntiSpoofManager");
15
- if (!managerClass) return false;
16
- SEL sel = sel_getUid("isModelLoaded");
17
- if (!sel) return false;
18
- BOOL (*msgSendBool)(id, SEL) = (BOOL (*)(id, SEL))objc_msgSend;
19
- return msgSendBool((id)managerClass, sel);
20
- }
21
-
22
- // Helper to call +[FaceAntiSpoofManager initializeModel]
23
- static bool FaceAntiSpoofManager_initialize() {
24
- Class managerClass = objc_getClass("FaceAntiSpoofManager");
25
- if (!managerClass) return false;
26
- SEL sel = sel_getUid("initializeModel");
27
- if (!sel) return false;
28
- BOOL (*msgSendBool)(id, SEL) = (BOOL (*)(id, SEL))objc_msgSend;
29
- return msgSendBool((id)managerClass, sel);
30
- }
31
-
32
- extern "C" void FaceAntiSpoofJSI_install(void *runtimePtr) {
33
- #ifdef __cplusplus
34
- if (!runtimePtr) {
35
- NSLog(@"[FaceAntiSpoof] JSI install called with NULL runtime pointer");
36
- return;
37
- }
38
-
39
- jsi::Runtime *rt = reinterpret_cast<jsi::Runtime*>(runtimePtr);
40
- if (!rt) {
41
- NSLog(@"[FaceAntiSpoof] JSI install: invalid runtime pointer");
42
- return;
43
- }
44
-
45
- try {
46
- // Register faceAntiSpoof_isModelLoaded()
47
- auto isLoadedFunc = jsi::Function::createFromHostFunction(*rt,
48
- jsi::PropNameID::forAscii(*rt, "faceAntiSpoof_isModelLoaded"), 0,
49
- [](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
50
- bool loaded = FaceAntiSpoofManager_isModelLoaded();
51
- return jsi::Value(loaded);
52
- }
53
- );
54
- rt->global().setProperty(*rt, "faceAntiSpoof_isModelLoaded", isLoadedFunc);
55
-
56
- // Register faceAntiSpoof_initialize()
57
- auto initFunc = jsi::Function::createFromHostFunction(*rt,
58
- jsi::PropNameID::forAscii(*rt, "faceAntiSpoof_initialize"), 0,
59
- [](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
60
- bool ok = FaceAntiSpoofManager_initialize();
61
- return jsi::Value(ok);
62
- }
63
- );
64
- rt->global().setProperty(*rt, "faceAntiSpoof_initialize", initFunc);
65
-
66
- // Register faceAntiSpoof_getModuleInfo()
67
- auto infoFunc = jsi::Function::createFromHostFunction(*rt,
68
- jsi::PropNameID::forAscii(*rt, "faceAntiSpoof_getModuleInfo"), 0,
69
- [](jsi::Runtime &rt, const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value {
70
- jsi::Object obj(rt);
71
- obj.setProperty(rt, "name", jsi::String::createFromUtf8(rt, "FaceAntiSpoof"));
72
- jsi::Array methods(rt, 4);
73
- methods.setValueAtIndex(rt, 0, jsi::String::createFromUtf8(rt, "initialize"));
74
- methods.setValueAtIndex(rt, 1, jsi::String::createFromUtf8(rt, "checkModelStatus"));
75
- methods.setValueAtIndex(rt, 2, jsi::String::createFromUtf8(rt, "isAvailable"));
76
- methods.setValueAtIndex(rt, 3, jsi::String::createFromUtf8(rt, "cleanup"));
77
- obj.setProperty(rt, "methods", methods);
78
- return obj;
79
- }
80
- );
81
- rt->global().setProperty(*rt, "faceAntiSpoof_getModuleInfo", infoFunc);
82
-
83
- NSLog(@"[FaceAntiSpoof] JSI functions registered");
84
- } catch (const std::exception &ex) {
85
- NSLog(@"[FaceAntiSpoof] JSI registration exception: %s", ex.what());
86
- } catch (...) {
87
- NSLog(@"[FaceAntiSpoof] JSI registration unknown exception");
88
- }
89
- #else
90
- NSLog(@"[FaceAntiSpoof] JSI install compiled without C++ support");
91
- #endif
92
- }
@@ -1,84 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
- #if __has_include(<VisionCamera/FrameProcessorPluginRegistry.h>)
3
- #import <VisionCamera/FrameProcessorPluginRegistry.h>
4
- #import <VisionCamera/FrameProcessorPlugin.h>
5
- #import <VisionCamera/VisionCameraProxyHolder.h>
6
- #define FACE_ANTISPOOF_HAS_VISION_CAMERA_HEADERS 1
7
- #elif __has_include("FrameProcessorPluginRegistry.h")
8
- #import "FrameProcessorPluginRegistry.h"
9
- #import "FrameProcessorPlugin.h"
10
- #import "VisionCameraProxyHolder.h"
11
- #define FACE_ANTISPOOF_HAS_VISION_CAMERA_HEADERS 1
12
- #endif
13
- #import <objc/runtime.h>
14
- #import <objc/message.h>
15
-
16
- // Register after VisionCamera has loaded so its registry is available.
17
- void FaceAntiSpoofRegisterPlugin(void) {
18
- @autoreleasepool {
19
- static BOOL registered = NO;
20
- if (registered) {
21
- return;
22
- }
23
-
24
- #if FACE_ANTISPOOF_HAS_VISION_CAMERA_HEADERS
25
- // Use a direct reference so the registry is linked in device builds.
26
- [FrameProcessorPluginRegistry addFrameProcessorPlugin:@"faceAntiSpoof"
27
- withInitializer:^FrameProcessorPlugin*(VisionCameraProxyHolder *proxy, NSDictionary *options) {
28
- Class dynClass = NSClassFromString(@"FaceAntiSpoofFrameProcessor");
29
- if (dynClass == Nil) {
30
- return nil;
31
- }
32
- id alloced = ((id (*)(id, SEL))objc_msgSend)((id)dynClass, sel_registerName("alloc"));
33
- SEL initSel = sel_registerName("initWithProxy:withOptions:");
34
- if (![alloced respondsToSelector:initSel]) {
35
- return nil;
36
- }
37
- return ((id (*)(id, SEL, id, id))objc_msgSend)(alloced, initSel, proxy, options);
38
- }];
39
- registered = YES;
40
- #else
41
- Class registry = NSClassFromString(@"FrameProcessorPluginRegistry");
42
-
43
- if (registry == Nil) {
44
- NSLog(@"[FaceAntiSpoof] VisionCamera registry is not loaded");
45
- return;
46
- }
47
-
48
- SEL selector = NSSelectorFromString(@"addFrameProcessorPlugin:withInitializer:");
49
- if (![registry respondsToSelector:selector]) {
50
- NSLog(@"[FaceAntiSpoof] VisionCamera registry API is unavailable");
51
- return;
52
- }
53
-
54
- // Create initializer block using objc_msgSend to avoid compile-time selector checks
55
- id initializer = ^id(id proxy, id options) {
56
- Class dynClass = NSClassFromString(@"FaceAntiSpoofFrameProcessor");
57
- if (dynClass == Nil) {
58
- return nil;
59
- }
60
- SEL allocSel = sel_registerName("alloc");
61
- id alloced = ((id (*)(id, SEL))objc_msgSend)((id)dynClass, allocSel);
62
-
63
- // VisionCamera's Objective-C initializer is `initWithProxy:withOptions:`.
64
- SEL initSel = sel_registerName("initWithProxy:withOptions:");
65
- if (![alloced respondsToSelector:initSel]) {
66
- return nil;
67
- }
68
- id instance = ((id (*)(id, SEL, id, id))objc_msgSend)(alloced, initSel, proxy, options);
69
- return instance;
70
- };
71
-
72
- // Call +addFrameProcessorPlugin:name with the block
73
- // We use objc_msgSend to avoid compile-time dependency on the header signature
74
- void (*msgSend)(id, SEL, id, id) = (void (*)(id, SEL, id, id))objc_msgSend;
75
- msgSend((id)registry, selector, @"faceAntiSpoof", initializer);
76
- registered = YES;
77
- #endif
78
- }
79
- }
80
-
81
- // Keep the old startup hook for apps where VisionCamera is already loaded.
82
- __attribute__((constructor)) static void register_face_anti_spoof_plugin_at_load(void) {
83
- FaceAntiSpoofRegisterPlugin();
84
- }
Binary file
@@ -1,22 +0,0 @@
1
- Pod::Spec.new do |s|
2
- s.name = 'react-native-vision-camera-spoof-detector'
3
- s.version = '1.1.0'
4
- s.summary = 'Face anti-spoof detector for VisionCamera (iOS)'
5
- s.homepage = 'https://github.com/dpraful/react-native-vision-camera-spoof-detector'
6
- s.license = { :type => 'MIT', :file => 'LICENSE' }
7
- s.authors = { 'JESCON TECHNOLOGIES PVT LTD' => 'jescontechnologies@gmail.com' }
8
- s.platform = :ios, '11.0'
9
- s.source = { :path => '.' }
10
-
11
- s.swift_version = '5.0'
12
-
13
- s.source_files = 'ios/**/*.{h,m,mm,swift,mm,cpp,c,cc}'
14
- s.resources = ['ios/models/*']
15
-
16
- # Dependencies
17
- s.dependency 'TensorFlowLiteSwift'
18
- s.dependency 'VisionCamera'
19
-
20
- # Keep default deployment target and static linkage consistent with RN
21
- s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
22
- end
File without changes