com.taptap.sdk.login 4.3.2 → 4.3.8-alpha.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.
@@ -5,16 +5,16 @@
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.2"/>
8
+ <androidPackage spec="com.taptap.sdk:tap-login-unity:4.3.8-alpha.11"/>
9
9
  </androidPackages>
10
10
 
11
11
  <!-- iOS Cocoapod dependencies can be specified by each iosPod element. -->
12
12
  <iosPods>
13
13
  <sources>
14
- <source>https://github.com/CocoaPods/Specs.git</source>
14
+ <source>git@git.gametaptap.com:ios/international/TapSDK4-iOS-podspecs.git</source>
15
15
  </sources>
16
16
  <iosPod name="Kingfisher" version="~> 6.0" bitcodeEnabled="false" addToAllTargets="false"/>
17
- <iosPod name="TapTapLoginSDK" version="~> 4.3.2" bitcodeEnabled="false" addToAllTargets="false"/>
17
+ <iosPod name="TapTapLoginSDK" version="~> 4.3.8-alpha.1" bitcodeEnabled="false" addToAllTargets="false"/>
18
18
  </iosPods>
19
19
  </dependencies>
20
20
 
@@ -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.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,103 @@
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)
57
+ {
58
+ Dictionary<string, string> parameters = new Dictionary<string, string>
59
+ {
60
+ { "func_name", funcNace },
61
+ { "seesion_id", seesionId }
62
+ };
63
+ ReportLog(ACTION_SUCCESS, new Dictionary<string, string>()
64
+ {
65
+ { "args", JsonConvert.SerializeObject(parameters) }
66
+ });
67
+ }
68
+
69
+ internal void TrackCancel(string funcNace, string seesionId)
70
+ {
71
+ Dictionary<string, string> parameters = new Dictionary<string, string>
72
+ {
73
+ { "func_name", funcNace },
74
+ { "seesion_id", seesionId },
75
+ };
76
+ ReportLog(ACTION_CANCEL, new Dictionary<string, string>()
77
+ {
78
+ { "args", JsonConvert.SerializeObject(parameters) }
79
+ });
80
+ }
81
+
82
+ internal void TrackFailure(string funcNace, string seesionId, int errorCode = -1, string errorMessage = null)
83
+ {
84
+ Dictionary<string, string> parameters = new Dictionary<string, string>
85
+ {
86
+ { "func_name", funcNace },
87
+ { "seesion_id", seesionId },
88
+ { "error_code", errorCode.ToString() },
89
+ { "error_msg", errorMessage }
90
+ };
91
+ ReportLog(ACTION_FAIL, new Dictionary<string, string>()
92
+ {
93
+ { "args", JsonConvert.SerializeObject(parameters) }
94
+ });
95
+ }
96
+
97
+
98
+ private void ReportLog(string action, Dictionary<string, string> parameters = null)
99
+ {
100
+ openlog.LogBusiness(action, parameters);
101
+ }
102
+ }
103
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 126318050cb3e47758db60d08272ba41
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: b2f7525f31d3a4d8ab6c1128fbdfa0e7
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -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();
@@ -57,6 +62,7 @@ namespace TapSDK.Login.Internal
57
62
  Scopes = scopes,
58
63
  OnAuth = async tokenData => {
59
64
  if (tokenData == null) {
65
+ TapLoginTracker.Instance.TrackFailure("loginWithScopes", sessionId, (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);
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, (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
92
  OnError = e => {
93
+ TapLoginTracker.Instance.TrackFailure("loginWithScopes", sessionId, 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
  };
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.2",
5
+ "version": "4.3.8-alpha.2",
6
6
  "unity": "2019.4",
7
7
  "license": "MIT",
8
8
  "dependencies": {
9
- "com.taptap.sdk.core": "4.3.2"
9
+ "com.taptap.sdk.core": "4.3.8-alpha.2"
10
10
  }
11
11
  }