com.xd.sdk.account 6.29.1 → 7.0.1
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.1.aar +0 -0
- package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGAccountBridge.java.meta → Plugins/Android/libs/XDGAccount_7.0.1.aar.meta} +2 -2
- package/Plugins/Android/libs/XDGBridgeAccount_v7_7.0.1.aar +0 -0
- package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnity.java.meta → Plugins/Android/libs/XDGBridgeAccount_v7_7.0.1.aar.meta} +2 -2
- package/Plugins/Android/libs/XDGSupport_7.0.1.aar +0 -0
- package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnityImpl.java.meta → Plugins/Android/libs/XDGSupport_7.0.1.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.1.aar +0 -0
- package/Plugins/Android/libs/XDGAccount_6.29.1.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,461 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
using System;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using System.Net.Http;
|
|
5
|
+
using System.Security.Cryptography;
|
|
6
|
+
using System.Text;
|
|
7
|
+
using System.Threading.Tasks;
|
|
8
|
+
using UnityEngine;
|
|
9
|
+
using XD.SDK.Account.Standalone;
|
|
10
|
+
using XD.SDK.Common;
|
|
11
|
+
using XD.SDK.Common.Internal;
|
|
12
|
+
using XD.SDK.Common.Internal.Events;
|
|
13
|
+
using XD.SDK.Common.Internal.Standalone;
|
|
14
|
+
using Random = System.Random;
|
|
15
|
+
|
|
16
|
+
namespace XD.SDK.Account.Internal.Standalone
|
|
17
|
+
{
|
|
18
|
+
public class AccountFeaturesImpl : IXDGAccountExtended
|
|
19
|
+
{
|
|
20
|
+
private static AccountFeaturesImpl _instance;
|
|
21
|
+
|
|
22
|
+
private static readonly object LockObj = new object();
|
|
23
|
+
|
|
24
|
+
public static AccountFeaturesImpl Instance
|
|
25
|
+
{
|
|
26
|
+
get
|
|
27
|
+
{
|
|
28
|
+
if (_instance == null)
|
|
29
|
+
{
|
|
30
|
+
lock (LockObj)
|
|
31
|
+
{
|
|
32
|
+
if (_instance == null)
|
|
33
|
+
{
|
|
34
|
+
_instance = new AccountFeaturesImpl();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return _instance;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private AccountFeaturesImpl()
|
|
44
|
+
{
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
internal static Action<XDGUserStatusCodeType, string> UserStatusChangeCallback;
|
|
48
|
+
|
|
49
|
+
public void AddUserStatusChangeCallback(Action<XDGUserStatusCodeType, string> callback)
|
|
50
|
+
{
|
|
51
|
+
UserStatusChangeCallback = callback;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public Action<XDGUserStatusCodeType, string> GetUserStatusCallback()
|
|
55
|
+
{
|
|
56
|
+
return UserStatusChangeCallback;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public async void LoginByType(LoginType loginType, Action<XDGUser> callback, Action<XDGError> errorCallback)
|
|
60
|
+
{
|
|
61
|
+
try
|
|
62
|
+
{
|
|
63
|
+
var user = await LoginByTypeInternal(loginType);
|
|
64
|
+
XDGCommonInternal.TrackUser(user.UserId);
|
|
65
|
+
callback.Invoke(await InvokeXdgPaymentCheckRefundStatusWithUI(user));
|
|
66
|
+
}
|
|
67
|
+
catch (XDGError xe)
|
|
68
|
+
{
|
|
69
|
+
errorCallback?.Invoke(xe);
|
|
70
|
+
}
|
|
71
|
+
catch (Exception e)
|
|
72
|
+
{
|
|
73
|
+
errorCallback?.Invoke(new XDGError(ResponseCode.Common.Failed, e.Message));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// 向后兼容的便捷方法
|
|
78
|
+
public void LoginByConsole(Action<XDGUser> successCallback, Action failCallback, Action<XDGError> errorCallback)
|
|
79
|
+
{
|
|
80
|
+
LoginByType(LoginType.Console, successCallback, errorCallback);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public void Logout()
|
|
84
|
+
{
|
|
85
|
+
try
|
|
86
|
+
{
|
|
87
|
+
InternalLogout();
|
|
88
|
+
}
|
|
89
|
+
catch (Exception e)
|
|
90
|
+
{
|
|
91
|
+
XDGLogger.Error(new XDGError(ResponseCode.Common.Failed, e.Message));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
public XDGUser GetCurrentUser()
|
|
96
|
+
{
|
|
97
|
+
return UserModule.GetCurrentUser();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
public void OpenCustomerService(XDGRoleInfo roleInfo, string path, Dictionary<string, object> paramsMap)
|
|
101
|
+
{
|
|
102
|
+
SupportModule.OpenCustomerService(roleInfo, path, paramsMap);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
public void OpenUserCenter()
|
|
106
|
+
{
|
|
107
|
+
var user = UserModule.current;
|
|
108
|
+
if (user == null)
|
|
109
|
+
{
|
|
110
|
+
XDGLogger.Warn("请先登录");
|
|
111
|
+
UIManager.ShowToast(XDLocalization.GetCurrentLocalizableString().NotLogin);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
UIManager.ShowUI<UserCenterAlert>(null, null);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
public async void OpenUserDashboard(XDGRoleInfo roleInfo)
|
|
119
|
+
{
|
|
120
|
+
try
|
|
121
|
+
{
|
|
122
|
+
if (!XDGCommonInternal.IsCn())
|
|
123
|
+
{
|
|
124
|
+
UIManager.ShowToast("Service not available in current region.");
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
var user = UserModule.current;
|
|
129
|
+
if (user == null)
|
|
130
|
+
{
|
|
131
|
+
XDGLogger.Warn("请先登录");
|
|
132
|
+
UIManager.ShowToast(XDLocalization.GetCurrentLocalizableString().NotLogin);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
Dictionary<string, object> authData = new Dictionary<string, object>()
|
|
137
|
+
{ { "scope", UserModule.CodeScope.USER_INFO } };
|
|
138
|
+
try
|
|
139
|
+
{
|
|
140
|
+
var response = await XDHttpClient.Client.PostAsync<RequestAuthCodeResponse>(UserModule.XDG_AUTH_CODE, data: authData);
|
|
141
|
+
|
|
142
|
+
var queries = new Dictionary<string, object>
|
|
143
|
+
{
|
|
144
|
+
["serverId"] = roleInfo.ServerId,
|
|
145
|
+
["roleId"] = roleInfo.RoleId,
|
|
146
|
+
["roleName"] = roleInfo.RoleName,
|
|
147
|
+
["extra"] = roleInfo.Extra
|
|
148
|
+
};
|
|
149
|
+
var url = AuthConstants.CN_PERSONAL_INFO + UserModule.XDG_PERSONAL_INFO + "?" +
|
|
150
|
+
XDUrlUtils.ToQueryString(queries);
|
|
151
|
+
|
|
152
|
+
UIManager.ShowUI<XDWebViewAlert>("XDWebViewAlert", new Dictionary<string, object>
|
|
153
|
+
{
|
|
154
|
+
{
|
|
155
|
+
"url", url
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"env", new Dictionary<string, string>()
|
|
159
|
+
{
|
|
160
|
+
{ "clientId", ConfigModule.ClientId },
|
|
161
|
+
{ "authCode", response.Data.Code },
|
|
162
|
+
{ "platform", XDUtility.GetPlatform() },
|
|
163
|
+
{ "sdkLang", XDLocalization.GetLanguageKey() },
|
|
164
|
+
{ "language", Application.systemLanguage.ToString() },
|
|
165
|
+
{ "sdkVer", XDGConstants.SDK_VERSION },
|
|
166
|
+
{ "deviceId", SystemInfo.deviceUniqueIdentifier },
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}, (code, data) =>
|
|
170
|
+
{
|
|
171
|
+
if (code == XDWebViewAlert.CLOSE_CODE)
|
|
172
|
+
{
|
|
173
|
+
UIManager.Dismiss();
|
|
174
|
+
UIManager.DismissLoading();
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
catch (XDGError e)
|
|
179
|
+
{
|
|
180
|
+
UIManager.ShowToast(e.ErrorMsg);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
catch (Exception e)
|
|
184
|
+
{
|
|
185
|
+
XDGLogger.Error(new XDGError(ResponseCode.Common.Failed, e.Message));
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
public async void OpenAccountDeletion()
|
|
190
|
+
{
|
|
191
|
+
try
|
|
192
|
+
{
|
|
193
|
+
await CancelAccount();
|
|
194
|
+
}
|
|
195
|
+
catch (XDGError e)
|
|
196
|
+
{
|
|
197
|
+
XDGLogger.Error(new XDGError(ResponseCode.Common.Failed, e.ErrorMsg));
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
public async void BindByType(LoginType loginType, Action<bool, XDGError> callback)
|
|
202
|
+
{
|
|
203
|
+
try
|
|
204
|
+
{
|
|
205
|
+
await UserModule.Bind(loginType);
|
|
206
|
+
callback?.Invoke(true, null);
|
|
207
|
+
}
|
|
208
|
+
catch (XDGError e)
|
|
209
|
+
{
|
|
210
|
+
callback?.Invoke(false, new XDGError(ResponseCode.Common.Failed, e.ErrorMsg));
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
public async Task<Dictionary<string, string>> GetRequestAuthorizationHeader(HttpRequestMessage request,
|
|
215
|
+
long timestamp)
|
|
216
|
+
{
|
|
217
|
+
var auth = await GetMacToken(request.RequestUri, request.Method, timestamp);
|
|
218
|
+
if (string.IsNullOrEmpty(auth))
|
|
219
|
+
{
|
|
220
|
+
return new Dictionary<string, string>();
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return new Dictionary<string, string>
|
|
224
|
+
{
|
|
225
|
+
{ "Authorization", auth }
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
private async Task<XDGUser> LoginByTypeInternal(LoginType loginType)
|
|
230
|
+
{
|
|
231
|
+
if (!XDGCommonInternal.IsInitialized())
|
|
232
|
+
{
|
|
233
|
+
throw XDGErrorExtensions.NotInitError();
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// 登录埋点
|
|
237
|
+
AliyunTrack.LoginStart(loginType.ToString());
|
|
238
|
+
try
|
|
239
|
+
{
|
|
240
|
+
var user = await UserModule.Login(loginType);
|
|
241
|
+
AliyunTrack.LoginAntiAddictionStartup();
|
|
242
|
+
var complianceResult =
|
|
243
|
+
await XDGEventBus.PublishAsync<Dictionary<string, object>>(XDGEvents.TapSDKComplianceStartup, ConfigModule.IsGlobal, user.UserId);
|
|
244
|
+
// TODO 统一走回调进行埋点
|
|
245
|
+
// AliyunTrack.LoginAntiAddictionResult(XDDictionary.GetValue(complianceResult, "code", -100),
|
|
246
|
+
// XDDictionary.GetValue<string>(complianceResult, "reason"),
|
|
247
|
+
// XDDictionary.GetValue<string>(complianceResult, "extras"));
|
|
248
|
+
if (XDDictionary.GetValue<bool>(complianceResult, "success"))
|
|
249
|
+
{
|
|
250
|
+
await AgreementModule.SignAgreement(user.UserId);
|
|
251
|
+
return user;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
ClearUserCache();
|
|
255
|
+
throw new XDGError("防沉迷校验失败");
|
|
256
|
+
}
|
|
257
|
+
catch (XDHttpException e)
|
|
258
|
+
{
|
|
259
|
+
if ((e.HttpStatusCode == 401 && loginType == LoginType.Default) || e.Code == 40311 || e.Code == 40312)
|
|
260
|
+
{
|
|
261
|
+
InternalLogout("LOGOUT_API", false);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
var errorMsg = e.Message;
|
|
265
|
+
if (e.Code == ResponseCode.Account.TokenExpired)
|
|
266
|
+
errorMsg = "XD_TOKEN_EXPIRED";
|
|
267
|
+
AliyunTrack.LoginFail(errorMsg);
|
|
268
|
+
throw;
|
|
269
|
+
}
|
|
270
|
+
catch (Exception e)
|
|
271
|
+
{
|
|
272
|
+
AliyunTrack.LoginFail(e.Message);
|
|
273
|
+
AgreementModule.ClearLocalSignedAgreements();
|
|
274
|
+
throw;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
public void InternalLogout(string logoutType = "LOGOUT_API", bool needNotify = true, bool bShowAgreement = true)
|
|
279
|
+
{
|
|
280
|
+
// SDK 登陆成功
|
|
281
|
+
AliyunTrack.LoginLogout(logoutType);
|
|
282
|
+
|
|
283
|
+
XDGEventBus.Publish(XDGEvents.TdsSDKLogout);
|
|
284
|
+
XDGEventBus.Publish(XDGEvents.TapSDKLogout);
|
|
285
|
+
if (logoutType != "SWITCH_ACCOUNT" && logoutType != "COMPLIANCE_EXIT")
|
|
286
|
+
{
|
|
287
|
+
XDGEventBus.Publish(XDGEvents.TapSDKComplianceExit, ConfigModule.IsGlobal);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
ClearUserCache();
|
|
291
|
+
|
|
292
|
+
if (bShowAgreement)
|
|
293
|
+
{
|
|
294
|
+
_ = AgreementModule.ConfirmAgreement().ContinueWith(t =>
|
|
295
|
+
{
|
|
296
|
+
if (!t.IsFaulted)
|
|
297
|
+
{
|
|
298
|
+
if (needNotify)
|
|
299
|
+
{
|
|
300
|
+
UserStatusChangeCallback?.Invoke(XDGUserStatusCodeType.ProtocolAgreedAfterLogout, null);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}, TaskScheduler.FromCurrentSynchronizationContext());
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
if (needNotify)
|
|
307
|
+
{
|
|
308
|
+
UserStatusChangeCallback?.Invoke(XDGUserStatusCodeType.LOGOUT, null);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
private static void ClearUserCache()
|
|
313
|
+
{
|
|
314
|
+
AccessTokenModule.ClearToken();
|
|
315
|
+
UserModule.ClearUserData();
|
|
316
|
+
AgreementModule.ClearLocalSignedAgreements();
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
private async Task CancelAccount()
|
|
320
|
+
{
|
|
321
|
+
var current = UserModule.current;
|
|
322
|
+
if (current == null)
|
|
323
|
+
{
|
|
324
|
+
XDGLogger.Warn("请先登录");
|
|
325
|
+
UIManager.ShowToast(XDLocalization.GetCurrentLocalizableString().NotLogin);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
string cancelUrl = ConfigModule.CancelUrl;
|
|
330
|
+
if (string.IsNullOrEmpty(cancelUrl))
|
|
331
|
+
{
|
|
332
|
+
XDGLogger.Warn("没有有效的注销 url");
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
try
|
|
337
|
+
{
|
|
338
|
+
UIManager.ShowLoading();
|
|
339
|
+
var accessToken = await AccessTokenModule.GetLocalAccessToken();
|
|
340
|
+
var queryParams = new Dictionary<string, object>
|
|
341
|
+
{
|
|
342
|
+
{ "kid", accessToken?.Kid },
|
|
343
|
+
{ "mac_key", accessToken?.MacKey },
|
|
344
|
+
{ "source", "game" },
|
|
345
|
+
{ "cn", ConfigModule.IsGlobal ? "0" : "1" },
|
|
346
|
+
{ "sdk_lang", XDLocalization.GetLanguageKey() },
|
|
347
|
+
{ "version", XDGConstants.SDK_VERSION },
|
|
348
|
+
{ "client_id", ConfigModule.ClientId },
|
|
349
|
+
{ "did", SystemInfo.deviceUniqueIdentifier }
|
|
350
|
+
};
|
|
351
|
+
var ipInfo = await IPInfoModule.GetIpInfo();
|
|
352
|
+
if (ipInfo != null)
|
|
353
|
+
{
|
|
354
|
+
queryParams["country_code"] = ipInfo.CountryCode;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (!string.IsNullOrEmpty(ConfigModule.Region))
|
|
358
|
+
{
|
|
359
|
+
queryParams["region"] = ConfigModule.Region;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
var url = $"{cancelUrl}?{XDUrlUtils.ToQueryString(queryParams)}";
|
|
363
|
+
XDGLogger.Debug($"cancel url: {url}");
|
|
364
|
+
|
|
365
|
+
// 打开内置浏览器
|
|
366
|
+
var data = new Dictionary<string, object>
|
|
367
|
+
{
|
|
368
|
+
{ "url", url }
|
|
369
|
+
};
|
|
370
|
+
Action<int, object> callback = (code, obj) =>
|
|
371
|
+
{
|
|
372
|
+
if (code == CancelAccountAlert.CANCEL_DONE_CODE)
|
|
373
|
+
{
|
|
374
|
+
InternalLogout();
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
UIManager.ShowUI<CancelAccountAlert>("CancelAccountAlert", data, callback);
|
|
378
|
+
}
|
|
379
|
+
finally
|
|
380
|
+
{
|
|
381
|
+
UIManager.DismissLoading();
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
private static async Task<XDGUser> InvokeXdgPaymentCheckRefundStatusWithUI(XDGUser user)
|
|
386
|
+
{
|
|
387
|
+
try
|
|
388
|
+
{
|
|
389
|
+
await XDGEventBus.PublishAsync<object>(XDGEvents.PaymentCheckRefundStatusWithUI);
|
|
390
|
+
}
|
|
391
|
+
catch (Exception e)
|
|
392
|
+
{
|
|
393
|
+
XDGLogger.Warn($"[InvokeXdgPaymentCheckRefundStatusWithUI] Error:{e.Message}");
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
return user;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
private static readonly string LetterStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
400
|
+
private static readonly string GetMethod = "GET";
|
|
401
|
+
private static readonly string PostMethod = "POST";
|
|
402
|
+
|
|
403
|
+
private static Task<string> GetMacToken(Uri uri, HttpMethod method, long timestamp)
|
|
404
|
+
{
|
|
405
|
+
if (method == HttpMethod.Get)
|
|
406
|
+
{
|
|
407
|
+
return GetMacToken(uri, GetMethod, timestamp);
|
|
408
|
+
}
|
|
409
|
+
else if (method == HttpMethod.Post)
|
|
410
|
+
{
|
|
411
|
+
return GetMacToken(uri, PostMethod, timestamp);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
return null;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
private static async Task<string> GetMacToken(Uri uri, string method, long timestamp)
|
|
418
|
+
{
|
|
419
|
+
var accessToken = await AccessTokenModule.GetLocalAccessToken();
|
|
420
|
+
string authToken = null;
|
|
421
|
+
if (accessToken != null)
|
|
422
|
+
{
|
|
423
|
+
string nonce = GetRandomStr(5);
|
|
424
|
+
string md = method.ToUpper();
|
|
425
|
+
|
|
426
|
+
string pathAndQuery = uri.PathAndQuery;
|
|
427
|
+
string domain = uri.Host.ToLower();
|
|
428
|
+
string port = $"{uri.Port}";
|
|
429
|
+
|
|
430
|
+
var dataStr = $"{timestamp}\n{nonce}\n{md}\n{pathAndQuery}\n{domain}\n{port}\n";
|
|
431
|
+
var mac = Base64WithSecret(accessToken.MacKey, dataStr);
|
|
432
|
+
authToken = $"MAC id=\"{accessToken.Kid}\",ts=\"{timestamp}\",nonce=\"{nonce}\",mac=\"{mac}\"";
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
return authToken;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
private static string GetRandomStr(int length)
|
|
439
|
+
{
|
|
440
|
+
var SB = new StringBuilder();
|
|
441
|
+
var rd = new Random();
|
|
442
|
+
for (int i = 0; i < length; i++)
|
|
443
|
+
{
|
|
444
|
+
SB.Append(LetterStr.Substring(rd.Next(0, LetterStr.Length), 1));
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
return SB.ToString();
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
private static string Base64WithSecret(string secret, string data)
|
|
451
|
+
{
|
|
452
|
+
var secretBytes = UTF8Encoding.UTF8.GetBytes(secret);
|
|
453
|
+
var hmac = new HMACSHA1(secretBytes);
|
|
454
|
+
var dataBytes = UTF8Encoding.UTF8.GetBytes(data);
|
|
455
|
+
var calcHash = hmac.ComputeHash(dataBytes);
|
|
456
|
+
var calcHashString = Convert.ToBase64String(calcHash);
|
|
457
|
+
return calcHashString;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
#endif
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.Net;
|
|
4
|
+
using System.Threading.Tasks;
|
|
5
|
+
using XD.SDK.Common;
|
|
6
|
+
using XD.SDK.Common.Internal.Standalone;
|
|
7
|
+
|
|
8
|
+
namespace XD.SDK.Account.Internal.Standalone
|
|
9
|
+
{
|
|
10
|
+
internal class AppleAuth : WebAuth
|
|
11
|
+
{
|
|
12
|
+
static List<HttpListener> servers = new List<HttpListener>();
|
|
13
|
+
|
|
14
|
+
internal static Task<Dictionary<string, object>> GetAuthData()
|
|
15
|
+
{
|
|
16
|
+
Dictionary<string, object> queryParams = new Dictionary<string, object>
|
|
17
|
+
{
|
|
18
|
+
{ "auth_type", "apple" },
|
|
19
|
+
{ "client_id", ConfigModule.Apple.ClientId },
|
|
20
|
+
{ "state", LocalServerUtils.GenerateRandomDataBase64url(32) }
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return StartListener(servers, LoginType.Apple, queryParams);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
#endif
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.Net;
|
|
4
|
+
using System.Threading.Tasks;
|
|
5
|
+
using XD.SDK.Common;
|
|
6
|
+
using XD.SDK.Common.Internal.Standalone;
|
|
7
|
+
namespace XD.SDK.Account.Internal.Standalone
|
|
8
|
+
{
|
|
9
|
+
public class FacebookAuth : WebAuth
|
|
10
|
+
{
|
|
11
|
+
static List<HttpListener> servers = new List<HttpListener>();
|
|
12
|
+
|
|
13
|
+
internal static Task<Dictionary<string, object>> GetAuthData()
|
|
14
|
+
{
|
|
15
|
+
Dictionary<string, object> queryParams = new Dictionary<string, object>
|
|
16
|
+
{
|
|
17
|
+
{ "auth_type", "facebook" },
|
|
18
|
+
{ "client_id", ConfigModule.Facebook.AppId },
|
|
19
|
+
{ "state", LocalServerUtils.GenerateRandomDataBase64url(32) }
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
return StartListener(servers, LoginType.Facebook, queryParams);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
#endif
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.Net;
|
|
4
|
+
using System.Threading.Tasks;
|
|
5
|
+
using XD.SDK.Common;
|
|
6
|
+
using XD.SDK.Common.Internal.Standalone;
|
|
7
|
+
|
|
8
|
+
namespace XD.SDK.Account.Internal.Standalone
|
|
9
|
+
{
|
|
10
|
+
internal class GoogleAuth : WebAuth
|
|
11
|
+
{
|
|
12
|
+
static List<HttpListener> servers = new List<HttpListener>();
|
|
13
|
+
|
|
14
|
+
internal static Task<Dictionary<string, object>> GetAuthData()
|
|
15
|
+
{
|
|
16
|
+
Dictionary<string, object> queryParams = new Dictionary<string, object>
|
|
17
|
+
{
|
|
18
|
+
{ "auth_type", "google" },
|
|
19
|
+
{ "client_id", ConfigModule.Google.ClientIdForPC },
|
|
20
|
+
{ "state", LocalServerUtils.GenerateRandomDataBase64url(32) }
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return StartListener(servers, LoginType.Google, queryParams);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
#endif
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
using XD.SDK.Common;
|
|
5
|
+
|
|
6
|
+
namespace XD.SDK.Account.Internal.Standalone
|
|
7
|
+
{
|
|
8
|
+
public class GuestAuth
|
|
9
|
+
{
|
|
10
|
+
public static Dictionary<string, object> GetAuthData()
|
|
11
|
+
{
|
|
12
|
+
AliyunTrack.LoginAuthorize();
|
|
13
|
+
AliyunTrack.LoginAuthorizeSuccess();
|
|
14
|
+
return new Dictionary<string, object>
|
|
15
|
+
{
|
|
16
|
+
{ "type", (int)LoginType.Guest },
|
|
17
|
+
{ "token", SystemInfo.deviceUniqueIdentifier }
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
#endif
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
using System;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using System.Threading.Tasks;
|
|
5
|
+
|
|
6
|
+
namespace XD.SDK.Common.Internal.Standalone {
|
|
7
|
+
public class PhoneAuth {
|
|
8
|
+
//internal static Task<object> Login() {
|
|
9
|
+
// TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
|
|
10
|
+
|
|
11
|
+
// UIManager.ShowUI<PhoneVerificationAlert>("XDPhoneLoginAlert", null, async (code, data) => {
|
|
12
|
+
// PhoneVerificationAlert.VerificationData verificationData = data as PhoneVerificationAlert.VerificationData;
|
|
13
|
+
// try {
|
|
14
|
+
// UIManager.ShowLoading();
|
|
15
|
+
// Dictionary<string, object> authData = new Dictionary<string, object> {
|
|
16
|
+
// { "type", (int) Account.LoginType.Phone },
|
|
17
|
+
// { "token", verificationData.PhoneNumber },
|
|
18
|
+
// { "secret", verificationData.Code },
|
|
19
|
+
// { "subType", "text" }
|
|
20
|
+
// };
|
|
21
|
+
// await AccessTokenModule.Login(authData, null);
|
|
22
|
+
// UIManager.Dismiss();
|
|
23
|
+
// tcs.TrySetResult(null);
|
|
24
|
+
// } catch (XDException e) {
|
|
25
|
+
// if (e.code == 40114) {
|
|
26
|
+
// // 验证码错误
|
|
27
|
+
// verificationData.PhoneVerificationAlert.VerifyFailed();
|
|
28
|
+
// } else {
|
|
29
|
+
// tcs.TrySetException(e);
|
|
30
|
+
// }
|
|
31
|
+
// } catch (Exception e) {
|
|
32
|
+
// tcs.TrySetException(e);
|
|
33
|
+
// } finally {
|
|
34
|
+
// UIManager.DismissLoading();
|
|
35
|
+
// }
|
|
36
|
+
// });
|
|
37
|
+
|
|
38
|
+
// return tcs.Task;
|
|
39
|
+
//}
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
#endif
|