com.xd.sdk.account 7.1.2 → 7.2.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.
@@ -4,6 +4,6 @@
4
4
  //
5
5
  // Created by Fattycat on 2023/4/14.
6
6
  //
7
- #define XDGAccount_VERSION @"7.1.2"
8
- #define XDSAccount_VERSION_CODE @"7001020"
9
- // HASH 5355bc04
7
+ #define XDGAccount_VERSION @"7.2.0"
8
+ #define XDSAccount_VERSION_CODE @"7020000"
9
+ // HASH 8d15387e
@@ -299,13 +299,12 @@ namespace XD.SDK.Account.Internal.Mobile
299
299
  try
300
300
  {
301
301
  var result = await XDGEventBus.PublishAsync<Dictionary<string, object>>(XDGEvents.TdsSDKGetUser);
302
- var objectId = XDDictionary.GetValue<string>(result, "objectId");
302
+ var objectId = XDDictionary.GetValue<string>(result.GetValueOrThrow(), "objectId");
303
303
  if (objectId == user.UserId)
304
304
  {
305
305
  return;
306
306
  }
307
307
 
308
- //TODO 同步之前先退登 TDSUser
309
308
  XDGEventBus.Publish(XDGEvents.TdsSDKLogout);
310
309
  var response = await HttpClient.PostAsync<LoginSyncResponse>(LoginSynUrl);
311
310
  var sessionToken = XDDictionary.GetValue<string>(response.Data, "sessionToken");
@@ -317,9 +316,9 @@ namespace XD.SDK.Account.Internal.Mobile
317
316
 
318
317
  XDGEventBus.Publish(XDGEvents.TdsSDKSyncUser, sessionToken, user.UserId);
319
318
  }
320
- catch (Exception e)
319
+ catch (XDGError e)
321
320
  {
322
- XDGLogger.Warn($"[SyncTDSUser] error:{e.Message}", XDGLoggerTag.Bridge);
321
+ XDGLogger.Warn($"[SyncTDSUser] error:{e.ErrorMsg}", XDGLoggerTag.Bridge);
323
322
  }
324
323
  }
325
324
 
@@ -148,7 +148,7 @@ namespace XD.SDK.Account.Internal.Standalone
148
148
  };
149
149
  var url = AuthConstants.CN_PERSONAL_INFO + UserModule.XDG_PERSONAL_INFO + "?" +
150
150
  XDUrlUtils.ToQueryString(queries);
