react-native-quicktracking-analytics-module 2.0.2 → 2.1.0

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 (48) hide show
  1. package/LICENSE +1 -1
  2. package/QuicktrackingAnalyticsModule.podspec +29 -0
  3. package/README.md +211 -151
  4. package/android/build.gradle +40 -101
  5. package/android/gradle.properties +5 -5
  6. package/android/src/main/AndroidManifest.xml +1 -2
  7. package/android/src/main/AndroidManifestNew.xml +2 -0
  8. package/android/src/main/java/com/quicktrackinganalyticsmodule/QTSDKManager.kt +112 -0
  9. package/android/src/main/java/com/quicktrackinganalyticsmodule/QuicktrackingAnalyticsModuleModule.kt +259 -0
  10. package/android/src/main/java/com/quicktrackinganalyticsmodule/QuicktrackingAnalyticsModulePackage.kt +17 -0
  11. package/android/src/main/java/com/quicktrackinganalyticsmodule/property/QTViewProperties.kt +84 -0
  12. package/android/src/main/java/com/quicktrackinganalyticsmodule/utils/QTLog.kt +119 -0
  13. package/android/src/main/java/com/quicktrackinganalyticsmodule/utils/RNPropertyManager.kt +35 -0
  14. package/android/src/main/java/com/quicktrackinganalyticsmodule/utils/RNTouchTargetHelper.kt +162 -0
  15. package/android/src/main/java/com/quicktrackinganalyticsmodule/utils/RNUtils.kt +170 -0
  16. package/android/src/main/java/com/quicktrackinganalyticsmodule/utils/RNViewUtils.kt +233 -0
  17. package/ios/QuicktrackingAnalyticsModule.h +1 -4
  18. package/ios/{QuicktrackingAnalyticsModule.m → QuicktrackingAnalyticsModule.mm} +144 -110
  19. package/lib/commonjs/hook.js +564 -0
  20. package/lib/commonjs/hook.js.map +1 -0
  21. package/lib/commonjs/index.js +276 -166
  22. package/lib/commonjs/index.js.map +1 -0
  23. package/lib/commonjs/package.json +1 -0
  24. package/lib/module/hook.js +564 -0
  25. package/lib/module/hook.js.map +1 -0
  26. package/lib/module/index.js +253 -164
  27. package/lib/module/index.js.map +1 -0
  28. package/lib/typescript/index.d.ts +120 -79
  29. package/lib/typescript/index.d.ts.map +1 -0
  30. package/package.json +83 -67
  31. package/src/hook.js +3 -3
  32. package/src/index.tsx +266 -169
  33. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  34. package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  35. package/android/gradlew +0 -234
  36. package/android/gradlew.bat +0 -89
  37. package/android/src/main/java/com/reactnativequicktrackinganalyticsmodule/QTSDKManager.java +0 -93
  38. package/android/src/main/java/com/reactnativequicktrackinganalyticsmodule/QuicktrackingAnalyticsModule.java +0 -242
  39. package/android/src/main/java/com/reactnativequicktrackinganalyticsmodule/QuicktrackingAnalyticsModulePackage.java +0 -28
  40. package/android/src/main/java/com/reactnativequicktrackinganalyticsmodule/property/QTViewProperties.java +0 -48
  41. package/android/src/main/java/com/reactnativequicktrackinganalyticsmodule/utils/QTLog.java +0 -122
  42. package/android/src/main/java/com/reactnativequicktrackinganalyticsmodule/utils/RNPropertyManager.java +0 -29
  43. package/android/src/main/java/com/reactnativequicktrackinganalyticsmodule/utils/RNTouchTargetHelper.java +0 -139
  44. package/android/src/main/java/com/reactnativequicktrackinganalyticsmodule/utils/RNUtils.java +0 -188
  45. package/android/src/main/java/com/reactnativequicktrackinganalyticsmodule/utils/RNViewUtils.java +0 -148
  46. package/ios/QuicktrackingAnalyticsModule.xcodeproj/project.pbxproj +0 -282
  47. package/ios/QuicktrackingAnalyticsModule.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  48. package/react-native-quicktracking-analytics-module.podspec +0 -37
