com.taptap.sdk.login 4.8.0-beta.1 → 4.8.1
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.
- package/Mobile/Editor/NativeDependencies.xml +4 -4
- package/Mobile/Runtime/TapTapLoginImpl.cs +3 -2
- package/Runtime/Public/TapTapLogin.cs +1 -1
- package/Standalone/Runtime/Internal/UIManager.cs +3 -2
- package/Standalone/Runtime/Internal/WebLoginRequestManager.cs +2 -1
- package/Standalone/Runtime/Internal2/AccountManager.cs +33 -11
- package/Standalone/Runtime/Internal2/TapLoginStandaloneImpl.cs +11 -10
- package/Standalone/Runtime/Internal2/UI/WebController.cs +1 -1
- package/link.xml.meta +1 -1
- package/package.json +9 -9
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
<?xml version="1.0" ?>
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
2
|
<dependencies>
|
|
3
3
|
<androidPackages>
|
|
4
4
|
<repositories>
|
|
5
5
|
<repository>https://repo.maven.apache.org/maven2</repository>
|
|
6
6
|
</repositories>
|
|
7
|
-
<androidPackage spec="com.taptap.sdk:tap-login-unity:4.8.
|
|
7
|
+
<androidPackage spec="com.taptap.sdk:tap-login-unity:4.8.1-beta.7"/>
|
|
8
8
|
</androidPackages>
|
|
9
9
|
<iosPods>
|
|
10
10
|
<sources>
|
|
11
11
|
<source>https://github.com/CocoaPods/Specs.git</source>
|
|
12
12
|
</sources>
|
|
13
|
-
<iosPod
|
|
14
|
-
<iosPod
|
|
13
|
+
<iosPod addToAllTargets="false" bitcodeEnabled="false" name="TapTapLoginSDK" version="4.8.1-beta.7"/>
|
|
14
|
+
<iosPod addToAllTargets="false" bitcodeEnabled="false" name="TapTapGidSDK" version="4.8.1-beta.7"/>
|
|
15
15
|
</iosPods>
|
|
16
16
|
</dependencies>
|
|
@@ -5,6 +5,7 @@ using TapSDK.Login.Mobile.Runtime;
|
|
|
5
5
|
using TapSDK.Login.Internal;
|
|
6
6
|
using UnityEngine;
|
|
7
7
|
using System.Runtime.InteropServices;
|
|
8
|
+
using TapSDK.Core.Internal.Log;
|
|
8
9
|
|
|
9
10
|
namespace TapSDK.Login.Mobile
|
|
10
11
|
{
|
|
@@ -43,7 +44,7 @@ namespace TapSDK.Login.Mobile
|
|
|
43
44
|
.CommandBuilder(),
|
|
44
45
|
result =>
|
|
45
46
|
{
|
|
46
|
-
|
|
47
|
+
TapLog.Log("Login result: " + result.content);
|
|
47
48
|
var wrapper = new AccountWrapper(result.content);
|
|
48
49
|
if (wrapper.code == 1)
|
|
49
50
|
{
|
|
@@ -76,7 +77,7 @@ namespace TapSDK.Login.Mobile
|
|
|
76
77
|
.Callback(true)
|
|
77
78
|
.OnceTime(true)
|
|
78
79
|
.CommandBuilder());
|
|
79
|
-
|
|
80
|
+
TapLog.Log("Current account: " + result.content);
|
|
80
81
|
return new AccountWrapper(result.content).account;
|
|
81
82
|
}
|
|
82
83
|
}
|
|
@@ -7,7 +7,7 @@ namespace TapSDK.Login
|
|
|
7
7
|
public class TapTapLogin
|
|
8
8
|
{
|
|
9
9
|
|
|
10
|
-
public static readonly string Version = "4.8.
|
|
10
|
+
public static readonly string Version = "4.8.1";
|
|
11
11
|
|
|
12
12
|
public const string TAP_LOGIN_SCOPE_BASIC_INFO = "basic_info";
|
|
13
13
|
public const string TAP_LOGIN_SCOPE_PUBLIC_PROFILE = "public_profile";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
using System;
|
|
2
2
|
using System.Collections.Generic;
|
|
3
|
+
using TapSDK.Core.Internal.Log;
|
|
3
4
|
using UnityEngine;
|
|
4
5
|
using Object = UnityEngine.Object;
|
|
5
6
|
|
|
@@ -27,7 +28,7 @@ namespace TapSDK.Login.Internal
|
|
|
27
28
|
{
|
|
28
29
|
if (containerObj == null || uiElements.Count == 0)
|
|
29
30
|
{
|
|
30
|
-
|
|
31
|
+
TapLog.Error("No UIElement can be popped.");
|
|
31
32
|
}
|
|
32
33
|
else
|
|
33
34
|
{
|
|
@@ -35,7 +36,7 @@ namespace TapSDK.Login.Internal
|
|
|
35
36
|
|
|
36
37
|
if (targetName != null && !targetName.Equals(element.name))
|
|
37
38
|
{
|
|
38
|
-
|
|
39
|
+
TapLog.Error("Could not find specify UIElement : " + targetName);
|
|
39
40
|
return;
|
|
40
41
|
}
|
|
41
42
|
|
|
@@ -8,6 +8,7 @@ using System.Linq;
|
|
|
8
8
|
using TapSDK.Core;
|
|
9
9
|
using UnityEngine;
|
|
10
10
|
using Random = System.Random;
|
|
11
|
+
using TapSDK.Core.Internal.Log;
|
|
11
12
|
|
|
12
13
|
namespace TapSDK.Login.Internal
|
|
13
14
|
{
|
|
@@ -119,7 +120,7 @@ namespace TapSDK.Login.Internal
|
|
|
119
120
|
public static string GetRedirectUri()
|
|
120
121
|
{
|
|
121
122
|
var redirectUri = $"http://{IPAddress.Loopback}:{GetRandomUnusedPort()}/";
|
|
122
|
-
|
|
123
|
+
TapLog.Log($"redirect uri:{redirectUri}");
|
|
123
124
|
return redirectUri;
|
|
124
125
|
}
|
|
125
126
|
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
using System;
|
|
1
2
|
using System.Collections.Generic;
|
|
3
|
+
using System.Diagnostics;
|
|
2
4
|
using JetBrains.Annotations;
|
|
3
5
|
using Newtonsoft.Json;
|
|
4
6
|
using TapSDK.Core;
|
|
7
|
+
using TapSDK.Core.Internal.Utils;
|
|
5
8
|
using TapSDK.Core.Standalone.Internal.Openlog;
|
|
6
9
|
|
|
7
10
|
namespace TapSDK.Login.Internal
|
|
@@ -48,11 +51,13 @@ namespace TapSDK.Login.Internal
|
|
|
48
51
|
{
|
|
49
52
|
DataStorage.SaveString(_account, null);
|
|
50
53
|
TapAppDurationStandalone.OnLogout();
|
|
54
|
+
EventManager.TriggerEvent(EventManager.OnTapUserChanged, "");
|
|
51
55
|
}
|
|
52
56
|
else
|
|
53
57
|
{
|
|
54
58
|
DataStorage.SaveString(_account, value.ToJson());
|
|
55
59
|
TapAppDurationStandalone.OnLogin(value?.openId);
|
|
60
|
+
EventManager.TriggerEvent(EventManager.OnTapUserChanged, "");
|
|
56
61
|
}
|
|
57
62
|
}
|
|
58
63
|
}
|
|
@@ -62,24 +67,41 @@ namespace TapSDK.Login.Internal
|
|
|
62
67
|
var accountStr = DataStorage.LoadString(_account);
|
|
63
68
|
if (!string.IsNullOrEmpty(accountStr))
|
|
64
69
|
{
|
|
65
|
-
|
|
70
|
+
try
|
|
71
|
+
{
|
|
72
|
+
Account = new TapTapAccount(Json.Deserialize(accountStr) as Dictionary<string, object>);
|
|
73
|
+
}
|
|
74
|
+
catch (Exception e)
|
|
75
|
+
{
|
|
76
|
+
UnityEngine.Debug.Log("TapSDK Login find account cache but parse failed" + e.Message);
|
|
77
|
+
DataStorage.RemoveCacheKey(_account);
|
|
78
|
+
}
|
|
66
79
|
}
|
|
67
80
|
else
|
|
68
81
|
{
|
|
69
|
-
|
|
70
|
-
if (string.IsNullOrEmpty(accessTokenStr))
|
|
82
|
+
try
|
|
71
83
|
{
|
|
72
|
-
|
|
73
|
-
|
|
84
|
+
var accessTokenStr = DataStorage.LoadString(_accessToken);
|
|
85
|
+
if (string.IsNullOrEmpty(accessTokenStr))
|
|
86
|
+
{
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
74
89
|
|
|
75
|
-
|
|
76
|
-
|
|
90
|
+
var profileStr = DataStorage.LoadString(_profile);
|
|
91
|
+
if (string.IsNullOrEmpty(profileStr))
|
|
92
|
+
{
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
var accessToken = JsonConvert.DeserializeObject<AccessToken>(accessTokenStr);
|
|
96
|
+
var profile = JsonConvert.DeserializeObject<Profile>(profileStr);
|
|
97
|
+
Account = new TapTapAccount(accessToken, profile.openid, profile.unionid, profile.name, profile.avatar, profile.email);
|
|
98
|
+
}
|
|
99
|
+
catch (Exception e)
|
|
77
100
|
{
|
|
78
|
-
|
|
101
|
+
UnityEngine.Debug.Log("TapSDK Login find old account cache but parse failed" + e.Message);
|
|
102
|
+
DataStorage.RemoveCacheKey(_accessToken);
|
|
103
|
+
DataStorage.RemoveCacheKey(_profile);
|
|
79
104
|
}
|
|
80
|
-
var accessToken = JsonConvert.DeserializeObject<AccessToken>(accessTokenStr);
|
|
81
|
-
var profile = JsonConvert.DeserializeObject<Profile>(profileStr);
|
|
82
|
-
Account = new TapTapAccount(accessToken, profile.openid, profile.unionid, profile.name, profile.avatar, profile.email);
|
|
83
105
|
}
|
|
84
106
|
}
|
|
85
107
|
|
|
@@ -6,6 +6,7 @@ using System.Net.Http.Headers;
|
|
|
6
6
|
using System.Threading;
|
|
7
7
|
using System.Threading.Tasks;
|
|
8
8
|
using TapSDK.Core;
|
|
9
|
+
using TapSDK.Core.Internal.Log;
|
|
9
10
|
using TapSDK.Core.Internal.Utils;
|
|
10
11
|
using TapSDK.Core.Standalone;
|
|
11
12
|
using TapSDK.Core.Standalone.Internal.Http;
|
|
@@ -48,7 +49,7 @@ namespace TapSDK.Login.Internal
|
|
|
48
49
|
TapTapSdk.SDKInitialize(clientId, regionType == TapTapRegionType.CN);
|
|
49
50
|
AccountManager.Instance.Init();
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
TapLog.Log("RegisterListenerForTapClientCheck ");
|
|
52
53
|
RegisterListenerForTapClientCheck();
|
|
53
54
|
|
|
54
55
|
_ = CheckAndRefreshToken();
|
|
@@ -187,7 +188,7 @@ namespace TapSDK.Login.Internal
|
|
|
187
188
|
{
|
|
188
189
|
string info = "{\"device_id\":\"" + SystemInfo.deviceModel + "\"}";
|
|
189
190
|
string sdkUA = "client_id=" + TapTapSdk.ClientId + "&uuid=" + SystemInfo.deviceUniqueIdentifier;
|
|
190
|
-
|
|
191
|
+
TapLog.Log("LoginWithScopes start in thread = " + Thread.CurrentThread.ManagedThreadId);
|
|
191
192
|
TaskCompletionSource<T> taskCompletionSource = new TaskCompletionSource<T>();
|
|
192
193
|
|
|
193
194
|
string responseType = "code";
|
|
@@ -199,8 +200,8 @@ namespace TapSDK.Login.Internal
|
|
|
199
200
|
string codeChallengeMethod = "S256";
|
|
200
201
|
TapLoginClientBridge.TapLoginResponseByTapClient response = await TapLoginClientBridge.LoginWithScopesAsync(scopes,
|
|
201
202
|
responseType, redirectUri, codeChallenge, state, codeChallengeMethod, versionCode, sdkUA, info);
|
|
202
|
-
|
|
203
|
-
|
|
203
|
+
TapLog.Log("start handle login result");
|
|
204
|
+
TapLog.Log("LoginWithScopes handle in thread = " + Thread.CurrentThread.ManagedThreadId);
|
|
204
205
|
|
|
205
206
|
if (response.isCancel)
|
|
206
207
|
{
|
|
@@ -212,7 +213,7 @@ namespace TapSDK.Login.Internal
|
|
|
212
213
|
}
|
|
213
214
|
else
|
|
214
215
|
{
|
|
215
|
-
|
|
216
|
+
TapLog.Log("login success prepare get token");
|
|
216
217
|
try
|
|
217
218
|
{
|
|
218
219
|
Uri uri = new Uri(response.redirectUri);
|
|
@@ -261,13 +262,13 @@ namespace TapSDK.Login.Internal
|
|
|
261
262
|
}
|
|
262
263
|
else
|
|
263
264
|
{
|
|
264
|
-
|
|
265
|
+
TapLog.Log("login success prepare get token but get error " + error);
|
|
265
266
|
throw new TapException((int)TapErrorCode.ERROR_CODE_UNDEFINED, error ?? "数据解析异常");
|
|
266
267
|
}
|
|
267
268
|
}
|
|
268
269
|
catch (Exception ex)
|
|
269
270
|
{
|
|
270
|
-
|
|
271
|
+
TapLog.Log("login success prepare get token fail " + ex.Message);
|
|
271
272
|
taskCompletionSource.TrySetException(ex);
|
|
272
273
|
}
|
|
273
274
|
}
|
|
@@ -352,7 +353,7 @@ namespace TapSDK.Login.Internal
|
|
|
352
353
|
{
|
|
353
354
|
EventManager.AddListener(EventManager.IsLaunchedFromTapTapPCFinished, (openId) =>
|
|
354
355
|
{
|
|
355
|
-
|
|
356
|
+
TapLog.Log("receive IsLaunchedFromTapTapPCFinished event");
|
|
356
357
|
if (openId is string userId && !string.IsNullOrEmpty(userId))
|
|
357
358
|
{
|
|
358
359
|
CheckLoginStateWithTapClient(userId);
|
|
@@ -373,7 +374,7 @@ namespace TapSDK.Login.Internal
|
|
|
373
374
|
if (account.openId != openId)
|
|
374
375
|
{
|
|
375
376
|
isCacheUserSameWithTapClient = false;
|
|
376
|
-
|
|
377
|
+
TapLog.Log("receive IsLaunchedFromTapTapPCFinished event and not same");
|
|
377
378
|
Logout();
|
|
378
379
|
}
|
|
379
380
|
else
|
|
@@ -431,7 +432,7 @@ namespace TapSDK.Login.Internal
|
|
|
431
432
|
}
|
|
432
433
|
catch (Exception e)
|
|
433
434
|
{
|
|
434
|
-
|
|
435
|
+
TapLog.Log("refresh TapToken fail reason : " + e.Message + "\n stack = " + e.StackTrace);
|
|
435
436
|
}
|
|
436
437
|
}
|
|
437
438
|
}
|
|
@@ -75,7 +75,7 @@ namespace TapSDK.Login.Internal {
|
|
|
75
75
|
while (isRunning) {
|
|
76
76
|
try {
|
|
77
77
|
HttpListenerContext context = await server.GetContextAsync();
|
|
78
|
-
|
|
78
|
+
TapLog.Log($"{context.Request.HttpMethod} {context.Request.Url}");
|
|
79
79
|
context.Response.StatusCode = 200;
|
|
80
80
|
context.Response.Close();
|
|
81
81
|
|
package/link.xml.meta
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
"name": "com.taptap.sdk.login",
|
|
3
|
+
"displayName": "TapTapSDK Login",
|
|
4
|
+
"description": "TapTapSDK Login",
|
|
5
|
+
"version": "4.8.1",
|
|
6
|
+
"unity": "2019.4",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"com.taptap.sdk.core": "4.8.1"
|
|
10
|
+
}
|
|
11
11
|
}
|