com.taptap.sdk.compliance 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.
@@ -4,12 +4,12 @@
4
4
  <repositories>
5
5
  <repository>https://repo.maven.apache.org/maven2</repository>
6
6
  </repositories>
7
- <androidPackage spec="com.taptap.sdk:tap-compliance:4.5.1-beta.1"/>
7
+ <androidPackage spec="com.taptap.sdk:tap-compliance: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
- <iosPod name="TapTapComplianceSDK" version="~> 4.5.0" bitcodeEnabled="false" addToAllTargets="false"/>
13
+ <iosPod name="TapTapComplianceSDK" version="~> 4.5.2" bitcodeEnabled="false" addToAllTargets="false"/>
14
14
  </iosPods>
15
15
  </dependencies>
@@ -11,8 +11,8 @@ namespace TapSDK.Compliance.Mobile.Runtime
11
11
  public static class ComplianceMobileBridge
12
12
  {
13
13
  private const string ANTI_ADDICTION_SERVICE = "BridgeComplianceService";
14
- private const string ANTI_ADDICTION_SERVICE_CLZ = "com.taptap.sdk.compilance.internal.enginebridge.BridgeComplianceService";
15
- private const string ANTI_ADDICTION_SERVICE_IMPL = "com.taptap.sdk.compilance.internal.enginebridge.BridgeComplianceServiceImpl";
14
+ private const string ANTI_ADDICTION_SERVICE_CLZ = "com.taptap.sdk.compliance.internal.enginebridge.BridgeComplianceService";
15
+ private const string ANTI_ADDICTION_SERVICE_IMPL = "com.taptap.sdk.compliance.internal.enginebridge.BridgeComplianceServiceImpl";
16
16
 
17
17
  private static bool hasRegisterMobileCallback = false;
18
18
  private static List<Action<int, string>> callbackList = new List<Action<int, string>>();
@@ -2,6 +2,7 @@
2
2
  using System.Threading.Tasks;
3
3
  using TapSDK.Compliance.Model;
4
4
  using System.Collections.Generic;
5
+ using TapSDK.Core;
5
6
  using TapSDK.Compliance.Mobile.Runtime;
6
7
 
7
8
  namespace TapSDK.Compliance.Mobile.Runtime
@@ -34,7 +35,7 @@ namespace TapSDK.Compliance.Mobile.Runtime
34
35
  return ComplianceMobileBridge.GetUserAgeRange();
35
36
  }
36
37
 
37
- public void Init(string clientId, string clientToken, TapTapComplianceOption config)
38
+ public void Init(string clientId, string clientToken, TapTapRegionType regionType, TapTapComplianceOption config)
38
39
  {
39
40
 
40
41
  }
@@ -70,9 +70,9 @@ namespace TapSDK.Compliance.Internal
70
70
  TapLogger.Debug(string.Format("Anti Addiction Job Type: {0} ! Platform: {1}", _job.GetType(), Application.platform.ToString()));
71
71
  }
72
72
 
73
- internal static void Init(string clientId, string clientToken, TapTapComplianceOption config)
73
+ internal static void Init(string clientId, string clientToken, TapTapRegionType regionType, TapTapComplianceOption config)
74
74
  {
75
- Job.Init(clientId, clientToken, config);
75
+ Job.Init(clientId, clientToken, regionType, config);
76
76
  _isInit = true;
77
77
  }
78
78
 
@@ -1,6 +1,7 @@
1
1
  using System;
2
2
  using System.Collections.Generic;
3
3
  using System.Threading.Tasks;
4
+ using TapSDK.Core;
4
5
 
5
6
  namespace TapSDK.Compliance.Model