@@ -0,0 +1,233 @@
1
+ package com.quicktrackinganalyticsmodule.utils
2
+
3
+ import android.app.Activity
4
+ import android.view.View
5
+ import android.view.ViewGroup
6
+ import org.json.JSONObject
7
+ import java.lang.ref.WeakReference
8
+ import java.util.WeakHashMap
9
+ import java.util.concurrent.locks.ReentrantReadWriteLock
10
+
11
+ /**
12
+ * Utility class for managing React Native view operations and screen tracking.
13
+ */
14
+ object RNViewUtils {
15
+ private val lock = ReentrantReadWriteLock()
16
+ private var mWeakCurrentActivityReference: WeakReference<Activity>? = null
17
+ private var currentTitle: String? = null
18
+ private var currentScreenName: String? = null
19
+ var isScreenVisible = false
20
+ private set
21
+ private var screenProperties: JSONObject? = null
22
+ private var onTouchViewReference: WeakReference<View>? = null
23
+ private val mScreenMap = WeakHashMap<Activity, JSONObject>()
24
+
25
+ /**
26
+ * Sets the current touch view for tracking.
27
+ * @param nativeTargetView The view that was touched
28
+ */
29
+ fun setOnTouchView(nativeTargetView: View) {
30
+ lock.writeLock().lock()
31
+ try {
32
+ onTouchViewReference = WeakReference(nativeTargetView)
33
+ } finally {
34
+ lock.writeLock().unlock()
35
+ }
36
+ }
37
+
38
+ /**
39
+ * Gets the current activity.
40
+ * @return The current activity or null if not available
41
+ */
42
+ fun getCurrentActivity(): Activity? {
43
+ lock.readLock().lock()
44
+ try {
45
+ return mWeakCurrentActivityReference?.get()
46
+ } finally {
47
+ lock.readLock().unlock()
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Finds a view by its ID in the view hierarchy.
53
+ * @param viewId The ID of the view to find
54
+ * @param onTouchView The view where the touch occurred
55
+ * @return The found view or null if not found
56
+ */
57
+ private fun getClickView(viewId: Int, onTouchView: View): View? {
58
+ var currentView = onTouchView
59
+ while (currentView.id != viewId) {
60
+ val parent = currentView.parent
61
+ if (parent !is View) {
62
+ return null
63
+ }
64
+ currentView = parent
65
+ }
66
+ return currentView
67
+ }
68
+
69
+ /**
70
+ * Recursively searches for a view by its ID in a ViewGroup's children.
71
+ * @param viewId The ID of the view to find
72
+ * @param currentView The ViewGroup to search in
73
+ * @return The found view or null if not found
74
+ */
75
+ private fun getClickViewInChild(viewId: Int, currentView: ViewGroup): View? {
76
+ for (i in 0 until currentView.childCount) {
77
+ val childView = currentView.getChildAt(i) ?: continue
78
+ if (childView.id == viewId) {
79
+ return childView
80
+ }
81
+ if (childView is ViewGroup) {
82
+ getClickViewInChild(viewId, childView)?.let { return it }
83
+ }
84
+ }
85
+ return null
86
+ }
87
+
88
+ /**
89
+ * Gets the view that was touched by its tag.
90
+ * @param viewTag The tag of the view to find
91
+ * @return The found view or null if not found
92
+ */
93
+ fun getTouchViewByTag(viewTag: Int): View? {
94
+ lock.readLock().lock()
95
+ try {
96
+ val onTouchView = onTouchViewReference?.get() ?: return null
97
+ var clickView = getClickView(viewTag, onTouchView)
98
+ if (clickView == null && onTouchView is ViewGroup) {
99
+ clickView = getClickViewInChild(viewTag, onTouchView)
100
+ }
101
+ return clickView
102
+ } finally {
103
+ lock.readLock().unlock()
104
+ }
105
+ }
106
+
107
+ /**
108
+ * Gets a view by its tag, searching in both the current activity and touch view.
109
+ * @param viewTag The tag of the view to find
110
+ * @return The found view or null if not found
111
+ */
112
+ fun getViewByTag(viewTag: Int): View? {
113
+ return try {
114
+ var clickView: View? = null
115
+ val currentActivity = getCurrentActivity()
116
+ if (currentActivity != null) {
117
+ clickView = currentActivity.findViewById(viewTag)
118
+ }
119
+ clickView ?: getTouchViewByTag(viewTag)
120
+ } catch (e: Exception) {
121
+ QTLog.printStackTrace(e)
122
+ null
123
+ }
124
+ }
125
+
126
+ /**
127
+ * Gets the current screen title.
128
+ * @return The current title or null if not set
129
+ */
130
+ fun getTitle(): String? = currentTitle
131
+
132
+ /**
133
+ * Gets the current screen name.
134
+ * @return The current screen name or null if not set
135
+ */
136
+ fun getScreenName(): String? = currentScreenName
137
+
138
+ /**
139
+ * Sets the current activity and updates screen properties.
140
+ * @param currentActivity The activity to set as current
141
+ */
142
+ private fun setCurrentActivity(currentActivity: Activity) {
143
+ lock.writeLock().lock()
144
+ try {
145
+ clearCurrentActivityReference()
146
+ mWeakCurrentActivityReference = WeakReference(currentActivity)
147
+ val properties = mScreenMap[currentActivity]
148
+ if (properties != null && properties.has("\$screen_name")) {
149
+ saveScreenAndTitle(
150
+ properties.optString("\$screen_name"),
151
+ properties.optString("\$title")
152
+ )
153
+ } else {
154
+ currentScreenName = null
155
+ currentTitle = null
156
+ screenProperties = null
157
+ }
158
+ } finally {
159
+ lock.writeLock().unlock()
160
+ }
161
+ }
162
+
163
+ /**
164
+ * Saves the current screen name and title.
165
+ * @param screenName The name of the screen
166
+ * @param title The title of the screen
167
+ */
168
+ fun saveScreenAndTitle(screenName: String, title: String) {
169
+ lock.writeLock().lock()
170
+ try {
171
+ currentScreenName = screenName
172
+ currentTitle = title
173
+ try {
174
+ screenProperties = JSONObject().apply {
175
+ put("\$title", title)
176
+ put("\$screen_name", screenName)
177
+ put("isSetRNViewTag", true)
178
+ }
179
+ } catch (e: Exception) {
180
+ QTLog.printStackTrace(e)
181
+ }
182
+ getCurrentActivity()?.let { currentActivity ->
183
+ screenProperties?.let { properties ->
184
+ mScreenMap[currentActivity] = properties
185
+ }
186
+ }
187
+ } finally {
188
+ lock.writeLock().unlock()
189
+ }
190
+ }
191
+
192
+ /**
193
+ * Clears the current activity reference.
194
+ */
195
+ fun clearCurrentActivityReference() {
196
+ lock.writeLock().lock()
197
+ try {
198
+ mWeakCurrentActivityReference?.clear()
199
+ mWeakCurrentActivityReference = null
200
+ } finally {
201
+ lock.writeLock().unlock()
202
+ }
203
+ }
204
+
205
+ /**
206
+ * Sets the screen visibility.
207
+ * @param isVisiable Whether the screen is visible
208
+ */
209
+ fun setScreenVisiable(isVisiable: Boolean) {
210
+ lock.writeLock().lock()
211
+ try {
212
+ this.isScreenVisible = isVisiable
213
+ } finally {
214
+ lock.writeLock().unlock()
215
+ }
216
+ }
217
+
218
+ /**
219
+ * Called when an activity is resumed.
220
+ * @param currentActivity The activity that was resumed
221
+ */
222
+ fun onActivityResumed(currentActivity: Activity) {
223
+ setScreenVisiable(true)
224
+ setCurrentActivity(currentActivity)
225
+ }
226
+
227
+ /**
228
+ * Called when an activity is paused.
229
+ */
230
+ fun onActivityPaused() {
231
+ setScreenVisiable(false)
232
+ }
233
+ }
@@ -1,15 +1,12 @@
1
1
  #import <Foundation/Foundation.h>
2
2
 
3
+
3
4
  #if __has_include(<React/RCTBridgeModule.h>)
4
5
  #import <React/RCTBridgeModule.h>
5
6
  #else
6
7
  #import "RCTBridgeModule.h"
7
8
  #endif
8
9
 
9
- NS_ASSUME_NONNULL_BEGIN
10
-
11
10
  @interface QuicktrackingAnalyticsModule : NSObject <RCTBridgeModule>
12
11
 
13
12
  @end
14
-
15
- NS_ASSUME_NONNULL_END
@@ -1,24 +1,117 @@
1
- //#if __has_include(<QTCommon/MobClick.h>)
1
+ #import "QuicktrackingAnalyticsModule.h"
2
+ #import <React/RCTConvert.h>
3
+ #import <React/RCTEventDispatcher.h>
4
+ #import <React/RCTLog.h>
5
+ #import "QTRNUtils.h"
6
+ #import "QuickTrackingSDKManager.h"
7
+
8
+ #if __has_include(<QTCommon/MobClick.h>)
2
9
  #import <QTCommon/MobClick.h>
3
10
  #import <QTCommon/UMConfigure.h>
4
11
  #import <QTCommon/UMSpm.h>
12
+ #endif
5
13
 
6
- //#else
7
- //#import "MobClick.h"
8
- //#endif
14
+ #if __has_include(<UMCommonLog/UMCommonLogHeaders.h>)
15
+ #import <UMCommonLog/UMCommonLogHeaders.h>
16
+ #endif
9
17
 
10
- #import "QuicktrackingAnalyticsModule.h"
11
- #import "QTRNUtils.h"
12
- #import "QuickTrackingSDKManager.h"
18
+ @implementation QuicktrackingAnalyticsModule
13
19
 
14
- #import <React/RCTConvert.h>
15
- #import <React/RCTEventDispatcher.h>
16
- #import <React/RCTLog.h>
20
+ RCT_EXPORT_MODULE()
17
21
 
22
+ //======================================全局属性相关===========================================//
23
+ RCT_EXPORT_METHOD(registerGlobalProperty:(NSDictionary*)globalproperty)
24
+ {
25
+ if (globalproperty == nil && [globalproperty isKindOfClass:[NSNull class]]) {
26
+ globalproperty = nil;
27
+ }
28
+ [QTMobClick registerGlobalProperty:globalproperty];
29
+ }
18
30
 
19
- @implementation QuicktrackingAnalyticsModule
31
+ RCT_EXPORT_METHOD(clearGlobalProperties)
32
+ {
33
+ [QTMobClick clearGlobalProperties];
34
+ }
35
+
36
+ RCT_EXPORT_METHOD(getGlobalProperty:(NSString*)propertyName resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
37
+ if (propertyName == nil || [propertyName isKindOfClass:[NSNull class]]) {
38
+ return;
39
+ }
40
+ @try {
41
+ NSString* property = [QTMobClick getGlobalProperty:propertyName];
42
+ resolve(property);
43
+ } @catch (NSException *exception) {
44
+ NSLog(@"[QuickTracking ReactNative] error:%@",exception);
45
+ }
46
+ }
47
+
48
+ RCT_EXPORT_METHOD(unregisterGlobalProperty:(NSString*)propertyName)
49
+ {
50
+ if (propertyName == nil && [propertyName isKindOfClass:[NSNull class]]) {
51
+ propertyName = nil;
52
+ }
53
+ [QTMobClick unregisterGlobalProperty:propertyName];
54
+ }
55
+
56
+ RCT_EXPORT_METHOD(getGlobalProperties:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
57
+ @try {
58
+ NSDictionary* dict = [QTMobClick getGlobalProperties];
59
+ resolve(dict);
60
+ } @catch (NSException *exception) {
61
+ NSLog(@"[QuickTracking ReactNative] error:%@",exception);
62
+ }
63
+ }
64
+
65
+ //======================================用户账号和用户属性相关===========================================//
66
+ RCT_EXPORT_METHOD(profileSignIn:(NSString*)puid provider:(NSString*)provider)
67
+ {
68
+ if (puid == nil || [puid isKindOfClass:[NSNull class]]) {
69
+ return;
70
+ }
71
+ if (provider == nil || [provider isKindOfClass:[NSNull class]]) {
72
+ [QTMobClick profileSignInWithPUID:puid];
73
+ } else {
74
+ [QTMobClick profileSignInWithPUID:puid provider:provider];
75
+ }
76
+ }
77
+
78
+ RCT_EXPORT_METHOD(profileSignOff)
79
+ {
80
+ [QTMobClick profileSignOff];
81
+ }
82
+
83
+ /**
84
+ * React Native 保存可点击控件列表信息
85
+ */
86
+ RCT_EXPORT_METHOD(saveViewProperties:(NSInteger)reactTag
87
+ clickable:(BOOL)clickable parameters:(NSDictionary *)paramters) {
88
+ @try {
89
+ [[QuickTrackingSDKManager sharedInstance] prepareView:@(reactTag) clickable:clickable paramters:paramters];
90
+ } @catch (NSException *exception) {
91
+ NSLog(@"[QuickTracking ReactNative] error: %@", exception);
92
+ }
93
+ }
94
+
95
+ /**
96
+ * React Native 保存可点击控件列表信息
97
+ *
98
+ * @param reactTag 当前控件唯一标识符
99
+ * @param clickable 当前控件可点击状态
100
+ * @param paramters 当前控件自定义参数
101
+ * @param rootTag 当前 RN 页面的唯一标识
102
+ *
103
+ */
104
+ RCT_EXPORT_METHOD(saveRootViewProperties:(NSInteger)reactTag
105
+ clickable:(BOOL)clickable
106
+ parameters:(NSDictionary *)paramters
107
+ rootTag:(NSInteger) rootTag) {
108
+ @try {
109
+ [[QuickTrackingSDKManager sharedInstance] prepareView:@(reactTag) clickable:clickable paramters:paramters rootTag:@(rootTag)];
110
+ } @catch (NSException *exception) {
111
+ NSLog(@"[QuickTracking ReactNative] error:%@",exception);
112
+ }
113
+ }
20
114
 
21
- RCT_EXPORT_MODULE(QuicktrackingAnalyticsModule)
22
115
  //======================================页面事件相关===========================================//
23
116
  //页面启动事件,在该页面展示时调用
24
117
  RCT_EXPORT_METHOD(onPageStart:(NSString *)pageName)
@@ -99,18 +192,6 @@ RCT_EXPORT_METHOD(onEvent:(NSString *)eventId)
99
192
  [QTMobClick event:eventId];
100
193
  }
101
194
 
102
- RCT_EXPORT_METHOD(onEventWithParamsAndCount:(NSString *)eventId parameters:(NSDictionary *)parameters eventNum:(int)eventNum)
103
- {
104
- if (eventId == nil || [eventId isKindOfClass:[NSNull class]]) {
105
- return;
106
- }
107
- if (parameters == nil && [parameters isKindOfClass:[NSNull class]]) {
108
- parameters = nil;
109
- }
110
-
111
- [QTMobClick event:eventId attributes:parameters counter:eventNum];
112
- }
113
-
114
195
  RCT_EXPORT_METHOD(onEventForH5:(NSString*)eventId attributes:(NSDictionary *)attributes) {
115
196
 
116
197
  Class _MobClickEvent = NSClassFromString(@"QTMobClickEvent");
@@ -133,108 +214,61 @@ RCT_EXPORT_METHOD(onEventAutoCLK:(NSInteger)reactTag) {
133
214
  }
134
215
  }
135
216
 
136
- //======================================全局属性相关===========================================//
137
- RCT_EXPORT_METHOD(registerGlobalProperty:(NSDictionary*)globalproperty)
217
+ //======================================初始化相关===========================================//
218
+ // 设置收数域名
219
+ RCT_EXPORT_METHOD(setTrackDomain:(NSString *)mainTrackDomain subTrackDomain:(NSString *)secondaryDomain)
138
220
  {
139
- if (globalproperty == nil && [globalproperty isKindOfClass:[NSNull class]]) {
140
- globalproperty = nil;
141
- }
142
- [QTMobClick registerGlobalProperty:globalproperty];
221
+ dispatch_async(dispatch_get_main_queue(), ^{
222
+ [QTConfigure setCustomDomain:mainTrackDomain standbyDomain:secondaryDomain];
223
+ });
143
224
  }
144
225
 
145
- RCT_EXPORT_METHOD(clearGlobalProperties)
226
+ // !!! SDK 初始化方法,必须在其他方法调用之前调用,否则其他方法调用无效
227
+ // 并且 1. 调用初始化方法之前必须调用 setTrackDomain 方法,设置SDK 收数域名
228
+ // 2. 调用初始化方法必须要在应用主线程中完成
229
+ // 3. 调用SDK初始化方法必须在主线程中调用,否则会报错
230
+ // 4. 请在隐私授权同意后才能调用初始化方法
231
+ RCT_EXPORT_METHOD(initWithAppkey:(NSString *)appKey channel:(NSString *)channel)
146
232
  {
147
- [QTMobClick clearGlobalProperties];
233
+ dispatch_async(dispatch_get_main_queue(), ^{
234
+ [QTConfigure initWithAppkey:appKey channel:channel];
235
+ });
148
236
  }
149
237
 
150
- RCT_EXPORT_METHOD(getGlobalProperty:(NSString*)propertyName resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject) {
151
- if (propertyName == nil || [propertyName isKindOfClass:[NSNull class]]) {
152
- return;
153
- }
154
- @try {
155
- NSString* property = [QTMobClick getGlobalProperty:propertyName];
156
- resolve(property);
157
- } @catch (NSException *exception) {
158
- NSLog(@"[QuickTracking ReactNative] error:%@",exception);
159
- }
160
- }
161
-
162
- RCT_EXPORT_METHOD(unregisterGlobalProperty:(NSString*)propertyName)
238
+ //======================================其他方法===========================================//
239
+ // 开启日志
240
+ RCT_EXPORT_METHOD(enableLog:(BOOL)enable)
163
241
  {
164
- if (propertyName == nil && [propertyName isKindOfClass:[NSNull class]]) {
165
- propertyName = nil;
166
- }
167
- [QTMobClick unregisterGlobalProperty:propertyName];
168
- }
169
-
170
- RCT_EXPORT_METHOD(getGlobalProperties:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) {
171
- @try {
172
- NSDictionary* dict = [QTMobClick getGlobalProperties];
173
- resolve(dict);
174
- } @catch (NSException *exception) {
175
- NSLog(@"[QuickTracking ReactNative] error:%@",exception);
176
- }
242
+ #if __has_include(<UMCommonLog/UMCommonLogHeaders.h>)
243
+ [UMCommonLogManager setUpUMCommonLogManager];
244
+ #endif
245
+ [QTConfigure setLogEnabled:enable];
177
246
  }
178
-
179
- // RCT_EXPORT_METHOD(preInit:(NSString*)appKey)
180
- // {
181
- // [QTMobClick preInit:appKey];
182
- // }
183
-
184
- RCT_EXPORT_METHOD(initWithAppkey:(NSString *)appKey channel:(NSString *)channel)
247
+ // 设置应用版本号
248
+ RCT_EXPORT_METHOD(setAppVersion:(NSString *)appVersion)
185
249
  {
186
- [QTConfigure initWithAppkey:appKey channel:channel];
250
+ [QTConfigure setAppVersion:appVersion];
187
251
  }
188
-
189
- //======================================用户账号和用户属性相关===========================================//
190
- RCT_EXPORT_METHOD(profileSignIn:(NSString*)puid provider:(NSString*)provider)
252
+ // 关闭SDK
253
+ RCT_EXPORT_METHOD(disableSDK)
191
254
  {
192
- if (puid == nil || [puid isKindOfClass:[NSNull class]]) {
193
- return;
194
- }
195
- if (provider == nil || [provider isKindOfClass:[NSNull class]]) {
196
- [QTMobClick profileSignInWithPUID:puid];
197
- } else {
198
- [QTMobClick profileSignInWithPUID:puid provider:provider];
199
- }
255
+ [QTConfigure disableSDK];
200
256
  }
201
-
202
- RCT_EXPORT_METHOD(profileSignOff)
257
+ // 开启SDK
258
+ RCT_EXPORT_METHOD(enableSDK)
203
259
  {
204
- [QTMobClick profileSignOff];
260
+ [QTConfigure enableSDK];
205
261
  }
206
262
 
207
- /**
208
- * React Native 保存可点击控件列表信息
209
- *
210
- */
211
- RCT_EXPORT_METHOD(saveViewProperties:(NSInteger)reactTag
212
- clickable:(BOOL)clickable parameters:(NSDictionary *)paramters) {
213
- @try {
214
- [[QuickTrackingSDKManager sharedInstance] prepareView:@(reactTag) clickable:clickable paramters:paramters];
215
- } @catch (NSException *exception) {
216
- NSLog(@"[QuickTracking ReactNative] error: %@", exception);
217
- }
263
+ // 设置自定义设备ID
264
+ RCT_EXPORT_METHOD(setCustomDeviceId:(NSString *)deviceId)
265
+ {
266
+ [QTConfigure setCustomDeviceId:deviceId];
218
267
  }
219
268
 
220
- /**
221
- * React Native 保存可点击控件列表信息
222
- *
223
- * @param reactTag 当前控件唯一标识符
224
- * @param clickable 当前控件可点击状态
225
- * @param paramters 当前控件自定义参数
226
- * @param rootTag 当前 RN 页面的唯一标识
227
- *
228
- */
229
- RCT_EXPORT_METHOD(saveRootViewProperties:(NSInteger)reactTag
230
- clickable:(BOOL)clickable
231
- parameters:(NSDictionary *)paramters
232
- rootTag:(NSInteger) rootTag) {
233
- @try {
234
- [[QuickTrackingSDKManager sharedInstance] prepareView:@(reactTag) clickable:clickable paramters:paramters rootTag:@(rootTag)];
235
- } @catch (NSException *exception) {
236
- NSLog(@"[QuickTracking ReactNative] error:%@",exception);
237
- }
269
+ // 获取设备ID
270
+ RCT_EXPORT_METHOD(getDeviceId:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
271
+ {
272
+ resolve([QTConfigure umidString]);
238
273
  }
239
-
240
274
  @end