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.
Files changed (205) hide show
  1. package/Plugins/Android/libs/XDGAccount_7.0.0.aar +0 -0
  2. package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGAccountBridge.java.meta → Plugins/Android/libs/XDGAccount_7.0.0.aar.meta} +2 -2
  3. package/Plugins/Android/libs/XDGBridgeAccount_v7_7.0.0.aar +0 -0
  4. package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnity.java.meta → Plugins/Android/libs/XDGBridgeAccount_v7_7.0.0.aar.meta} +2 -2
  5. package/Plugins/Android/libs/XDGSupport_7.0.0.aar +0 -0
  6. package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnityImpl.java.meta → Plugins/Android/libs/XDGSupport_7.0.0.aar.meta} +2 -2
  7. package/Plugins/Android/libs.meta +1 -1
  8. package/Plugins/Android.meta +1 -1
  9. package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginHelper.h +2 -8
  10. package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginHelper.h.meta +1 -1
  11. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK-Swift.h +329 -0
  12. package/Plugins/iOS/XDAccountSDK.framework/Headers/{TDSGlobalThirdPartyLoginManager.h.meta → XDAccountSDK-Swift.h.meta} +1 -1
  13. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK.h +1 -2
  14. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK.h.meta +1 -1
  15. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccount.h +29 -43
  16. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccount.h.meta +1 -1
  17. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountDefines.h +43 -0
  18. package/Plugins/iOS/XDAccountSDK.framework/Headers/{XDGPhoneAuthManager.h.meta → XDGAccountDefines.h.meta} +1 -1
  19. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountVersion.h +3 -3
  20. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountVersion.h.meta +1 -1
  21. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLogger+Account.h +3 -0
  22. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLogger+Account.h.meta +1 -1
  23. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLoginEntriesConfig.h.meta +1 -1
  24. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLoginService.h.meta +1 -1
  25. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGTapLoginPermissionDialog.h.meta +1 -1
  26. package/Plugins/iOS/XDAccountSDK.framework/Headers.meta +1 -1
  27. package/Plugins/iOS/XDAccountSDK.framework/Info.plist +0 -0
  28. package/Plugins/iOS/XDAccountSDK.framework/Info.plist.meta +1 -1
  29. package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
  30. package/Plugins/iOS/XDAccountSDK.framework/{Headers/XDGRoleInfo.h.meta → Modules/XDAccountSDK.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo.meta} +1 -1
  31. package/{Mobile/Http.meta → Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/Project.meta} +1 -1
  32. package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.abi.json +9 -0
  33. package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.abi.json.meta +7 -0
  34. package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  35. package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftdoc.meta +7 -0
  36. package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftmodule +0 -0
  37. package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftmodule.meta +7 -0
  38. package/{Mobile/Editor.meta → Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule.meta} +1 -1
  39. package/Plugins/iOS/XDAccountSDK.framework/Modules/module.modulemap.meta +1 -1
  40. package/Plugins/iOS/XDAccountSDK.framework/Modules.meta +1 -1
  41. package/Plugins/iOS/XDAccountSDK.framework/XDAccountSDK +0 -0
  42. package/Plugins/iOS/XDAccountSDK.framework/XDAccountSDK.meta +1 -1
  43. package/Plugins/iOS/XDAccountSDK.framework.meta +4 -4
  44. package/Plugins/iOS.meta +1 -1
  45. package/Plugins.meta +1 -1
  46. package/Runtime/Internal/IXDGAccount.Extended.cs +11 -0
  47. package/{Mobile/Http/XDGAccountHttpConfigMobile.cs.meta → Runtime/Internal/IXDGAccount.Extended.cs.meta} +1 -1
  48. package/Runtime/Internal/Mobile/AccountFeaturesImpl.cs +348 -0
  49. package/{Mobile/User/UserManagerMobile.cs.meta → Runtime/Internal/Mobile/AccountFeaturesImpl.cs.meta} +1 -1
  50. package/Runtime/Internal/Mobile/Http/LoginSyncResponse.cs +14 -0
  51. package/Runtime/Internal/Mobile/Http/LoginSyncResponse.cs.meta +3 -0
  52. package/Runtime/Internal/Mobile/Http/MacAuthenticationInterceptor.cs +37 -0
  53. package/Runtime/Internal/Mobile/Http/MacAuthenticationInterceptor.cs.meta +3 -0
  54. package/Runtime/Internal/Mobile/Http.meta +3 -0
  55. package/{Mobile.meta → Runtime/Internal/Mobile.meta} +1 -1
  56. package/Runtime/Internal/Standalone/AccessToken/AccessTokenModule.cs +168 -0
  57. package/{Mobile/Editor/XDAccountMobileProcessBuild.cs.meta → Runtime/Internal/Standalone/AccessToken/AccessTokenModule.cs.meta} +1 -1
  58. package/Runtime/Internal/Standalone/AccessToken.meta +8 -0
  59. package/Runtime/Internal/Standalone/AccountCell.cs +143 -0
  60. package/{Mobile/XDGAccountMobile.cs.meta → Runtime/Internal/Standalone/AccountCell.cs.meta} +1 -1
  61. package/Runtime/Internal/Standalone/AccountFeaturesImpl.cs +461 -0
  62. package/Runtime/Internal/Standalone/AccountFeaturesImpl.cs.meta +11 -0
  63. package/Runtime/Internal/Standalone/Auth/AppleAuth.cs +27 -0
  64. package/Runtime/Internal/Standalone/Auth/AppleAuth.cs.meta +11 -0
  65. package/Runtime/Internal/Standalone/Auth/FacebookAuth.cs +27 -0
  66. package/Runtime/Internal/Standalone/Auth/FacebookAuth.cs.meta +11 -0
  67. package/Runtime/Internal/Standalone/Auth/GoogleAuth.cs +27 -0
  68. package/Runtime/Internal/Standalone/Auth/GoogleAuth.cs.meta +11 -0
  69. package/Runtime/Internal/Standalone/Auth/GuestAuth.cs +22 -0
  70. package/Runtime/Internal/Standalone/Auth/GuestAuth.cs.meta +11 -0
  71. package/Runtime/Internal/Standalone/Auth/PhoneAuth.cs +43 -0
  72. package/Runtime/Internal/Standalone/Auth/PhoneAuth.cs.meta +11 -0
  73. package/Runtime/Internal/Standalone/Auth/SteamAuth.cs +90 -0
  74. package/Runtime/Internal/Standalone/Auth/SteamAuth.cs.meta +11 -0
  75. package/Runtime/Internal/Standalone/Auth/TapAuth.cs +72 -0
  76. package/Runtime/Internal/Standalone/Auth/TapAuth.cs.meta +11 -0
  77. package/Runtime/Internal/Standalone/Auth/WebAuth.cs +144 -0
  78. package/Runtime/Internal/Standalone/Auth/WebAuth.cs.meta +11 -0
  79. package/Runtime/Internal/Standalone/Auth.meta +8 -0
  80. package/Runtime/Internal/Standalone/Compliance/XDComplianceCode.cs +15 -0
  81. package/Runtime/Internal/Standalone/Compliance/XDComplianceCode.cs.meta +11 -0
  82. package/Runtime/Internal/Standalone/Compliance.meta +8 -0
  83. package/Runtime/Internal/Standalone/LoginModule/Email/EmailModule.cs +374 -0
  84. package/Runtime/Internal/Standalone/LoginModule/Email/EmailModule.cs.meta +11 -0
  85. package/Runtime/Internal/Standalone/LoginModule/Email.meta +8 -0
  86. package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModule.cs +245 -0
  87. package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModule.cs.meta +11 -0
  88. package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModuleIO.cs +392 -0
  89. package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModuleIO.cs.meta +11 -0
  90. package/Runtime/Internal/Standalone/LoginModule/Phone.meta +8 -0
  91. package/Runtime/Internal/Standalone/LoginModule.meta +8 -0
  92. package/Runtime/Internal/Standalone/SupportModule/SupportModule.cs +228 -0
  93. package/Runtime/Internal/Standalone/SupportModule/SupportModule.cs.meta +3 -0
  94. package/Runtime/Internal/Standalone/SupportModule/SupportResponse.cs +27 -0
  95. package/Runtime/Internal/Standalone/SupportModule/SupportResponse.cs.meta +3 -0
  96. package/Runtime/Internal/Standalone/SupportModule.meta +3 -0
  97. package/Runtime/Internal/Standalone/Track/AliyunTrack.Login.cs +479 -0
  98. package/Runtime/Internal/Standalone/Track/AliyunTrack.Login.cs.meta +11 -0
  99. package/Runtime/Internal/Standalone/Track.meta +8 -0
  100. package/Runtime/Internal/Standalone/UI/CodeUnbindAlert.cs +156 -0
  101. package/Runtime/Internal/Standalone/UI/CodeUnbindAlert.cs.meta +11 -0
  102. package/Runtime/Internal/Standalone/UI/Email/EmailAlert.cs +295 -0
  103. package/Runtime/Internal/Standalone/UI/Email/EmailAlert.cs.meta +11 -0
  104. package/Runtime/Internal/Standalone/UI/Email.meta +8 -0
  105. package/Runtime/Internal/Standalone/UI/PhoneIO/AreaCodeCell.cs +46 -0
  106. package/Runtime/Internal/Standalone/UI/PhoneIO/AreaCodeCell.cs.meta +11 -0
  107. package/Runtime/Internal/Standalone/UI/PhoneIO/PhoneAlertIO.cs +522 -0
  108. package/Runtime/Internal/Standalone/UI/PhoneIO/PhoneAlertIO.cs.meta +11 -0
  109. package/Runtime/Internal/Standalone/UI/PhoneIO.meta +8 -0
  110. package/Runtime/Internal/Standalone/UI/PhoneVerification/PhoneNumberInputAlert.cs +84 -0
  111. package/Runtime/Internal/Standalone/UI/PhoneVerification/PhoneNumberInputAlert.cs.meta +11 -0
  112. package/Runtime/Internal/Standalone/UI/PhoneVerification/RiskControlAlert.cs +190 -0
  113. package/Runtime/Internal/Standalone/UI/PhoneVerification/RiskControlAlert.cs.meta +11 -0
  114. package/Runtime/Internal/Standalone/UI/PhoneVerification/VerifyCodeInputAlert.cs +164 -0
  115. package/Runtime/Internal/Standalone/UI/PhoneVerification/VerifyCodeInputAlert.cs.meta +11 -0
  116. package/Runtime/Internal/Standalone/UI/PhoneVerification.meta +8 -0
  117. package/Runtime/Internal/Standalone/UI.meta +8 -0
  118. package/Runtime/Internal/Standalone/UserCenterAlert.cs +405 -0
  119. package/Runtime/Internal/Standalone/UserCenterAlert.cs.meta +11 -0
  120. package/Runtime/Internal/Standalone/UserModule.cs +604 -0
  121. package/Runtime/Internal/Standalone/UserModule.cs.meta +11 -0
  122. package/Runtime/Internal/Standalone/WebFunction/AccessTokenWebFunction.cs +47 -0
  123. package/Runtime/Internal/Standalone/WebFunction/AccessTokenWebFunction.cs.meta +3 -0
  124. package/Runtime/Internal/Standalone/WebFunction.meta +3 -0
  125. package/{Mobile/Plugins.meta → Runtime/Internal/Standalone.meta} +1 -1
  126. package/Runtime/Internal/XDGAccountEventHandler.cs +23 -0
  127. package/Runtime/Internal/XDGAccountEventHandler.cs.meta +3 -0
  128. package/Runtime/Internal/XDGAccountInternal.cs +86 -0
  129. package/Runtime/Internal/XDGAccountInternal.cs.meta +11 -0
  130. package/Runtime/Internal.meta +1 -1
  131. package/Runtime/Public/XDGAccount.Deprecated.cs +37 -0
  132. package/Runtime/Public/XDGAccount.Deprecated.cs.meta +11 -0
  133. package/Runtime/Public/XDGAccount.cs +107 -0
  134. package/Runtime/{XDGAccount.cs.meta → Public/XDGAccount.cs.meta} +1 -1
  135. package/Runtime/Public.meta +8 -0
  136. package/Runtime/XD.SDK.Account.asmdef +7 -2
  137. package/Runtime/XD.SDK.Account.asmdef.meta +1 -1
  138. package/Runtime.meta +1 -1
  139. package/package.json +5 -5
  140. package/package.json.meta +2 -2
  141. package/Mobile/Editor/XD.SDK.Account.Mobile.Editor.asmdef +0 -20
  142. package/Mobile/Editor/XD.SDK.Account.Mobile.Editor.asmdef.meta +0 -7
  143. package/Mobile/Editor/XDAccountMobileProcessBuild.cs +0 -20
  144. package/Mobile/Http/XDGAccountHttpConfigMobile.cs +0 -36
  145. package/Mobile/Plugins/Android/com/xd/account/bridge/XDGAccountBridge.java +0 -36
  146. package/Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnity.java +0 -16
  147. package/Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnityImpl.java +0 -20
  148. package/Mobile/Plugins/Android/com/xd/account/bridge.meta +0 -8
  149. package/Mobile/Plugins/Android/com/xd/account.meta +0 -8
  150. package/Mobile/Plugins/Android/com/xd.meta +0 -8
  151. package/Mobile/Plugins/Android/com.meta +0 -8
  152. package/Mobile/Plugins/Android.meta +0 -8
  153. package/Mobile/Plugins/iOS/XDAccountBridge.m +0 -29
  154. package/Mobile/Plugins/iOS/XDAccountBridge.m.meta +0 -37
  155. package/Mobile/Plugins/iOS/XDGLoginServiceUnity.h +0 -17
  156. package/Mobile/Plugins/iOS/XDGLoginServiceUnity.h.meta +0 -27
  157. package/Mobile/Plugins/iOS/XDGLoginServiceUnity.m +0 -23
  158. package/Mobile/Plugins/iOS/XDGLoginServiceUnity.m.meta +0 -37
  159. package/Mobile/Plugins/iOS.meta +0 -8
  160. package/Mobile/User/UserManagerMobile.cs +0 -45
  161. package/Mobile/User.meta +0 -8
  162. package/Mobile/XD.SDK.Account.Mobile.asmdef +0 -23
  163. package/Mobile/XD.SDK.Account.Mobile.asmdef.meta +0 -7
  164. package/Mobile/XDGAccountMobile.cs +0 -138
  165. package/Mobile/XDGAccountMobileImpl.cs +0 -444
  166. package/Mobile/XDGAccountMobileImpl.cs.meta +0 -11
  167. package/Mobile/XDGTokenManager.cs +0 -116
  168. package/Mobile/XDGTokenManager.cs.meta +0 -11
  169. package/Mobile/XDGUserWrapper.cs +0 -167
  170. package/Mobile/XDGUserWrapper.cs.meta +0 -11
  171. package/Plugins/Android/libs/XDGAccount_6.29.0.aar +0 -0
  172. package/Plugins/Android/libs/XDGAccount_6.29.0.aar.meta +0 -32
  173. package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginManager.h +0 -47
  174. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGPhoneAuthManager.h +0 -33
  175. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGRoleInfo.h +0 -22
  176. package/README.md +0 -0
  177. package/README.md.meta +0 -7
  178. package/Runtime/Editor/XD.SDK.Account.Editor.asmdef +0 -19
  179. package/Runtime/Editor/XD.SDK.Account.Editor.asmdef.meta +0 -7
  180. package/Runtime/Editor/XDAccountProcessBuild.cs +0 -18
  181. package/Runtime/Editor/XDAccountProcessBuild.cs.meta +0 -11
  182. package/Runtime/Editor.meta +0 -8
  183. package/Runtime/IXDGAccount.cs +0 -44
  184. package/Runtime/IXDGAccount.cs.meta +0 -11
  185. package/Runtime/Internal/Http/IXDAccountHttpConfig.cs +0 -9
  186. package/Runtime/Internal/Http/IXDAccountHttpConfig.cs.meta +0 -11
  187. package/Runtime/Internal/Http/XDAccountHttpConfig.cs +0 -32
  188. package/Runtime/Internal/Http/XDAccountHttpConfig.cs.meta +0 -11
  189. package/Runtime/Internal/Http.meta +0 -8
  190. package/Runtime/Internal/User/IUserManagerPlatformWrapper.cs +0 -7
  191. package/Runtime/Internal/User/IUserManagerPlatformWrapper.cs.meta +0 -11
  192. package/Runtime/Internal/User.meta +0 -8
  193. package/Runtime/UserManager.cs +0 -35
  194. package/Runtime/UserManager.cs.meta +0 -11
  195. package/Runtime/XDGAccessToken.cs +0 -18
  196. package/Runtime/XDGAccessToken.cs.meta +0 -11
  197. package/Runtime/XDGAccount.cs +0 -130
  198. package/Runtime/XDGLoginType.cs +0 -17
  199. package/Runtime/XDGLoginType.cs.meta +0 -11
  200. package/Runtime/XDGRoleInfo.cs +0 -24
  201. package/Runtime/XDGRoleInfo.cs.meta +0 -11
  202. package/Runtime/XDGUser.cs +0 -30
  203. package/Runtime/XDGUser.cs.meta +0 -11
  204. package/Runtime/XDGUserStatusCode.cs +0 -16
  205. package/Runtime/XDGUserStatusCode.cs.meta +0 -11
@@ -0,0 +1,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,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 16ca5b1fcd8b49e9b3d190800b8f6907
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 4103416c9c5b4c21b2d92dc1bf42aeac
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: c16a043c6d7a466e9abb1546bd388b48
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -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,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 97b8c4893e324feb964059732a111251
3
+ timeCreated: 1746669710
@@ -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
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: ce2e53d437014853afc83885c352d6db
3
+ timeCreated: 1746670881
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: de78a5ae8d9a410995fffdf7d7f43909
3
+ timeCreated: 1746669700