6
7
  {
@@ -23,7 +24,7 @@ namespace TapSDK.Compliance.Model
23
24
  /// 新的初始化接口
24
25
  /// </summary>
25
26
  /// <param name="config"></param>
26
- void Init(string clientId, string clientToken, TapTapComplianceOption config);
27
+ void Init(string clientId, string clientToken, TapTapRegionType regionType, TapTapComplianceOption config);
27
28
  /// <summary>
28
29
  /// 设置防沉迷回调
29
30
  /// </summary>
@@ -10,7 +10,7 @@ namespace TapSDK.Compliance.Internal.Init
10
10
 
11
11
  public void Init(TapTapSdkOptions coreOption, TapTapSdkBaseOptions[] otherOptions)
12
12
  {
13
- if (coreOption == null || coreOption.region == TapTapRegionType.Overseas)
13
+ if (coreOption == null)
14
14
  {
15
15
  return;
16
16
  }
@@ -29,17 +29,17 @@ namespace TapSDK.Compliance.Internal.Init
29
29
  {
30
30
  complianceOption = new TapTapComplianceOption();
31
31
  }
32
- ComplianceJobManager.Init(coreOption.clientId, coreOption.clientToken, complianceOption);
32
+ ComplianceJobManager.Init(coreOption.clientId, coreOption.clientToken, coreOption.region, complianceOption);
33
33
  }
34
34
 
35
35
  public void Init(TapTapSdkOptions coreOption)
36
36
  {
37
- if (coreOption == null || coreOption.region == TapTapRegionType.Overseas)
37
+ if (coreOption == null)
38
38
  {
39
39
  return;
40
40
  }
41
41
  TapTapComplianceOption option = new TapTapComplianceOption();
42
- ComplianceJobManager.Init(coreOption.clientId, coreOption.clientToken, option);
42
+ ComplianceJobManager.Init(coreOption.clientId, coreOption.clientToken, coreOption.region, option);
43
43
 
44
44
  }
45
45
  }
@@ -10,7 +10,7 @@ namespace TapSDK.Compliance
10
10
  public static class TapTapCompliance
