omnipay-reactnative-sdk 1.2.1 → 1.2.2-beta.2

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 (47) hide show
  1. package/android/build.gradle +13 -0
  2. package/android/src/main/AndroidManifest.xml +5 -0
  3. package/android/src/main/java/com/omniretail/omnipay/LivenessCameraViewManager.java +116 -0
  4. package/android/src/main/java/com/omniretail/omnipay/LivenessDetectionModule.java +588 -0
  5. package/android/src/main/java/com/omniretail/omnipay/OmnipayActivityPackage.java +4 -1
  6. package/ios/LivenessCameraView.h +22 -0
  7. package/ios/LivenessCameraView.m +135 -0
  8. package/ios/LivenessCameraViewManager.h +12 -0
  9. package/ios/LivenessCameraViewManager.m +24 -0
  10. package/ios/LivenessDetectionModule.h +46 -0
  11. package/ios/LivenessDetectionModule.m +603 -0
  12. package/lib/commonjs/components/OmnipayProvider.js +10 -1
  13. package/lib/commonjs/components/OmnipayProvider.js.map +1 -1
  14. package/lib/commonjs/components/biometrics/FaceVerification.js +439 -0
  15. package/lib/commonjs/components/biometrics/FaceVerification.js.map +1 -0
  16. package/lib/commonjs/components/biometrics/LivenessCameraView.js +43 -0
  17. package/lib/commonjs/components/biometrics/LivenessCameraView.js.map +1 -0
  18. package/lib/commonjs/components/biometrics/LivenessDetection.js +252 -0
  19. package/lib/commonjs/components/biometrics/LivenessDetection.js.map +1 -0
  20. package/lib/commonjs/index.js +28 -0
  21. package/lib/commonjs/index.js.map +1 -1
  22. package/lib/module/components/OmnipayProvider.js +10 -1
  23. package/lib/module/components/OmnipayProvider.js.map +1 -1
  24. package/lib/module/components/biometrics/FaceVerification.js +429 -0
  25. package/lib/module/components/biometrics/FaceVerification.js.map +1 -0
  26. package/lib/module/components/biometrics/LivenessCameraView.js +38 -0
  27. package/lib/module/components/biometrics/LivenessCameraView.js.map +1 -0
  28. package/lib/module/components/biometrics/LivenessDetection.js +244 -0
  29. package/lib/module/components/biometrics/LivenessDetection.js.map +1 -0
  30. package/lib/module/index.js +5 -0
  31. package/lib/module/index.js.map +1 -1
  32. package/lib/typescript/components/OmnipayProvider.d.ts.map +1 -1
  33. package/lib/typescript/components/biometrics/FaceVerification.d.ts +12 -0
  34. package/lib/typescript/components/biometrics/FaceVerification.d.ts.map +1 -0
  35. package/lib/typescript/components/biometrics/LivenessCameraView.d.ts +22 -0
  36. package/lib/typescript/components/biometrics/LivenessCameraView.d.ts.map +1 -0
  37. package/lib/typescript/components/biometrics/LivenessDetection.d.ts +73 -0
  38. package/lib/typescript/components/biometrics/LivenessDetection.d.ts.map +1 -0
  39. package/lib/typescript/index.d.ts +3 -0
  40. package/lib/typescript/index.d.ts.map +1 -1
  41. package/omnipay-reactnative-sdk.podspec +47 -0
  42. package/package.json +3 -2
  43. package/src/components/OmnipayProvider.tsx +12 -0
  44. package/src/components/biometrics/FaceVerification.tsx +484 -0
  45. package/src/components/biometrics/LivenessCameraView.tsx +61 -0
  46. package/src/components/biometrics/LivenessDetection.ts +305 -0
  47. package/src/index.tsx +18 -0
