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,392 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
using System;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using System.Threading.Tasks;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
using XD.SDK.Common;
|
|
7
|
+
using XD.SDK.Common.Internal;
|
|
8
|
+
using XD.SDK.Common.Internal.Standalone;
|
|
9
|
+
using XDHttpClient = XD.SDK.Common.Internal.Standalone.XDHttpClient;
|
|
10
|
+
|
|
11
|
+
namespace XD.SDK.Account.Internal.Standalone
|
|
12
|
+
{
|
|
13
|
+
public static class PhoneModuleIO
|
|
14
|
+
{
|
|
15
|
+
|
|
16
|
+
private static readonly string XDG_LOGIN_CODE_SEND = "api/login/v1/verification/code/send";
|
|
17
|
+
private static readonly string XDG_UNBIND_CODE_SEND = "api/account/v1/unbind/verification/code/send";
|
|
18
|
+
|
|
19
|
+
public const int RISK_CONTROL = 40024;
|
|
20
|
+
public const int RISK_CONTROL_FAILED = 40025;
|
|
21
|
+
public const int INVALID_PHONE_NUMBER_FORMAT = 40022;
|
|
22
|
+
public const int INVALID_VERIFY_CODE = 40114;
|
|
23
|
+
public const int LOGIN_REQUEST_FREQUENTLY = 42900;
|
|
24
|
+
|
|
25
|
+
internal static readonly Color PhoneUIColor = new Color(255.0f / 255.0f, 102.0f / 255.0f, 0.0f / 255.0f);
|
|
26
|
+
|
|
27
|
+
internal static readonly Color PhoneUIDisableColor =
|
|
28
|
+
new Color(185.0f / 255.0f, 190.0f / 255.0f, 193.0f / 255.0f);
|
|
29
|
+
|
|
30
|
+
internal static readonly Color PhoneUIBlackColor = new Color(17.0f / 255.0f, 17.0f / 255.0f, 17.0f / 255.0f);
|
|
31
|
+
|
|
32
|
+
private static PhoneAlertIO loginAlert;
|
|
33
|
+
private static CodeUnbindAlert unbindAlert;
|
|
34
|
+
|
|
35
|
+
public static Task LoginOrBind(bool login)
|
|
36
|
+
{
|
|
37
|
+
TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
|
|
38
|
+
AliyunTrack.LoginAuthorize();
|
|
39
|
+
if (login)
|
|
40
|
+
{
|
|
41
|
+
AliyunTrack.LoginTrackPhoneData();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
loginAlert = UIManager.ShowUI<PhoneAlertIO>("XDPhoneAlertIO",
|
|
45
|
+
new Dictionary<string, object>() { { "login", login } }, async (code, data) =>
|
|
46
|
+
{
|
|
47
|
+
switch (code)
|
|
48
|
+
{
|
|
49
|
+
case PhoneAlertIO.CLOSE_CODE:
|
|
50
|
+
UIManager.Dismiss();
|
|
51
|
+
AliyunTrack.LoginAuthorizeFail("cancel");
|
|
52
|
+
tcs.TrySetException(XDGErrorExtensions.CancelledError());
|
|
53
|
+
break;
|
|
54
|
+
case PhoneAlertIO.SEND_CODE:
|
|
55
|
+
{
|
|
56
|
+
try
|
|
57
|
+
{
|
|
58
|
+
PhoneAlertIO.Data phoneData = data as PhoneAlertIO.Data;
|
|
59
|
+
if (phoneData?.phoneNumber.Length != 0)
|
|
60
|
+
{
|
|
61
|
+
await RequestLoginVerifyCode(phoneData?.areaCode, phoneData?.phoneNumber);
|
|
62
|
+
}
|
|
63
|
+
else
|
|
64
|
+
{
|
|
65
|
+
loginAlert.UpdatePhoneNumberError(XDLocalization.GetCurrentLocalizableString()
|
|
66
|
+
.PhoneNumberEmpty);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (Exception)
|
|
70
|
+
{
|
|
71
|
+
UIManager.DismissLoading();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
break;
|
|
75
|
+
case PhoneAlertIO.LOGIN_OR_BIND:
|
|
76
|
+
{
|
|
77
|
+
try
|
|
78
|
+
{
|
|
79
|
+
PhoneAlertIO.Data phoneData = data as PhoneAlertIO.Data;
|
|
80
|
+
if (phoneData?.phoneNumber.Length != 0)
|
|
81
|
+
{
|
|
82
|
+
if (phoneData?.code.Length != 0)
|
|
83
|
+
{
|
|
84
|
+
if (login)
|
|
85
|
+
{
|
|
86
|
+
await LoginByPhone(phoneData?.areaCode, phoneData?.phoneNumber,
|
|
87
|
+
phoneData?.code);
|
|
88
|
+
}
|
|
89
|
+
else
|
|
90
|
+
{
|
|
91
|
+
await BindByPhone(phoneData?.areaCode, phoneData?.phoneNumber,
|
|
92
|
+
phoneData?.code);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
UIManager.Dismiss();
|
|
96
|
+
tcs.TrySetResult(null);
|
|
97
|
+
}
|
|
98
|
+
else
|
|
99
|
+
{
|
|
100
|
+
loginAlert.UpdateCodeError(XDLocalization.GetCurrentLocalizableString()
|
|
101
|
+
.CodeEmpty);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
else
|
|
105
|
+
{
|
|
106
|
+
loginAlert.UpdatePhoneNumberError(XDLocalization.GetCurrentLocalizableString()
|
|
107
|
+
.PhoneNumberEmpty);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
catch (XDGError e)
|
|
111
|
+
{
|
|
112
|
+
if (e.Code == INVALID_VERIFY_CODE)
|
|
113
|
+
{
|
|
114
|
+
loginAlert.UpdateCodeError(e.ErrorMsg);
|
|
115
|
+
}
|
|
116
|
+
else if (e.Code == INVALID_PHONE_NUMBER_FORMAT)
|
|
117
|
+
{
|
|
118
|
+
loginAlert.UpdatePhoneNumberError(e.ErrorMsg);
|
|
119
|
+
}
|
|
120
|
+
else
|
|
121
|
+
{
|
|
122
|
+
UIManager.ShowToast(e.ErrorMsg);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
catch (Exception e)
|
|
126
|
+
{
|
|
127
|
+
tcs.TrySetException(e);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
return tcs.Task;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
public static Task Unbind(Dictionary<string, object> extras)
|
|
137
|
+
{
|
|
138
|
+
TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
|
|
139
|
+
|
|
140
|
+
unbindAlert = UIManager.ShowUI<CodeUnbindAlert>("XDCodeUnbindAlert", extras, async (code, data) =>
|
|
141
|
+
{
|
|
142
|
+
switch (code)
|
|
143
|
+
{
|
|
144
|
+
case CodeUnbindAlert.CLOSE_CODE:
|
|
145
|
+
UIManager.Dismiss();
|
|
146
|
+
tcs.TrySetException(XDGErrorExtensions.CancelledError());
|
|
147
|
+
break;
|
|
148
|
+
case CodeUnbindAlert.SEND_CODE:
|
|
149
|
+
{
|
|
150
|
+
try
|
|
151
|
+
{
|
|
152
|
+
await RequestUnbindVerifyCode();
|
|
153
|
+
}
|
|
154
|
+
catch (Exception)
|
|
155
|
+
{
|
|
156
|
+
UIManager.DismissLoading();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
break;
|
|
160
|
+
case CodeUnbindAlert.UNBIND:
|
|
161
|
+
{
|
|
162
|
+
try
|
|
163
|
+
{
|
|
164
|
+
CodeUnbindAlert.Data phoneData = data as CodeUnbindAlert.Data;
|
|
165
|
+
await UnbindByPhone(phoneData?.code);
|
|
166
|
+
UIManager.Dismiss();
|
|
167
|
+
tcs.TrySetResult(null);
|
|
168
|
+
}
|
|
169
|
+
catch (XDGError e)
|
|
170
|
+
{
|
|
171
|
+
if (e.Code == INVALID_VERIFY_CODE)
|
|
172
|
+
{
|
|
173
|
+
unbindAlert.UpdateCodeError(e.ErrorMsg);
|
|
174
|
+
}
|
|
175
|
+
else
|
|
176
|
+
{
|
|
177
|
+
UIManager.ShowToast(e.ErrorMsg);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
catch (Exception e)
|
|
181
|
+
{
|
|
182
|
+
tcs.TrySetException(e);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
return tcs.Task;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
private static async Task<RequestVerifyCodeData> RequestLoginVerifyCode(string areaCode, string phoneNumber,
|
|
192
|
+
string riskControlData = null)
|
|
193
|
+
{
|
|
194
|
+
Dictionary<string, object> data = new Dictionary<string, object>
|
|
195
|
+
{
|
|
196
|
+
{ "type", "SMS" },
|
|
197
|
+
{ "areaCode", areaCode }, // 当前版本固定国内
|
|
198
|
+
{ "phoneNumber", phoneNumber }
|
|
199
|
+
};
|
|
200
|
+
Dictionary<string, object> headers = null;
|
|
201
|
+
if (riskControlData != null)
|
|
202
|
+
{
|
|
203
|
+
headers = new Dictionary<string, object>()
|
|
204
|
+
{
|
|
205
|
+
{ "Risk-Authenticate-Sig", riskControlData }
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
RequestVerifyCodeData response = null;
|
|
210
|
+
UIManager.ShowLoading(true);
|
|
211
|
+
try
|
|
212
|
+
{
|
|
213
|
+
loginAlert?.SetSendButtonEnable(false);
|
|
214
|
+
response = (await XDHttpClient.Client.PostAsync<RequestVerifyCodeResponse>(XDG_LOGIN_CODE_SEND, headers: headers,
|
|
215
|
+
data: data))?.Data;
|
|
216
|
+
loginAlert?.SetSendButtonEnable(true);
|
|
217
|
+
if (response != null) loginAlert?.UpdateCanResendSeconds(response.ReSendInterval);
|
|
218
|
+
UIManager.ShowToast(XDLocalization.GetCurrentLocalizableString()?.CodeSendSuccess);
|
|
219
|
+
AliyunTrack.LoginMobileVerifyCodeSendSuccess();
|
|
220
|
+
}
|
|
221
|
+
catch (XDGError e)
|
|
222
|
+
{
|
|
223
|
+
loginAlert?.SetSendButtonEnable(true);
|
|
224
|
+
if (e.Code == RISK_CONTROL || e.Code == RISK_CONTROL_FAILED)
|
|
225
|
+
{
|
|
226
|
+
TaskCompletionSource<RequestVerifyCodeData> tcs = new TaskCompletionSource<RequestVerifyCodeData>();
|
|
227
|
+
|
|
228
|
+
string scene = e.ExtraData["captcha_scene"] as string;
|
|
229
|
+
|
|
230
|
+
async void Callback(string token, XDGError error)
|
|
231
|
+
{
|
|
232
|
+
if (!string.IsNullOrEmpty(token))
|
|
233
|
+
{
|
|
234
|
+
try
|
|
235
|
+
{
|
|
236
|
+
AliyunTrack.TriggerCaptchaSuccess("login_sms");
|
|
237
|
+
RequestVerifyCodeData codeData =
|
|
238
|
+
await RequestLoginVerifyCode(areaCode, phoneNumber, token);
|
|
239
|
+
tcs.TrySetResult(codeData);
|
|
240
|
+
}
|
|
241
|
+
catch (XDGError exception)
|
|
242
|
+
{
|
|
243
|
+
tcs.TrySetException(exception);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
else
|
|
247
|
+
{
|
|
248
|
+
tcs.TrySetException(error as XDGError ?? throw new InvalidOperationException());
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
AliyunTrack.TriggerCaptchaStart("login_sms");
|
|
253
|
+
XDGCaptcha.ValidateWithCaptcha(scene, new Dictionary<string, string>(){{"eventSessionId", AliyunTrack.LoginEventSessionId}}, Callback);
|
|
254
|
+
response = await tcs.Task;
|
|
255
|
+
}
|
|
256
|
+
else if (e.Code == INVALID_PHONE_NUMBER_FORMAT)
|
|
257
|
+
{
|
|
258
|
+
loginAlert?.UpdatePhoneNumberError(e.ErrorMsg);
|
|
259
|
+
}
|
|
260
|
+
else
|
|
261
|
+
{
|
|
262
|
+
UIManager.ShowToast(e.ErrorMsg);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
catch (Exception)
|
|
266
|
+
{
|
|
267
|
+
loginAlert?.SetSendButtonEnable(true);
|
|
268
|
+
UIManager.DismissLoading();
|
|
269
|
+
AliyunTrack.LoginMobileVerifyCodeSendFail();
|
|
270
|
+
throw;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
UIManager.DismissLoading();
|
|
274
|
+
return response;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
private static async Task<RequestVerifyCodeData> RequestUnbindVerifyCode(string riskControlData = null)
|
|
278
|
+
{
|
|
279
|
+
Dictionary<string, object> data = new Dictionary<string, object>
|
|
280
|
+
{
|
|
281
|
+
{ "type", "SMS" }
|
|
282
|
+
};
|
|
283
|
+
Dictionary<string, object> headers = null;
|
|
284
|
+
if (riskControlData != null)
|
|
285
|
+
{
|
|
286
|
+
headers = new Dictionary<string, object>()
|
|
287
|
+
{
|
|
288
|
+
{ "Risk-Authenticate-Sig", riskControlData }
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
RequestVerifyCodeData response = null;
|
|
293
|
+
try
|
|
294
|
+
{
|
|
295
|
+
unbindAlert?.SetSendButtonEnable(false);
|
|
296
|
+
response = (await XDHttpClient.Client.PostAsync<RequestVerifyCodeResponse>(XDG_UNBIND_CODE_SEND, headers: headers,
|
|
297
|
+
data: data))?.Data;
|
|
298
|
+
unbindAlert?.SetSendButtonEnable(true);
|
|
299
|
+
if (response != null) unbindAlert?.UpdateCanResendSeconds(response.ReSendInterval);
|
|
300
|
+
UIManager.ShowToast(XDLocalization.GetCurrentLocalizableString()?.CodeSendSuccess);
|
|
301
|
+
}
|
|
302
|
+
catch (XDGError e)
|
|
303
|
+
{
|
|
304
|
+
unbindAlert?.SetSendButtonEnable(true);
|
|
305
|
+
if (e.Code == RISK_CONTROL || e.Code == RISK_CONTROL_FAILED)
|
|
306
|
+
{
|
|
307
|
+
TaskCompletionSource<RequestVerifyCodeData> tcs = new TaskCompletionSource<RequestVerifyCodeData>();
|
|
308
|
+
|
|
309
|
+
string scene = e.ExtraData["captcha_scene"] as string;
|
|
310
|
+
|
|
311
|
+
async void Callback(string token, XDGError error)
|
|
312
|
+
{
|
|
313
|
+
if (!string.IsNullOrEmpty(token))
|
|
314
|
+
{
|
|
315
|
+
try
|
|
316
|
+
{
|
|
317
|
+
RequestVerifyCodeData codeData = await RequestUnbindVerifyCode(token);
|
|
318
|
+
tcs.TrySetResult(codeData);
|
|
319
|
+
}
|
|
320
|
+
catch (XDGError exception)
|
|
321
|
+
{
|
|
322
|
+
tcs.TrySetException(exception);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
else
|
|
326
|
+
{
|
|
327
|
+
tcs.TrySetException(error as XDGError ?? throw new InvalidOperationException());
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
XDGCaptcha.ValidateWithCaptcha(scene, new Dictionary<string, string>(){{"eventSessionId", AliyunTrack.LoginEventSessionId}}, Callback);
|
|
331
|
+
response = await tcs.Task;
|
|
332
|
+
}
|
|
333
|
+
else
|
|
334
|
+
{
|
|
335
|
+
UIManager.ShowToast(e.ErrorMsg);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
catch (Exception)
|
|
339
|
+
{
|
|
340
|
+
loginAlert?.SetSendButtonEnable(true);
|
|
341
|
+
UIManager.DismissLoading();
|
|
342
|
+
throw;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
return response;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
private static async Task LoginByPhone(string areaCode, string phoneNumber, string code)
|
|
349
|
+
{
|
|
350
|
+
Dictionary<string, object> authData = new Dictionary<string, object>
|
|
351
|
+
{
|
|
352
|
+
{ "type", (int)LoginType.Phone },
|
|
353
|
+
{ "token", $"{areaCode} {phoneNumber}" },
|
|
354
|
+
{ "secret", code },
|
|
355
|
+
{ "subType", "text" }
|
|
356
|
+
};
|
|
357
|
+
try
|
|
358
|
+
{
|
|
359
|
+
await AccessTokenModule.Login(authData, null);
|
|
360
|
+
AliyunTrack.LoginMobileVerifyCodePassSuccess();
|
|
361
|
+
}
|
|
362
|
+
catch (XDGError e)
|
|
363
|
+
{
|
|
364
|
+
AliyunTrack.LoginMobileVerifyCodePassFail(e.ErrorMsg);
|
|
365
|
+
throw;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
private static async Task BindByPhone(string areaCode, string phoneNumber, string code)
|
|
370
|
+
{
|
|
371
|
+
Dictionary<string, object> authData = new Dictionary<string, object>
|
|
372
|
+
{
|
|
373
|
+
{ "type", (int)LoginType.Phone },
|
|
374
|
+
{ "token", $"{areaCode} {phoneNumber}" },
|
|
375
|
+
{ "secret", code },
|
|
376
|
+
{ "subType", "text" }
|
|
377
|
+
};
|
|
378
|
+
await XDHttpClient.Client.PostAsync<BaseResponse>(UserModule.XDG_BIND_INTERFACE, data: authData);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
private static async Task UnbindByPhone(string code)
|
|
382
|
+
{
|
|
383
|
+
Dictionary<string, object> data = new Dictionary<string, object>()
|
|
384
|
+
{
|
|
385
|
+
{ "type", (int)LoginType.Phone },
|
|
386
|
+
{ "verificationCode", code }
|
|
387
|
+
};
|
|
388
|
+
await XDHttpClient.Client.PostAsync<BaseResponse>(UserModule.XDG_UNBIND_INTERFACE, data: data);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
#endif
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
using System;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using System.Diagnostics;
|
|
5
|
+
using System.Threading;
|
|
6
|
+
using System.Threading.Tasks;
|
|
7
|
+
using Newtonsoft.Json;
|
|
8
|
+
using UnityEngine;
|
|
9
|
+
using XD.SDK.Common;
|
|
10
|
+
using XD.SDK.Common.Internal.Standalone;
|
|
11
|
+
|
|
12
|
+
namespace XD.SDK.Account.Internal.Standalone
|
|
13
|
+
{
|
|
14
|
+
public class SupportModule
|
|
15
|
+
{
|
|
16
|
+
private static SupportModule _instance;
|
|
17
|
+
|
|
18
|
+
private static readonly object LockObj = new object();
|
|
19
|
+
|
|
20
|
+
private SupportModule()
|
|
21
|
+
{
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public static SupportModule Instance
|
|
25
|
+
{
|
|
26
|
+
get
|
|
27
|
+
{
|
|
28
|
+
if (_instance != null) return _instance;
|
|
29
|
+
lock (LockObj)
|
|
30
|
+
{
|
|
31
|
+
if (_instance == null)
|
|
32
|
+
{
|
|
33
|
+
_instance = new SupportModule();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return _instance;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public void TryStartPolling()
|
|
42
|
+
{
|
|
43
|
+
if (!ConfigModule.CustomerDisable)
|
|
44
|
+
{
|
|
45
|
+
StartCheckUnRead();
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
XDGLogger.Debug("XSupportManager is disabled by config, skipping polling start");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
private const string XdgSupportUserUnreadCheck = "api/support/v1/user/unread/check";
|
|
53
|
+
|
|
54
|
+
private const string XdgSupportAnonymousUnreadCheck = "api/support/v1/user/anonymous/unread/check";
|
|
55
|
+
|
|
56
|
+
private const string XdgSupportUserGetURL = "api/support/v1/user/url/get";
|
|
57
|
+
|
|
58
|
+
private const string XdgSupportAnonymousGetURL = "api/support/v1/user/anonymous/url/get";
|
|
59
|
+
|
|
60
|
+
private int nextCheckUnreadTime = 10;
|
|
61
|
+
|
|
62
|
+
private bool bLastHasRead;
|
|
63
|
+
|
|
64
|
+
private CancellationTokenSource cts = new CancellationTokenSource();
|
|
65
|
+
|
|
66
|
+
public static void OpenCustomerService(XDGRoleInfo roleInfo, string path, Dictionary<string, object> paramsMap)
|
|
67
|
+
{
|
|
68
|
+
RequestSupportUrl(roleInfo, path, paramsMap, (success, xd, url) =>
|
|
69
|
+
{
|
|
70
|
+
if (!success)
|
|
71
|
+
{
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (xd)
|
|
76
|
+
{
|
|
77
|
+
WebRequest.OpenWebPage(url, (code, data) => { });
|
|
78
|
+
}
|
|
79
|
+
else
|
|
80
|
+
{
|
|
81
|
+
UIManager.ShowUI<XDWebViewAlert>("XDWebViewAlert", new Dictionary<string, object>
|
|
82
|
+
{
|
|
83
|
+
{
|
|
84
|
+
"url", url
|
|
85
|
+
}
|
|
86
|
+
}, (code, data) =>
|
|
87
|
+
{
|
|
88
|
+
if (code == XDWebViewAlert.CLOSE_CODE)
|
|
89
|
+
{
|
|
90
|
+
UIManager.Dismiss();
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
private static async void CheckUnRead()
|
|
98
|
+
{
|
|
99
|
+
XDGLogger.Debug("Support check unread");
|
|
100
|
+
try
|
|
101
|
+
{
|
|
102
|
+
string requestUrl;
|
|
103
|
+
Dictionary<string, object> queryMap;
|
|
104
|
+
if (UserModule.GetCurrentUser() != null)
|
|
105
|
+
{
|
|
106
|
+
requestUrl = XdgSupportUserUnreadCheck;
|
|
107
|
+
queryMap = null;
|
|
108
|
+
}
|
|
109
|
+
else
|
|
110
|
+
{
|
|
111
|
+
requestUrl = XdgSupportAnonymousUnreadCheck;
|
|
112
|
+
queryMap = new Dictionary<string, object>()
|
|
113
|
+
{
|
|
114
|
+
{ "anonymousId", SystemInfo.deviceUniqueIdentifier }
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
var response = await XDHttpClient.Client.GetAsync<SupportBaseResponse<SupportUnReadResponse>>(
|
|
119
|
+
requestUrl,null, queryMap);
|
|
120
|
+
|
|
121
|
+
var bHasUnRead = response.Data.HasUnread;
|
|
122
|
+
var bUnReadStatusChange = bHasUnRead != Instance.bLastHasRead;
|
|
123
|
+
Instance.bLastHasRead = bHasUnRead;
|
|
124
|
+
var nextTimeInterval = bUnReadStatusChange ? 10 : IncreaseTimeInterval();
|
|
125
|
+
Instance.nextCheckUnreadTime = response.Data.IntervalSec > 0 ? response.Data.IntervalSec : nextTimeInterval;
|
|
126
|
+
XDGLogger.Debug($"Support Check UnRead Success, hasUnread:{response.Data.HasUnread} interval:{response.Data.IntervalSec}");
|
|
127
|
+
if (bUnReadStatusChange)
|
|
128
|
+
{
|
|
129
|
+
AccountFeaturesImpl.Instance.GetUserStatusCallback()
|
|
130
|
+
.Invoke(response.Data.HasUnread ? XDGUserStatusCodeType.SupportHasUnRead : XDGUserStatusCodeType.SupportNoUnRead, null);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
catch (XDGError e)
|
|
134
|
+
{
|
|
135
|
+
UIManager.ShowToast(e.ErrorMsg);
|
|
136
|
+
Instance.nextCheckUnreadTime = IncreaseTimeInterval();
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
StartCheckUnRead();
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
private static int IncreaseTimeInterval()
|
|
143
|
+
{
|
|
144
|
+
var currentInterval = Instance.nextCheckUnreadTime;
|
|
145
|
+
return currentInterval >= 300 ? currentInterval : (currentInterval += 10);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
private static void StartCheckUnRead()
|
|
149
|
+
{
|
|
150
|
+
try
|
|
151
|
+
{
|
|
152
|
+
Instance.cts.Cancel();
|
|
153
|
+
}
|
|
154
|
+
catch (ObjectDisposedException e)
|
|
155
|
+
{
|
|
156
|
+
XDGLogger.Warn($"Support Cancel CheckUnRead Action error:{e.Message}");
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
Instance.cts = new CancellationTokenSource();
|
|
160
|
+
if (Instance.nextCheckUnreadTime > 0)
|
|
161
|
+
{
|
|
162
|
+
TaskDispatcher.RunSafeAsync(async () =>
|
|
163
|
+
{
|
|
164
|
+
try
|
|
165
|
+
{
|
|
166
|
+
await Task.Delay(Instance.nextCheckUnreadTime * 1000, Instance.cts.Token);
|
|
167
|
+
await TaskDispatcher.SwitchToMainThread(Instance.cts.Token);
|
|
168
|
+
CheckUnRead();
|
|
169
|
+
}
|
|
170
|
+
catch (TaskCanceledException e)
|
|
171
|
+
{
|
|
172
|
+
XDGLogger.Warn($"Support Start CheckUnRead Action error:{e.Message}");
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
CheckUnRead();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
private static async void RequestSupportUrl(XDGRoleInfo roleInfo, string path, Dictionary<string, object> extra, Action<bool, bool, string> action)
|
|
182
|
+
{
|
|
183
|
+
XDGLogger.Debug("Support RequestSupportUrl");
|
|
184
|
+
try
|
|
185
|
+
{
|
|
186
|
+
if (path == null)
|
|
187
|
+
{
|
|
188
|
+
path = "";
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (extra == null)
|
|
192
|
+
{
|
|
193
|
+
extra = new Dictionary<string, object>();
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (roleInfo != null)
|
|
197
|
+
{
|
|
198
|
+
extra.Add("role_id", roleInfo.RoleId);
|
|
199
|
+
extra.Add("role_name", roleInfo.RoleName);
|
|
200
|
+
extra.Add("server_id", roleInfo.ServerId);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
var data = new Dictionary<string, object>
|
|
204
|
+
{
|
|
205
|
+
{ "path", path },
|
|
206
|
+
{ "urlEncodedUserParams", Uri.EscapeDataString(JsonConvert.SerializeObject(extra)) }
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
var query = new Dictionary<string, object>()
|
|
210
|
+
{
|
|
211
|
+
{ "anonymousId", SystemInfo.deviceUniqueIdentifier }
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
var response = await XDHttpClient.Client.PostAsync<SupportBaseResponse<SupportUrlResponse>>(UserModule.current == null
|
|
215
|
+
? XdgSupportAnonymousGetURL
|
|
216
|
+
: XdgSupportUserGetURL, null, data, UserModule.current == null ? query : null);
|
|
217
|
+
|
|
218
|
+
action.Invoke(true, response.Data.XD, response.Data.Url);
|
|
219
|
+
}
|
|
220
|
+
catch (XDGError e)
|
|
221
|
+
{
|
|
222
|
+
XDGLogger.Warn($"Support RequestSupportUrl error:{e.ErrorMsg}");
|
|
223
|
+
action.Invoke(false, false, null);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
#endif
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#if UNITY_EDITOR || UNITY_STANDALONE
|
|
2
|
+
|
|
3
|
+
using Newtonsoft.Json;
|
|
4
|
+
using XD.SDK.Common.Internal;
|
|
5
|
+
|
|
6
|
+
namespace XD.SDK.Account.Internal.Standalone
|
|
7
|
+
{
|
|
8
|
+
public class SupportBaseResponse<T> : BaseResponse
|
|
9
|
+
{
|
|
10
|
+
[JsonProperty("data")] public T Data { get; set; }
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public class SupportUnReadResponse
|
|
14
|
+
{
|
|
15
|
+
[JsonProperty("hasUnread")] public bool HasUnread { get; set; }
|
|
16
|
+
|
|
17
|
+
[JsonProperty("intervalSec")] public int IntervalSec { get; set; }
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public class SupportUrlResponse
|
|
21
|
+
{
|
|
22
|
+
[JsonProperty("url")] public string Url { get; set; }
|
|
23
|
+
|
|
24
|
+
[JsonProperty("isXD")] public bool XD { get; set; }
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
#endif
|