react-native-trustdevice 1.1.4 → 1.1.6

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 (70) hide show
  1. package/README.md +61 -5
  2. package/android/build.gradle +2 -13
  3. package/android/src/main/AndroidManifest.xml +1 -2
  4. package/android/src/main/java/com/trustdevice/TrustdeviceModule.java +44 -2
  5. package/android/src/main/java/com/trustdevice/utils/TDUniRiskUtils.java +13 -0
  6. package/index.d.ts +25 -2
  7. package/index.js +9 -4
  8. package/ios/TrustDevice.m +82 -3
  9. package/ios/TrustDeviceSe.m +16 -1
  10. package/package.json +7 -2
  11. package/react-native-trustdevice.podspec +0 -2
  12. package/src/TrustDevice.android.js +1 -1
  13. package/src/TrustDevice.ios.js +0 -1
  14. package/android/.gradle/8.10/checksums/checksums.lock +0 -0
  15. package/android/.gradle/8.10/checksums/md5-checksums.bin +0 -0
  16. package/android/.gradle/8.10/checksums/sha1-checksums.bin +0 -0
  17. package/android/.gradle/8.10/dependencies-accessors/gc.properties +0 -0
  18. package/android/.gradle/8.10/fileChanges/last-build.bin +0 -0
  19. package/android/.gradle/8.10/fileHashes/fileHashes.bin +0 -0
  20. package/android/.gradle/8.10/fileHashes/fileHashes.lock +0 -0
  21. package/android/.gradle/8.10/gc.properties +0 -0
  22. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  23. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  24. package/android/.gradle/nb-cache/trust/6BEC0066B99297FC163AB3C2D5CC7668CDC2525F18622C2FFD1FE9D77756146A +0 -1
  25. package/android/.gradle/vcs-1/gc.properties +0 -0
  26. package/android/build/.transforms/41053347d20d0a776c1e1d56e9cc047e/results.bin +0 -1
  27. package/android/build/.transforms/41053347d20d0a776c1e1d56e9cc047e/transformed/classes/classes.dex +0 -0
  28. package/android/build/.transforms/5932fa5b98f0003ce689cad35520f6df/results.bin +0 -1
  29. package/android/build/.transforms/5932fa5b98f0003ce689cad35520f6df/transformed/classes/classes.dex +0 -0
  30. package/android/build/.transforms/ff2232c43c8cccbad5f33e76433cddb2/results.bin +0 -1
  31. package/android/build/.transforms/ff2232c43c8cccbad5f33e76433cddb2/transformed/classes/classes.dex +0 -0
  32. package/android/build/generated/source/buildConfig/debug/com/trustdevice/BuildConfig.java +0 -10
  33. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +0 -7
  34. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +0 -18
  35. package/android/build/intermediates/aar_main_jar/debug/classes.jar +0 -0
  36. package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +0 -5
  37. package/android/build/intermediates/annotation_processor_list/debug/annotationProcessors.json +0 -1
  38. package/android/build/intermediates/annotations_typedef_file/debug/typedefs.txt +0 -0
  39. package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
  40. package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
  41. package/android/build/intermediates/compile_symbol_list/debug/R.txt +0 -1954
  42. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +0 -1
  43. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +0 -2
  44. package/android/build/intermediates/incremental/debug-mergeJavaRes/merge-state +0 -0
  45. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +0 -2
  46. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +0 -2
  47. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +0 -2
  48. package/android/build/intermediates/javac/debug/classes/com/trustdevice/BuildConfig.class +0 -0
  49. package/android/build/intermediates/javac/debug/classes/com/trustdevice/TrustdeviceModule$1.class +0 -0
  50. package/android/build/intermediates/javac/debug/classes/com/trustdevice/TrustdeviceModule.class +0 -0
  51. package/android/build/intermediates/javac/debug/classes/com/trustdevice/TrustdevicePackage.class +0 -0
  52. package/android/build/intermediates/javac/debug/classes/com/trustdevice/TrustdeviceSeModule$1.class +0 -0
  53. package/android/build/intermediates/javac/debug/classes/com/trustdevice/TrustdeviceSeModule$2.class +0 -0
  54. package/android/build/intermediates/javac/debug/classes/com/trustdevice/TrustdeviceSeModule.class +0 -0
  55. package/android/build/intermediates/javac/debug/classes/com/trustdevice/utils/TDUniRiskUtils.class +0 -0
  56. package/android/build/intermediates/local_only_symbol_list/debug/R-def.txt +0 -2
  57. package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +0 -8
  58. package/android/build/intermediates/merged_java_res/debug/feature-react-native-trustdevice.jar +0 -0
  59. package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +0 -7
  60. package/android/build/intermediates/navigation_json/debug/navigation.json +0 -1
  61. package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +0 -18
  62. package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
  63. package/android/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt +0 -1447
  64. package/android/build/outputs/aar/react-native-trustdevice-debug.aar +0 -0
  65. package/android/build/outputs/logs/manifest-merger-debug-report.txt +0 -25
  66. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/TrustdevicePackage.class.uniqueId1 +0 -0
  67. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/TrustdeviceSeModule$1.class.uniqueId0 +0 -0
  68. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/TrustdeviceSeModule$2.class.uniqueId3 +0 -0
  69. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/TrustdeviceSeModule.class.uniqueId2 +0 -0
  70. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
