com.xd.sdk.account 6.29.0 → 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.
- package/Plugins/Android/libs/XDGAccount_7.0.0.aar +0 -0
- package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGAccountBridge.java.meta → Plugins/Android/libs/XDGAccount_7.0.0.aar.meta} +2 -2
- package/Plugins/Android/libs/XDGBridgeAccount_v7_7.0.0.aar +0 -0
- package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnity.java.meta → Plugins/Android/libs/XDGBridgeAccount_v7_7.0.0.aar.meta} +2 -2
- package/Plugins/Android/libs/XDGSupport_7.0.0.aar +0 -0
- package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnityImpl.java.meta → Plugins/Android/libs/XDGSupport_7.0.0.aar.meta} +2 -2
- package/Plugins/Android/libs.meta +1 -1
- package/Plugins/Android.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginHelper.h +2 -8
- package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginHelper.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK-Swift.h +329 -0
- package/Plugins/iOS/XDAccountSDK.framework/Headers/{TDSGlobalThirdPartyLoginManager.h.meta → XDAccountSDK-Swift.h.meta} +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK.h +1 -2
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccount.h +29 -43
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccount.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountDefines.h +43 -0
- package/Plugins/iOS/XDAccountSDK.framework/Headers/{XDGPhoneAuthManager.h.meta → XDGAccountDefines.h.meta} +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountVersion.h +3 -3
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountVersion.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLogger+Account.h +3 -0
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLogger+Account.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLoginEntriesConfig.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLoginService.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGTapLoginPermissionDialog.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Info.plist +0 -0
- package/Plugins/iOS/XDAccountSDK.framework/Info.plist.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
- package/Plugins/iOS/XDAccountSDK.framework/{Headers/XDGRoleInfo.h.meta → Modules/XDAccountSDK.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo.meta} +1 -1
- package/{Mobile/Http.meta → Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/Project.meta} +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.abi.json +9 -0
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.abi.json.meta +7 -0
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftdoc.meta +7 -0
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftmodule +0 -0
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftmodule.meta +7 -0
- package/{Mobile/Editor.meta → Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule.meta} +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Modules/module.modulemap.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Modules.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/XDAccountSDK +0 -0
- package/Plugins/iOS/XDAccountSDK.framework/XDAccountSDK.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework.meta +4 -4
- package/Plugins/iOS.meta +1 -1
- package/Plugins.meta +1 -1
- package/Runtime/Internal/IXDGAccount.Extended.cs +11 -0
- package/{Mobile/Http/XDGAccountHttpConfigMobile.cs.meta → Runtime/Internal/IXDGAccount.Extended.cs.meta} +1 -1
- package/Runtime/Internal/Mobile/AccountFeaturesImpl.cs +348 -0
- package/{Mobile/User/UserManagerMobile.cs.meta → Runtime/Internal/Mobile/AccountFeaturesImpl.cs.meta} +1 -1
- package/Runtime/Internal/Mobile/Http/LoginSyncResponse.cs +14 -0
- package/Runtime/Internal/Mobile/Http/LoginSyncResponse.cs.meta +3 -0
- package/Runtime/Internal/Mobile/Http/MacAuthenticationInterceptor.cs +37 -0
- package/Runtime/Internal/Mobile/Http/MacAuthenticationInterceptor.cs.meta +3 -0
- package/Runtime/Internal/Mobile/Http.meta +3 -0
- package/{Mobile.meta → Runtime/Internal/Mobile.meta} +1 -1
- package/Runtime/Internal/Standalone/AccessToken/AccessTokenModule.cs +168 -0
- package/{Mobile/Editor/XDAccountMobileProcessBuild.cs.meta → Runtime/Internal/Standalone/AccessToken/AccessTokenModule.cs.meta} +1 -1
- package/Runtime/Internal/Standalone/AccessToken.meta +8 -0
- package/Runtime/Internal/Standalone/AccountCell.cs +143 -0
- package/{Mobile/XDGAccountMobile.cs.meta → Runtime/Internal/Standalone/AccountCell.cs.meta} +1 -1
- package/Runtime/Internal/Standalone/AccountFeaturesImpl.cs +461 -0
- package/Runtime/Internal/Standalone/AccountFeaturesImpl.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/AppleAuth.cs +27 -0
- package/Runtime/Internal/Standalone/Auth/AppleAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/FacebookAuth.cs +27 -0
- package/Runtime/Internal/Standalone/Auth/FacebookAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/GoogleAuth.cs +27 -0
- package/Runtime/Internal/Standalone/Auth/GoogleAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/GuestAuth.cs +22 -0
- package/Runtime/Internal/Standalone/Auth/GuestAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/PhoneAuth.cs +43 -0
- package/Runtime/Internal/Standalone/Auth/PhoneAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/SteamAuth.cs +90 -0
- package/Runtime/Internal/Standalone/Auth/SteamAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/TapAuth.cs +72 -0
- package/Runtime/Internal/Standalone/Auth/TapAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/WebAuth.cs +144 -0
- package/Runtime/Internal/Standalone/Auth/WebAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth.meta +8 -0
- package/Runtime/Internal/Standalone/Compliance/XDComplianceCode.cs +15 -0
- package/Runtime/Internal/Standalone/Compliance/XDComplianceCode.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Compliance.meta +8 -0
- package/Runtime/Internal/Standalone/LoginModule/Email/EmailModule.cs +374 -0
- package/Runtime/Internal/Standalone/LoginModule/Email/EmailModule.cs.meta +11 -0
- package/Runtime/Internal/Standalone/LoginModule/Email.meta +8 -0
- package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModule.cs +245 -0
- package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModule.cs.meta +11 -0
- package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModuleIO.cs +392 -0
- package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModuleIO.cs.meta +11 -0
- package/Runtime/Internal/Standalone/LoginModule/Phone.meta +8 -0
- package/Runtime/Internal/Standalone/LoginModule.meta +8 -0
- package/Runtime/Internal/Standalone/SupportModule/SupportModule.cs +228 -0
- package/Runtime/Internal/Standalone/SupportModule/SupportModule.cs.meta +3 -0
- package/Runtime/Internal/Standalone/SupportModule/SupportResponse.cs +27 -0
- package/Runtime/Internal/Standalone/SupportModule/SupportResponse.cs.meta +3 -0
- package/Runtime/Internal/Standalone/SupportModule.meta +3 -0
- package/Runtime/Internal/Standalone/Track/AliyunTrack.Login.cs +479 -0
- package/Runtime/Internal/Standalone/Track/AliyunTrack.Login.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Track.meta +8 -0
- package/Runtime/Internal/Standalone/UI/CodeUnbindAlert.cs +156 -0
- package/Runtime/Internal/Standalone/UI/CodeUnbindAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/Email/EmailAlert.cs +295 -0
- package/Runtime/Internal/Standalone/UI/Email/EmailAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/Email.meta +8 -0
- package/Runtime/Internal/Standalone/UI/PhoneIO/AreaCodeCell.cs +46 -0
- package/Runtime/Internal/Standalone/UI/PhoneIO/AreaCodeCell.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/PhoneIO/PhoneAlertIO.cs +522 -0
- package/Runtime/Internal/Standalone/UI/PhoneIO/PhoneAlertIO.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/PhoneIO.meta +8 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/PhoneNumberInputAlert.cs +84 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/PhoneNumberInputAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/RiskControlAlert.cs +190 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/RiskControlAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/VerifyCodeInputAlert.cs +164 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/VerifyCodeInputAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification.meta +8 -0
- package/Runtime/Internal/Standalone/UI.meta +8 -0
- package/Runtime/Internal/Standalone/UserCenterAlert.cs +405 -0
- package/Runtime/Internal/Standalone/UserCenterAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UserModule.cs +604 -0
- package/Runtime/Internal/Standalone/UserModule.cs.meta +11 -0
- package/Runtime/Internal/Standalone/WebFunction/AccessTokenWebFunction.cs +47 -0
- package/Runtime/Internal/Standalone/WebFunction/AccessTokenWebFunction.cs.meta +3 -0
- package/Runtime/Internal/Standalone/WebFunction.meta +3 -0
- package/{Mobile/Plugins.meta → Runtime/Internal/Standalone.meta} +1 -1
- package/Runtime/Internal/XDGAccountEventHandler.cs +23 -0
- package/Runtime/Internal/XDGAccountEventHandler.cs.meta +3 -0
- package/Runtime/Internal/XDGAccountInternal.cs +86 -0
- package/Runtime/Internal/XDGAccountInternal.cs.meta +11 -0
- package/Runtime/Internal.meta +1 -1
- package/Runtime/Public/XDGAccount.Deprecated.cs +37 -0
- package/Runtime/Public/XDGAccount.Deprecated.cs.meta +11 -0
- package/Runtime/Public/XDGAccount.cs +107 -0
- package/Runtime/{XDGAccount.cs.meta → Public/XDGAccount.cs.meta} +1 -1
- package/Runtime/Public.meta +8 -0
- package/Runtime/XD.SDK.Account.asmdef +7 -2
- package/Runtime/XD.SDK.Account.asmdef.meta +1 -1
- package/Runtime.meta +1 -1
- package/package.json +5 -5
- package/package.json.meta +2 -2
- package/Mobile/Editor/XD.SDK.Account.Mobile.Editor.asmdef +0 -20
- package/Mobile/Editor/XD.SDK.Account.Mobile.Editor.asmdef.meta +0 -7
- package/Mobile/Editor/XDAccountMobileProcessBuild.cs +0 -20
- package/Mobile/Http/XDGAccountHttpConfigMobile.cs +0 -36
- package/Mobile/Plugins/Android/com/xd/account/bridge/XDGAccountBridge.java +0 -36
- package/Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnity.java +0 -16
- package/Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnityImpl.java +0 -20
- package/Mobile/Plugins/Android/com/xd/account/bridge.meta +0 -8
- package/Mobile/Plugins/Android/com/xd/account.meta +0 -8
- package/Mobile/Plugins/Android/com/xd.meta +0 -8
- package/Mobile/Plugins/Android/com.meta +0 -8
- package/Mobile/Plugins/Android.meta +0 -8
- package/Mobile/Plugins/iOS/XDAccountBridge.m +0 -29
- package/Mobile/Plugins/iOS/XDAccountBridge.m.meta +0 -37
- package/Mobile/Plugins/iOS/XDGLoginServiceUnity.h +0 -17
- package/Mobile/Plugins/iOS/XDGLoginServiceUnity.h.meta +0 -27
- package/Mobile/Plugins/iOS/XDGLoginServiceUnity.m +0 -23
- package/Mobile/Plugins/iOS/XDGLoginServiceUnity.m.meta +0 -37
- package/Mobile/Plugins/iOS.meta +0 -8
- package/Mobile/User/UserManagerMobile.cs +0 -45
- package/Mobile/User.meta +0 -8
- package/Mobile/XD.SDK.Account.Mobile.asmdef +0 -23
- package/Mobile/XD.SDK.Account.Mobile.asmdef.meta +0 -7
- package/Mobile/XDGAccountMobile.cs +0 -138
- package/Mobile/XDGAccountMobileImpl.cs +0 -444
- package/Mobile/XDGAccountMobileImpl.cs.meta +0 -11
- package/Mobile/XDGTokenManager.cs +0 -116
- package/Mobile/XDGTokenManager.cs.meta +0 -11
- package/Mobile/XDGUserWrapper.cs +0 -167
- package/Mobile/XDGUserWrapper.cs.meta +0 -11
- package/Plugins/Android/libs/XDGAccount_6.29.0.aar +0 -0
- package/Plugins/Android/libs/XDGAccount_6.29.0.aar.meta +0 -32
- package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginManager.h +0 -47
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGPhoneAuthManager.h +0 -33
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGRoleInfo.h +0 -22
- package/README.md +0 -0
- package/README.md.meta +0 -7
- package/Runtime/Editor/XD.SDK.Account.Editor.asmdef +0 -19
- package/Runtime/Editor/XD.SDK.Account.Editor.asmdef.meta +0 -7
- package/Runtime/Editor/XDAccountProcessBuild.cs +0 -18
- package/Runtime/Editor/XDAccountProcessBuild.cs.meta +0 -11
- package/Runtime/Editor.meta +0 -8
- package/Runtime/IXDGAccount.cs +0 -44
- package/Runtime/IXDGAccount.cs.meta +0 -11
- package/Runtime/Internal/Http/IXDAccountHttpConfig.cs +0 -9
- package/Runtime/Internal/Http/IXDAccountHttpConfig.cs.meta +0 -11
- package/Runtime/Internal/Http/XDAccountHttpConfig.cs +0 -32
- package/Runtime/Internal/Http/XDAccountHttpConfig.cs.meta +0 -11
- package/Runtime/Internal/Http.meta +0 -8
- package/Runtime/Internal/User/IUserManagerPlatformWrapper.cs +0 -7
- package/Runtime/Internal/User/IUserManagerPlatformWrapper.cs.meta +0 -11
- package/Runtime/Internal/User.meta +0 -8
- package/Runtime/UserManager.cs +0 -35
- package/Runtime/UserManager.cs.meta +0 -11
- package/Runtime/XDGAccessToken.cs +0 -18
- package/Runtime/XDGAccessToken.cs.meta +0 -11
- package/Runtime/XDGAccount.cs +0 -130
- package/Runtime/XDGLoginType.cs +0 -17
- package/Runtime/XDGLoginType.cs.meta +0 -11
- package/Runtime/XDGRoleInfo.cs +0 -24
- package/Runtime/XDGRoleInfo.cs.meta +0 -11
- package/Runtime/XDGUser.cs +0 -30
- package/Runtime/XDGUser.cs.meta +0 -11
- package/Runtime/XDGUserStatusCode.cs +0 -16
- 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,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
|