@rk911/tracker-sdk 1.7.15 → 1.7.16

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.
@@ -74,6 +74,7 @@ public class AndroidTracker implements Application.ActivityLifecycleCallbacks {
74
74
  private volatile String userId;
75
75
  private volatile String phone;
76
76
  private volatile String storeName;
77
+ private volatile String userName;
77
78
  private volatile int sequence = 0;
78
79
  private volatile int pflag = -1;
79
80
  private volatile String platformName = "";
@@ -203,6 +204,7 @@ public class AndroidTracker implements Application.ActivityLifecycleCallbacks {
203
204
  this.userId = userId != null ? userId : "";
204
205
  this.phone = phone != null ? phone : "";
205
206
  this.storeName = storeName != null ? storeName : "";
207
+ this.userName = "";
206
208
  this.sessionId = "android_" + System.currentTimeMillis() + "_" + (int) (Math.random() * 10000);
207
209
 
208
210
  // 初始化 SQLite 本地持久化数据库 (S1 防丢保障)
@@ -233,10 +235,15 @@ public class AndroidTracker implements Application.ActivityLifecycleCallbacks {
233
235
  }
234
236
 
235
237
  public void updateUser(String userId, String phone, String storeName) {
238
+ updateUser(userId, phone, storeName, null);
239
+ }
240
+
241
+ public void updateUser(String userId, String phone, String storeName, String userName) {
236
242
  if (userId != null) this.userId = userId;
237
243
  if (phone != null) this.phone = phone;
238
244
  if (storeName != null) this.storeName = storeName;
239
- Log.i(TAG, "===> [Native Tracker User Updated] UserId: " + this.userId + ", Phone: " + this.phone + ", Store: " + this.storeName);
245
+ if (userName != null) this.userName = userName;
246
+ Log.i(TAG, "===> [Native Tracker User Updated] UserId: " + this.userId + ", Phone: " + this.phone + ", Store: " + this.storeName + ", User: " + this.userName);
240
247
  }
241
248
 
242
249
  public void setPlatform(int pflag, String platformName) {
@@ -273,6 +280,10 @@ public class AndroidTracker implements Application.ActivityLifecycleCallbacks {
273
280
  return storeName != null ? storeName : "";
274
281
  }
275
282
 
283
+ public String getUserName() {
284
+ return userName != null ? userName : "";
285
+ }
286
+
276
287
  public void setUserId(String userId) {
277
288
  updateUser(userId, null, null);
278
289
  }
@@ -758,6 +769,7 @@ public class AndroidTracker implements Application.ActivityLifecycleCallbacks {
758
769
  body.put("userId", batchUserId);
759
770
  body.put("phone", phone != null ? phone : "");
760
771
  body.put("storeName", storeName != null ? storeName : "");
772
+ body.put("userName", userName != null ? userName : "");
761
773
  body.put("platform", "android");
762
774
  if (pflag != -1) body.put("pflag", pflag);
763
775
  if (!TextUtils.isEmpty(platformName)) body.put("platformName", platformName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rk911/tracker-sdk",
3
- "version": "1.7.15",
3
+ "version": "1.7.16",
4
4
  "description": "人康多端埋点 SDK — 跨端自动化采集 + 手动埋点双写兼容",
5
5
  "main": "index.js",
6
6
  "module": "index.js",