@@ -43,4 +43,17 @@ repositories {
43
43
 
44
44
  dependencies {
45
45
  implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
46
+
47
+ // CameraX dependencies for liveness detection
48
+ implementation 'androidx.camera:camera-core:1.3.1'
49
+ implementation 'androidx.camera:camera-camera2:1.3.1'
50
+ implementation 'androidx.camera:camera-lifecycle:1.3.1'
51
+ implementation 'androidx.camera:camera-view:1.3.1'
52
+
53
+ // ML Kit for face detection
54
+ implementation 'com.google.mlkit:face-detection:16.1.5'
55
+
56
+ // Additional required dependencies
57
+ implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.7.0'
58
+ implementation 'androidx.core:core-ktx:1.12.0'
46
59
  }
@@ -1,6 +1,11 @@
1
1
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
2
  package="com.omniretail.omnipay">
3
3
 
4
+ <!-- Camera permissions for liveness detection -->
5
+ <uses-permission android:name="android.permission.CAMERA" />
6
+ <uses-feature android:name="android.hardware.camera" android:required="true" />
7
+ <uses-feature android:name="android.hardware.camera.front" android:required="false" />
8
+
4
9
  <application>
5
10
  <service
6
11
  android:name=".OmnipayActivityModule"
@@ -0,0 +1,116 @@
1
+ package com.omniretail.omnipay;
2
+
3
+ import android.content.Context;
4
+ import android.view.View;
5
+ import android.widget.FrameLayout;
6
+
7
+ import androidx.annotation.NonNull;
8
+ import androidx.annotation.Nullable;
9
+ import androidx.camera.view.PreviewView;
10
+
11
+ import com.facebook.react.bridge.ReactApplicationContext;
12
+ import com.facebook.react.bridge.ReactContext;
13
+ import com.facebook.react.common.MapBuilder;
14
+ import com.facebook.react.uimanager.SimpleViewManager;
15
+ import com.facebook.react.uimanager.ThemedReactContext;
16
+ import com.facebook.react.uimanager.annotations.ReactProp;
17
+
18
+ import java.util.Map;
19
+
20
+ public class LivenessCameraViewManager extends SimpleViewManager<FrameLayout> {
21
+ public static final String REACT_CLASS = "LivenessCameraView";
22
+ private ReactApplicationContext reactContext;
23
+
24
+ public LivenessCameraViewManager(ReactApplicationContext reactContext) {
25
+ this.reactContext = reactContext;
26
+ }
27
+
28
+ @Override
29
+ @NonNull
30
+ public String getName() {
31
+ return REACT_CLASS;
32
+ }
33
+
34
+ @Override
35
+ @NonNull
36
+ public FrameLayout createViewInstance(@NonNull ThemedReactContext context) {
37
+ FrameLayout frameLayout = new FrameLayout(context);
38
+ frameLayout.setLayoutParams(new FrameLayout.LayoutParams(
39
+ FrameLayout.LayoutParams.MATCH_PARENT,
40
+ FrameLayout.LayoutParams.MATCH_PARENT
41
+ ));
42
+
43
+ // Get the camera preview from the LivenessDetectionModule
44
+ try {
45
+ LivenessDetectionModule livenessModule = reactContext.getNativeModule(LivenessDetectionModule.class);
46
+ if (livenessModule != null) {
47
+ PreviewView previewView = livenessModule.getPreviewView();
48
+ if (previewView != null) {
49
+ // Remove from any existing parent
50
+ if (previewView.getParent() != null) {
51
+ ((FrameLayout) previewView.getParent()).removeView(previewView);
52
+ }
53
+
54
+ frameLayout.addView(previewView, new FrameLayout.LayoutParams(
55
+ FrameLayout.LayoutParams.MATCH_PARENT,
56
+ FrameLayout.LayoutParams.MATCH_PARENT
57
+ ));
58
+ }
59
+ }
60
+ } catch (Exception e) {
61
+ // Handle gracefully - the camera view will be set up later
62
+ }
63
+
64
+ return frameLayout;
65
+ }
66
+
67
+ @ReactProp(name = "scaleType")
68
+ public void setScaleType(FrameLayout view, @Nullable String scaleType) {
69
+ // Find the PreviewView child and set scale type
70
+ for (int i = 0; i < view.getChildCount(); i++) {
71
+ View child = view.getChildAt(i);
72
+ if (child instanceof PreviewView) {
73
+ PreviewView previewView = (PreviewView) child;
74
+ if ("fillStart".equals(scaleType)) {
75
+ previewView.setScaleType(PreviewView.ScaleType.FILL_START);
76
+ } else if ("fillCenter".equals(scaleType)) {
77
+ previewView.setScaleType(PreviewView.ScaleType.FILL_CENTER);
78
+ } else if ("fillEnd".equals(scaleType)) {
79
+ previewView.setScaleType(PreviewView.ScaleType.FILL_END);
80
+ } else if ("fitStart".equals(scaleType)) {
81
+ previewView.setScaleType(PreviewView.ScaleType.FIT_START);
82
+ } else if ("fitCenter".equals(scaleType)) {
83
+ previewView.setScaleType(PreviewView.ScaleType.FIT_CENTER);
84
+ } else if ("fitEnd".equals(scaleType)) {
85
+ previewView.setScaleType(PreviewView.ScaleType.FIT_END);
86
+ } else {
87
+ // Default to fill center
88
+ previewView.setScaleType(PreviewView.ScaleType.FILL_CENTER);
89
+ }
90
+ break;
91
+ }
92
+ }
93
+ }
94
+
95
+ @Override
96
+ public void onDropViewInstance(@NonNull FrameLayout view) {
97
+ super.onDropViewInstance(view);
98
+ // Clean up camera resources if needed
99
+ try {
100
+ LivenessDetectionModule livenessModule = reactContext.getNativeModule(LivenessDetectionModule.class);
101
+ if (livenessModule != null) {
102
+ // The module will handle cleanup when detection stops
103
+ }
104
+ } catch (Exception e) {
105
+ // Handle gracefully
106
+ }
107
+ }
108
+
109
+ @Override
110
+ public Map<String, Object> getExportedCustomDirectEventTypeConstants() {
111
+ return MapBuilder.<String, Object>builder()
112
+ .put("onCameraReady", MapBuilder.of("registrationName", "onCameraReady"))
113
+ .put("onCameraError", MapBuilder.of("registrationName", "onCameraError"))
114
+ .build();
115
+ }
116
+ }