com.taptap.sdk.login 4.5.1-beta.2 → 4.5.2
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 +3 -2
- package/Mobile/Runtime/TapTapLoginImpl.cs +7 -5
- package/Plugins/iOS/TapTapSDKLoginAppDelegate.mm +2 -1
- package/Runtime/Public/TapTapAccount.cs +5 -5
- package/Runtime/Public/TapTapLogin.cs +1 -1
- package/Runtime/Public/TapTapSdk.cs +0 -2
- package/Standalone/Runtime/Internal2/TapLoginStandaloneImpl.cs +16 -1
- package/Standalone/Runtime/Public/IComplianceProvider.cs +1 -1
- package/Standalone/Runtime/Public/TapTapLoginStandalone.cs +13 -0
- package/package.json +2 -2
|
@@ -4,13 +4,14 @@
|
|
|
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.5.
|
|
7
|
+
<androidPackage spec="com.taptap.sdk:tap-login-unity:4.5.2"/>
|
|
8
8
|
</androidPackages>
|
|
9
9
|
<iosPods>
|
|
10
10
|
<sources>
|
|
11
11
|
<source>https://github.com/CocoaPods/Specs.git</source>
|
|
12
12
|
</sources>
|
|
13
13
|
<iosPod name="Kingfisher" version="~> 6.0" bitcodeEnabled="false" addToAllTargets="false"/>
|
|
14
|
-
<iosPod name="TapTapLoginSDK" version="~> 4.5.
|
|
14
|
+
<iosPod name="TapTapLoginSDK" version="~> 4.5.2" bitcodeEnabled="false" addToAllTargets="false"/>
|
|
15
|
+
<iosPod name="TapTapGidSDK" version="~> 4.5.2" bitcodeEnabled="false" addToAllTargets="false"/>
|
|
15
16
|
</iosPods>
|
|
16
17
|
</dependencies>
|
|
@@ -17,16 +17,18 @@ namespace TapSDK.Login.Mobile
|
|
|
17
17
|
|
|
18
18
|
private const string SERVICE_NAME = "BridgeLoginService";
|
|
19
19
|
|
|
20
|
+
public TapTapLoginImpl(){
|
|
21
|
+
EngineBridge.GetInstance().Register(
|
|
22
|
+
"com.taptap.sdk.login.unity.BridgeLoginService",
|
|
23
|
+
"com.taptap.sdk.login.unity.BridgeLoginServiceImpl");
|
|
24
|
+
}
|
|
25
|
+
|
|
20
26
|
public void Init(string clientId, TapTapRegionType regionType)
|
|
21
27
|
{
|
|
22
28
|
|
|
23
29
|
#if UNITY_IOS
|
|
24
30
|
RegisterTapTapSDKLoginAppDelegateListener();
|
|
25
|
-
#endif
|
|
26
|
-
|
|
27
|
-
EngineBridge.GetInstance().Register(
|
|
28
|
-
"com.taptap.sdk.login.unity.BridgeLoginService",
|
|
29
|
-
"com.taptap.sdk.login.unity.BridgeLoginServiceImpl");
|
|
31
|
+
#endif
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
public Task<TapTapAccount> Login(string[] scopes)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
|
|
2
2
|
#import <UIKit/UIKit.h>
|
|
3
|
+
#import <Foundation/Foundation.h>
|
|
4
|
+
#import <TapTapBasicToolsSDK/TapTapSDKVerifyProtocol.h>
|
|
3
5
|
#import <TapTapLoginSDK/TapTapLoginSDK-Swift.h>
|
|
4
6
|
#import "UnityAppController.h"
|
|
5
|
-
#import <Foundation/Foundation.h>
|
|
6
7
|
#import <UIKit/UIKit.h>
|
|
7
8
|
#import "AppDelegateListener.h"
|
|
8
9
|
|
|
@@ -16,7 +16,7 @@ namespace TapSDK.Login
|
|
|
16
16
|
public string openId { get; }
|
|
17
17
|
|
|
18
18
|
[JsonProperty("unionid")]
|
|
19
|
-
public string
|
|
19
|
+
public string unionId { get; }
|
|
20
20
|
|
|
21
21
|
[JsonProperty("name")]
|
|
22
22
|
[CanBeNull] public string name { get; }
|
|
@@ -31,17 +31,17 @@ namespace TapSDK.Login
|
|
|
31
31
|
{
|
|
32
32
|
accessToken = new AccessToken(SafeDictionary.GetValue<Dictionary<string, object>>(dict, "access_token"));
|
|
33
33
|
openId = SafeDictionary.GetValue<string>(dict, "openid");
|
|
34
|
-
|
|
34
|
+
unionId = SafeDictionary.GetValue<string>(dict, "unionid");
|
|
35
35
|
name = SafeDictionary.GetValue<string>(dict, "name");
|
|
36
36
|
avatar = SafeDictionary.GetValue<string>(dict, "avatar");
|
|
37
37
|
email = SafeDictionary.GetValue<string>(dict, "email");
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
public TapTapAccount(AccessToken accessToken, string openId, string
|
|
40
|
+
public TapTapAccount(AccessToken accessToken, string openId, string unionId, string name, string avatar, string email)
|
|
41
41
|
{
|
|
42
42
|
this.accessToken = accessToken;
|
|
43
43
|
this.openId = openId;
|
|
44
|
-
this.
|
|
44
|
+
this.unionId = unionId;
|
|
45
45
|
this.name = name;
|
|
46
46
|
this.avatar = avatar;
|
|
47
47
|
this.email = email;
|
|
@@ -53,7 +53,7 @@ namespace TapSDK.Login
|
|
|
53
53
|
{
|
|
54
54
|
["access_token"] = accessToken.ToDict(),
|
|
55
55
|
["openid"] = openId,
|
|
56
|
-
["unionid"] =
|
|
56
|
+
["unionid"] = unionId,
|
|
57
57
|
["name"] = name,
|
|
58
58
|
["avatar"] = avatar,
|
|
59
59
|
["email"] = email
|
|
@@ -7,7 +7,7 @@ namespace TapSDK.Login
|
|
|
7
7
|
public class TapTapLogin
|
|
8
8
|
{
|
|
9
9
|
|
|
10
|
-
public static readonly string Version = "4.5.
|
|
10
|
+
public static readonly string Version = "4.5.2";
|
|
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";
|
|
@@ -13,8 +13,6 @@ namespace TapSDK.Login.Internal
|
|
|
13
13
|
public static Region CurrentRegion { get; private set; }
|
|
14
14
|
|
|
15
15
|
public static void SDKInitialize(string clientId, bool isCn) {
|
|
16
|
-
if (string.IsNullOrEmpty(clientId))
|
|
17
|
-
throw new ArgumentException("[TapSDK] clientId is null or empty!");
|
|
18
16
|
ClientId = clientId;
|
|
19
17
|
CurrentRegion = isCn ? (Region)new RegionCN() : new RegionIO();
|
|
20
18
|
TapLocalizeManager.SetCurrentRegion(isCn);
|
|
@@ -16,6 +16,9 @@ namespace TapSDK.Login.Internal
|
|
|
16
16
|
{
|
|
17
17
|
private static TapLoginStandaloneImpl instance;
|
|
18
18
|
|
|
19
|
+
// 当前是否正在登录中
|
|
20
|
+
private volatile bool IsLogging = false;
|
|
21
|
+
|
|
19
22
|
private TapLoginStandaloneImpl()
|
|
20
23
|
{
|
|
21
24
|
|
|
@@ -43,6 +46,13 @@ namespace TapSDK.Login.Internal
|
|
|
43
46
|
|
|
44
47
|
public Task<TapTapAccount> Login(string[] scopes)
|
|
45
48
|
{
|
|
49
|
+
// 正在登录时,返回登录异常
|
|
50
|
+
if(IsLogging){
|
|
51
|
+
var defaultTcs = new TaskCompletionSource<TapTapAccount>();
|
|
52
|
+
defaultTcs.TrySetException(new TapException((int) TapErrorCode.ERROR_CODE_LOGOUT_INVALID_LOGIN_STATE, "Currently logging in"));
|
|
53
|
+
return defaultTcs.Task;
|
|
54
|
+
}
|
|
55
|
+
IsLogging = true;
|
|
46
56
|
string sessionId = Guid.NewGuid().ToString();
|
|
47
57
|
TapLoginTracker.Instance.TrackStart("loginWithScopes", sessionId);
|
|
48
58
|
|
|
@@ -52,7 +62,7 @@ namespace TapSDK.Login.Internal
|
|
|
52
62
|
}
|
|
53
63
|
IComplianceProvider provider = BridgeUtils.CreateBridgeImplementation(typeof(IComplianceProvider),
|
|
54
64
|
"TapSDK.Compliance") as IComplianceProvider;
|
|
55
|
-
|
|
65
|
+
string complianceScope = provider?.GetAgeRangeScope(TapTapSdk.CurrentRegion is RegionCN _);
|
|
56
66
|
if (complianceScope != null)
|
|
57
67
|
{
|
|
58
68
|
scopes = scopes.Append(complianceScope).ToArray();
|
|
@@ -64,6 +74,7 @@ namespace TapSDK.Login.Internal
|
|
|
64
74
|
OnAuth = async (tokenData, loginType) => {
|
|
65
75
|
if (tokenData == null) {
|
|
66
76
|
TapLoginTracker.Instance.TrackFailure("loginWithScopes", sessionId, loginType, (int) TapErrorCode.ERROR_CODE_UNDEFINED, "UnKnow Error");
|
|
77
|
+
IsLogging = false;
|
|
67
78
|
tcs.TrySetException(new TapException((int) TapErrorCode.ERROR_CODE_UNDEFINED, "UnKnow Error"));
|
|
68
79
|
} else {
|
|
69
80
|
// 将 TokenData 转化为 AccessToken
|
|
@@ -81,21 +92,25 @@ namespace TapSDK.Login.Internal
|
|
|
81
92
|
AccountManager.Instance.Account = new TapTapAccount(
|
|
82
93
|
refreshToken, profileData.OpenId, profileData.UnionId, profileData.Name, profileData.Avatar,
|
|
83
94
|
profileData.Email);
|
|
95
|
+
IsLogging = false;
|
|
84
96
|
tcs.TrySetResult(AccountManager.Instance.Account);
|
|
85
97
|
}
|
|
86
98
|
else
|
|
87
99
|
{
|
|
88
100
|
TapLoginTracker.Instance.TrackFailure("loginWithScopes", sessionId, loginType, (int) TapErrorCode.ERROR_CODE_UNDEFINED, "UnKnow Error");
|
|
101
|
+
IsLogging = false;
|
|
89
102
|
tcs.TrySetException(new TapException((int) TapErrorCode.ERROR_CODE_UNDEFINED, "UnKnow Error"));
|
|
90
103
|
}
|
|
91
104
|
}
|
|
92
105
|
},
|
|
93
106
|
OnError = (e, loginType) => {
|
|
94
107
|
TapLoginTracker.Instance.TrackFailure("loginWithScopes", sessionId, loginType, e.Code, e.Message);
|
|
108
|
+
IsLogging = false;
|
|
95
109
|
tcs.TrySetException(e);
|
|
96
110
|
},
|
|
97
111
|
OnClose = () => {
|
|
98
112
|
TapLoginTracker.Instance.TrackCancel("loginWithScopes", sessionId);
|
|
113
|
+
IsLogging = false;
|
|
99
114
|
tcs.TrySetCanceled();
|
|
100
115
|
}
|
|
101
116
|
};
|
|
@@ -16,16 +16,29 @@ namespace TapSDK.Login.Standalone
|
|
|
16
16
|
|
|
17
17
|
public Task<TapTapAccount> Login(string[] scopes)
|
|
18
18
|
{
|
|
19
|
+
if(!TapCoreStandalone.CheckInitState()){
|
|
20
|
+
var defaultTcs = new TaskCompletionSource<TapTapAccount>();
|
|
21
|
+
defaultTcs.TrySetResult(null);
|
|
22
|
+
return defaultTcs.Task;
|
|
23
|
+
}
|
|
19
24
|
return TapLoginStandaloneImpl.Instance.Login(scopes);
|
|
20
25
|
}
|
|
21
26
|
|
|
22
27
|
public void Logout()
|
|
23
28
|
{
|
|
29
|
+
if(!TapCoreStandalone.CheckInitState()){
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
24
32
|
TapLoginStandaloneImpl.Instance.Logout();
|
|
25
33
|
}
|
|
26
34
|
|
|
27
35
|
public Task<TapTapAccount> GetCurrentAccount()
|
|
28
36
|
{
|
|
37
|
+
if(!TapCoreStandalone.CheckInitState()){
|
|
38
|
+
var defaultTcs = new TaskCompletionSource<TapTapAccount>();
|
|
39
|
+
defaultTcs.TrySetResult(null);
|
|
40
|
+
return defaultTcs.Task;
|
|
41
|
+
}
|
|
29
42
|
return TapLoginStandaloneImpl.Instance.GetCurrentAccount();
|
|
30
43
|
}
|
|
31
44
|
}
|
package/package.json
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"name": "com.taptap.sdk.login",
|
|
3
3
|
"displayName": "TapTapSDK Login",
|
|
4
4
|
"description": "TapTapSDK Login",
|
|
5
|
-
"version": "4.5.
|
|
5
|
+
"version": "4.5.2",
|
|
6
6
|
"unity": "2019.4",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"com.taptap.sdk.core": "4.5.
|
|
9
|
+
"com.taptap.sdk.core": "4.5.2"
|
|
10
10
|
}
|
|
11
11
|
}
|