react-native-okaycam 3.0.0 → 3.0.1

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/README.md CHANGED
@@ -15,6 +15,26 @@
15
15
 
16
16
  `$ yarn add react-native-okaycam@3.x.x`
17
17
 
18
+ ### Android
19
+
20
+ 1. Navigate to `android` folder
21
+ 2. Add following snippet in the root `build.gradle` file:
22
+
23
+ ```
24
+ allprojects {
25
+ repositories {
26
+ maven {
27
+ url "https://innov8tif-okaycam.firebaseapp.com"
28
+ content {
29
+ includeGroup "com.innov8tif.xendity"
30
+ }
31
+ }
32
+ }
33
+ }
34
+ ```
35
+
36
+ 3. Sync gradle
37
+
18
38
  ### iOS
19
39
 
20
40
  1. Navigate to ios folder
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-okaycam",
3
3
  "title": "React Native OkayCam",
4
- "version": "3.0.0",
4
+ "version": "3.0.1",
5
5
  "description": "React-Native version of OkayCam",
6
6
  "main": "index.ts",
7
7
  "files": [
@@ -9,22 +9,26 @@
9
9
  "android",
10
10
  "index.ts",
11
11
  "ios",
12
+ "setup_podfile.js",
12
13
  "react-native-okaycam.podspec"
13
14
  ],
14
15
  "scripts": {
15
- "test": "echo \"Error: no test specified\" && exit 1"
16
+ "test": "echo \"Error: no test specified\" && exit 1",
17
+ "postinstall": "node setup_podfile.js"
16
18
  },
17
19
  "repository": {
18
20
  "type": "git",
19
- "url": "git+https://gitlab.com/innov8tif-ekyc-product/okaycam/mobile/react-native-okaycam.git",
20
- "baseUrl": "https://gitlab.com/innov8tif-ekyc-product/okaycam/mobile/react-native-okaycam.git"
21
+ "url": "git+https://gitlab.com/innov8tif-ekyc-product/okaycam/mobile/react-native-okaycam.git"
21
22
  },
22
23
  "keywords": [
23
- "react-native"
24
+ "react-native",
25
+ "camera",
26
+ "okaycam",
27
+ "ios-sdk"
24
28
  ],
25
29
  "author": {
26
- "name": "Raymond",
27
- "email": "raymond@innov8tif.com"
30
+ "name": "innov8tif",
31
+ "email": "ekyc.team@innov8tif.com"
28
32
  },
29
33
  "license": "MIT",
30
34
  "licenseFilename": "LICENSE",
@@ -33,8 +37,12 @@
33
37
  "react": "^18.0.2",
34
38
  "react-native": ">=0.75.2 <1.0.x"
35
39
  },
40
+ "dependencies": {
41
+ "fs-extra": "^11.2.0"
42
+ },
36
43
  "devDependencies": {
37
- "react": "^18.0.2",
38
- "react-native": "^0.75.2"
44
+ "typescript": "^5.4.0",
45
+ "@types/node": "^20.10.0",
46
+ "@react-native/cli": "^13.2.0"
39
47
  }
40
48
  }
@@ -16,28 +16,22 @@ Pod::Spec.new do |s|
16
16
  s.source_files = "ios/**/*.{h,m,swift}"
17
17
  s.requires_arc = true
18
18
  s.static_framework = true
19
- s.swift_version = '5.0'
20
- s.module_name = "ReactNativeOkayCam"
19
+ s.swift_version = "5.0"
20
+ s.module_name = "ReactNativeOkayCamV3"
21
21
 
22
- # ✅ Updated React Native dependencies for RN 0.72+
22
+ # React Native dependencies
23
23
  s.dependency "React-Core"
24
24
  s.dependency "ReactCommon/turbomodule/core"
25
-
26
- # If your native code emits events to JS
27
25
  s.dependency "React-RCTAppDelegate"
28
26
  s.dependency "React-RCTFabric"
29
27
 
30
- # OkayCam dependencies
31
- s.dependency "OkayCam", "3.0.3"
28
+ # OkayCam CocoaPod dependency
29
+ s.dependency "OkayCam", "3.0.5"
32
30
  s.dependency "CryptoSwift", "1.8.2"
33
31
 
34
- # ✅ Architecture exclusions
35
32
  s.pod_target_xcconfig = {
33
+ 'DEFINES_MODULE' => 'YES',
36
34
  'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64',
37
- 'IPHONEOS_DEPLOYMENT_TARGET' => '15.0'
38
- }
39
-
40
- s.user_target_xcconfig = {
41
- 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64'
35
+ 'LD_RUNPATH_SEARCH_PATHS' => '$(inherited) @executable_path/Frameworks @loader_path/Frameworks'
42
36
  }
43
37
  end