151
-
151
+
152
152
  UIManager.ShowUI<XDWebViewAlert>("XDWebViewAlert", new Dictionary<string, object>
153
153
  {
154
154
  {
@@ -245,7 +245,8 @@ namespace XD.SDK.Account.Internal.Standalone
245
245
  // AliyunTrack.LoginAntiAddictionResult(XDDictionary.GetValue(complianceResult, "code", -100),
246
246
  // XDDictionary.GetValue<string>(complianceResult, "reason"),
247
247
  // XDDictionary.GetValue<string>(complianceResult, "extras"));
248
- if (XDDictionary.GetValue<bool>(complianceResult, "success"))
248
+ var compliance = complianceResult.GetValueOrDefault();
249
+ if (XDDictionary.GetValue<bool>(compliance, "success"))
249
250
  {
250
251
  await AgreementModule.SignAgreement(user.UserId);
251
252
  return user;
@@ -269,7 +270,15 @@ namespace XD.SDK.Account.Internal.Standalone
269
270
  }
270
271
  catch (Exception e)
271
272
  {
272
- AliyunTrack.LoginFail(e.Message);
273
+ if (e is XDGError error)
274
+ {
275
+ AliyunTrack.LoginFail(error.ErrorMsg);
276
+ }
277
+ else
278
+ {
279
+ AliyunTrack.LoginFail(e.Message);
280
+ }
281
+
273
282
  AgreementModule.ClearLocalSignedAgreements();
274
283
  throw;
275
284
  }
@@ -279,7 +288,7 @@ namespace XD.SDK.Account.Internal.Standalone
279
288
  {
280
289
  // SDK 登陆成功
281
290
  AliyunTrack.LoginLogout(logoutType);
282
-
291
+
283
292
  ClearUserCache();
284
293
 
285
294
  XDGEventBus.Publish(XDGEvents.TdsSDKLogout);
@@ -27,18 +27,11 @@ namespace XD.SDK.Account.Internal.Standalone
27
27
  UIManager.ShowLoading(timeout: 3);
28
28
  }
29
29
  // 使用明确指定参数类型的反射调用
30
- var permissions = ConfigModule.TapConfig.Permissions;
31
- var authData = await XDGEventBus.PublishAsync<Dictionary<string, object>>(XDGEvents.TapSDKLogin, permissions);
32
-
33
- // 检查返回结果是否为 null
34
- if (authData == null)
35
- {
36
- throw new XDGError(ResponseCode.Common.Failed, "TapTap 登录返回数据为空");
37
- }
38
-
30
+ var permissions = ConfigModule.TapConfig?.Permissions;
31
+ var authDataResult = await XDGEventBus.PublishAsync<Dictionary<string, object>>(XDGEvents.TapSDKLogin, permissions);
32
+ var authData = authDataResult.GetValueOrThrow();
39
33
  authData.Add("type", (int)LoginType.TapTap);
40
34
  authData.Add("scope", string.Join(",", permissions?.ToArray()));
41
-
42
35
  if (ConfigModule.TapConfig != null && ConfigModule.UsingTapPC)
43
36
  {
44
37
  UIManager.DismissLoading();
@@ -60,11 +53,11 @@ namespace XD.SDK.Account.Internal.Standalone
60
53
  // throw new XDGError(ResponseCode.Common.Failed, e.Message);
61
54
  // }
62
55
  // }
63
- catch (Exception e)
56
+ catch (XDGError e)
64
57
  {
65
- AliyunTrack.LoginAuthorizeFail(e.Message);
66
- XDGLogger.Warn($"Tap 登录失败:{e}", XDGLoggerTag.Account);
67
- throw new XDGError(ResponseCode.Common.Failed, e.Message);
58
+ AliyunTrack.LoginAuthorizeFail(e.ErrorMsg);
59
+ XDGLogger.Warn($"Tap 登录失败:{e.ErrorMsg}",XDGLoggerTag.Common);
60
+ throw new XDGError(ResponseCode.Common.Failed, e.ErrorMsg);
68
61
  }
69
62
  }
70
63
  }
@@ -431,7 +431,8 @@ namespace XD.SDK.Account.Internal.Standalone
431
431
 
432
432
  private static Dictionary<string, string> GetLoginModuleCommonProperties(string eventName, string userLoginTypeString = "")
433
433
  {
434
- var current = XDGEventBus.Publish<XDGUser>(XDGEvents.AccountGetCurrentUser)?.UserId;
434
+ var result = XDGEventBus.Publish<XDGUser>(XDGEvents.AccountGetCurrentUser);
435
+ var current = result.GetValueOrDefault()?.UserId;
435
436
  var content = new Dictionary<string, string>();
436
437
  content["tag"] = "sdklogin";
437
438
  content["event_session_id"] = LoginEventSessionId;
@@ -205,18 +205,18 @@ namespace XD.SDK.Account.Internal.Standalone
205
205
  {
206
206
  try
207
207
  {
208
- var token = await XDGEventBus.PublishAsync<Dictionary<string, object>>(XDGEvents.TapSDKGetAccessToken);
209
-
208
+ var tokenResult = await XDGEventBus.PublishAsync<Dictionary<string, object>>(XDGEvents.TapSDKGetAccessToken);
209
+ var token = tokenResult.GetValueOrThrow();
210
210
  if (token == null || !token.ContainsKey("token"))
211
211
  {
212
212
  XDGLogger.Warn("Third token expired.", XDGLoggerTag.Account);
213
213
  throw new XDGError(ResponseCode.Account.TokenExpired, "Third token expired.");
214
214
  }
215
215
  }
216
- catch (Exception e)
216
+ catch (XDGError e)
217
217
  {
218
- XDGLogger.Warn(e.Message, XDGLoggerTag.Account);
219
- throw new XDGError(ResponseCode.Common.Failed, e.Message);
218
+ XDGLogger.Warn(e.ErrorMsg, XDGLoggerTag.Account);
219
+ throw new XDGError(ResponseCode.Common.Failed, e.ErrorMsg);
220
220
  }
221
221
  }
222
222
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "com.xd.sdk.account",
3
3
  "displayName": "XDGSDK Account",
4
- "version": "7.1.2",
4
+ "version": "7.2.0",
5
5
  "description": "XDGSDK",
6
6
  "unity": "2019.3",
7
7
  "license": "MIT",
8
8
  "dependencies": {
9
- "com.xd.sdk.common": "7.1.2"
9
+ "com.xd.sdk.common": "7.2.0"
10
10
  }
11
11
  }