com.xd.sdk.account 6.29.1 → 7.0.0

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.
Files changed (205) hide show
  1. package/Plugins/Android/libs/XDGAccount_7.0.0.aar +0 -0
  2. package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGAccountBridge.java.meta → Plugins/Android/libs/XDGAccount_7.0.0.aar.meta} +2 -2
  3. package/Plugins/Android/libs/XDGBridgeAccount_v7_7.0.0.aar +0 -0
  4. package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnity.java.meta → Plugins/Android/libs/XDGBridgeAccount_v7_7.0.0.aar.meta} +2 -2
  5. package/Plugins/Android/libs/XDGSupport_7.0.0.aar +0 -0
  6. package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnityImpl.java.meta → Plugins/Android/libs/XDGSupport_7.0.0.aar.meta} +2 -2
  7. package/Plugins/Android/libs.meta +1 -1
  8. package/Plugins/Android.meta +1 -1
  9. package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginHelper.h +2 -8
  10. package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginHelper.h.meta +1 -1
  11. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK-Swift.h +329 -0
  12. package/Plugins/iOS/XDAccountSDK.framework/Headers/{TDSGlobalThirdPartyLoginManager.h.meta → XDAccountSDK-Swift.h.meta} +1 -1
  13. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK.h +1 -2
  14. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK.h.meta +1 -1
  15. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccount.h +29 -43
  16. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccount.h.meta +1 -1
  17. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountDefines.h +43 -0
  18. package/Plugins/iOS/XDAccountSDK.framework/Headers/{XDGPhoneAuthManager.h.meta → XDGAccountDefines.h.meta} +1 -1
  19. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountVersion.h +3 -3
  20. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountVersion.h.meta +1 -1
  21. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLogger+Account.h +3 -0
  22. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLogger+Account.h.meta +1 -1
  23. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLoginEntriesConfig.h.meta +1 -1
  24. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLoginService.h.meta +1 -1
  25. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGTapLoginPermissionDialog.h.meta +1 -1
  26. package/Plugins/iOS/XDAccountSDK.framework/Headers.meta +1 -1
  27. package/Plugins/iOS/XDAccountSDK.framework/Info.plist +0 -0
  28. package/Plugins/iOS/XDAccountSDK.framework/Info.plist.meta +1 -1
  29. package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  30. package/Plugins/iOS/XDAccountSDK.framework/{Headers/XDGRoleInfo.h.meta → Modules/XDAccountSDK.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo.meta} +1 -1
  31. package/{Mobile/Http.meta → Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/Project.meta} +1 -1
  32. package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.abi.json +9 -0
  33. package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.abi.json.meta +7 -0
  34. package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  35. package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftdoc.meta +7 -0
  36. package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftmodule +0 -0
  37. package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftmodule.meta +7 -0
  38. package/{Mobile/Editor.meta → Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule.meta} +1 -1
  39. package/Plugins/iOS/XDAccountSDK.framework/Modules/module.modulemap.meta +1 -1
  40. package/Plugins/iOS/XDAccountSDK.framework/Modules.meta +1 -1
  41. package/Plugins/iOS/XDAccountSDK.framework/XDAccountSDK +0 -0
  42. package/Plugins/iOS/XDAccountSDK.framework/XDAccountSDK.meta +1 -1
  43. package/Plugins/iOS/XDAccountSDK.framework.meta +4 -4
  44. package/Plugins/iOS.meta +1 -1
  45. package/Plugins.meta +1 -1
  46. package/Runtime/Internal/IXDGAccount.Extended.cs +11 -0
  47. package/{Mobile/Http/XDGAccountHttpConfigMobile.cs.meta → Runtime/Internal/IXDGAccount.Extended.cs.meta} +1 -1
  48. package/Runtime/Internal/Mobile/AccountFeaturesImpl.cs +348 -0
  49. package/{Mobile/User/UserManagerMobile.cs.meta → Runtime/Internal/Mobile/AccountFeaturesImpl.cs.meta} +1 -1
  50. package/Runtime/Internal/Mobile/Http/LoginSyncResponse.cs +14 -0
  51. package/Runtime/Internal/Mobile/Http/LoginSyncResponse.cs.meta +3 -0
  52. package/Runtime/Internal/Mobile/Http/MacAuthenticationInterceptor.cs +37 -0
  53. package/Runtime/Internal/Mobile/Http/MacAuthenticationInterceptor.cs.meta +3 -0
  54. package/Runtime/Internal/Mobile/Http.meta +3 -0
  55. package/{Mobile.meta → Runtime/Internal/Mobile.meta} +1 -1
  56. package/Runtime/Internal/Standalone/AccessToken/AccessTokenModule.cs +168 -0
  57. package/{Mobile/Editor/XDAccountMobileProcessBuild.cs.meta → Runtime/Internal/Standalone/AccessToken/AccessTokenModule.cs.meta} +1 -1
  58. package/Runtime/Internal/Standalone/AccessToken.meta +8 -0
  59. package/Runtime/Internal/Standalone/AccountCell.cs +143 -0
  60. package/{Mobile/XDGAccountMobile.cs.meta → Runtime/Internal/Standalone/AccountCell.cs.meta} +1 -1
  61. package/Runtime/Internal/Standalone/AccountFeaturesImpl.cs +461 -0
  62. package/Runtime/Internal/Standalone/AccountFeaturesImpl.cs.meta +11 -0
  63. package/Runtime/Internal/Standalone/Auth/AppleAuth.cs +27 -0
  64. package/Runtime/Internal/Standalone/Auth/AppleAuth.cs.meta +11 -0
  65. package/Runtime/Internal/Standalone/Auth/FacebookAuth.cs +27 -0
  66. package/Runtime/Internal/Standalone/Auth/FacebookAuth.cs.meta +11 -0
  67. package/Runtime/Internal/Standalone/Auth/GoogleAuth.cs +27 -0
  68. package/Runtime/Internal/Standalone/Auth/GoogleAuth.cs.meta +11 -0
  69. package/Runtime/Internal/Standalone/Auth/GuestAuth.cs +22 -0
  70. package/Runtime/Internal/Standalone/Auth/GuestAuth.cs.meta +11 -0
  71. package/Runtime/Internal/Standalone/Auth/PhoneAuth.cs +43 -0
  72. package/Runtime/Internal/Standalone/Auth/PhoneAuth.cs.meta +11 -0
  73. package/Runtime/Internal/Standalone/Auth/SteamAuth.cs +90 -0
  74. package/Runtime/Internal/Standalone/Auth/SteamAuth.cs.meta +11 -0
  75. package/Runtime/Internal/Standalone/Auth/TapAuth.cs +72 -0
  76. package/Runtime/Internal/Standalone/Auth/TapAuth.cs.meta +11 -0
  77. package/Runtime/Internal/Standalone/Auth/WebAuth.cs +144 -0
  78. package/Runtime/Internal/Standalone/Auth/WebAuth.cs.meta +11 -0
  79. package/Runtime/Internal/Standalone/Auth.meta +8 -0
  80. package/Runtime/Internal/Standalone/Compliance/XDComplianceCode.cs +15 -0
  81. package/Runtime/Internal/Standalone/Compliance/XDComplianceCode.cs.meta +11 -0
  82. package/Runtime/Internal/Standalone/Compliance.meta +8 -0
  83. package/Runtime/Internal/Standalone/LoginModule/Email/EmailModule.cs +374 -0
  84. package/Runtime/Internal/Standalone/LoginModule/Email/EmailModule.cs.meta +11 -0
  85. package/Runtime/Internal/Standalone/LoginModule/Email.meta +8 -0
  86. package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModule.cs +245 -0
  87. package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModule.cs.meta +11 -0
  88. package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModuleIO.cs +392 -0
  89. package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModuleIO.cs.meta +11 -0
  90. package/Runtime/Internal/Standalone/LoginModule/Phone.meta +8 -0
  91. package/Runtime/Internal/Standalone/LoginModule.meta +8 -0
  92. package/Runtime/Internal/Standalone/SupportModule/SupportModule.cs +228 -0
  93. package/Runtime/Internal/Standalone/SupportModule/SupportModule.cs.meta +3 -0
  94. package/Runtime/Internal/Standalone/SupportModule/SupportResponse.cs +27 -0
  95. package/Runtime/Internal/Standalone/SupportModule/SupportResponse.cs.meta +3 -0
  96. package/Runtime/Internal/Standalone/SupportModule.meta +3 -0
  97. package/Runtime/Internal/Standalone/Track/AliyunTrack.Login.cs +479 -0
  98. package/Runtime/Internal/Standalone/Track/AliyunTrack.Login.cs.meta +11 -0
  99. package/Runtime/Internal/Standalone/Track.meta +8 -0
  100. package/Runtime/Internal/Standalone/UI/CodeUnbindAlert.cs +156 -0
  101. package/Runtime/Internal/Standalone/UI/CodeUnbindAlert.cs.meta +11 -0
  102. package/Runtime/Internal/Standalone/UI/Email/EmailAlert.cs +295 -0
  103. package/Runtime/Internal/Standalone/UI/Email/EmailAlert.cs.meta +11 -0
  104. package/Runtime/Internal/Standalone/UI/Email.meta +8 -0
  105. package/Runtime/Internal/Standalone/UI/PhoneIO/AreaCodeCell.cs +46 -0
  106. package/Runtime/Internal/Standalone/UI/PhoneIO/AreaCodeCell.cs.meta +11 -0
  107. package/Runtime/Internal/Standalone/UI/PhoneIO/PhoneAlertIO.cs +522 -0
  108. package/Runtime/Internal/Standalone/UI/PhoneIO/PhoneAlertIO.cs.meta +11 -0
  109. package/Runtime/Internal/Standalone/UI/PhoneIO.meta +8 -0
  110. package/Runtime/Internal/Standalone/UI/PhoneVerification/PhoneNumberInputAlert.cs +84 -0
  111. package/Runtime/Internal/Standalone/UI/PhoneVerification/PhoneNumberInputAlert.cs.meta +11 -0
  112. package/Runtime/Internal/Standalone/UI/PhoneVerification/RiskControlAlert.cs +190 -0
  113. package/Runtime/Internal/Standalone/UI/PhoneVerification/RiskControlAlert.cs.meta +11 -0
  114. package/Runtime/Internal/Standalone/UI/PhoneVerification/VerifyCodeInputAlert.cs +164 -0
  115. package/Runtime/Internal/Standalone/UI/PhoneVerification/VerifyCodeInputAlert.cs.meta +11 -0
  116. package/Runtime/Internal/Standalone/UI/PhoneVerification.meta +8 -0
  117. package/Runtime/Internal/Standalone/UI.meta +8 -0
  118. package/Runtime/Internal/Standalone/UserCenterAlert.cs +405 -0
  119. package/Runtime/Internal/Standalone/UserCenterAlert.cs.meta +11 -0
  120. package/Runtime/Internal/Standalone/UserModule.cs +604 -0
  121. package/Runtime/Internal/Standalone/UserModule.cs.meta +11 -0
  122. package/Runtime/Internal/Standalone/WebFunction/AccessTokenWebFunction.cs +47 -0
  123. package/Runtime/Internal/Standalone/WebFunction/AccessTokenWebFunction.cs.meta +3 -0
  124. package/Runtime/Internal/Standalone/WebFunction.meta +3 -0
  125. package/{Mobile/Plugins.meta → Runtime/Internal/Standalone.meta} +1 -1
  126. package/Runtime/Internal/XDGAccountEventHandler.cs +23 -0
  127. package/Runtime/Internal/XDGAccountEventHandler.cs.meta +3 -0
  128. package/Runtime/Internal/XDGAccountInternal.cs +86 -0
  129. package/Runtime/Internal/XDGAccountInternal.cs.meta +11 -0
  130. package/Runtime/Internal.meta +1 -1
  131. package/Runtime/Public/XDGAccount.Deprecated.cs +37 -0
  132. package/Runtime/Public/XDGAccount.Deprecated.cs.meta +11 -0
  133. package/Runtime/Public/XDGAccount.cs +107 -0
  134. package/Runtime/{XDGAccount.cs.meta → Public/XDGAccount.cs.meta} +1 -1
  135. package/Runtime/Public.meta +8 -0
  136. package/Runtime/XD.SDK.Account.asmdef +7 -2
  137. package/Runtime/XD.SDK.Account.asmdef.meta +1 -1
  138. package/Runtime.meta +1 -1
  139. package/package.json +5 -5
  140. package/package.json.meta +2 -2
  141. package/Mobile/Editor/XD.SDK.Account.Mobile.Editor.asmdef +0 -20
  142. package/Mobile/Editor/XD.SDK.Account.Mobile.Editor.asmdef.meta +0 -7
  143. package/Mobile/Editor/XDAccountMobileProcessBuild.cs +0 -20
  144. package/Mobile/Http/XDGAccountHttpConfigMobile.cs +0 -36
  145. package/Mobile/Plugins/Android/com/xd/account/bridge/XDGAccountBridge.java +0 -36
  146. package/Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnity.java +0 -16
  147. package/Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnityImpl.java +0 -20
  148. package/Mobile/Plugins/Android/com/xd/account/bridge.meta +0 -8
  149. package/Mobile/Plugins/Android/com/xd/account.meta +0 -8
  150. package/Mobile/Plugins/Android/com/xd.meta +0 -8
  151. package/Mobile/Plugins/Android/com.meta +0 -8
  152. package/Mobile/Plugins/Android.meta +0 -8
  153. package/Mobile/Plugins/iOS/XDAccountBridge.m +0 -29
  154. package/Mobile/Plugins/iOS/XDAccountBridge.m.meta +0 -37
  155. package/Mobile/Plugins/iOS/XDGLoginServiceUnity.h +0 -17
  156. package/Mobile/Plugins/iOS/XDGLoginServiceUnity.h.meta +0 -27
  157. package/Mobile/Plugins/iOS/XDGLoginServiceUnity.m +0 -23
  158. package/Mobile/Plugins/iOS/XDGLoginServiceUnity.m.meta +0 -37
  159. package/Mobile/Plugins/iOS.meta +0 -8
  160. package/Mobile/User/UserManagerMobile.cs +0 -45
  161. package/Mobile/User.meta +0 -8
  162. package/Mobile/XD.SDK.Account.Mobile.asmdef +0 -23
  163. package/Mobile/XD.SDK.Account.Mobile.asmdef.meta +0 -7
  164. package/Mobile/XDGAccountMobile.cs +0 -138
  165. package/Mobile/XDGAccountMobileImpl.cs +0 -444
  166. package/Mobile/XDGAccountMobileImpl.cs.meta +0 -11
  167. package/Mobile/XDGTokenManager.cs +0 -116
  168. package/Mobile/XDGTokenManager.cs.meta +0 -11
  169. package/Mobile/XDGUserWrapper.cs +0 -167
  170. package/Mobile/XDGUserWrapper.cs.meta +0 -11
  171. package/Plugins/Android/libs/XDGAccount_6.29.1.aar +0 -0
  172. package/Plugins/Android/libs/XDGAccount_6.29.1.aar.meta +0 -32
  173. package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginManager.h +0 -47
  174. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGPhoneAuthManager.h +0 -33
  175. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGRoleInfo.h +0 -22
  176. package/README.md +0 -0
  177. package/README.md.meta +0 -7
  178. package/Runtime/Editor/XD.SDK.Account.Editor.asmdef +0 -19
  179. package/Runtime/Editor/XD.SDK.Account.Editor.asmdef.meta +0 -7
  180. package/Runtime/Editor/XDAccountProcessBuild.cs +0 -18
  181. package/Runtime/Editor/XDAccountProcessBuild.cs.meta +0 -11
  182. package/Runtime/Editor.meta +0 -8
  183. package/Runtime/IXDGAccount.cs +0 -44
  184. package/Runtime/IXDGAccount.cs.meta +0 -11
  185. package/Runtime/Internal/Http/IXDAccountHttpConfig.cs +0 -9
  186. package/Runtime/Internal/Http/IXDAccountHttpConfig.cs.meta +0 -11
  187. package/Runtime/Internal/Http/XDAccountHttpConfig.cs +0 -32
  188. package/Runtime/Internal/Http/XDAccountHttpConfig.cs.meta +0 -11
  189. package/Runtime/Internal/Http.meta +0 -8
  190. package/Runtime/Internal/User/IUserManagerPlatformWrapper.cs +0 -7
  191. package/Runtime/Internal/User/IUserManagerPlatformWrapper.cs.meta +0 -11
  192. package/Runtime/Internal/User.meta +0 -8
  193. package/Runtime/UserManager.cs +0 -35
  194. package/Runtime/UserManager.cs.meta +0 -11
  195. package/Runtime/XDGAccessToken.cs +0 -18
  196. package/Runtime/XDGAccessToken.cs.meta +0 -11
  197. package/Runtime/XDGAccount.cs +0 -130
  198. package/Runtime/XDGLoginType.cs +0 -17
  199. package/Runtime/XDGLoginType.cs.meta +0 -11
  200. package/Runtime/XDGRoleInfo.cs +0 -24
  201. package/Runtime/XDGRoleInfo.cs.meta +0 -11
  202. package/Runtime/XDGUser.cs +0 -30
  203. package/Runtime/XDGUser.cs.meta +0 -11
  204. package/Runtime/XDGUserStatusCode.cs +0 -16
  205. package/Runtime/XDGUserStatusCode.cs.meta +0 -11