@@ -0,0 +1,117 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync, readFileSync, writeFileSync } from "fs";
3
+ import { join, resolve } from "path";
4
+
5
+ import { fileURLToPath } from "url";
6
+ import { dirname } from "path";
7
+
8
+ console.log("🪪 OkayCam setup script running...");
9
+
10
+ const __filename = fileURLToPath(import.meta.url);
11
+ const __dirname = dirname(__filename);
12
+
13
+ // --- Find project root ---
14
+ let currentDir = __dirname;
15
+ let projectRoot = null;
16
+
17
+ for (let i = 0; i < 6; i++) {
18
+ const iosPath = join(currentDir, "ios", "Podfile");
19
+ if (existsSync(iosPath)) {
20
+ projectRoot = currentDir;
21
+ break;
22
+ }
23
+ currentDir = resolve(currentDir, "..");
24
+ }
25
+
26
+ if (!projectRoot) {
27
+ console.warn("🚫 Could not find ios/Podfile — skipping OkayCam setup.");
28
+ process.exit(0);
29
+ }
30
+
31
+ const podfilePath = join(projectRoot, "ios", "Podfile");
32
+ console.log(`📄 Found Podfile at: ${podfilePath}`);
33
+
34
+ let podfile = readFileSync(podfilePath, "utf8");
35
+
36
+ // --- Check if already added ---
37
+ if (podfile.includes("🪪 Re-sign OkayCam Frameworks")) {
38
+ console.log("ℹ️ OkayCam post_install hook already exists — skipping.");
39
+ process.exit(0);
40
+ }
41
+
42
+ // --- The Ruby hook to inject ---
43
+ const hook = `
44
+ post_install do |installer|
45
+ installer.aggregate_targets.each do |target|
46
+ target.user_project.native_targets.each do |native_target|
47
+ phase_name = "Re-sign OkayCam Frameworks"
48
+ next if native_target.shell_script_build_phases.any? { |p| p.name == phase_name }
49
+
50
+ script = <<~SCRIPT
51
+ echo "Re-signing embedded frameworks..."
52
+ set -e
53
+ APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
54
+ find "$APP_PATH/Frameworks" -type d -name "*.framework" | while read framework
55
+ do
56
+ echo "Re-signing $framework"
57
+ /usr/bin/codesign --force --sign "$EXPANDED_CODE_SIGN_IDENTITY" --deep --preserve-metadata=identifier,entitlements "$framework"
58
+ done
59
+ SCRIPT
60
+
61
+ phase = native_target.new_shell_script_build_phase(phase_name)
62
+ phase.shell_script = script
63
+ end
64
+ end
65
+ end
66
+ `;
67
+
68
+ if (podfile.includes("post_install do |installer|")) {
69
+ console.log(
70
+ "🔧 Detected existing post_install block — injecting after react_native_post_install"
71
+ );
72
+
73
+ const innerHook = `
74
+ # Re-sign OkayCam Frameworks
75
+ installer.aggregate_targets.each do |target|
76
+ target.user_project.native_targets.each do |native_target|
77
+ phase_name = "Re-sign OkayCam Frameworks"
78
+ next if native_target.shell_script_build_phases.any? { |p| p.name == phase_name }
79
+
80
+ script = <<~SCRIPT
81
+ echo "Re-signing embedded frameworks..."
82
+ set -e
83
+ APP_PATH="${TARGET_BUILD_DIR}/${WRAPPER_NAME}"
84
+ find "$APP_PATH/Frameworks" -type d -name "*.framework" | while read framework
85
+ do
86
+ echo "Re-signing $framework"
87
+ /usr/bin/codesign --force --sign "$EXPANDED_CODE_SIGN_IDENTITY" --deep --preserve-metadata=identifier,entitlements "$framework"
88
+ done
89
+ SCRIPT
90
+
91
+ phase = native_target.new_shell_script_build_phase(phase_name)
92
+ phase.shell_script = script
93
+ end
94
+ end
95
+ `;
96
+
97
+ if (podfile.includes("react_native_post_install")) {
98
+ podfile = podfile.replace(
99
+ /(react_native_post_install\s*\(.*\)\s*)/,
100
+ `$1\n${innerHook}`
101
+ );
102
+ console.log("✨ Injected OkayCam hook after react_native_post_install.");
103
+ } else {
104
+ console.log(
105
+ "⚠️ react_native_post_install not found, appending before end of post_install."
106
+ );
107
+ podfile = podfile.replace(/end\s*$/, `${innerHook}\nend`);
108
+ }
109
+ } else {
110
+ console.log("✨ No post_install found — creating a new one.");
111
+ podfile += `
112
+ ${hook}
113
+ `;
114
+ }
115
+
116
+ writeFileSync(podfilePath, podfile, "utf8");
117
+ console.log("✅ Successfully added OkayCam re-sign hook.");