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,90 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
using System;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using System.Net;
|
|
5
|
+
using System.Threading.Tasks;
|
|
6
|
+
using XD.SDK.Common;
|
|
7
|
+
using XD.SDK.Common.Internal.Standalone;
|
|
8
|
+
|
|
9
|
+
namespace XD.SDK.Account.Internal.Standalone
|
|
10
|
+
{
|
|
11
|
+
public class SteamAuth : WebAuth
|
|
12
|
+
{
|
|
13
|
+
static readonly List<HttpListener> servers = new List<HttpListener>();
|
|
14
|
+
|
|
15
|
+
internal static async Task<Dictionary<string, object>> GetAuthData()
|
|
16
|
+
{
|
|
17
|
+
if (SteamUtils.IsSDKSupported)
|
|
18
|
+
{
|
|
19
|
+
// 先尝试从 Steam SDK 中获取 auth data
|
|
20
|
+
Dictionary<string, object> authData = await GetAuthDataFromSDK();
|
|
21
|
+
return authData;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// 返回 Web 授权的 AuthData
|
|
25
|
+
Dictionary<string, object> queryParams = new Dictionary<string, object>
|
|
26
|
+
{
|
|
27
|
+
{ "auth_type", "steam" },
|
|
28
|
+
{ "state", LocalServerUtils.GenerateRandomDataBase64url(32) },
|
|
29
|
+
{ "console_type", "steam" },
|
|
30
|
+
};
|
|
31
|
+
return await StartListener(servers, LoginType.Steam, queryParams);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public static async Task<Dictionary<string, object>> GetAuthDataFromSDK()
|
|
35
|
+
{
|
|
36
|
+
// 返回 SDK 授权的 AuthData
|
|
37
|
+
// 登陆跳转授权 Track
|
|
38
|
+
AliyunTrack.LoginAuthorize();
|
|
39
|
+
try
|
|
40
|
+
{
|
|
41
|
+
string ticket = await SteamUtils.Instance.GetAuthTicket();
|
|
42
|
+
if (string.IsNullOrWhiteSpace(ticket))
|
|
43
|
+
{
|
|
44
|
+
// 登陆授权失败
|
|
45
|
+
AliyunTrack.LoginAuthorizeFail("SteamNoTicket");
|
|
46
|
+
}
|
|
47
|
+
else
|
|
48
|
+
{
|
|
49
|
+
// 登陆授权成功
|
|
50
|
+
AliyunTrack.LoginAuthorizeSuccess();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return new Dictionary<string, object>
|
|
54
|
+
{
|
|
55
|
+
{ "type", (int)LoginType.Steam },
|
|
56
|
+
{ "token", ticket }
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
catch (Exception e)
|
|
60
|
+
{
|
|
61
|
+
// 登陆授权成功
|
|
62
|
+
AliyunTrack.LoginAuthorizeFail($"SteamNoTicket {e.Message}");
|
|
63
|
+
return new Dictionary<string, object>
|
|
64
|
+
{
|
|
65
|
+
{ "type", (int)LoginType.Steam },
|
|
66
|
+
{ "token", null }
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public static string GetSteamIdFromSDK()
|
|
72
|
+
{
|
|
73
|
+
return SteamUtils.Instance.GetSteamId();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
public static Dictionary<string, object> GetCacheData()
|
|
77
|
+
{
|
|
78
|
+
if (!SteamUtils.IsSDKSupported)
|
|
79
|
+
{
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return new Dictionary<string, object>
|
|
84
|
+
{
|
|
85
|
+
{ "steamId", GetSteamIdFromSDK() }
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
#endif
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
using System;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using System.Threading.Tasks;
|
|
5
|
+
using XD.SDK.Common;
|
|
6
|
+
using XD.SDK.Common.Internal;
|
|
7
|
+
using XD.SDK.Common.Internal.Events;
|
|
8
|
+
using XD.SDK.Common.Internal.Standalone;
|
|
9
|
+
|
|
10
|
+
namespace XD.SDK.Account.Internal.Standalone
|
|
11
|
+
{
|
|
12
|
+
internal class TapAuth
|
|
13
|
+
{
|
|
14
|
+
internal static async Task<Dictionary<string, object>> GetAuthData()
|
|
15
|
+
{
|
|
16
|
+
return await RequestTapToken();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private static async Task<Dictionary<string, object>> RequestTapToken()
|
|
20
|
+
{
|
|
21
|
+
try
|
|
22
|
+
{
|
|
23
|
+
AliyunTrack.LoginAuthorize();
|
|
24
|
+
|
|
25
|
+
if (ConfigModule.TapConfig != null && ConfigModule.UsingTapPC)
|
|
26
|
+
{
|
|
27
|
+
UIManager.ShowLoading(timeout: 3);
|
|
28
|
+
}
|
|
29
|
+
// 使用明确指定参数类型的反射调用
|
|
30
|
+
var permissions = ConfigModule.TapConfig.Permissions;
|
|
31
|
+
var authData = await XDGEventBus.PublishAsync<Dictionary<string, object>>(XDGEvents.TapSDKLogin, permissions);
|
|
32
|
+
|
|
33
|
+
// 检查返回结果是否为 null
|
|
34
|
+
if (authData == null)
|
|
35
|
+
{
|
|
36
|
+
throw new XDGError(ResponseCode.Common.Failed, "TapTap 登录返回数据为空");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
authData.Add("type", (int)LoginType.TapTap);
|
|
40
|
+
authData.Add("scope", string.Join(",", permissions?.ToArray()));
|
|
41
|
+
|
|
42
|
+
if (ConfigModule.TapConfig != null && ConfigModule.UsingTapPC)
|
|
43
|
+
{
|
|
44
|
+
UIManager.DismissLoading();
|
|
45
|
+
}
|
|
46
|
+
AliyunTrack.LoginAuthorizeSuccess();
|
|
47
|
+
return authData;
|
|
48
|
+
}
|
|
49
|
+
// catch (TapException e)
|
|
50
|
+
// {
|
|
51
|
+
// if (e.code == (int)TapErrorCode.ERROR_CODE_LOGIN_CANCEL)
|
|
52
|
+
// {
|
|
53
|
+
// XDGLogger.Debug($"Tap 取消登录,{e}");
|
|
54
|
+
// AliyunTrack.LoginAuthorizeFail(e.Message);
|
|
55
|
+
// throw XDGErrorExtensions.CancelledError(e.message);
|
|
56
|
+
// }
|
|
57
|
+
// else
|
|
58
|
+
// {
|
|
59
|
+
// XDGLogger.Warn($"Tap 登录失败:{e}");
|
|
60
|
+
// throw new XDGError(ResponseCode.Common.Failed, e.Message);
|
|
61
|
+
// }
|
|
62
|
+
// }
|
|
63
|
+
catch (Exception e)
|
|
64
|
+
{
|
|
65
|
+
AliyunTrack.LoginAuthorizeFail(e.Message);
|
|
66
|
+
XDGLogger.Warn($"Tap 登录失败:{e}");
|
|
67
|
+
throw new XDGError(ResponseCode.Common.Failed, e.Message);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
#endif
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
using System;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using System.Linq;
|
|
5
|
+
using System.Net;
|
|
6
|
+
using System.Threading.Tasks;
|
|
7
|
+
using UnityEngine;
|
|
8
|
+
using XD.SDK.Common;
|
|
9
|
+
using XD.SDK.Common.Internal;
|
|
10
|
+
using XD.SDK.Common.Internal.Standalone;
|
|
11
|
+
using CommonTrack = XD.SDK.Common.Internal.Standalone.AliyunTrack;
|
|
12
|
+
|
|
13
|
+
namespace XD.SDK.Account.Internal.Standalone
|
|
14
|
+
{
|
|
15
|
+
public class WebAuth
|
|
16
|
+
{
|
|
17
|
+
protected static async Task<Dictionary<string, object>> StartListener(List<HttpListener> servers,
|
|
18
|
+
LoginType loginType,
|
|
19
|
+
Dictionary<string, object> queryParams)
|
|
20
|
+
{
|
|
21
|
+
string redirectUri = $"http://{IPAddress.Loopback}:{LocalServerUtils.GetRandomUnusedPort()}";
|
|
22
|
+
string gameName = ConfigModule.GameName;
|
|
23
|
+
string lang = XDLocalization.GetLanguageKey();
|
|
24
|
+
|
|
25
|
+
string url = ConfigModule.IsGlobal ? AuthConstants.GLOBAL_AUTH_HOST : AuthConstants.CN_AUTH_HOST;
|
|
26
|
+
Dictionary<string, object> queryParameters = new Dictionary<string, object>
|
|
27
|
+
{
|
|
28
|
+
{ "redirect_uri", redirectUri },
|
|
29
|
+
{ "game_name", gameName },
|
|
30
|
+
{ "lang", lang },
|
|
31
|
+
|
|
32
|
+
{ "eventSessionId", AliyunTrack.LoginEventSessionId },
|
|
33
|
+
{ "app_version", Application.version },
|
|
34
|
+
{ "brand", SystemInfo.deviceModel },
|
|
35
|
+
{ "channel", ConfigModule.Channel },
|
|
36
|
+
{ "device_id", SystemInfo.deviceUniqueIdentifier },
|
|
37
|
+
{ "isloginmodule", true },
|
|
38
|
+
{ "loc", StandaloneDeviceInfo.GetLocation() },
|
|
39
|
+
{ "model", SystemInfo.processorType },
|
|
40
|
+
{ "orientation", Screen.orientation.ToString().ToLower() },
|
|
41
|
+
{ "session_uuid", CommonTrack.CurrentSessionUUId },
|
|
42
|
+
{ "xd_client_id", ConfigModule.ClientId },
|
|
43
|
+
{ "sdk_version", XDGConstants.SDK_VERSION },
|
|
44
|
+
{ "os", CommonTrack.GetPlatform() },
|
|
45
|
+
{ "os_version", SystemInfo.operatingSystem }
|
|
46
|
+
};
|
|
47
|
+
if (queryParams != null)
|
|
48
|
+
{
|
|
49
|
+
foreach (KeyValuePair<string, object> kv in queryParams)
|
|
50
|
+
{
|
|
51
|
+
queryParameters[kv.Key] = kv.Value;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
IEnumerable<string> queryPairs = queryParameters.Select(kv => $"{kv.Key}={kv.Value}");
|
|
56
|
+
string authRequest = $"{url}?{string.Join("&", queryPairs)}";
|
|
57
|
+
|
|
58
|
+
// 弹出授权页
|
|
59
|
+
XDGLogger.Debug($"auth: {authRequest}");
|
|
60
|
+
AliyunTrack.LoginAuthorize();
|
|
61
|
+
// 登陆跳转授权 Track
|
|
62
|
+
Application.OpenURL(Uri.EscapeUriString(authRequest));
|
|
63
|
+
|
|
64
|
+
// 启动监听
|
|
65
|
+
HttpListener server = new HttpListener();
|
|
66
|
+
server.Prefixes.Add($"{redirectUri}/");
|
|
67
|
+
server.Start();
|
|
68
|
+
|
|
69
|
+
servers.Add(server);
|
|
70
|
+
|
|
71
|
+
Dictionary<string, object> authData = new Dictionary<string, object>
|
|
72
|
+
{
|
|
73
|
+
{ "type", (int)loginType }
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
while (true)
|
|
77
|
+
{
|
|
78
|
+
try
|
|
79
|
+
{
|
|
80
|
+
HttpListenerContext context = await server.GetContextAsync();
|
|
81
|
+
|
|
82
|
+
XDGLogger.Debug($"Request url: {context.Request.RawUrl}");
|
|
83
|
+
XDGLogger.Debug($"Request method: {context.Request.HttpMethod}");
|
|
84
|
+
|
|
85
|
+
context.Response.StatusCode = 200;
|
|
86
|
+
context.Response.Close();
|
|
87
|
+
|
|
88
|
+
if (context.Request.HttpMethod == "OPTIONS")
|
|
89
|
+
{
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
foreach (HttpListener svr in servers)
|
|
94
|
+
{
|
|
95
|
+
svr.Stop();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
servers.Clear();
|
|
99
|
+
|
|
100
|
+
// 解析 Web 像 SDK 传递的参数
|
|
101
|
+
string[] urlSegments = context.Request.RawUrl.Split('?');
|
|
102
|
+
if (urlSegments.Length < 2)
|
|
103
|
+
{
|
|
104
|
+
return new Dictionary<string, object>();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
string queryString = urlSegments[1];
|
|
108
|
+
string[] queries = queryString.Split('&');
|
|
109
|
+
|
|
110
|
+
foreach (string query in queries)
|
|
111
|
+
{
|
|
112
|
+
if (string.IsNullOrEmpty(query))
|
|
113
|
+
{
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
string[] kv = query.Split('=');
|
|
118
|
+
if (kv.Length < 2)
|
|
119
|
+
{
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
authData[kv[0]] = kv[1];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// 登陆授权成功
|
|
127
|
+
AliyunTrack.LoginAuthorizeSuccess();
|
|
128
|
+
return authData;
|
|
129
|
+
}
|
|
130
|
+
catch (Exception e)
|
|
131
|
+
{
|
|
132
|
+
XDGLogger.Debug(e.Message);
|
|
133
|
+
// 异常结果则一直 pending
|
|
134
|
+
// 登陆授权失败
|
|
135
|
+
AliyunTrack.LoginAuthorizeFail(e.Message);
|
|
136
|
+
TaskCompletionSource<Dictionary<string, object>> tcs =
|
|
137
|
+
new TaskCompletionSource<Dictionary<string, object>>();
|
|
138
|
+
return await tcs.Task;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
#endif
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
namespace XD.SDK.Account.Standalone
|
|
2
|
+
{
|
|
3
|
+
public enum XDComplianceCode
|
|
4
|
+
{
|
|
5
|
+
LoginSuccess = 500,
|
|
6
|
+
Exited = 1000,
|
|
7
|
+
SwitchAccount = 1001,
|
|
8
|
+
PeriodRestrict = 1030,
|
|
9
|
+
DurationLimit = 1050,
|
|
10
|
+
AgeLimit = 1100,
|
|
11
|
+
InvalidClientOrNetworkError = 1200,
|
|
12
|
+
RealNameStop = 9002
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|