idwise-react-native-sdk 6.8.6 → 6.8.9

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.
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
16
16
  s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
17
17
  s.private_header_files = "ios/**/*.h"
18
18
 
19
- s.dependency 'IDWise', '6.8.6'
19
+ s.dependency 'IDWise', '6.8.9'
20
20
  s.pod_target_xcconfig = {
21
21
  "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
22
22
  "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
package/README.md CHANGED
@@ -38,6 +38,20 @@ OR
38
38
  yarn add idwise-react-native-sdk
39
39
  ```
40
40
 
41
+ ### Expo (managed workflow)
42
+
43
+ This package ships a [config plugin](https://docs.expo.dev/config-plugins/introduction/) so it works in Expo managed projects without ejecting. Add it to the `plugins` array in your `app.json` / `app.config.js`:
44
+
45
+ ```json
46
+ {
47
+ "expo": {
48
+ "plugins": ["idwise-react-native-sdk"]
49
+ }
50
+ }
51
+ ```
52
+
53
+ The plugin registers the Android Maven repository and the private CocoaPods spec source the SDK depends on, so `npx expo prebuild` (and EAS Build) generate native projects that can resolve the IDWise native SDKs automatically — no manual edits to `android/build.gradle` or `ios/Podfile` are required.
54
+
41
55
  <!-- badges -->
42
56
 
43
57
  [version-badge]: https://img.shields.io/npm/v/idwise-react-native-sdk.svg?style=flat-square
@@ -4,4 +4,4 @@ IdwiseReactNativeSdk_targetSdkVersion=34
4
4
  IdwiseReactNativeSdk_compileSdkVersion=35
5
5
  IdwiseReactNativeSdk_ndkVersion=27.1.12297006
6
6
  # Idwise SDK version
7
- idwise_sdk_version=6.8.6
7
+ idwise_sdk_version=6.8.9
package/app.plugin.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./plugin/withIdwise');
package/package.json CHANGED
@@ -1,15 +1,19 @@
1
1
  {
2
2
  "name": "idwise-react-native-sdk",
3
- "version": "6.8.6",
3
+ "version": "6.8.9",
4
4
  "description": "React-Native Wrapper for IDWise SDK",
5
5
  "main": "./lib/index.js",
6
6
  "react-native": "./src/index.js",
7
7
  "types": "./index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
- "default": "./lib/index.js",
11
- "types": "./index.d.ts"
12
- }
10
+ "types": "./index.d.ts",
11
+ "react-native": "./src/index.js",
12
+ "default": "./lib/index.js"
13
+ },
14
+ "./app.plugin": "./app.plugin.js",
15
+ "./app.plugin.js": "./app.plugin.js",
16
+ "./package.json": "./package.json"
13
17
  },
14
18
  "files": [
15
19
  "src",
@@ -20,6 +24,8 @@
20
24
  "ios",
21
25
  "cpp",
22
26
  "*.podspec",
27
+ "app.plugin.js",
28
+ "plugin",
23
29
  "react-native.config.js",
24
30
  "!ios/build",
25
31
  "!android/build",
@@ -65,6 +71,9 @@
65
71
  "publishConfig": {
66
72
  "registry": "https://registry.npmjs.org/"
67
73
  },
74
+ "dependencies": {
75
+ "@expo/config-plugins": "^57.0.0"
76
+ },
68
77
  "devDependencies": {
69
78
  "@commitlint/config-conventional": "^19.6.0",
70
79
  "@eslint/compat": "^1.2.7",
@@ -0,0 +1,18 @@
1
+ const { createRunOncePlugin, withPlugins } = require('@expo/config-plugins');
2
+
3
+ const withIdwiseAndroidMavenRepo = require('./withIdwiseAndroid');
4
+ const withIdwiseAndroidManifest = require('./withIdwiseAndroidManifest');
5
+ const withIdwiseAndroidDataBinding = require('./withIdwiseAndroidDataBinding');
6
+ const withIdwiseIosPodSource = require('./withIdwiseIos');
7
+ const pkg = require('../package.json');
8
+
9
+ function withIdwise(config) {
10
+ return withPlugins(config, [
11
+ withIdwiseAndroidMavenRepo,
12
+ withIdwiseAndroidManifest,
13
+ withIdwiseAndroidDataBinding,
14
+ withIdwiseIosPodSource,
15
+ ]);
16
+ }
17
+
18
+ module.exports = createRunOncePlugin(withIdwise, pkg.name, pkg.version);
@@ -0,0 +1,37 @@
1
+ const { withGradleProperties } = require('@expo/config-plugins');
2
+
3
+ const ANDROID_MAVEN_REPO_URL = 'https://mobile-sdk.idwise.ai/releases/';
4
+ const EXTRA_MAVEN_REPOS_KEY = 'android.extraMavenRepos';
5
+
6
+ function withIdwiseAndroidMavenRepo(config) {
7
+ return withGradleProperties(config, (config) => {
8
+ const properties = config.modResults;
9
+ const existing = properties.find(
10
+ (item) => item.type === 'property' && item.key === EXTRA_MAVEN_REPOS_KEY
11
+ );
12
+
13
+ let repos = [];
14
+ if (existing) {
15
+ try {
16
+ repos = JSON.parse(existing.value);
17
+ } catch {
18
+ repos = [];
19
+ }
20
+ }
21
+
22
+ if (!repos.some((repo) => repo.url === ANDROID_MAVEN_REPO_URL)) {
23
+ repos.push({ url: ANDROID_MAVEN_REPO_URL });
24
+ }
25
+
26
+ const value = JSON.stringify(repos);
27
+ if (existing) {
28
+ existing.value = value;
29
+ } else {
30
+ properties.push({ type: 'property', key: EXTRA_MAVEN_REPOS_KEY, value });
31
+ }
32
+
33
+ return config;
34
+ });
35
+ }
36
+
37
+ module.exports = withIdwiseAndroidMavenRepo;
@@ -0,0 +1,38 @@
1
+ const { withAppBuildGradle, CodeGenerator } = require('@expo/config-plugins');
2
+
3
+ const MERGE_TAG = 'idwise-react-native-sdk-databinding';
4
+
5
+ // The IDWise Android SDK relies on data binding for its UI layouts, so the consuming app's
6
+ // own android/app/build.gradle needs `buildFeatures { dataBinding true }` as well.
7
+ function withIdwiseAndroidDataBinding(config) {
8
+ return withAppBuildGradle(config, (config) => {
9
+ if (config.modResults.language !== 'groovy') {
10
+ return config;
11
+ }
12
+
13
+ const { contents } = config.modResults;
14
+
15
+ if (/buildFeatures\s*\{/.test(contents)) {
16
+ if (!/buildFeatures\s*\{[^}]*dataBinding/.test(contents)) {
17
+ config.modResults.contents = contents.replace(
18
+ /buildFeatures\s*\{/,
19
+ (match) => `${match}\n dataBinding true`
20
+ );
21
+ }
22
+ return config;
23
+ }
24
+
25
+ config.modResults.contents = CodeGenerator.mergeContents({
26
+ src: contents,
27
+ newSrc: ' buildFeatures {\n dataBinding true\n }',
28
+ tag: MERGE_TAG,
29
+ anchor: /^android\s*\{/,
30
+ offset: 1,
31
+ comment: '//',
32
+ }).contents;
33
+
34
+ return config;
35
+ });
36
+ }
37
+
38
+ module.exports = withIdwiseAndroidDataBinding;
@@ -0,0 +1,36 @@
1
+ const { AndroidConfig, withAndroidManifest } = require('@expo/config-plugins');
2
+
3
+ const MLKIT_DEPENDENCIES_META_DATA = 'com.google.mlkit.vision.DEPENDENCIES';
4
+
5
+ // The IDWise Android SDK declares this meta-data tag to request the MLKit modules it bundles
6
+ // (ocr, face, custom_ica). expo-dev-launcher's QR-to-connect scanner declares the same tag with
7
+ // its own module (barcode_ui). The Android manifest merger cannot reconcile two different values
8
+ // for the same tag, so we take ownership of it at the app level and union the known values.
9
+ const REQUIRED_MLKIT_MODULES = ['ocr', 'face', 'custom_ica', 'barcode_ui'];
10
+
11
+ function withIdwiseAndroidManifest(config) {
12
+ return withAndroidManifest(config, (config) => {
13
+ const androidManifest = config.modResults;
14
+ androidManifest.manifest.$['xmlns:tools'] =
15
+ androidManifest.manifest.$['xmlns:tools'] || 'http://schemas.android.com/tools';
16
+
17
+ const mainApplication = AndroidConfig.Manifest.getMainApplicationOrThrow(androidManifest);
18
+
19
+ AndroidConfig.Manifest.addMetaDataItemToMainApplication(
20
+ mainApplication,
21
+ MLKIT_DEPENDENCIES_META_DATA,
22
+ REQUIRED_MLKIT_MODULES.join(',')
23
+ );
24
+
25
+ const metaDataItem = mainApplication['meta-data'].find(
26
+ (item) => item.$['android:name'] === MLKIT_DEPENDENCIES_META_DATA
27
+ );
28
+ if (metaDataItem) {
29
+ metaDataItem.$['tools:replace'] = 'android:value';
30
+ }
31
+
32
+ return config;
33
+ });
34
+ }
35
+
36
+ module.exports = withIdwiseAndroidManifest;
@@ -0,0 +1,30 @@
1
+ const { withPodfileProperties } = require('@expo/config-plugins');
2
+
3
+ const IOS_POD_NAME = 'IDWise';
4
+ const IOS_POD_SOURCE_URL = 'https://github.com/idwise/ios-sdk';
5
+ const EXTRA_PODS_KEY = 'apple.extraPods';
6
+
7
+ function withIdwiseIosPodSource(config) {
8
+ return withPodfileProperties(config, (config) => {
9
+ const properties = config.modResults;
10
+
11
+ let pods = [];
12
+ if (properties[EXTRA_PODS_KEY]) {
13
+ try {
14
+ pods = JSON.parse(properties[EXTRA_PODS_KEY]);
15
+ } catch {
16
+ pods = [];
17
+ }
18
+ }
19
+
20
+ if (!pods.some((pod) => pod.name === IOS_POD_NAME)) {
21
+ pods.push({ name: IOS_POD_NAME, source: IOS_POD_SOURCE_URL });
22
+ }
23
+
24
+ properties[EXTRA_PODS_KEY] = JSON.stringify(pods);
25
+
26
+ return config;
27
+ });
28
+ }
29
+
30
+ module.exports = withIdwiseIosPodSource;