@yeomessagingcom/react-native-yeofr 0.1.9 → 0.1.11

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/index.ts CHANGED
@@ -6,7 +6,4 @@ export const createTracker = (): Promise<number> => YEOFRModule.createTracker();
6
6
  export const freeTracker = (): Promise<number> => YEOFRModule.freeTracker();
7
7
  export const getTrackerData = (): Promise<string> => YEOFRModule.getTrackerData();
8
8
  export const loadTracker = (base64: string): Promise<number> => YEOFRModule.loadTracker(base64);
9
- export const enroll = (faceID: number, name: string): Promise<number> => YEOFRModule.enroll(faceID, name);
10
- export const processFrameBase64 = (args: {
11
- base64ARGB: string; width: number; height: number; stride: number; ratio?: number; needFaceRect?: boolean;
12
- }) => YEOFRModule.processFrameBase64(args.base64ARGB, args.width, args.height, args.stride, args.ratio ?? 1, !!args.needFaceRect);
9
+ export const enroll = (faceID: number, name: string): Promise<number> => YEOFRModule.enroll(faceID, name);
package/ios/YEOFRModule.m CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  RCT_EXTERN_METHOD(getVersion:(RCTPromiseResolveBlock)resolve
6
6
  rejecter:(RCTPromiseRejectBlock)reject)
7
-
7
+
8
8
  RCT_EXTERN_METHOD(createTracker:(RCTPromiseResolveBlock)resolve
9
9
  rejecter:(RCTPromiseRejectBlock)reject)
10
10
 
@@ -27,13 +27,4 @@ RCT_EXTERN_METHOD(enroll:(nonnull NSNumber *)faceID
27
27
  resolver:(RCTPromiseResolveBlock)resolve
28
28
  rejecter:(RCTPromiseRejectBlock)reject)
29
29
 
30
- RCT_EXTERN_METHOD(processFrameBase64:(NSString *)base64ARGB
31
- width:(nonnull NSNumber *)width
32
- height:(nonnull NSNumber *)height
33
- stride:(nonnull NSNumber *)stride
34
- ratio:(nonnull NSNumber *)ratio
35
- needFaceRect:(BOOL)needFaceRect
36
- resolver:(RCTPromiseResolveBlock)resolve
37
- rejecter:(RCTPromiseRejectBlock)reject)
38
-
39
30
  @end
@@ -1,5 +1,6 @@
1
1
  import Foundation
2
- import YEOFRSDK // from your xcframework
2
+ import React
3
+ import YEOFR // from your xcframework
3
4
 
4
5
  @objc(YEOFRModule)
5
6
  class YEOFRModule: NSObject {
@@ -52,40 +53,4 @@ class YEOFRModule: NSObject {
52
53
  let rc = sdk.enroll(faceID: faceID.int64Value, name: name, learnFromCurrentFrame: true)
53
54
  rc == .OK ? resolve(rc.rawValue) : reject("rc", "enroll failed: \(rc.rawValue)", nil)
54
55
  }
55
-
56
- // JS-only helper for quick smoke tests; production should feed frames via native iOS component.
57
- @objc func processFrameBase64(_ base64ARGB: String,
58
- width: NSNumber,
59
- height: NSNumber,
60
- stride: NSNumber,
61
- ratio: NSNumber,
62
- needFaceRect: Bool,
63
- resolver resolve: RCTPromiseResolveBlock,
64
- rejecter reject: RCTPromiseRejectBlock) {
65
- guard let bytes = Data(base64Encoded: base64ARGB) else {
66
- return reject("bad_input", "invalid base64", nil)
67
- }
68
- let count = bytes.count
69
- let ptr = UnsafeMutablePointer<UInt8>.allocate(capacity: count)
70
- _ = bytes.copyBytes(to: ptr, count: count)
71
-
72
- let params = ImageFrameParameters(buffer: ptr,
73
- width: width.intValue,
74
- height: height.intValue,
75
- scanLine: stride.intValue,
76
- ratio: ratio.floatValue)
77
- let result = sdk.detectFaces(params: params, needFaceRect: needFaceRect)
78
-
79
- var faces: [[String: Any]] = []
80
- if let rects = result.faceRects, let ids = result.faceIDs {
81
- for (id, rect) in rects {
82
- faces.append([
83
- "id": id,
84
- "name": ids[id] ?? NSNull(),
85
- "rect": ["x": rect.origin.x, "y": rect.origin.y, "w": rect.size.width, "h": rect.size.height]
86
- ])
87
- }
88
- }
89
- resolve(["state": result.faceState.rawValue, "count": result.detectedCount, "faces": faces])
90
- }
91
56
  }
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = "react-native-yeofr"
3
- s.version = "0.1.9" # keep this in sync with your npm version
3
+ s.version = "0.1.11" # keep this in sync with your npm version
4
4
  s.summary = "React Native iOS integration for YEO Face Recognition (device-only)."