package/README.md CHANGED
@@ -21,7 +21,7 @@ Please note that when integrating SDK products provided by the TrustDecision in
21
21
  | | Android | iOS |
22
22
  | ------------------------- | ------------------------------------ | :----------------- |
23
23
  | Supported System Versions | Android 5.0 and above | iOS 9.0 and above |
24
- | Supported Architectures | armeabi, armeabi-v7a, arm64-v8a, x86 | armv7,arm64,x86_64 |
24
+ | Supported Architectures | armeabi-v7a, arm64-v8a, x86 | armv7,arm64,x86_64 |
25
25
 
26
26
  # Integrate
27
27
 
@@ -32,9 +32,47 @@ Please note that when integrating SDK products provided by the TrustDecision in
32
32
  Please execute in your react native project root directory
33
33
 
34
34
  ```shell
35
- npm install --save react-native-trustdevice@1.1.2
35
+ npm install --save react-native-trustdevice@1.1.6
36
36
  ```
37
37
 
38
+ ### iOS behavior collection dependency (Swift Package Manager)
39
+
40
+ The React Native bridge is still auto-linked through CocoaPods, but the iOS
41
+ behavior collection SDK is distributed through Swift Package Manager. After
42
+ running `pod install`, the host app must add the following package in Xcode:
43
+
44
+ 1. Open `ios/<YourApp>.xcworkspace`.
45
+ 2. Select **File > Add Package Dependencies...**.
46
+ 3. Enter `https://github.com/trustdecision/TDBehavior_spm`.
47
+ 4. Select **Exact Version** and enter `1.5.2`.
48
+ 5. Add the `TDBehavior` product to the host application target. Do not add it
49
+ to the Pods project or a Pods target.
50
+
51
+ This app-target dependency cannot be declared by the plugin podspec. It is a
52
+ one-time host project setting and remains in the Xcode project after subsequent
53
+ `npm install` and `pod install` commands. CI can resolve it with:
54
+
55
+ ```shell
56
+ xcodebuild -resolvePackageDependencies \
57
+ -workspace ios/<YourApp>.xcworkspace \
58
+ -scheme <YourApp>
59
+ ```
60
+
61
+ ### Android behavior collection dependency
62
+
63
+ The plugin does not bundle the Android behavior collection SDK. If behavior
64
+ collection is required, add the following dependency to the host application's
65
+ `android/app/build.gradle`:
66
+
67
+ ```gradle
68
+ dependencies {
69
+ implementation 'com.trustdecision.android:behavior:1.5.1'
70
+ }
71
+ ```
72
+
73
+ Then rebuild the native application. Adding or removing this dependency cannot
74
+ be applied through Metro hot reload.
75
+
38
76
  ### AndroidManifest.xml
