com.taptap.sdk.login 4.3.4 → 4.3.10-alpha.4
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 +2 -2
- package/Runtime/Internal/Init/LoginInitTask.cs +2 -2
- package/Runtime/Public/TapTapLogin.cs +3 -0
- package/Runtime/Public/TapTapSdk.cs +1 -1
- package/Standalone/Runtime/Internal/Tracker/TapLoginTracker.cs +104 -0
- package/Standalone/Runtime/Internal/Tracker/TapLoginTracker.cs.meta +11 -0
- package/Standalone/Runtime/Internal/Tracker.meta +8 -0
- package/Standalone/Runtime/Internal2/AccountManager.cs +4 -2
- package/Standalone/Runtime/Internal2/TapLoginStandaloneImpl.cs +14 -4
- package/Standalone/Runtime/Internal2/UI/LoginPanelController.cs +4 -4
- package/Standalone/Runtime/Internal2/UI/QRCodeController.cs +7 -5
- package/Standalone/Runtime/Internal2/UI/WebController.cs +5 -4
- package/package.json +2 -2
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<repositories>
|
|
6
6
|
<repository>https://repo.maven.apache.org/maven2</repository>
|
|
7
7
|
</repositories>
|
|
8
|
-
<androidPackage spec="com.taptap.sdk:tap-login-unity:4.3.
|
|
8
|
+
<androidPackage spec="com.taptap.sdk:tap-login-unity:4.3.10"/>
|
|
9
9
|
</androidPackages>
|
|
10
10
|
|
|
11
11
|
<!-- iOS Cocoapod dependencies can be specified by each iosPod element. -->
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
<source>https://github.com/CocoaPods/Specs.git</source>
|
|
15
15
|
</sources>
|
|
16
16
|
<iosPod name="Kingfisher" version="~> 6.0" bitcodeEnabled="false" addToAllTargets="false"/>
|
|
17
|
-
<iosPod name="TapTapLoginSDK" version="~> 4.3.
|
|
17
|
+
<iosPod name="TapTapLoginSDK" version="~> 4.3.10" bitcodeEnabled="false" addToAllTargets="false"/>
|
|
18
18
|
</iosPods>
|
|
19
19
|
</dependencies>
|
|
20
20
|
|
|
@@ -7,12 +7,12 @@ namespace TapSDK.Login.Internal.Init {
|
|
|
7
7
|
public class LoginInitTask : IInitTask {
|
|
8
8
|
public int Order => 11;
|
|
9
9
|
|
|
10
|
-
public void Init(
|
|
10
|
+
public void Init(TapTapSdkOptions coreOption, TapTapSdkBaseOptions[] otherOptions)
|
|
11
11
|
{
|
|
12
12
|
TapTapLoginManager.Instance.Init(coreOption.clientId, coreOption.region);
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
public void Init(
|
|
15
|
+
public void Init(TapTapSdkOptions coreOption)
|
|
16
16
|
{
|
|
17
17
|
TapTapLoginManager.Instance.Init(coreOption.clientId, coreOption.region);
|
|
18
18
|
}
|
|
@@ -6,6 +6,9 @@ namespace TapSDK.Login
|
|
|
6
6
|
{
|
|
7
7
|
public class TapTapLogin
|
|
8
8
|
{
|
|
9
|
+
|
|
10
|
+
public static readonly string Version = "4.3.10-alpha.4";
|
|
11
|
+
|
|
9
12
|
public const string TAP_LOGIN_SCOPE_BASIC_INFO = "basic_info";
|
|
10
13
|
public const string TAP_LOGIN_SCOPE_PUBLIC_PROFILE = "public_profile";
|
|
11
14
|
public const string TAP_LOGIN_SCOPE_EMAIL = "email";
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using Newtonsoft.Json;
|
|
4
|
+
using TapSDK.Core.Standalone.Internal.Openlog;
|
|
5
|
+
|
|
6
|
+
namespace TapSDK.Login.Standalone.Internal
|
|
7
|
+
{
|
|
8
|
+
internal class TapLoginTracker
|
|
9
|
+
{
|
|
10
|
+
|
|
11
|
+
private const string ACTION_INIT = "init";
|
|
12
|
+
private const string ACTION_START = "start";
|
|
13
|
+
private const string ACTION_SUCCESS = "success";
|
|
14
|
+
private const string ACTION_FAIL = "fail";
|
|
15
|
+
private const string ACTION_CANCEL = "cancel";
|
|
16
|
+
|
|
17
|
+
private static TapLoginTracker instance;
|
|
18
|
+
|
|
19
|
+
private TapOpenlogStandalone openlog;
|
|
20
|
+
|
|
21
|
+
private TapLoginTracker()
|
|
22
|
+
{
|
|
23
|
+
openlog = new TapOpenlogStandalone("TapLogin", TapTapLogin.Version);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public static TapLoginTracker Instance
|
|
27
|
+
{
|
|
28
|
+
get
|
|
29
|
+
{
|
|
30
|
+
if (instance == null)
|
|
31
|
+
{
|
|
32
|
+
instance = new TapLoginTracker();
|
|
33
|
+
}
|
|
34
|
+
return instance;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
internal void TrackInit()
|
|
39
|
+
{
|
|
40
|
+
ReportLog(ACTION_INIT);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
internal void TrackStart(string funcNace, string seesionId)
|
|
44
|
+
{
|
|
45
|
+
Dictionary<string, string> parameters = new Dictionary<string, string>
|
|
46
|
+
{
|
|
47
|
+
{ "func_name", funcNace },
|
|
48
|
+
{ "seesion_id", seesionId },
|
|
49
|
+
};
|
|
50
|
+
ReportLog(ACTION_START, new Dictionary<string, string>()
|
|
51
|
+
{
|
|
52
|
+
{ "args", JsonConvert.SerializeObject(parameters) }
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
internal void TrackSuccess(string funcNace, string seesionId, string loginType)
|
|
57
|
+
{
|
|
58
|
+
Dictionary<string, string> parameters = new Dictionary<string, string>
|
|
59
|
+
{
|
|
60
|
+
{ "func_name", funcNace },
|
|
61
|
+
{ "seesion_id", seesionId },
|
|
62
|
+
{ "login_type", loginType }
|
|
63
|
+
};
|
|
64
|
+
ReportLog(ACTION_SUCCESS, new Dictionary<string, string>()
|
|
65
|
+
{
|
|
66
|
+
{ "args", JsonConvert.SerializeObject(parameters) }
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
internal void TrackCancel(string funcNace, string seesionId)
|
|
71
|
+
{
|
|
72
|
+
Dictionary<string, string> parameters = new Dictionary<string, string>
|
|
73
|
+
{
|
|
74
|
+
{ "func_name", funcNace },
|
|
75
|
+
{ "seesion_id", seesionId },
|
|
76
|
+
};
|
|
77
|
+
ReportLog(ACTION_CANCEL, new Dictionary<string, string>()
|
|
78
|
+
{
|
|
79
|
+
{ "args", JsonConvert.SerializeObject(parameters) }
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
internal void TrackFailure(string funcNace, string seesionId, string loginType, int errorCode = -1, string errorMessage = null)
|
|
84
|
+
{
|
|
85
|
+
Dictionary<string, string> parameters = new Dictionary<string, string>
|
|
86
|
+
{
|
|
87
|
+
{ "func_name", funcNace },
|
|
88
|
+
{ "seesion_id", seesionId },
|
|
89
|
+
{ "error_code", errorCode.ToString() },
|
|
90
|
+
{ "error_msg", errorMessage },
|
|
91
|
+
{ "login_type", loginType }
|
|
92
|
+
};
|
|
93
|
+
ReportLog(ACTION_FAIL, new Dictionary<string, string>()
|
|
94
|
+
{
|
|
95
|
+
{ "args", JsonConvert.SerializeObject(parameters) }
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private void ReportLog(string action, Dictionary<string, string> parameters = null)
|
|
100
|
+
{
|
|
101
|
+
openlog.LogBusiness(action, parameters);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -2,6 +2,7 @@ using System.Collections.Generic;
|
|
|
2
2
|
using JetBrains.Annotations;
|
|
3
3
|
using Newtonsoft.Json;
|
|
4
4
|
using TapSDK.Core;
|
|
5
|
+
using TapSDK.Core.Standalone.Internal.Openlog;
|
|
5
6
|
|
|
6
7
|
namespace TapSDK.Login.Internal
|
|
7
8
|
{
|
|
@@ -10,7 +11,7 @@ namespace TapSDK.Login.Internal
|
|
|
10
11
|
private static readonly string _accessToken = "taptapsdk_accesstoken";
|
|
11
12
|
private static readonly string _profile = "taptapsdk_profile";
|
|
12
13
|
private static readonly string _account = "taptapsdk_account";
|
|
13
|
-
|
|
14
|
+
|
|
14
15
|
private static AccountManager _instance;
|
|
15
16
|
|
|
16
17
|
private AccountManager()
|
|
@@ -42,6 +43,7 @@ namespace TapSDK.Login.Internal
|
|
|
42
43
|
set
|
|
43
44
|
{
|
|
44
45
|
_tapAccount = value;
|
|
46
|
+
TapOpenlogStandalone.openid = value?.openId ?? "";
|
|
45
47
|
if (value == null)
|
|
46
48
|
{
|
|
47
49
|
DataStorage.SaveString(_account, null);
|
|
@@ -67,7 +69,7 @@ namespace TapSDK.Login.Internal
|
|
|
67
69
|
{
|
|
68
70
|
return;
|
|
69
71
|
}
|
|
70
|
-
|
|
72
|
+
|
|
71
73
|
var profileStr = DataStorage.LoadString(_profile);
|
|
72
74
|
if (string.IsNullOrEmpty(profileStr))
|
|
73
75
|
{
|
|
@@ -6,6 +6,7 @@ using TapSDK.Core;
|
|
|
6
6
|
using TapSDK.Core.Internal.Utils;
|
|
7
7
|
using TapSDK.Login.Internal.Http;
|
|
8
8
|
using TapSDK.Login.Standalone;
|
|
9
|
+
using TapSDK.Login.Standalone.Internal;
|
|
9
10
|
using UnityEngine;
|
|
10
11
|
|
|
11
12
|
namespace TapSDK.Login.Internal
|
|
@@ -36,10 +37,14 @@ namespace TapSDK.Login.Internal
|
|
|
36
37
|
TapTapSdk.SDKInitialize(clientId, regionType == TapTapRegionType.CN);
|
|
37
38
|
AccountManager.Instance.Init();
|
|
38
39
|
CheckAndRefreshToken();
|
|
40
|
+
TapLoginTracker.Instance.TrackInit();
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
public Task<TapTapAccount> Login(string[] scopes)
|
|
42
44
|
{
|
|
45
|
+
string sessionId = Guid.NewGuid().ToString();
|
|
46
|
+
TapLoginTracker.Instance.TrackStart("loginWithScopes", sessionId);
|
|
47
|
+
|
|
43
48
|
if (!scopes.Contains(TapTapLogin.TAP_LOGIN_SCOPE_PUBLIC_PROFILE))
|
|
44
49
|
{
|
|
45
50
|
scopes = scopes.Append(TapTapLogin.TAP_LOGIN_SCOPE_PUBLIC_PROFILE).ToArray();
|
|
@@ -55,8 +60,9 @@ namespace TapSDK.Login.Internal
|
|
|
55
60
|
LoginPanelController.OpenParams openParams = new LoginPanelController.OpenParams {
|
|
56
61
|
ClientId = TapTapSdk.ClientId,
|
|
57
62
|
Scopes = scopes,
|
|
58
|
-
OnAuth = async tokenData => {
|
|
63
|
+
OnAuth = async (tokenData, loginType) => {
|
|
59
64
|
if (tokenData == null) {
|
|
65
|
+
TapLoginTracker.Instance.TrackFailure("loginWithScopes", sessionId, loginType, (int) TapErrorCode.ERROR_CODE_UNDEFINED, "UnKnow Error");
|
|
60
66
|
tcs.TrySetException(new TapException((int) TapErrorCode.ERROR_CODE_UNDEFINED, "UnKnow Error"));
|
|
61
67
|
} else {
|
|
62
68
|
// 将 TokenData 转化为 AccessToken
|
|
@@ -70,6 +76,7 @@ namespace TapSDK.Login.Internal
|
|
|
70
76
|
ProfileData profileData = await LoginService.GetProfile(TapTapSdk.ClientId, refreshToken);
|
|
71
77
|
if (profileData != null)
|
|
72
78
|
{
|
|
79
|
+
TapLoginTracker.Instance.TrackSuccess("loginWithScopes", sessionId, loginType);
|
|
73
80
|
AccountManager.Instance.Account = new TapTapAccount(
|
|
74
81
|
refreshToken, profileData.OpenId, profileData.UnionId, profileData.Name, profileData.Avatar,
|
|
75
82
|
profileData.Email);
|
|
@@ -77,14 +84,17 @@ namespace TapSDK.Login.Internal
|
|
|
77
84
|
}
|
|
78
85
|
else
|
|
79
86
|
{
|
|
87
|
+
TapLoginTracker.Instance.TrackFailure("loginWithScopes", sessionId, loginType, (int) TapErrorCode.ERROR_CODE_UNDEFINED, "UnKnow Error");
|
|
80
88
|
tcs.TrySetException(new TapException((int) TapErrorCode.ERROR_CODE_UNDEFINED, "UnKnow Error"));
|
|
81
89
|
}
|
|
82
90
|
}
|
|
83
91
|
},
|
|
84
|
-
OnError = e => {
|
|
92
|
+
OnError = (e, loginType) => {
|
|
93
|
+
TapLoginTracker.Instance.TrackFailure("loginWithScopes", sessionId, loginType, e.Code, e.Message);
|
|
85
94
|
tcs.TrySetException(e);
|
|
86
95
|
},
|
|
87
96
|
OnClose = () => {
|
|
97
|
+
TapLoginTracker.Instance.TrackCancel("loginWithScopes", sessionId);
|
|
88
98
|
tcs.TrySetCanceled();
|
|
89
99
|
}
|
|
90
100
|
};
|
|
@@ -98,7 +108,7 @@ namespace TapSDK.Login.Internal
|
|
|
98
108
|
LoginPanelController.OpenParams openParams = new LoginPanelController.OpenParams {
|
|
99
109
|
ClientId = TapTapSdk.ClientId,
|
|
100
110
|
Scopes = new HashSet<string>(scopes).ToArray(),
|
|
101
|
-
OnAuth = tokenData => {
|
|
111
|
+
OnAuth = (tokenData, loginType) => {
|
|
102
112
|
if (tokenData == null) {
|
|
103
113
|
tcs.TrySetException(new TapException((int) TapErrorCode.ERROR_CODE_UNDEFINED, "UnKnow Error"));
|
|
104
114
|
} else {
|
|
@@ -113,7 +123,7 @@ namespace TapSDK.Login.Internal
|
|
|
113
123
|
tcs.TrySetResult(accessToken);
|
|
114
124
|
}
|
|
115
125
|
},
|
|
116
|
-
OnError = e => {
|
|
126
|
+
OnError = (e, loginType) => {
|
|
117
127
|
tcs.TrySetException(e);
|
|
118
128
|
},
|
|
119
129
|
OnClose = () => {
|
|
@@ -16,8 +16,8 @@ namespace TapSDK.Login.Internal {
|
|
|
16
16
|
public Type Type { get; set; }
|
|
17
17
|
public string ClientId { get; set; }
|
|
18
18
|
public string[] Scopes { get; set; }
|
|
19
|
-
public Action<TokenData> OnAuth { get; set; }
|
|
20
|
-
public Action<TapException> OnError { get; set; }
|
|
19
|
+
public Action<TokenData, String> OnAuth { get; set; }
|
|
20
|
+
public Action<TapException, String> OnError { get; set; }
|
|
21
21
|
public Action OnClose { get; set; }
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -61,10 +61,10 @@ namespace TapSDK.Login.Internal {
|
|
|
61
61
|
openParams.OnClose.Invoke();
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
protected void OnAuth(TokenData tokenData) {
|
|
64
|
+
protected void OnAuth(TokenData tokenData, String loginType) {
|
|
65
65
|
if (tokenData != null) {
|
|
66
66
|
OpenParams openParams = openParam as OpenParams;
|
|
67
|
-
openParams.OnAuth.Invoke(tokenData);
|
|
67
|
+
openParams.OnAuth.Invoke(tokenData, loginType);
|
|
68
68
|
Close();
|
|
69
69
|
}
|
|
70
70
|
}
|
|
@@ -6,6 +6,7 @@ using TapSDK.Login.Internal.Http;
|
|
|
6
6
|
using TapSDK.Core;
|
|
7
7
|
using TapSDK.Core.Internal.Utils;
|
|
8
8
|
using UnityEngine.EventSystems;
|
|
9
|
+
using TapSDK.Core.Internal.Log;
|
|
9
10
|
|
|
10
11
|
namespace TapSDK.Login.Internal {
|
|
11
12
|
public class QRCodeController {
|
|
@@ -25,7 +26,7 @@ namespace TapSDK.Login.Internal {
|
|
|
25
26
|
private readonly static string AUTH_DENIED = "access_denied";
|
|
26
27
|
private readonly static string AUTH_SUCCESS = "";
|
|
27
28
|
|
|
28
|
-
private readonly Action<TokenData> onAuth;
|
|
29
|
+
private readonly Action<TokenData, String> onAuth;
|
|
29
30
|
|
|
30
31
|
private readonly Text titleText;
|
|
31
32
|
private readonly RawImage qrcodeImage;
|
|
@@ -41,7 +42,7 @@ namespace TapSDK.Login.Internal {
|
|
|
41
42
|
private string clientId;
|
|
42
43
|
private string[] scopes;
|
|
43
44
|
|
|
44
|
-
public QRCodeController(Transform transform, Action<TokenData> onAuth) {
|
|
45
|
+
public QRCodeController(Transform transform, Action<TokenData, String> onAuth) {
|
|
45
46
|
this.onAuth = onAuth;
|
|
46
47
|
|
|
47
48
|
titleText = transform.Find("Title").GetComponent<Text>();
|
|
@@ -113,7 +114,8 @@ namespace TapSDK.Login.Internal {
|
|
|
113
114
|
} else {
|
|
114
115
|
try {
|
|
115
116
|
TokenData tokenData = await LoginService.RequestScanQRCodeResult(clientId, qrcodeData.DeviceCode);
|
|
116
|
-
|
|
117
|
+
TapLog.Log("Login , QRCodeController Success");
|
|
118
|
+
onAuth.Invoke(tokenData, "pc_code");
|
|
117
119
|
|
|
118
120
|
return ;
|
|
119
121
|
} catch (TapException e) {
|
|
@@ -140,7 +142,7 @@ namespace TapSDK.Login.Internal {
|
|
|
140
142
|
|
|
141
143
|
private void OnShowIOSDemoImage() {
|
|
142
144
|
string url = DEMO_IMAGE_URL_IOS_ZH;
|
|
143
|
-
if (TapTapSDK.
|
|
145
|
+
if (TapTapSDK.taptapSdkOptions != null && TapTapSDK.taptapSdkOptions.region == TapTapRegionType.Overseas) {
|
|
144
146
|
url = DEMO_IMAGE_URL_IOS_EN;
|
|
145
147
|
}
|
|
146
148
|
ShowDemoImage(url);
|
|
@@ -148,7 +150,7 @@ namespace TapSDK.Login.Internal {
|
|
|
148
150
|
|
|
149
151
|
private void OnShowAndroidDemoImage() {
|
|
150
152
|
string url = DEMO_IMAGE_URL_ANDROID_ZH;
|
|
151
|
-
if (TapTapSDK.
|
|
153
|
+
if (TapTapSDK.taptapSdkOptions != null && TapTapSDK.taptapSdkOptions.region == TapTapRegionType.Overseas) {
|
|
152
154
|
url = DEMO_IMAGE_URL_ANDROID_EN;
|
|
153
155
|
}
|
|
154
156
|
ShowDemoImage(url);
|
|
@@ -5,10 +5,11 @@ using UnityEngine.UI;
|
|
|
5
5
|
using TapSDK.Login.Internal.Http;
|
|
6
6
|
using System.Collections.Specialized;
|
|
7
7
|
using TapSDK.Core.Internal.Utils;
|
|
8
|
+
using TapSDK.Core.Internal.Log;
|
|
8
9
|
|
|
9
10
|
namespace TapSDK.Login.Internal {
|
|
10
11
|
public class WebController {
|
|
11
|
-
private readonly Action<TokenData> onAuth;
|
|
12
|
+
private readonly Action<TokenData, String> onAuth;
|
|
12
13
|
|
|
13
14
|
private readonly Text titleText;
|
|
14
15
|
private readonly Button jumpButton;
|
|
@@ -22,7 +23,7 @@ namespace TapSDK.Login.Internal {
|
|
|
22
23
|
|
|
23
24
|
private bool isRunning;
|
|
24
25
|
|
|
25
|
-
public WebController(Transform transform, Action<TokenData> onAuth) {
|
|
26
|
+
public WebController(Transform transform, Action<TokenData, String> onAuth) {
|
|
26
27
|
this.onAuth = onAuth;
|
|
27
28
|
|
|
28
29
|
titleText = transform.Find("Title").GetComponent<Text>();
|
|
@@ -92,8 +93,8 @@ namespace TapSDK.Login.Internal {
|
|
|
92
93
|
}
|
|
93
94
|
|
|
94
95
|
TokenData tokenData = await LoginService.Authorize(clientId, code);
|
|
95
|
-
|
|
96
|
-
onAuth.Invoke(tokenData);
|
|
96
|
+
TapLog.Log("Login , WebController Success");
|
|
97
|
+
onAuth.Invoke(tokenData, "pc_browser");
|
|
97
98
|
|
|
98
99
|
return;
|
|
99
100
|
} catch (Exception) {
|
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.3.4",
|
|
5
|
+
"version": "4.3.10-alpha.4",
|
|
6
6
|
"unity": "2019.4",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"com.taptap.sdk.core": "4.3.4"
|
|
9
|
+
"com.taptap.sdk.core": "4.3.10-alpha.4"
|
|
10
10
|
}
|
|
11
11
|
}
|