5
5
  s.homepage = "https://github.com/yeomessaging/react-native-yeofr"
6
6
  s.license = { :type => "Commercial", :file => "../LICENSE" }
@@ -8,16 +8,33 @@ Pod::Spec.new do |s|
8
8
  s.platform = :ios, "15.1"
9
9
  s.swift_version = "5.9"
10
10
 
11
- # RN shim only
11
+ # RN shim source files live in the repo (autolink-friendly)
12
+ s.source = { :git => "https://github.com/yeomessaging/react-native-yeofr.git",
13
+ :tag => s.version.to_s }
14
+
15
+ # Paths are from the repo root after CocoaPods clones it
12
16
  s.source_files = "ios/YEOFRModule.m", "ios/YEOFRModule.swift"
13
17
 
14
- # Public SPM release zip (for now)
15
- s.source = {
16
- :http => "https://github.com/YEOMessaging/YEOFR-SPM/releases/download/0.1.3/YEOFR.xcframework.zip",
17
- :sha256 => "42311f41302ea706ccfa4b1db5a2d354bf3e1631a4172802f34cb8e9679b5da4"
18
- }
18
+ # Download the binary xcframework (public SPM zip for now)
19
+ bin_ver = ENV['YEOFR_BINARY_VERSION'] || "0.1.3"
20
+ repo = "https://github.com/YEOMessaging/YEOFR-SPM"
21
+ asset = "YEOFR.xcframework.zip"
22
+ url = ENV['YEOFR_XCFRAMEWORK_URL'] || "#{repo}/releases/download/#{bin_ver}/#{asset}"
23
+ sha256 = ENV['YEOFR_SHA256'] || "42311f41302ea706ccfa4b1db5a2d354bf3e1631a4172802f34cb8e9679b5da4"
24
+
25
+ s.prepare_command = <<-CMD
26
+ set -e
27
+ cd ios
28
+ rm -rf Vendor && mkdir -p Vendor
29
+ echo "YEOFR: downloading #{url}"
30
+ curl -fL -o "#{asset}" "#{url}"
31
+ echo "#{sha256} #{asset}" | shasum -a 256 -c -
32
+ unzip -o "#{asset}" -d Vendor >/dev/null
33
+ CMD
34
+
35
+ # Vendored framework lives under ios/ after prepare_command
36
+ s.vendored_frameworks = "ios/Vendor/YEOFR.xcframework"
19
37
 
20
- s.vendored_frameworks = "YEOFR.xcframework"
21
38
  s.dependency "React-Core"
22
39
 
23
40
  # Device-only (exclude simulator slices)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeomessagingcom/react-native-yeofr",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "React Native iOS integration for YEO Face Recognition (device-only).",
5
5
  "main": "index.ts",
6
6
  "react-native": "index.ts",
@@ -2,10 +2,9 @@ module.exports = {
2
2
  dependency: {
3
3
  platforms: {
4
4
  ios: {
5
- project: null,
6
- podspecPath: 'ios/react-native-yeofr.podspec'
5
+ podspecPath: 'ios/react-native-yeofr.podspec',
7
6
  },
8
- android: null
9
- }
10
- }
7
+ android: null,
8
+ },
9
+ },
11
10
  };