39
77
 
40
78
  Declare the following permissions in the AndroidManifest.xml file under the application module
@@ -99,6 +137,24 @@ Declare the following permissions in the AndroidManifest.xml file under the appl
99
137
  async function getBlackBoxAsync();
100
138
  ```
101
139
 
140
+ ## Behavior collection
141
+
142
+ Initialize the SDK before starting collection. There must be a real user
143
+ interaction such as typing, tapping, or scrolling between `start` and
144
+ `collect`; otherwise `collect` may return code `104`.
145
+
146
+ ```tsx
147
+ await TrustDevice.start();
148
+
149
+ const result = await TrustDevice.collect();
150
+ // result: {code: number, payload: string, msg: string}
151
+
152
+ await TrustDevice.stop();
153
+ ```
154
+
155
+ `collect` returns and clears the currently buffered behavior data. `stop`
156
+ stops collection and clears any uncollected data.
157
+
102
158
  ## Best Practices
103
159
 
104
160
  1. Get TrustDevice Module
@@ -116,7 +172,7 @@ Declare the following permissions in the AndroidManifest.xml file under the appl
116
172
  "partner": "[Your partner]",
117
173
  "appKey": "[Your appKey]",
118
174
  "appName": "[Your appName]",
119
- "country": "[Your country code]",
175
+ "dataCenter": "[Your dataCenter]",
120
176
  "debug": false,
121
177
  }
122
178
 
@@ -165,7 +221,7 @@ Declare the following permissions in the AndroidManifest.xml file under the appl
165
221
  | ------------------ | ----------------------------------------------------------------------------------------------------------------------------- | ------- | ------------------------------------ |
166
222
  | partner(required) | Partner code, contact operator to obtain. | All | options["partner"] = "your partner" |
167
223
  | appKey(required) | Application identification, please refer to[how to get appKey](https://en-doc.trustdecision.com/reference/android-get-appkey) | All | options["appKey"] = "your appKey" |
168
- | country(required) | Data-center: **cn** for China **fra** for Europe **sg** for Singapore **inda** for Indonesia **us** for the USA | All | options["country"] = "your country" |
224
+ | dataCenter(required) | Data-center: **cn** for China **fra** for Europe **sg** for Singapore **inda** for Indonesia **us** for the USA | All | options["dataCenter"] = "your dataCenter" |
169
225
  | appName | Application name, contact operator to obtain | All | options["appName"] = "your appName" |
170
226
  | debug | Allow debugging, default false, must be closed before the application release. | All | options["debug"] = true |
171
227
  | timeLimit | Network timeout configuration, in seconds, default 15s | All | options["timeLimit"] = 5 |
@@ -176,4 +232,4 @@ Declare the following permissions in the AndroidManifest.xml file under the appl
176
232
  | runningTasks | Whether collecting running tasks, default allowed | Android | options["runningTasks"] = true |
177
233
  | sensor | Whether collecting sensor information, default allowed | Android | options["sensor"] = true |
178
234
  | readPhone | Whether collecting READ _PHONE_ STATE permission-related information, default allowed | Android | options["readPhone"] = true |
179
- | installPackageList | Whether collecting application list information, default allowed | Android | options["installPackageList"] = true |
235
+ | installPackageList | Whether collecting application list information, default allowed | Android | options["installPackageList"] = true |
@@ -1,18 +1,8 @@
1
-
2
- buildscript {
3
- repositories {
4
- google()
5
- mavenCentral()
6
- }
7
-
8
- dependencies {
9
- classpath("com.android.tools.build:gradle:4.1.3")
10
- }
11
- }
12
-
13
1
  apply plugin: 'com.android.library'
14
2
 
15
3
  android {
4
+ namespace 'com.trustdevice' // 添加这一行,AGP8.0+需要namespace
5
+
16
6
  compileSdkVersion 34
17
7
 
18
8
  defaultConfig {
@@ -35,4 +25,3 @@ dependencies {
35
25
  implementation 'com.facebook.react:react-native:+'
36
26
  implementation 'com.trustdecision.android:mobrisk:+'
37
27
  }
38
-
@@ -1,6 +1,5 @@
1
1
 
2
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
- package="com.trustdevice">
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
4
3
 
5
4
  </manifest>
6
5
 
@@ -17,6 +17,7 @@ import java.util.HashMap;
17
17
  import com.trustdecision.mobrisk.TDRisk;
18
18
  import com.trustdecision.mobrisk.TDRiskCallback;
19
19
  import com.trustdecision.mobrisk.TDAPISignResult;
20
+ import com.trustdecision.mobrisk.TDBehaviorResult;
20
21
 
21
22
  public class TrustdeviceModule extends ReactContextBaseJavaModule {
22
23
  private final ReactApplicationContext reactContext;
@@ -34,11 +35,18 @@ public class TrustdeviceModule extends ReactContextBaseJavaModule {
34
35
 
35
36
  @ReactMethod
36
37
  public void initWithOptions(ReadableMap readableMap, Promise promise) {
37
- if (readableMap != null) {
38
+ if (readableMap == null) {
39
+ promise.reject("initWithOptions Error", "options must not be null");
40
+ return;
41
+ }
42
+
43
+ try {
38
44
  HashMap<String, Object> options = readableMap.toHashMap();
39
45
  TDRisk.Builder builder = TDUniRiskUtils.mapToBuilder(options);
40
46
  TDRisk.initWithOptions(this.reactContext.getApplicationContext(), builder);
41
47
  promise.resolve(null);
48
+ } catch (Exception e) {
49
+ promise.reject("initWithOptions Error", e);
42
50
  }
43
51
  }
44
52
 
@@ -83,9 +91,43 @@ public class TrustdeviceModule extends ReactContextBaseJavaModule {
83
91
  }
84
92
  }
85
93
 
94
+ @ReactMethod
95
+ public void start(Promise promise) {
96
+ try {
97
+ TDRisk.start();
98
+ promise.resolve(null);
99
+ } catch (Exception e) {
100
+ promise.reject("behaviorStart Error", e);
101
+ }
102
+ }
103
+
104
+ @ReactMethod
105
+ public void stop(Promise promise) {
106
+ try {
107
+ TDRisk.stop();
108
+ promise.resolve(null);
109
+ } catch (Exception e) {
110
+ promise.reject("behaviorStop Error", e);
111
+ }
112
+ }
113
+
114
+ @ReactMethod
115
+ public void collect(Promise promise) {
116
+ try {
117
+ TDBehaviorResult behaviorResult = TDRisk.collect();
118
+ WritableMap resultMap = Arguments.createMap();
119
+ resultMap.putInt("code", behaviorResult.code());
120
+ resultMap.putString("payload", behaviorResult.payload());
121
+ resultMap.putString("msg", behaviorResult.msg());
122
+ promise.resolve(resultMap);
123
+ } catch (Exception e) {
124
+ promise.reject("behaviorCollect Error", e);
125
+ }
126
+ }
127
+
86
128
  @ReactMethod
87
129
  public void getSDKVersion(Promise promise) {
88
130
  String sdkVersion = TDRisk.getSDKVersion();
89
131
  promise.resolve(sdkVersion);
90
132
  }
91
- }
133
+ }
@@ -13,6 +13,7 @@ public class TDUniRiskUtils {
13
13
  static final String KEY_APPKEY = "appKey";
14
14
  static final String KEY_APPNAME = "appName";
15
15
  static final String KEY_COUNTRY = "country";
16
+ static final String KEY_DATACENTER = "dataCenter";
16
17
  static final String KEY_CHANNEL = "channel";
17
18
  static final String KEY_DEBUG = "debug";
18
19
  static final String KEY_TIME_LIMIT = "timeLimit";
@@ -71,6 +72,12 @@ public class TDUniRiskUtils {
71
72
  builder.country(country.toUpperCase());
72
73
  }
73
74
  }
75
+ if (configMap.containsKey(KEY_DATACENTER)) {
76
+ String dataCenter = (String) configMap.get(KEY_DATACENTER);
77
+ if (!TextUtils.isEmpty(dataCenter)) {
78
+ builder.country(dataCenter.toUpperCase());
79
+ }
80
+ }
74
81
  // if (configMap.containsKey(KEY_URL)) {
75
82
  // String url = (String) configMap.get(KEY_URL);
76
83
  // if (!TextUtils.isEmpty(url)) {
@@ -232,6 +239,12 @@ public class TDUniRiskUtils {
232
239
  builder.country(country.toUpperCase());
233
240
  }
234
241
  }
242
+ if (configMap.containsKey(KEY_DATACENTER)) {
243
+ String dataCenter = (String) configMap.get(KEY_DATACENTER);
244
+ if (!TextUtils.isEmpty(dataCenter)) {
245
+ builder.country(dataCenter.toUpperCase());
246
+ }
247
+ }
235
248
  if (configMap.containsKey(KEY_DEBUG)) {
236
249
  Object debug = configMap.get(KEY_DEBUG);
237
250
  if (debug != null) {
package/index.d.ts CHANGED
@@ -1,4 +1,27 @@
1
+ export interface TDSignResult {
2
+ code: number;
3
+ sign: string;
4
+ msg: string;
5
+ }
1
6
 
2
- /// <reference types="react-scripts">
7
+ export interface TDBehaviorResult {
8
+ code: number;
9
+ payload: string;
10
+ msg: string;
11
+ }
3
12
 
4
- declare module 'react-native-trustdevice';
13
+ export interface TrustDeviceModule {
14
+ initWithOptions(options: Record<string, unknown>): Promise<void> | void;
15
+ getSDKVersion(): Promise<string>;
16
+ getBlackBox(): Promise<string>;
17
+ getBlackBoxAsync(): Promise<string>;
18
+ sign(path: string): Promise<TDSignResult>;
19
+ start(): Promise<void>;
20
+ stop(): Promise<void>;
21
+ collect(): Promise<TDBehaviorResult>;
22
+ }
23
+
24
+ declare const TrustDevice: TrustDeviceModule;
25
+
26
+ export {TrustDevice};
27
+ export default TrustDevice;
package/index.js CHANGED
@@ -1,4 +1,9 @@
1
- const TrustDevice = require('./src/TrustDevice');
2
- export { TrustDevice };
3
- export default TrustDevice;
4
- module.exports = TrustDevice;
1
+ // Platform files are transpiled as ES modules by Metro, while older published
2
+ // versions of this package were consumed as CommonJS. Normalize the platform
3
+ // export once and preserve all existing public import styles.
4
+ const platformModule = require('./src/TrustDevice');
5
+ const TrustDevice = platformModule.default || platformModule;
6
+
7
+ module.exports = TrustDevice;
8
+ module.exports.default = TrustDevice;
9
+ module.exports.TrustDevice = TrustDevice;
package/ios/TrustDevice.m CHANGED
@@ -27,7 +27,22 @@ RCT_REMAP_METHOD(getSDKVersion,
27
27
  RCT_EXPORT_METHOD(initWithOptions:(NSDictionary*)options)
28
28
  {
29
29
  NSMutableDictionary* mutableOptions = [options mutableCopy];
30
- mutableOptions[@"allowd"] = options[@"debug"];
30
+
31
+ // 1. 判断 debug 是否为空(nil 或 NSNull)
32
+ id debugValue = options[@"debug"];
33
+ if (debugValue && debugValue != [NSNull null]) {
34
+ mutableOptions[@"allowd"] = debugValue; // 原逻辑保留
35
+ } else {
36
+ // debug 为空时,可能设置默认值或不设置
37
+ mutableOptions[@"allowd"] = @(NO); // 示例默认 false
38
+ }
39
+
40
+ // 2. 增加 dataCenter 赋值给 country
41
+ id dataCenter = options[@"dataCenter"];
42
+ if (dataCenter && dataCenter != [NSNull null]) {
43
+ mutableOptions[@"country"] = dataCenter;
44
+ }
45
+
31
46
  TDMobRiskManager_t *manager = [TDMobRiskManager sharedManager];
32
47
  manager->initWithOptions([mutableOptions copy]);
33
48
  }
@@ -78,6 +93,72 @@ RCT_EXPORT_METHOD(sign:(NSString*)path
78
93
  resolve(resultDict);
79
94
  }
80
95
 
96
+ RCT_REMAP_METHOD(start,
97
+ startResolver:(RCTPromiseResolveBlock)resolve
98
+ rejecter:(RCTPromiseRejectBlock)reject)
99
+ {
100
+ TDMobRiskManager_t *manager = [TDMobRiskManager sharedManager];
101
+ if (manager == NULL || manager->start == NULL) {
102
+ reject(@"behavior_unavailable",
103
+ @"TDBehavior is unavailable. Add TDBehavior_spm 1.5.2 to the host App Target.",
104
+ nil);
105
+ return;
106
+ }
107
+
108
+ // TDBehavior starts UIKit-backed providers (for example device orientation),
109
+ // which must be created and stopped on the main thread. React Native invokes
110
+ // native module methods on a background method queue by default.
111
+ dispatch_async(dispatch_get_main_queue(), ^{
112
+ manager->start();
113
+ resolve(nil);
114
+ });
115
+ }
116
+
117
+ RCT_REMAP_METHOD(stop,
118
+ stopResolver:(RCTPromiseResolveBlock)resolve
119
+ rejecter:(RCTPromiseRejectBlock)reject)
120
+ {
121
+ TDMobRiskManager_t *manager = [TDMobRiskManager sharedManager];
122
+ if (manager == NULL || manager->stop == NULL) {
123
+ reject(@"behavior_unavailable",
124
+ @"TDBehavior is unavailable. Add TDBehavior_spm 1.5.2 to the host App Target.",
125
+ nil);
126
+ return;
127
+ }
128
+
129
+ dispatch_async(dispatch_get_main_queue(), ^{
130
+ manager->stop();
131
+ resolve(nil);
132
+ });
133
+ }
134
+
135
+ RCT_REMAP_METHOD(collect,
136
+ collectResolver:(RCTPromiseResolveBlock)resolve
137
+ rejecter:(RCTPromiseRejectBlock)reject)
138
+ {
139
+ TDMobRiskManager_t *manager = [TDMobRiskManager sharedManager];
140
+ if (manager == NULL || manager->collect == NULL) {
141
+ reject(@"behavior_unavailable",
142
+ @"TDBehavior is unavailable. Add TDBehavior_spm 1.5.2 to the host App Target.",
143
+ nil);
144
+ return;
145
+ }
146
+ TDBehaviorResultStruct behaviorResult = manager->collect();
147
+
148
+ NSString *payload = behaviorResult.payload
149
+ ? [NSString stringWithUTF8String:behaviorResult.payload]
150
+ : @"";
151
+ NSString *message = behaviorResult.msg
152
+ ? [NSString stringWithUTF8String:behaviorResult.msg]
153
+ : @"";
154
+
155
+ resolve(@{
156
+ @"code": @(behaviorResult.code),
157
+ @"payload": payload,
158
+ @"msg": message
159
+ });
160
+ }
161
+
81
162
  - (UIWindow *)getKeyWindow
82
163
  {
83
164
  if (@available(iOS 13.0, *))
@@ -139,5 +220,3 @@ RCT_REMAP_METHOD(showCaptcha,
139
220
 
140
221
 
141
222
  @end
142
-
143
-
@@ -27,7 +27,22 @@ RCT_REMAP_METHOD(getSDKVersion,
27
27
  RCT_EXPORT_METHOD(initWithOptions:(NSDictionary*)options)
28
28
  {
29
29
  NSMutableDictionary* mutableOptions = [options mutableCopy];
30
- mutableOptions[@"allowd"] = options[@"debug"];
30
+
31
+ // 1. 判断 debug 是否为空(nil 或 NSNull)
32
+ id debugValue = options[@"debug"];
33
+ if (debugValue && debugValue != [NSNull null]) {
34
+ mutableOptions[@"allowd"] = debugValue; // 原逻辑保留
35
+ } else {
36
+ // debug 为空时,可能设置默认值或不设置
37
+ mutableOptions[@"allowd"] = @(NO); // 示例默认 false
38
+ }
39
+
40
+ // 2. 增加 dataCenter 赋值给 country
41
+ id dataCenter = options[@"dataCenter"];
42
+ if (dataCenter && dataCenter != [NSNull null]) {
43
+ mutableOptions[@"country"] = dataCenter;
44
+ }
45
+
31
46
  TDDeviceManager_t *manager = [TDDeviceManager sharedManager];
32
47
  manager->initWithOptions([mutableOptions copy]);
33
48
  }
package/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "react-native-trustdevice",
3
- "version": "1.1.4",
3
+ "publishConfig": {
4
+ "access": "public"
5
+ },
6
+ "version": "1.1.6",
4
7
  "description": "React Native TrustDevice component",
5
8
  "main": "index.js",
6
9
  "react-native": "index.js",
@@ -18,13 +21,15 @@
18
21
  "react-native-trustdevice"
19
22
  ],
20
23
  "files": [
21
- "android",
24
+ "android/build.gradle",
25
+ "android/src",
22
26
  "ios",
23
27
  "src",
24
28
  "index.js",
25
29
  "index.d.ts",
26
30
  "react-native-trustdevice.podspec"
27
31
  ],
32
+
28
33
  "homepage": "https://trustdecision.com",
29
34
  "peerDependencies": {
30
35
  "react": "*",
@@ -25,5 +25,3 @@ Pod::Spec.new do |s|
25
25
  s.dependency "TrustDecisionPro"
26
26
 
27
27
  end
28
-
29
-
@@ -1,4 +1,4 @@
1
1
 
2
2
  import {NativeModules} from 'react-native';
3
3
  const TrustDevice = NativeModules.TrustDevice;
4
- var _default=exports.default=TrustDevice;
4
+ var _default=exports.default=TrustDevice;
@@ -6,4 +6,3 @@ import { requireNativeComponent,NativeModules } from 'react-native';
6
6
  const TrustDevice = NativeModules.TrustDevice;
7
7
 
8
8
  var _default=exports.default=TrustDevice;
9
-
File without changes
@@ -1,2 +0,0 @@
1
- #Tue Oct 28 10:00:11 CST 2025
2
- gradle.version=8.10
@@ -1 +0,0 @@
1
- 78098113B327001A7ADBB2DD53260281F0DC0024D59151B959C636AEF9B80944
File without changes
@@ -1,10 +0,0 @@
1
- /**
2
- * Automatically generated file. DO NOT MODIFY
3
- */
4
- package com.trustdevice;
5
-
6
- public final class BuildConfig {
7
- public static final boolean DEBUG = Boolean.parseBoolean("true");
8
- public static final String LIBRARY_PACKAGE_NAME = "com.trustdevice";
9
- public static final String BUILD_TYPE = "debug";
10
- }
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
- package="com.trustdevice" >
4
-
5
- <uses-sdk android:minSdkVersion="21" />
6
-
7
- </manifest>
@@ -1,18 +0,0 @@
1
- {
2
- "version": 3,
3
- "artifactType": {
4
- "type": "AAPT_FRIENDLY_MERGED_MANIFESTS",
5
- "kind": "Directory"
6
- },
7
- "applicationId": "com.trustdevice",
8
- "variantName": "debug",
9
- "elements": [
10
- {
11
- "type": "SINGLE",
12
- "filters": [],
13
- "attributes": [],
14
- "outputFile": "AndroidManifest.xml"
15
- }
16
- ],
17
- "elementType": "File"
18
- }
@@ -1,5 +0,0 @@
1
- aarFormatVersion=1.0
2
- aarMetadataVersion=1.0
3
- minCompileSdk=1
4
- minCompileSdkExtension=0
5
- minAndroidGradlePluginVersion=1.0.0