11
11
  {
12
12
 
13
- public static readonly string Version = "4.5.1-beta.2";
13
+ public static readonly string Version = "4.5.2";
14
14
 
15
15
  public static void RegisterComplianceCallback(Action<int, string> callback)
16
16
  {
@@ -6,6 +6,9 @@ using TapSDK.Compliance.Model;
6
6
  using System.Collections.Generic;
7
7
  using TapSDK.Compliance.Standalone.Internal;
8
8
  using TapSDK.Core;
9
+ using TapSDK.Core.Standalone;
10
+ using TapSDK.Core.Internal.Utils;
11
+ using Newtonsoft.Json;
9
12
 
10
13
  namespace TapSDK.Compliance
11
14
  {
@@ -13,6 +16,8 @@ namespace TapSDK.Compliance
13
16
  {
14
17
  internal bool UseAgeRange = true;
15
18
 
19
+ internal TapTapRegionType currentRegionType = TapTapRegionType.CN;
20
+
16
21
  // 是否正在处理用户信息,当调用 startup 接口后设置为 true, 当通知游戏回调时设置为 false
17
22
  internal volatile bool isCheckingUser = false;
18
23
  private List<Action<int, string>> _externalCallbackList;
@@ -24,6 +29,11 @@ namespace TapSDK.Compliance
24
29
 
25
30
  public Task<int> GetAgeRange()
26
31
  {
32
+ if(!CheckInitState()){
33
+ var defaultTcs = new TaskCompletionSource<int>();
34
+ defaultTcs.TrySetResult(-1);
35
+ return defaultTcs.Task;
36
+ }
27
37
  var tcs = new TaskCompletionSource<int>();
28
38
  if (!Verification.IsVerified || !UseAgeRange){
29
39
  tcs.TrySetResult(-1);
@@ -42,6 +52,11 @@ namespace TapSDK.Compliance
42
52
  /// </summary>
43
53
  public Task<int> GetRemainingTime()
44
54
  {
55
+ if(!CheckInitState()){
56
+ var defaultTcs = new TaskCompletionSource<int>();
57
+ defaultTcs.TrySetResult(0);
58
+ return defaultTcs.Task;
59
+ }
45
60
  int time = 0;
46
61
  if (TapTapComplianceManager.CurrentRemainSeconds == null){
47
62
  time = 0;
@@ -62,6 +77,11 @@ namespace TapSDK.Compliance
62
77
 
63
78
  public Task<string> GetCurrentToken()
64
79
  {
80
+ if(!CheckInitState()){
81
+ var defaultTcs = new TaskCompletionSource<string>();
82
+ defaultTcs.TrySetResult("");
83
+ return defaultTcs.Task;
84
+ }
65
85
  var tcs = new TaskCompletionSource<string>();
66
86
  if (!Verification.IsVerified){
67
87
  tcs.TrySetResult("");
@@ -71,13 +91,17 @@ namespace TapSDK.Compliance
71
91
  return tcs.Task;
72
92
  }
73
93
 
74
- public void Init(string clientId, string clientToken, TapTapComplianceOption config) {
94
+ public void Init(string clientId, string clientToken, TapTapRegionType reginType, TapTapComplianceOption config) {
75
95
  UseAgeRange = config.useAgeRange;
96
+ currentRegionType = reginType;
76
97
  TapTapComplianceManager.Init(clientId, clientToken, config);
77
98
  TapComplianceTracker.Instance.TrackInit();
78
99
  }
79
100
 
80
101
  public void RegisterComplianceCallback(Action<int, string> callback){
102
+ if(!CheckInitState()){
103
+ return;
104
+ }
81
105
  if(_externalCallbackList == null){
82
106
  _externalCallbackList = new List<Action<int, string>>();
83
107
  }
@@ -88,6 +112,9 @@ namespace TapSDK.Compliance
88
112
 
89
113
  public async void Startup(string userId)
90
114
  {
115
+ if(!CheckInitState()){
116
+ return;
117
+ }
91
118
  // 如果正在处理中,直接返回
92
119
  if (isCheckingUser) {
93
120
  TapLogger.Debug(" current user is checking so return");
@@ -125,17 +152,19 @@ namespace TapSDK.Compliance
125
152
 
126
153
  public void Exit()
127
154
  {
128
- TapTapComplianceManager.Logout();
129
- if(_externalCallbackList != null){
130
- foreach(Action<int, string> callback in _externalCallbackList){
131
- callback?.Invoke(StartUpResult.EXITED, null);
132
- }
155
+ if(!CheckInitState()){
156
+ return;
133
157
  }
158
+ TapTapComplianceManager.Logout();
159
+ OnInvokeExternalCallback(StartUpResult.EXITED, null);
134
160
  }
135
161
 
136
162
 
137
163
  public async void CheckPaymentLimit(long amount, Action<CheckPayResult> handleCheckPayLimit, Action<string> handleCheckPayLimitException)
138
164
  {
165
+ if(!CheckInitState()){
166
+ return;
167
+ }
139
168
  try
140
169
  {
141
170
  var payResult = await TapTapComplianceManager.CheckPayLimit(amount);
@@ -158,6 +187,9 @@ namespace TapSDK.Compliance
158
187
 
159
188
  public async void SubmitPayment(long amount, Action handleSubmitPayResult, Action<string> handleSubmitPayResultException)
160
189
  {
190
+ if(!CheckInitState()){
191
+ return;
192
+ }
161
193
  try
162
194
  {
163
195
  await TapTapComplianceManager.SubmitPayResult(amount);
@@ -174,6 +206,9 @@ namespace TapSDK.Compliance
174
206
 
175
207
 
176
208
  public void SetTestEnvironment(bool enable) {
209
+ if(!CheckInitState()){
210
+ return;
211
+ }
177
212
  TapTapComplianceManager.SetTestEnvironment(enable);
178
213
  }
179
214
 
@@ -200,6 +235,24 @@ namespace TapSDK.Compliance
200
235
  // 用户结束校验流程
201
236
  isCheckingUser = false;
202
237
  }
238
+ // 在 openlog 中设置当前用户信息
239
+ if ( code == StartUpResult.LOGIN_SUCCESS || code == StartUpResult.EXITED || code == StartUpResult.SWITCH_ACCOUNT)
240
+ {
241
+ string userIdentifier = "";
242
+ string userSessionId = "";
243
+ if (code == StartUpResult.LOGIN_SUCCESS)
244
+ {
245
+ userIdentifier = TapTapComplianceManager.UserId ?? "";
246
+ userSessionId = TapTapComplianceManager.CurrentSession ?? "";
247
+ }
248
+ Dictionary<string,string> userData = new Dictionary<string,string>() {
249
+ ["anti_addict_user_identifier"] = userIdentifier,
250
+ ["anti_addict_session_id"] = userSessionId
251
+ };
252
+ string userInfo = JsonConvert.SerializeObject(userData);
253
+ EventManager.TriggerEvent(EventManager.OnComplianceUserChanged, userInfo);
254
+ }
255
+
203
256
  if (StartUpResult.Contains(code)){
204
257
  if(_externalCallbackList != null){
205
258
  foreach(Action<int, string> callback in _externalCallbackList){
@@ -209,5 +262,23 @@ namespace TapSDK.Compliance
209
262
  }
210
263
  }
211
264
 
265
+ /// <summary>
266
+ /// 校验初始化参数及区域
267
+ /// </summary>
268
+ /// <returns>是否校验通过</returns>
269
+ private bool CheckInitState()
270
+ {
271
+ if (!TapCoreStandalone.CheckInitState())
272
+ {
273
+ return false;
274
+ }
275
+ if (currentRegionType == TapTapRegionType.Overseas)
276
+ {
277
+ TapVerifyInitStateUtils.ShowVerifyErrorMsg("海外不支持使用合规认证服务", "海外不支持使用合规认证服务");
278
+ return false;
279
+ }
280
+ return true;
281
+ }
282
+
212
283
  }
213
284
  }
@@ -16,6 +16,8 @@ using System.Security.Cryptography;
16
16
  using System.Text;
17
17
  using System.Linq;
18
18
  using TapSDK.Core.Standalone.Internal;
19
+ using TapSDK.Core.Standalone;
20
+ using System.Net;
19
21
 
20
22
 
21
23
  namespace TapSDK.Compliance.Internal
@@ -57,7 +59,7 @@ namespace TapSDK.Compliance.Internal
57
59
  /// </summary>
58
60
  /// <returns></returns>
59
61
  internal static async Task<RealNameConfigResult> FetchConfig(string userId) {
60
- string path = $"real-name/v1/get-global-config?client_id={gameId}";
62
+ string path = $"real-name/v1/get-global-config?client_id={gameId}&user_identifier={WebUtility.UrlEncode(userId)}";
61
63
  var headers = GetAuthHeaders(path,"GET", 0, null);
62
64
  RealNameConfigResponse response = await HttpClient.Get<RealNameConfigResponse>(path, headers);
63
65
  return response.Result;
@@ -69,7 +71,7 @@ namespace TapSDK.Compliance.Internal
69
71
  /// <returns></returns>
70
72
  internal static async Task<VerificationResult> FetchVerification(string userId)
71
73
  {
72
- string path = $"real-name/v1/anti-addiction-token?client_id={gameId}";
74
+ string path = $"real-name/v1/anti-addiction-token?client_id={gameId}&user_identifier={WebUtility.UrlEncode(userId)}";
73
75
  var headers = GetAuthHeaders(path,"GET", 0, null);
74
76
  ServerVerificationResponse response = await HttpClient.Get<ServerVerificationResponse>(path, headers);
75
77
  return response.Result;
@@ -81,7 +83,8 @@ namespace TapSDK.Compliance.Internal
81
83
  {
82
84
  string path = $"real-name/v1/anti-addiction-token-upgrade?client_id={gameId}";
83
85
  var param = new Dictionary<string, object> {
84
- ["anti_addiction_token_v1"] = oldToken
86
+ ["anti_addiction_token_v1"] = oldToken,
87
+ ["user_identifier"] = userId
85
88
  };
86
89
  var headers = GetAuthHeaders(path,"POST", 0, param);
87
90
  ServerVerificationResponse response = await HttpClient.Post<ServerVerificationResponse>(path, headers, data:param);
@@ -92,7 +95,7 @@ namespace TapSDK.Compliance.Internal
92
95
  /// 使用 TapToken 获取实名 token
93
96
  /// <returns></returns>
94
97
  public static async Task<VerificationResult> FetchVerificationByTapToken(string userId, AccessToken token, long timestamp = 0) {
95
- string path = $"real-name/v1/anti-addiction-token-taptap?client_id={gameId}";
98
+ string path = $"real-name/v1/anti-addiction-token-taptap?client_id={gameId}&user_identifier={WebUtility.UrlEncode(userId)}";
96
99
  var httpClientType = typeof(ComplianceHttpClient);
97
100
  var hostFieldInfo = httpClientType.GetField("serverUrl", BindingFlags.NonPublic | BindingFlags.Instance);
98
101
  string host = hostFieldInfo?.GetValue(HttpClient) as string;
@@ -137,7 +140,8 @@ namespace TapSDK.Compliance.Internal
137
140
  Dictionary<string, object> data = new Dictionary<string, object>
138
141
  {
139
142
  ["name"] = userName,
140
- ["idcard"] = idCard
143
+ ["idcard"] = idCard,
144
+ ["user_identifier"] = TapTapComplianceManager.UserId
141
145
  };
142
146
  var headers = GetAuthHeaders(path,"POST", 0, data);
143
147
  ServerVerificationResponse response = await HttpClient.Post<ServerVerificationResponse>(path, headers, data: data);
@@ -154,9 +158,9 @@ namespace TapSDK.Compliance.Internal
154
158
  {
155
159
  string path;
156
160
  if (!enableTestMode) {
157
- path = $"anti-addiction/v1/get-config-by-token?platform=pc&client_id={gameId}";
161
+ path = $"anti-addiction/v1/get-config-by-token?platform=pc&client_id={gameId}&user_identifier={WebUtility.UrlEncode(TapTapComplianceManager.UserId)}";
158
162
  }else{
159
- path = $"anti-addiction/v1/get-config-by-token?platform=pc&client_id={gameId}&test_mode=1";
163
+ path = $"anti-addiction/v1/get-config-by-token?platform=pc&client_id={gameId}&test_mode=1&user_identifier={WebUtility.UrlEncode(TapTapComplianceManager.UserId)}";
160
164
  }
161
165
  Dictionary<string, object> headers = GetAuthHeaders(path,"GET",0,null);
162
166
  UserComplianceConfigResponse response = await HttpClient.Get<UserComplianceConfigResponse>(path, headers: headers);
@@ -179,7 +183,8 @@ namespace TapSDK.Compliance.Internal
179
183
  path = $"anti-addiction/v1/heartbeat?client_id={gameId}&test_mode=1";
180
184
  }
181
185
  Dictionary<string,object> data = new Dictionary<string,object>{
182
- ["session_id"] = TapTapComplianceManager.CurrentSession
186
+ ["session_id"] = TapTapComplianceManager.CurrentSession,
187
+ ["user_identifier"] = TapTapComplianceManager.UserId
183
188
  };
184
189
  Dictionary<string, object> headers = GetAuthHeaders(path,"POST",0, data);
185
190
  PlayableResponse response = await HttpClient.Post<PlayableResponse>(path, headers: headers, data:data);
@@ -198,10 +203,10 @@ namespace TapSDK.Compliance.Internal
198
203
  {
199
204
  string path = "";
200
205
  if (!enableTestMode) {
201
- path = $"anti-addiction/v1/payable?client_id={gameId}&amount={amount}";
206
+ path = $"anti-addiction/v1/payable?client_id={gameId}&amount={amount}&user_identifier={WebUtility.UrlEncode(TapTapComplianceManager.UserId)}";
202
207
  }
203
208
  else {
204
- path = $"anti-addiction/v1/payable?client_id={gameId}&amount={amount}&test_mode=1";
209
+ path = $"anti-addiction/v1/payable?client_id={gameId}&amount={amount}&test_mode=1&user_identifier={WebUtility.UrlEncode(TapTapComplianceManager.UserId)}";
205
210
  }
206
211
  Dictionary<string, object> headers = GetAuthHeaders(path, "GET", 0, null);
207
212
  PayableResponse response = await HttpClient.Get<PayableResponse>(path, headers: headers);
@@ -224,7 +229,8 @@ namespace TapSDK.Compliance.Internal
224
229
  }
225
230
  Dictionary<string, object> data = new Dictionary<string, object>
226
231
  {
227
- { "amount", amount }
232
+ { "amount", amount },
233
+ {"user_identifier", TapTapComplianceManager.UserId}
228
234
  };
229
235
  Dictionary<string, object> headers = GetAuthHeaders(path, "POST", 0, data);
230
236
 
@@ -264,9 +270,12 @@ namespace TapSDK.Compliance.Internal
264
270
  {
265
271
  headers.Add("X-Tap-Anti-Addiction-Token", token);
266
272
  }
267
- if(!string.IsNullOrEmpty(TapTapComplianceManager.UserId)){
268
- headers.Add("X-Tap-SDK-Game-User-Id", TapTapComplianceManager.UserId);
273
+
274
+ string currentDBUserId = TapCoreStandalone.GetCurrentUserId();
275
+ if(currentDBUserId != null && currentDBUserId.Length > 0) {
276
+ headers.Add("X-Tap-SDK-Game-User-Id", currentDBUserId);
269
277
  }
278
+
270
279
  headers = headers.OrderBy(x => x.Key).ToDictionary(x => x.Key, y=>y.Value);
271
280
  List<string> headerList = new List<string>();
272
281
  foreach(KeyValuePair<string,object> kv in headers){
@@ -5,9 +5,9 @@ namespace TapSDK.Compliance
5
5
  {
6
6
  public class TapLoginPermissionConfig : IComplianceProvider
7
7
  {
8
- public string GetAgeRangeScope()
8
+ public string GetAgeRangeScope(bool isCN)
9
9
  {
10
- if (TapTapComplianceManager.ClientId != null)
10
+ if (TapTapComplianceManager.ClientId != null && isCN)
11
11
  {
12
12
  if (TapTapComplianceManager.ComplianceConfig.useAgeRange)
13
13
  {
@@ -7,7 +7,8 @@ using TapSDK.UI;
7
7
  using TapSDK.Compliance.Model;
8
8
  using TapSDK.Compliance.Standalone.Internal;
9
9
 
10
- namespace TapSDK.Compliance.Internal {
10
+ namespace TapSDK.Compliance.Internal
11
+ {
11
12
  public class TaptapComplianceIDInputController : BasePanelController
12
13
  {
13
14
  public Button closeButton;
@@ -28,7 +29,13 @@ namespace TapSDK.Compliance.Internal {
28
29
 
29
30
  public bool activeManualVerification;
30
31
  private bool _isSending;
31
-
32
+
33
+ // 上次服务端已校验过的错误的用户名
34
+ private string lastErrorUserName = "";
35
+
36
+ // 上次服务端已校验过的错误的用户身份证
37
+ private string lastErrorUserIdNumber = "";
38
+
32
39
 
33
40
  private bool isSending
34
41
  {
@@ -74,17 +81,19 @@ namespace TapSDK.Compliance.Internal {
74
81
  if (config != null)
75
82
  {
76
83
  titleText.text = config.Title;
77
- descriptionText.text = config.Content.Replace(" ","\u00A0");
78
- if (IsTextOverflowing(descriptionText, out int lineCount, out float lineHeight)) {
84
+ descriptionText.text = config.Content.Replace(" ", "\u00A0");
85
+ if (IsTextOverflowing(descriptionText, out int lineCount, out float lineHeight))
86
+ {
79
87
  scrollRect.enabled = true;
80
88
  descriptionText.rectTransform.sizeDelta = new Vector2(descriptionText.rectTransform.sizeDelta.x,
81
89
  40 + (lineCount - 3) * lineHeight);
82
-
90
+
83
91
  var contentRect = scrollRect.transform.Find("Viewport/Content").GetComponent<RectTransform>();
84
92
  contentRect.sizeDelta = new Vector2(contentRect.sizeDelta.x,
85
93
  40 + (lineCount - 3) * lineHeight);
86
94
  }
87
- else {
95
+ else
96
+ {
88
97
  scrollRect.enabled = false;
89
98
  }
90
99
  buttonText.text = config.PositiveButtonText;
@@ -124,10 +133,21 @@ namespace TapSDK.Compliance.Internal {
124
133
  {
125
134
  try
126
135
  {
136
+ // 如果提交时已明确为错误身份信息,直接弹 toast 提示
137
+ if (name.Equals(lastErrorUserName) && idNumber.Equals(lastErrorUserIdNumber))
138
+ {
139
+ UIManager.Instance.OpenToast("输入信息有误", UIManager.GeneralToastLevel.Error);
140
+ return;
141
+ }
127
142
  isSending = true;
143
+ // 提交后按钮不可用
144
+ submitButton.interactable = false;
128
145
  var verificationResult = await Verification.FetchVerificationManual(TapTapComplianceManager.UserId, name, idNumber);
129
146
  isSending = false;
130
- if (verificationResult.Status.Equals("pass")) {
147
+ // 后端返回后按钮可用
148
+ submitButton.interactable = true;
149
+ if (verificationResult.Status.Equals("pass"))
150
+ {
131
151
  // TODO@luran:本地化
132
152
  Close();
133
153
  UIManager.Instance.OpenToast("提交成功", UIManager.GeneralToastLevel.Success);
@@ -137,6 +157,14 @@ namespace TapSDK.Compliance.Internal {
137
157
  catch (Exception e)
138
158
  {
139
159
  isSending = false;
160
+ submitButton.interactable = true;
161
+ // 判断是否为明确的错误身份信息
162
+ if ( e is ComplianceException compoliaceError
163
+ && compoliaceError.Error != null && compoliaceError.Error.Equals("business_code_error")
164
+ && compoliaceError.ErrorCode == 200001){
165
+ lastErrorUserName = name;
166
+ lastErrorUserIdNumber = idNumber;
167
+ }
140
168
  OnException?.Invoke(e);
141
169
  }
142
170
  }
@@ -161,51 +189,51 @@ namespace TapSDK.Compliance.Internal {
161
189
  private static bool IsIdNum(string input)
162
190
  {
163
191
  return !string.IsNullOrWhiteSpace(input);
164
- // double iSum = 0;
165
- // // 18位验证
166
- // Regex rg = new Regex(@"^\d{17}(\d|x)$");
167
- // Match mc = rg.Match(input);
168
- // if (!mc.Success)
169
- // {
170
- // return false;
171
- // }
172
- //
173
- // // 生日验证
174
- // input = input.ToLower();
175
- // input = input.Replace("x", "a");
176
- // try
177
- // {
178
- // var year = input.Substring(6, 4);
179
- // var month = input.Substring(10, 2);
180
- // var day = input.Substring(12, 2);
181
- // DateTime.Parse(year + "-" + month + "-" + day);
182
- // }
183
- // catch
184
- // {
185
- // #if UNITY_EDITOR
186
- // TapLogger.Error("国内-防沉迷 身份证号非法出生日期");
187
- // #endif
188
- // return false;
189
- // }
190
- //
191
- // // 最后一位验证
192
- // for (int i = 17; i >= 0; i--)
193
- // {
194
- // iSum += (Math.Pow(2, i) % 11) *
195
- // int.Parse(input[17 - i].ToString(), System.Globalization.NumberStyles.HexNumber);
196
- // }
197
- //
198
- // if (iSum % 11 != 1)
199
- // {
200
- // #if UNITY_EDITOR
201
- // TapLogger.Error("国内-防沉迷 身份证号非法尾号");
202
- // #endif
203
- // return false;
204
- // }
205
- //
206
- // return true;
192
+ // double iSum = 0;
193
+ // // 18位验证
194
+ // Regex rg = new Regex(@"^\d{17}(\d|x)$");
195
+ // Match mc = rg.Match(input);
196
+ // if (!mc.Success)
197
+ // {
198
+ // return false;
199
+ // }
200
+ //
201
+ // // 生日验证
202
+ // input = input.ToLower();
203
+ // input = input.Replace("x", "a");
204
+ // try
205
+ // {
206
+ // var year = input.Substring(6, 4);
207
+ // var month = input.Substring(10, 2);
208
+ // var day = input.Substring(12, 2);
209
+ // DateTime.Parse(year + "-" + month + "-" + day);
210
+ // }
211
+ // catch
212
+ // {
213
+ // #if UNITY_EDITOR
214
+ // TapLogger.Error("国内-防沉迷 身份证号非法出生日期");
215
+ // #endif
216
+ // return false;
217
+ // }
218
+ //
219
+ // // 最后一位验证
220
+ // for (int i = 17; i >= 0; i--)
221
+ // {
222
+ // iSum += (Math.Pow(2, i) % 11) *
223
+ // int.Parse(input[17 - i].ToString(), System.Globalization.NumberStyles.HexNumber);
224
+ // }
225
+ //
226
+ // if (iSum % 11 != 1)
227
+ // {
228
+ // #if UNITY_EDITOR
229
+ // TapLogger.Error("国内-防沉迷 身份证号非法尾号");
230
+ // #endif
231
+ // return false;
232
+ // }
233
+ //
234
+ // return true;
207
235
  }
208
-
236
+
209
237
  bool IsTextOverflowing(Text text, out int lineCount, out float lineHeight)
210
238
  {
211
239
  var textGenerator = text.cachedTextGenerator;
package/package.json CHANGED
@@ -2,11 +2,11 @@
2
2
  "name": "com.taptap.sdk.compliance",
3
3
  "displayName": "TapTapSDK Compliance",
4
4
  "description": "TapTapSDK Compliance",
5
- "version": "4.5.1-beta.2",
5
+ "version": "4.5.2",
6
6
  "unity": "2019.4",
7
7
  "license": "MIT",
8
8
  "dependencies": {
9
- "com.taptap.sdk.core": "4.5.1-beta.2",
10
- "com.taptap.sdk.login": "4.5.1-beta.2"
9
+ "com.taptap.sdk.core": "4.5.2",
10
+ "com.taptap.sdk.login": "4.5.2"
11
11
  }
12
12
  }