com.xd.sdk.account 0.0.15-alpha → 0.0.16-alpha

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.
@@ -6,4 +6,4 @@
6
6
  //
7
7
  #define XDGAccount_VERSION @"7.0.0"
8
8
  #define XDSAccount_VERSION_CODE @"7000000"
9
- // HASH 8bd7e79
9
+ // HASH 5925d9e
@@ -77,7 +77,7 @@ namespace XD.SDK.Account.Internal.Mobile
77
77
  .Callback(true)
78
78
  .OnceTime(false)
79
79
  .CommandBuilder();
80
- EngineBridge.GetInstance().CallHandler(command, async (result) =>
80
+ EngineBridge.GetInstance().CallHandler(command, (result) =>
81
81
  {
82
82
  if (!XDGTool.CheckResultSuccess(result))
83
83
  {
@@ -290,6 +290,12 @@ namespace XD.SDK.Account.Internal.Mobile
290
290
 
291
291
  private async Task SyncTdsUser(XDGUser user)
292
292
  {
293
+ var bHasTdsUser = ReflectionUtils.FindType("TapTap.Bootstrap.TDSUser", "XD.SDK.TDSWrapper") != null;
294
+ if (!bHasTdsUser)
295
+ {
296
+ return;
297
+ }
298
+
293
299
  try
294
300
  {
295
301
  var result = await XDGEventBus.PublishAsync<Dictionary<string, object>>(XDGEvents.TdsSDKGetUser);
@@ -308,6 +314,7 @@ namespace XD.SDK.Account.Internal.Mobile
308
314
  XDGLogger.Warn("[SyncTDSUser] sessionToken is Null!");
309
315
  return;
310
316
  }
317
+
311
318
  XDGEventBus.Publish(XDGEvents.TdsSDKSyncUser, sessionToken, user.UserId);
312
319
  }
313
320
  catch (Exception e)
@@ -148,6 +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
  UIManager.ShowUI<XDWebViewAlert>("XDWebViewAlert", new Dictionary<string, object>
152
153
  {
153
154
  {
@@ -170,6 +171,7 @@ namespace XD.SDK.Account.Internal.Standalone
170
171
  if (code == XDWebViewAlert.CLOSE_CODE)
171
172
  {
172
173
  UIManager.Dismiss();
174
+ UIManager.DismissLoading();
173
175
  }
174
176
  });
175
177
  }
@@ -385,7 +385,7 @@ namespace XD.SDK.Account.Standalone
385
385
  { Dialog.SECONDARY_TEXT_KEY, localizable.Confirm2 },
386
386
  { Dialog.PRIMARY_TEXT_KEY, localizable.Cancel2 }
387
387
  };
388
- UIManager.ShowUI<Dialog>("Dialog", config, async (code, data) =>
388
+ UIManager.ShowUI<Dialog>("Dialog", config, (code, data) =>
389
389
  {
390
390
  UIManager.ShowLoading(true);
391
391
  _currentTime = TIMEOUT;
@@ -185,7 +185,7 @@ namespace XD.SDK.Account.Internal.Standalone
185
185
  {
186
186
  return await LoginByConsole();
187
187
  }
188
-
188
+
189
189
  var localUser = await GetLocalUser();
190
190
 
191
191
  if (loginType == LoginType.Default)
@@ -197,6 +197,7 @@ namespace XD.SDK.Account.Internal.Standalone
197
197
  {
198
198
  return await Login(LoginType.TapTap);
199
199
  }
200
+
200
201
  throw new XDGError(ResponseCode.Common.Failed, XDLocalization.GetCurrentLocalizableString().LoginFailed);
201
202
  }
202
203
 
@@ -205,7 +206,7 @@ namespace XD.SDK.Account.Internal.Standalone
205
206
  try
206
207
  {
207
208
  var token = await XDGEventBus.PublishAsync<Dictionary<string, object>>(XDGEvents.TapSDKGetAccessToken);
208
-
209
+
209
210
  if (token == null || !token.ContainsKey("token"))
210
211
  {
211
212
  XDGLogger.Warn("Third token expired.");
@@ -218,7 +219,7 @@ namespace XD.SDK.Account.Internal.Standalone
218
219
  throw new XDGError(ResponseCode.Common.Failed, e.Message);
219
220
  }
220
221
  }
221
-
222
+
222
223
  try
223
224
  {
224
225
  localUser = await FetchUserInfo();
@@ -236,7 +237,7 @@ namespace XD.SDK.Account.Internal.Standalone
236
237
  }
237
238
 
238
239
  _ = AccessTokenModule.Refresh();
239
-
240
+
240
241
  return localUser;
241
242
  }
242
243
 
@@ -278,12 +279,13 @@ namespace XD.SDK.Account.Internal.Standalone
278
279
  var user = await FetchUserInfo();
279
280
  try
280
281
  {
281
- await SyncTDSUser(user.UserId);
282
+ await SyncTdsUser(user.UserId);
282
283
  }
283
284
  catch (Exception e)
284
285
  {
285
286
  XDGLogger.Warn(e.ToString());
286
287
  }
288
+
287
289
  XDGLogger.Debug(string.Format($"xd userID: {user.UserId}"));
288
290
  return user;
289
291
  }
@@ -360,11 +362,11 @@ namespace XD.SDK.Account.Internal.Standalone
360
362
  {
361
363
  AliyunTrack.LoginStart("Default_Steam", "Steam");
362
364
  UIManager.ShowLoading();
363
-
365
+
364
366
  XDGAccessToken localToken = await AccessTokenModule.GetLocalAccessToken();
365
367
  string steamId = SteamAuth.GetSteamIdFromSDK();
366
368
  XDGUser user;
367
- XDGLogger.Debug($"LoginByConsole steamId: {steamId} localToken: {localToken} steamId: {steamId}" );
369
+ XDGLogger.Debug($"LoginByConsole steamId: {steamId} localToken: {localToken} steamId: {steamId}");
368
370
  if (!string.IsNullOrEmpty(localToken?.SteamId) && !string.IsNullOrEmpty(steamId) && localToken?.SteamId == steamId)
369
371
  {
370
372
  try
@@ -395,7 +397,7 @@ namespace XD.SDK.Account.Internal.Standalone
395
397
 
396
398
  try
397
399
  {
398
- await SyncTDSUser(user.UserId);
400
+ await SyncTdsUser(user.UserId);
399
401
  }
400
402
  catch (Exception e)
401
403
  {
@@ -410,6 +412,7 @@ namespace XD.SDK.Account.Internal.Standalone
410
412
  UIManager.DismissLoading();
411
413
  }
412
414
  }
415
+
413
416
  // 尝试其他主机 SDK
414
417
  throw new NotImplementedException("NO supported console sdk.");
415
418
  }
@@ -456,16 +459,19 @@ namespace XD.SDK.Account.Internal.Standalone
456
459
  }
457
460
  }
458
461
 
459
- private static async Task SyncTDSUser(string userId)
462
+ private static async Task SyncTdsUser(string userId)
460
463
  {
461
464
  // 效果等于 BecomeWithSessionToken,为了少一次网络请求
462
465
  // SyncTokenResponse tokenResponse = await XDHttpClient.Client.PostAsync<SyncTokenResponse>(XDG_LOGIN_SYN);
463
466
  // TDSUser user = TDSUser.CreateWithoutData(TDSUser.CLASS_NAME, userId) as TDSUser;
464
467
  // user.SessionToken = tokenResponse.SyncToken.SessionToken;
465
- // await user.SaveToLocal();
466
- var token = await XDHttpClient.Client.PostAsync<SyncTokenResponse>(XDG_LOGIN_SYN);
467
-
468
- XDGEventBus.Publish(XDGEvents.TdsSDKSyncUser, token.SyncToken.SessionToken, userId);
468
+ // await user.SaveToLocal();
469
+ var bHasTdsUser = ReflectionUtils.FindType("TapTap.Bootstrap.TDSUser", "XD.SDK.TDSWrapper") != null;
470
+ if (bHasTdsUser)
471
+ {
472
+ var token = await XDHttpClient.Client.PostAsync<SyncTokenResponse>(XDG_LOGIN_SYN);
473
+ XDGEventBus.Publish(XDGEvents.TdsSDKSyncUser, token.SyncToken.SessionToken, userId);
474
+ }
469
475
  }
470
476
 
471
477
  public static async Task<XDGUser> FetchUserInfo()
@@ -509,6 +515,7 @@ namespace XD.SDK.Account.Internal.Standalone
509
515
  {
510
516
  tcs.SetResult(await FetchUserInfo());
511
517
  }
518
+
512
519
  return;
513
520
  }
514
521
  }
@@ -19,7 +19,6 @@ namespace XD.SDK.Account
19
19
  _platformWrapper = XD.SDK.Account.Internal.Mobile.AccountFeaturesImpl.Instance;
20
20
  #elif UNITY_STANDALONE
21
21
  _platformWrapper = XD.SDK.Account.Internal.Standalone.AccountFeaturesImpl.Instance;
22
- // XDHttpClientFactory.RegisterHeadersTaskFunc(GetRequestAuthorizationHeader);
23
22
  #endif
24
23
  if (_platformWrapper == null)
25
24
  {
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "com.xd.sdk.account",
3
3
  "displayName": "XDGSDK Account",
4
- "version": "0.0.15-alpha",
4
+ "version": "0.0.16-alpha",
5
5
  "description": "XDGSDK",
6
6
  "unity": "2019.3",
7
7
  "license": "MIT",
8
8
  "dependencies": {
9
- "com.xd.sdk.common": "0.0.15-alpha"
9
+ "com.xd.sdk.common": "0.0.16-alpha"
10
10
  }
11
11
  }