@@ -0,0 +1,190 @@
1
+ #if UNITY_EDITOR || UNITY_STANDALONE
2
+ using System;
3
+ using System.Threading.Tasks;
4
+ using System.Collections.Generic;
5
+ using System.Net.NetworkInformation;
6
+ using System.Net.Sockets;
7
+ using Newtonsoft.Json;
8
+ using UnityEngine;
9
+ using UnityEngine.UI;
10
+ using Vuplex.WebView;
11
+ using XD.SDK.Common;
12
+ using XD.SDK.Common.Internal.Standalone;
13
+
14
+ namespace XD.SDK.Account.Internal.Standalone {
15
+ public class RiskControlAlert : UIElement {
16
+ public const int CONTROL_DONE_CODE = 0;
17
+ public const int CLOSE_CODE = -1;
18
+ public const int BACK_CODE = 1;
19
+
20
+ private Button backButton;
21
+ private Button closeButton;
22
+
23
+ private CanvasWebViewPrefab canvasWebViewPrefab;
24
+
25
+ public static async Task<int> Control(Func<string, Task<RequestVerifyCodeData>> requestVerifyCodeFunc) {
26
+ RiskControlAlert alert = null;
27
+ string riskControlData = null;
28
+ TaskCompletionSource<int> tcs = new TaskCompletionSource<int>();
29
+ try {
30
+ UIManager.ShowLoading(true);
31
+ RequestVerifyCodeData verifyCodeData = await requestVerifyCodeFunc(riskControlData);
32
+ tcs.TrySetResult(verifyCodeData.ReSendInterval);
33
+ } catch (XDGError e) {
34
+ if (e.Code == PhoneModule.RISK_CONTROL) {
35
+ // 触发风控
36
+ alert = UIManager.ShowUI<RiskControlAlert>("XDRiskControlAlert", null, async (code, data) => {
37
+ if (code == CLOSE_CODE) {
38
+ UIManager.Dismiss();
39
+ tcs.TrySetException(XDGErrorExtensions.CancelledError());
40
+ } else if (code == BACK_CODE) {
41
+ UIManager.Dismiss();
42
+ } else if (code == CONTROL_DONE_CODE) {
43
+ riskControlData = data as string;
44
+ try {
45
+ UIManager.ShowLoading();
46
+ RequestVerifyCodeData result = await requestVerifyCodeFunc(riskControlData);
47
+ tcs.TrySetResult(result.ReSendInterval);
48
+ } catch (XDGError ex) {
49
+ UIManager.DismissLoading();
50
+ if (ex.Code == PhoneModule.RISK_CONTROL) {
51
+ // 触发风控
52
+ await alert.Reload();
53
+ } else if (ex.Code == PhoneModule.RISK_CONTROL_FAILED) {
54
+ // 滑动验证失败
55
+ await alert.Reload();
56
+ UIManager.ShowToast(e.Message);
57
+ } else {
58
+ tcs.TrySetException(ex);
59
+ }
60
+ } finally {
61
+ UIManager.DismissLoading();
62
+ }
63
+ }
64
+ });
65
+ } else {
66
+ tcs.TrySetException(e);
67
+ }
68
+ } catch (Exception e) {
69
+ tcs.TrySetException(e);
70
+ } finally {
71
+ UIManager.DismissLoading();
72
+ }
73
+
74
+ return await tcs.Task;
75
+ }
76
+
77
+ private void Awake() {
78
+ Transform webviewContainer = transform.Find("WebViewContainer");
79
+ canvasWebViewPrefab = CanvasWebViewPrefab.Instantiate();
80
+ canvasWebViewPrefab.transform.SetParent(webviewContainer);
81
+ RectTransform rectTransform = canvasWebViewPrefab.GetComponent<RectTransform>();
82
+ rectTransform.offsetMin = Vector2.zero;
83
+ rectTransform.offsetMax = Vector2.zero;
84
+
85
+ backButton = transform.Find("BackButton").GetComponent<Button>();
86
+ backButton.onClick.AddListener(OnBackClicked);
87
+
88
+ closeButton = transform.Find("CloseButton").GetComponent<Button>();
89
+ closeButton.onClick.AddListener(OnCloseClicked);
90
+ }
91
+
92
+ private async void Start() {
93
+ UIManager.ShowLoading();
94
+
95
+ await canvasWebViewPrefab.WaitUntilInitialized();
96
+
97
+ canvasWebViewPrefab.DragMode = DragMode.DragWithinPage;
98
+
99
+ canvasWebViewPrefab.WebView.MessageEmitted += (sender, eventArgs) => {
100
+ XDGLogger.Debug(eventArgs.Value);
101
+ Dictionary<string, string> response = JsonConvert.DeserializeObject<Dictionary<string, string>>(eventArgs.Value);
102
+ Dictionary<string, object> data = JsonConvert.DeserializeObject<Dictionary<string, object>>(response["message"]);
103
+ string riskControlData = JsonConvert.SerializeObject(data["data"]);
104
+ XDGLogger.Debug(riskControlData);
105
+ UIManager.Dismiss();
106
+
107
+ OnCallback(CONTROL_DONE_CODE, riskControlData);
108
+ };
109
+
110
+ await Reload();
111
+ }
112
+
113
+ private string GetIP()
114
+ {
115
+ string output = "";
116
+
117
+ foreach (NetworkInterface item in NetworkInterface.GetAllNetworkInterfaces())
118
+ {
119
+ #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
120
+ NetworkInterfaceType _type1 = NetworkInterfaceType.Wireless80211;
121
+ NetworkInterfaceType _type2 = NetworkInterfaceType.Ethernet;
122
+
123
+ if ((item.NetworkInterfaceType == _type1 || item.NetworkInterfaceType == _type2) && item.OperationalStatus == OperationalStatus.Up)
124
+ #endif
125
+ {
126
+ foreach (UnicastIPAddressInformation ip in item.GetIPProperties().UnicastAddresses)
127
+ {
128
+ //IPv4
129
+ if (ip.Address.AddressFamily == AddressFamily.InterNetwork)
130
+ {
131
+ output = ip.Address.ToString();
132
+ XDGLogger.Debug($"ip local: {output}");
133
+ }
134
+ }
135
+ }
136
+ }
137
+ return output;
138
+ }
139
+ private async Task Reload() {
140
+ UIManager.ShowLoading();
141
+ var ip = GetIP();
142
+ canvasWebViewPrefab.WebView.LoadUrl($"https://login-xdsdk.xd.cn/awsc?platform={Platform}&eventSessionId={AliyunTrack.LoginEventSessionId}&login_type=Phone&sub_login_type=2&xd_client_id={ConfigModule.ClientId}&device_id={SystemInfo.deviceUniqueIdentifier}&os={SystemInfo.operatingSystem}&ip={ip}&app_version={Application.version}&language={XDLocalization.CurrentLang.ToString()}");
143
+ await canvasWebViewPrefab.WebView.WaitForNextPageLoadToFinish();
144
+ // 注入 js
145
+ _ = canvasWebViewPrefab.WebView.ExecuteJavaScript(@";(function (window) {
146
+ window._xd_jsbridge = {
147
+ invoke: function (json) {
148
+ try {
149
+ window.vuplex.postMessage({ type: 'verify', message: json });
150
+ } catch (error) {
151
+ console.error('xd-jsbridge error::', error)
152
+ }
153
+ },
154
+ };
155
+ })(window);");
156
+
157
+ UIManager.DismissLoading();
158
+ }
159
+
160
+ private string Platform {
161
+ get {
162
+ if (Application.platform == RuntimePlatform.Android)
163
+ {
164
+ return "Android";
165
+ }
166
+ else if (Application.platform == RuntimePlatform.IPhonePlayer)
167
+ {
168
+ return "IOS";
169
+ }
170
+ else
171
+ {
172
+ return "PC";
173
+ }
174
+ }
175
+ }
176
+
177
+ #region UI Events
178
+
179
+ private void OnBackClicked() {
180
+ OnCallback(BACK_CODE, null);
181
+ }
182
+
183
+ private void OnCloseClicked() {
184
+ OnCallback(CLOSE_CODE, null);
185
+ }
186
+
187
+ #endregion
188
+ }
189
+ }
190
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 0d519c9a209a443296960badecf16664
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,164 @@
1
+ #if UNITY_EDITOR || UNITY_STANDALONE
2
+ using System;
3
+ using System.Threading.Tasks;
4
+ using System.Collections;
5
+ using System.Collections.Generic;
6
+ using UnityEngine;
7
+ using UnityEngine.UI;
8
+ using XD.SDK.Common;
9
+ using XD.SDK.Common.Internal.Standalone;
10
+
11
+ namespace XD.SDK.Account.Internal.Standalone {
12
+ public class VerifyCodeInputAlert : UIElement {
13
+ public const int INPUT_DONE_CODE = 0;
14
+ public const int CLOSE_CODE = -1;
15
+ public const int RESEND_CODE = 1;
16
+ public const int BACK_CODE = 2;
17
+
18
+ private const int VERIFY_CODE_LENGTH = 6;
19
+
20
+ public Action OnBack { get; set; }
21
+ public Action<string, string, string> OnVerify { get; set; }
22
+
23
+ private Button backButton;
24
+ private Button closeButton;
25
+ private Text titleText;
26
+ private Text phoneNumberTipsText;
27
+ private InputField codeInput;
28
+ private Text errorCodeTipsText;
29
+ private Button reSendButton;
30
+
31
+ public static async Task Verify(string phoneNumber,
32
+ Func<string, Task<RequestVerifyCodeData>> requestVerifyCodeFunc,
33
+ Func<string, Task> verifyFunc) {
34
+
35
+ TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
36
+
37
+ int resendInterval;
38
+ try {
39
+ // 通过风控
40
+ resendInterval = await RiskControlAlert.Control(requestVerifyCodeFunc);
41
+
42
+ // 输入验证码
43
+ Dictionary<string, object> conf = new Dictionary<string, object> {
44
+ { "phoneNumber", phoneNumber },
45
+ { "reSendInterval", resendInterval }
46
+ };
47
+ VerifyCodeInputAlert alert = null;
48
+
49
+ AliyunTrack.LoginMobileVerifyCodeInput();
50
+ alert = UIManager.ShowUI<VerifyCodeInputAlert>("XDVerifyCodeInputAlert", conf, async (code, data) => {
51
+ if (code == CLOSE_CODE) {
52
+ UIManager.Dismiss();
53
+ tcs.TrySetException(XDGErrorExtensions.CancelledError());
54
+ } else if (code == BACK_CODE) {
55
+ UIManager.Dismiss();
56
+ } else if (code == RESEND_CODE) {
57
+ try {
58
+ resendInterval = await RiskControlAlert.Control(requestVerifyCodeFunc);
59
+ alert.Extra["reSendInterval"] = resendInterval;
60
+ alert.Start();
61
+ AliyunTrack.LoginMobileVerifyCodeInput();
62
+ } catch (TaskCanceledException) {
63
+ UIManager.Dismiss();
64
+ tcs.TrySetException(XDGErrorExtensions.CancelledError());
65
+ }
66
+ } else if (code == INPUT_DONE_CODE) {
67
+
68
+ try {
69
+ await verifyFunc(data as string);
70
+ tcs.TrySetResult(null);
71
+ UIManager.Dismiss();
72
+ } catch (XDGError e) {
73
+ if (e.Code == PhoneModule.INVALID_VERIFY_CODE) {
74
+ alert.VerifyFailed();
75
+ AliyunTrack.LoginMobileVerifyCodePassFail(e.ErrorMsg);
76
+ } else {
77
+ AliyunTrack.LoginMobileVerifyCodePassFail(e.ErrorMsg);
78
+ tcs.TrySetException(e);
79
+ UIManager.Dismiss();
80
+ }
81
+ } catch (Exception e) {
82
+ tcs.TrySetException(e);
83
+ UIManager.Dismiss();
84
+ }
85
+ }
86
+ });
87
+ } catch (TaskCanceledException) {
88
+ tcs.TrySetException(XDGErrorExtensions.CancelledError());
89
+ }
90
+
91
+ await tcs.Task;
92
+ }
93
+
94
+ private void Awake() {
95
+ backButton = transform.Find("Alert/BackButton").GetComponent<Button>();
96
+ closeButton = transform.Find("Alert/CloseButton").GetComponent<Button>();
97
+ titleText = transform.Find("Alert/TitleText").GetComponent<Text>();
98
+ phoneNumberTipsText = transform.Find("Alert/PhoneNumberTips").GetComponent<Text>();
99
+ codeInput = transform.Find("Alert/Input/CodeInput").GetComponent<InputField>();
100
+ errorCodeTipsText = transform.Find("Alert/ErrorCodeTips").GetComponent<Text>();
101
+ reSendButton = transform.Find("Alert/ReSendButton").GetComponent<Button>();
102
+
103
+ errorCodeTipsText.gameObject.SetActive(false);
104
+
105
+ closeButton.onClick.AddListener(OnCloseClicked);
106
+ backButton.onClick.AddListener(OnVerifyDialogBackClicked);
107
+ codeInput.onValueChanged.AddListener(OnCodeInputValueChanged);
108
+ reSendButton.onClick.AddListener(OnReSendClicked);
109
+ }
110
+
111
+ private void Start()
112
+ {
113
+ phoneNumberTipsText.text = $"已发送至 {Extra["phoneNumber"]}";
114
+ // 倒计时
115
+ StartCoroutine(UpdateResendInterval());
116
+ codeInput.Select();
117
+ }
118
+
119
+ IEnumerator UpdateResendInterval() {
120
+ int resendInterval = (int) Extra["reSendInterval"];
121
+ while (resendInterval > 0) {
122
+ reSendButton.interactable = false;
123
+ Text reSendText = reSendButton.GetComponentInChildren<Text>();
124
+ reSendText.text = $"{resendInterval} 秒后可重新发送";
125
+ yield return new WaitForSeconds(1);
126
+ resendInterval--;
127
+ }
128
+ reSendButton.interactable = true;
129
+ reSendButton.GetComponentInChildren<Text>().text = "重新发送";
130
+ }
131
+
132
+ public void VerifyFailed() {
133
+ errorCodeTipsText.gameObject.SetActive(true);
134
+ }
135
+
136
+ #region UI Events
137
+
138
+ private void OnCloseClicked() {
139
+ OnCallback(CLOSE_CODE, null);
140
+ }
141
+
142
+ private void OnVerifyDialogBackClicked() {
143
+ OnCallback(BACK_CODE, null);
144
+ }
145
+
146
+ private void OnCodeInputValueChanged(string code) {
147
+ errorCodeTipsText.gameObject.SetActive(false);
148
+
149
+ if (code?.Length != VERIFY_CODE_LENGTH) {
150
+ return;
151
+ }
152
+
153
+ // 请求校验验证码
154
+ OnCallback(INPUT_DONE_CODE, code);
155
+ }
156
+
157
+ private void OnReSendClicked() {
158
+ OnCallback(RESEND_CODE, null);
159
+ }
160
+
161
+ #endregion
162
+ }
163
+ }
164
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 28535633d6a74f09a33a0e5ae5914d0e
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: ad659f9f5492401395c1e7c7ad280a3b
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: dedede41064a405b8e8c5d745b19e0ea
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant: