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
@@ -1,444 +0,0 @@
1
- using System;
2
- using System.Collections.Generic;
3
- using System.Linq;
4
- using System.Threading.Tasks;
5
- using LeanCloud.Storage;
6
- using TapTap.Bootstrap;
7
- using TapTap.Common;
8
- using XD.SDK.Account;
9
- using XD.SDK.Common;
10
- using LoginType = XD.SDK.Account.LoginType;
11
-
12
- namespace XD.SDK.Account{
13
- public class XDGAccountMobileImpl{
14
- //Account
15
- private static string ACCOUNT_SERVICE_NAME = "com.xd.intl.account.unitybridge.XDGLoginService";
16
- private static string ACCOUNT_SERVICE_IMPL = "com.xd.intl.account.unitybridge.XDGLoginServiceImpl";
17
- private static string ACCOUNT_SERVICE_NAME_UNITY = "com.xd.account.bridge.XDGLoginServiceUnity";
18
- private static string ACCOUNT_SERVICE_IMPL_UNITY = "com.xd.account.bridge.XDGLoginServiceUnityImpl";
19
- private XDGAccountMobileImpl(){
20
- EngineBridge.GetInstance()
21
- .Register(ACCOUNT_SERVICE_NAME, ACCOUNT_SERVICE_IMPL);
22
- EngineBridge.GetInstance()
23
- .Register(ACCOUNT_SERVICE_NAME_UNITY, ACCOUNT_SERVICE_IMPL_UNITY);
24
- }
25
-
26
- private readonly string XDG_ACCOUNT_SERVICE = "XDGLoginService"; //注意要和iOS本地的桥接文件名一样!
27
- private readonly string XDG_ACCOUNT_SERVICE_UNITY = "XDGLoginServiceUnity"; //注意要和iOS本地的桥接文件名一样!
28
- private static volatile XDGAccountMobileImpl _instance;
29
- private static readonly object Locker = new object();
30
-
31
- public static XDGAccountMobileImpl GetInstance(){
32
- lock (Locker){
33
- if (_instance == null){
34
- _instance = new XDGAccountMobileImpl();
35
- }
36
- }
37
-
38
- return _instance;
39
- }
40
-
41
- public void Login(List<LoginType> loginTypes, Action<XDGUser> callback, Action<XDGError> errorCallback){
42
- var command = new Command.Builder()
43
- .Service(XDG_ACCOUNT_SERVICE)
44
- .Method("login")
45
- .Args("login", getLoginTypeStr(loginTypes))
46
- .Callback(true)
47
- .OnceTime(true)
48
- .CommandBuilder();
49
-
50
- EngineBridge.GetInstance().CallHandler(command, result => {
51
- try{
52
- XDGLogger.Debug("Login 方法结果: " + result.ToJSON());
53
- if (!XDGTool.checkResultSuccess(result)){
54
- XDGLogger.Warn($"Login 登录失败1 :{result.ToJSON()}");
55
- errorCallback(new XDGErrorMobile(result.code, result.message));
56
- return;
57
- }
58
-
59
- var userWrapper = new XDGUserWrapper(result.content);
60
- if (userWrapper.error != null){
61
- XDGLogger.Warn($"Login 登录失败2 :{result.ToJSON()}");
62
- errorCallback(userWrapper.error);
63
- return;
64
- }
65
-
66
- if (userWrapper.user == null){
67
- XDGLogger.Warn($"Login 登录失败3 :{result.ToJSON()}");
68
- }
69
-
70
- ActiveLeanCloudToken(userWrapper.user, callback, errorCallback);
71
- } catch (Exception e){
72
- errorCallback(new XDGErrorMobile(result.code, result.message));
73
- XDGLogger.Warn("Login 报错" + e.Message);
74
- }
75
- });
76
- }
77
-
78
- private static string getLoginTypeStr(List<LoginType> types){
79
- var str = "";
80
- foreach (var type in types){
81
- if (type == XD.SDK.Account.LoginType.TapTap){
82
- str += "TAPTAP,";
83
- } else if (type == XD.SDK.Account.LoginType.Google){
84
- str += "GOOGLE,";
85
- } else if (type == XD.SDK.Account.LoginType.Facebook){
86
- str += "FACEBOOK,";
87
- } else if (type == XD.SDK.Account.LoginType.Apple){
88
- str += "APPLE,";
89
- } else if (type == XD.SDK.Account.LoginType.LINE){
90
- str += "LINE,";
91
- } else if (type == XD.SDK.Account.LoginType.Twitter){
92
- str += "TWITTER,";
93
- } else if (type == XD.SDK.Account.LoginType.Guest){
94
- str += "GUEST,";
95
- // } else if (type == XD.SDK.Account.LoginType.Twitch){
96
- // str += "TWITCH,";
97
- } else if (type == XD.SDK.Account.LoginType.Steam){
98
- str += "STEAM,";
99
- } else if (type == XD.SDK.Account.LoginType.Phone){
100
- str += "PHONE,";
101
- // } else if (type == XD.SDK.Account.LoginType.QQ){
102
- // str += "QQ,";
103
- } else if (type == XD.SDK.Account.LoginType.Email){
104
- str += "EMAIL,";
105
- }
106
- }
107
-
108
- return str;
109
- }
110
-
111
- private async void ActiveLeanCloudToken(XDGUser user, Action<XDGUser> callback,
112
- Action<XDGError> errorCallback){
113
- XDGLogger.Debug("LoginSync 开始执行 ActiveLeanCloudToken");
114
-
115
- if (user == null || XDGTool.IsEmpty(user.userId)){
116
- errorCallback(new XDGErrorMobile(-1001, "user is null"));
117
- XDGLogger.Warn("LoginSync 报错:user 是空!");
118
- return;
119
- } else{
120
- XDGLogger.Debug($"LoginSync 设置userId {user.userId}");
121
- }
122
-
123
- XDGLogger.Debug("LoginSync 开始执行 GetCurrent");
124
- var preUser = await TDSUser.GetCurrent();
125
- if (preUser != null){
126
- if (preUser.ObjectId == user.userId){
127
- XDGLogger.Debug("LoginSync 使用local pre user");
128
- callback(user);
129
- return;
130
- } else{
131
- // id 不同可能是有残存的数据,则清空后走重新创建逻辑
132
- XDGLogger.Debug("LoginSync 开始执行 await LCUser.Logout();");
133
- await LCUser.Logout();
134
- }
135
- }
136
-
137
- XDGCommon.ShowLoading();
138
- var resultJson = "空";
139
- var command = new Command.Builder()
140
- .Service(XDG_ACCOUNT_SERVICE)
141
- .Method("loginSync")
142
- .Callback(true)
143
- .OnceTime(true)
144
- .CommandBuilder();
145
- EngineBridge.GetInstance().CallHandler(command, (async result => {
146
- try{
147
- resultJson = result.ToJSON();
148
- XDGLogger.Debug("LoginSync 方法结果: " + resultJson);
149
- if (!XDGTool.checkResultSuccess(result)){
150
- XDGCommon.HideLoading();
151
- callback(user);
152
- XDGLogger.Warn($"LoginSync checkResultSuccess 失败 {result.code} {result.message}");
153
- return;
154
- }
155
-
156
- var contentDic = Json.Deserialize(result.content) as Dictionary<string, object>;
157
- var sessionToken = SafeDictionary.GetValue<string>(contentDic, "sessionToken");
158
- var errorDic = SafeDictionary.GetValue<Dictionary<string, object>>(contentDic, "error");
159
-
160
- if (errorDic != null){ //接口失败
161
- XDGCommon.HideLoading();
162
- callback(user);
163
- XDGLogger.Warn("LoginSync 报错:请求sessionToken接口失败, 【result结果:" + resultJson + "】");
164
- return;
165
- }
166
-
167
- if (XDGTool.IsEmpty(sessionToken)){ //接口成功,token是空(不太可能吧)
168
- XDGCommon.HideLoading();
169
- callback(user);
170
- XDGLogger.Warn("LoginSync 报错:token 是空! 【result结果:" + resultJson + "】");
171
- return;
172
- }
173
-
174
- LCUser lcUser = LCObject.CreateWithoutData(LCUser.CLASS_NAME, user.userId) as LCUser;
175
- lcUser.SessionToken = sessionToken;
176
- await lcUser.SaveToLocal();
177
-
178
- callback(user);
179
- XDGCommon.HideLoading();
180
- XDGLogger.Debug("LoginSync BecomeWithSessionToken 执行完毕");
181
- } catch (Exception e){
182
- XDGCommon.HideLoading();
183
- callback(user);
184
- if (e.InnerException != null){
185
- XDGLogger.Warn("LoginSync 报错:" + e.Message + e.StackTrace + "【InnerException: " +
186
- e.InnerException.Message + e.InnerException.StackTrace + "】" + "。 【result结果:" +
187
- resultJson + "】");
188
- } else{
189
- XDGLogger.Warn("LoginSync 报错:" + e.Message + e.StackTrace + "。 【result结果:" + resultJson +
190
- "】");
191
- }
192
- }
193
- }));
194
- }
195
-
196
-
197
- public async void Logout(){
198
- await TDSUser.Logout(); //退出LC
199
- var command = new Command.Builder()
200
- .Service(XDG_ACCOUNT_SERVICE)
201
- .Method("logout")
202
- .Callback(false)
203
- .CommandBuilder();
204
- EngineBridge.GetInstance().CallHandler(command);
205
- }
206
-
207
- public void AddUserStatusChangeCallback(Action<XDGUserStatusCodeType, string> callback){
208
- var command = new Command.Builder()
209
- .Service(XDG_ACCOUNT_SERVICE)
210
- .Method("addUserStatusChangeCallback")
211
- .Callback(true)
212
- .OnceTime(false)
213
- .CommandBuilder();
214
- EngineBridge.GetInstance().CallHandler(command, async (result) => {
215
- XDGLogger.Debug("AddUserStatusChangeCallback 方法结果: " + result.ToJSON());
216
-
217
- if (!XDGTool.checkResultSuccess(result)){
218
- callback(XDGUserStatusCodeType.ERROR, "Unknow error");
219
- return;
220
- }
221
-
222
- var wrapper = new XD.SDK.Common.XDGUserStatusChangeWrapper(result.content);
223
- if (wrapper.code == (int) XDGUserStatusCodeType.LOGOUT){
224
- await TDSUser.Logout();
225
- callback(XDGUserStatusCodeType.LOGOUT, wrapper.message);
226
- } else if (wrapper.code == (int) XDGUserStatusCodeType.BIND){
227
- callback(XDGUserStatusCodeType.BIND, wrapper.message);
228
- } else if (wrapper.code == (int) XDGUserStatusCodeType.UNBIND){
229
- callback(XDGUserStatusCodeType.UNBIND, wrapper.message);
230
- }else if (wrapper.code == (int) XDGUserStatusCodeType.ProtocolAgreedAfterLogout){
231
- callback(XDGUserStatusCodeType.ProtocolAgreedAfterLogout, wrapper.message);
232
- } else{
233
- XDGLogger.Warn($"AddUserStatusChangeCallback 未知回调 :{result.ToJSON()}");
234
- callback(XDGUserStatusCodeType.ERROR, wrapper.message);
235
- }
236
- });
237
- }
238
-
239
- public void GetUser(Action<XDGUser> callback, Action<XDGError> errorCallback){
240
- var command = new Command.Builder()
241
- .Service(XDG_ACCOUNT_SERVICE)
242
- .Method("getUser")
243
- .Callback(true)
244
- .OnceTime(true)
245
- .CommandBuilder();
246
- EngineBridge.GetInstance().CallHandler(command, result => {
247
- XDGLogger.Debug("GetUser 方法结果: " + result.ToJSON());
248
- if (!XDGTool.checkResultSuccess(result)){
249
- XDGLogger.Warn($"GetUser 失败1 :{result.ToJSON()}");
250
- errorCallback(new XDGErrorMobile(result.code, result.message));
251
- return;
252
- }
253
-
254
- XDGUserWrapper userWrapper = new XDGUserWrapper(result.content);
255
- if (userWrapper.error != null){
256
- XDGLogger.Warn($"GetUser 失败2 :{result.ToJSON()}");
257
- errorCallback(userWrapper.error);
258
- return;
259
- }
260
-
261
- if (userWrapper.user == null){
262
- XDGLogger.Warn($"GetUser 失败3 :{result.ToJSON()}");
263
- }
264
-
265
- callback(userWrapper.user);
266
- });
267
- }
268
-
269
- public void OpenUserCenter(){
270
- var command = new Command.Builder()
271
- .Service(XDG_ACCOUNT_SERVICE)
272
- .Method("openUserCenter")
273
- .Callback(false)
274
- .CommandBuilder();
275
- EngineBridge.GetInstance().CallHandler(command);
276
- }
277
-
278
- public void LoginByType(LoginType loginType, Action<XDGUser> callback, Action<XDGError> errorCallback){
279
- var command = new Command.Builder()
280
- .Service(XDG_ACCOUNT_SERVICE)
281
- .Method("loginByType")
282
- .Args("loginType", XDGAccount.GetLoginTypeString(loginType)) //和app交互用的是字符串,如TapTap
283
- .Callback(true)
284
- .OnceTime(true)
285
- .CommandBuilder();
286
-
287
- XDGLogger.Debug("调用方法:loginByType ");
288
- EngineBridge.GetInstance().CallHandler(command, result => {
289
- XDGLogger.Debug("LoginByType 方法结果: " + result.ToJSON());
290
- if (!XDGTool.checkResultSuccess(result)){
291
- XDGLogger.Warn($"LoginByType 登录失败1:{result.ToJSON()} ");
292
- errorCallback(new XDGErrorMobile(result.code, result.message));
293
- return;
294
- }
295
-
296
- XDGUserWrapper wrapper = new XDGUserWrapper(result.content);
297
- if (wrapper.error != null){
298
- XDGLogger.Warn($"LoginByType 登录失败2:{result.ToJSON()}");
299
- errorCallback(wrapper.error);
300
- return;
301
- }
302
-
303
- if (wrapper.user == null){
304
- XDGLogger.Warn($"LoginByType 登录失败3 wrapper user 是空 :{result.ToJSON()}");
305
- }
306
-
307
- ActiveLeanCloudToken(wrapper.user, callback, errorCallback);
308
- });
309
- }
310
-
311
- public void OpenUnregister(){
312
- var command = new Command.Builder()
313
- .Service(XDG_ACCOUNT_SERVICE)
314
- .Method("accountCancellation")
315
- .Callback(false)
316
- .CommandBuilder();
317
- EngineBridge.GetInstance().CallHandler(command);
318
- }
319
-
320
- // 641 FB token
321
- public void IsTokenActiveWithType(LoginType loginType, Action<bool> callback){
322
- var command = new Command.Builder()
323
- .Service(XDG_ACCOUNT_SERVICE)
324
- .Method("isTokenActiveWithType")
325
- .Args("isTokenActiveWithType", XDGAccount.GetLoginTypeString(loginType))
326
- .Callback(true)
327
- .OnceTime(true)
328
- .CommandBuilder();
329
-
330
- EngineBridge.GetInstance().CallHandler(command, result => {
331
- XDGLogger.Debug("isTokenActiveWithType 方法结果: " + result.ToJSON());
332
- if (!XDGTool.checkResultSuccess(result)){
333
- XDGLogger.Warn($"isTokenActiveWithType 失败1:{result.ToJSON()} ");
334
- callback(false);
335
- return;
336
- }
337
-
338
- var contentDic = Json.Deserialize(result.content) as Dictionary<string, object>;
339
- var success = SafeDictionary.GetValue<bool>(contentDic, "success");
340
- callback(success);
341
- });
342
- }
343
-
344
- public void BindByType(LoginType loginType, Action<bool, XDGError> callback){
345
- var command = new Command.Builder()
346
- .Service(XDG_ACCOUNT_SERVICE)
347
- .Method("bindByType")
348
- .Args("bindByType", XDGAccount.GetLoginTypeString(loginType))
349
- .Callback(true)
350
- .OnceTime(true)
351
- .CommandBuilder();
352
-
353
- EngineBridge.GetInstance().CallHandler(command, result => {
354
- XDGLogger.Debug("bindByType 方法结果: " + result.ToJSON());
355
-
356
- if (!XDGTool.checkResultSuccess(result)){
357
- XDGLogger.Warn($"bindByType 失败1:{result.ToJSON()} ");
358
- callback(false, new XDGErrorMobile(result.code, result.message));
359
- return;
360
- }
361
-
362
- var contentDic = Json.Deserialize(result.content) as Dictionary<string, object>;
363
- var success = SafeDictionary.GetValue<bool>(contentDic, "success");
364
- var errorDic = SafeDictionary.GetValue<Dictionary<string, object>>(contentDic, "error");
365
-
366
- XDGErrorMobile error = null;
367
- if (errorDic != null){
368
- error = new XDGErrorMobile(errorDic);
369
- XDGLogger.Warn($"bindByType 失败2:{result.ToJSON()} ");
370
- }
371
- callback(success, error);
372
- });
373
- }
374
-
375
- public void GetFacebookToken(Action<string, string> successCallback, Action<XDGError> errorCallback){
376
- var command = new Command.Builder()
377
- .Service(XDG_ACCOUNT_SERVICE)
378
- .Method("getFacebookToken")
379
- .Callback(true)
380
- .OnceTime(true)
381
- .CommandBuilder();
382
-
383
- EngineBridge.GetInstance().CallHandler(command, result => {
384
- XDGLogger.Debug("getFacebookToken 方法结果: " + result.ToJSON());
385
- if (!XDGTool.checkResultSuccess(result)){
386
- XDGLogger.Warn($"getFacebookToken 失败1:{result.ToJSON()} ");
387
- errorCallback(new XDGErrorMobile(result.code, result.message));
388
- return;
389
- }
390
-
391
- var contentDic = Json.Deserialize(result.content) as Dictionary<string, object>;
392
- var userId = SafeDictionary.GetValue<string>(contentDic, "userID");
393
- var accessToken = SafeDictionary.GetValue<string>(contentDic, "access_token");
394
- var errorDic = SafeDictionary.GetValue<Dictionary<string, object>>(contentDic, "error");
395
-
396
- if (errorDic != null){
397
- XDGLogger.Warn($"getFacebookToken 失败2:{result.ToJSON()} ");
398
- errorCallback(new XDGErrorMobile(errorDic));
399
- } else{
400
- successCallback(userId, accessToken);
401
- }
402
- });
403
- }
404
-
405
- public void updateThirdPlatformTokenWithCallback(Action<bool> callback){
406
- var command = new Command.Builder()
407
- .Service(XDG_ACCOUNT_SERVICE)
408
- .Method("updateThirdPlatformTokenWithCallback")
409
- .Callback(true)
410
- .OnceTime(true)
411
- .CommandBuilder();
412
-
413
- EngineBridge.GetInstance().CallHandler(command, result => {
414
- XDGLogger.Debug("updateThirdPlatformTokenWithCallback 方法结果: " + result.ToJSON());
415
- if (!XDGTool.checkResultSuccess(result)){
416
- XDGLogger.Warn($"updateThirdPlatformTokenWithCallback 失败1:{result.ToJSON()} ");
417
- callback(false);
418
- return;
419
- }
420
-
421
- var contentDic = Json.Deserialize(result.content) as Dictionary<string, object>;
422
- var success = SafeDictionary.GetValue<bool>(contentDic, "success");
423
- callback(success);
424
- });
425
- }
426
-
427
- public void OpenUserDashboard(XDGRoleInfo roleInfo){
428
- var dic = new Dictionary<string, object>{
429
- {"serverId", roleInfo.serverId},
430
- {"roleId", roleInfo.roleId},
431
- {"roleName", roleInfo.roleName},
432
- {"extra", roleInfo.extra}
433
- };
434
- var command = new Command.Builder()
435
- .Service(XDG_ACCOUNT_SERVICE_UNITY)
436
- .Method("openUserDashboard")
437
- .Args(dic)
438
- .Callback(false)
439
- .OnceTime(true)
440
- .CommandBuilder();
441
- EngineBridge.GetInstance().CallHandler(command);
442
- }
443
- }
444
- }
@@ -1,11 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: 5283d50d00d3440c89857f1efc520fbc
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant:
@@ -1,116 +0,0 @@
1
- using System;
2
- using System.Collections.Generic;
3
- using TapTap.Bootstrap;
4
- using TapTap.Common;
5
- using XD.SDK.Account;
6
- using XD.SDK.Common;
7
-
8
- namespace XD.SDK.Account{
9
- public class XDGTokenManager{
10
- private static readonly string RefreshFacebookDateKey = "RefreshFacebookDateKeySDK";
11
- private static long DaySeconds = 24 * 60 * 60; // 24 小时有多少秒
12
-
13
- public static void updateFacebookToken(XDGUser xdgUser){
14
- try{
15
- var preTime = getFacebookRefreshTime(); //上一次刷新时间
16
- if (preTime == 0 || (getCurrentSecond() - preTime) < DaySeconds){ //第一次 或 不到 24小时
17
- if (preTime == 0){
18
- updateFacebookRefreshTime();
19
- }
20
-
21
- return;
22
- }
23
-
24
- XDGAccountMobileImpl.GetInstance().updateThirdPlatformTokenWithCallback(async (success) => {
25
- if (success){
26
- try
27
- {
28
- foreach (var bound in xdgUser.boundAccounts){
29
- if (bound.ToLower().Equals("facebook")){
30
- var tdsUser = await TDSUser.GetCurrent().Result.Fetch();
31
- if (tdsUser != null && tdsUser.AuthData != null &&
32
- tdsUser.AuthData["facebook"] != null){
33
- //获取之前的信息
34
- object obj;
35
- var fbDic = tdsUser.AuthData["facebook"] as Dictionary<string, object>;
36
- var platToken = fbDic["access_token"] as string;
37
- fbDic.TryGetValue("uid", out obj);
38
- var platUserId = obj as string;
39
- if (string.IsNullOrEmpty(platToken) || string.IsNullOrEmpty(platUserId)){
40
- fbDic.TryGetValue("openid", out obj);
41
- platUserId = obj as string;
42
- }
43
- if (string.IsNullOrEmpty(platToken) || string.IsNullOrEmpty(platUserId)){
44
- XDGLogger.Warn($"获取FB token失败, 有空: uid:{platUserId}, token: {platToken}");
45
- return;
46
- }
47
-
48
- XDGLogger.Debug($"FB token刷新前是 uid: {platUserId}, token:{platToken}");
49
- //获取最新信息
50
- XDGAccountMobileImpl.GetInstance().GetFacebookToken(async (newUid, newToken) => {
51
- if (newUid.Equals(platUserId) && !newToken.Equals(platToken)){
52
- //uid相同,token不同
53
- fbDic["access_token"] = newToken;
54
- await tdsUser.AssociateAuthData(fbDic, "facebook");
55
- updateFacebookRefreshTime();
56
- XDGLogger.Debug(
57
- $"刷新FB成功后 uid: {newUid}, token:{newToken}。\n 刷新前是 uid: {platUserId}, token:{platToken}");
58
- } else{
59
- XDGLogger.Debug($"FB token相同 不刷新: uid:{newUid}, token:{newToken}");
60
- }
61
- },
62
- (e) => {
63
- XDGLogger.Warn(
64
- $"获取FB token 失败: code:{e.code}, msg:{e.error_msg}, uid:{platUserId}, token:{platToken}");
65
- });
66
- } else{
67
- XDGLogger.Warn("刷新FB token 失败 tdsUser/AuthData/AuthData[facebook] 是空");
68
- }
69
- break;
70
- }
71
- }
72
- }
73
- catch (Exception e)
74
- {
75
- XDGLogger.Warn($"刷新FB updateThirdPlatformTokenWithCallback: false,{e}");
76
- }
77
-
78
- } else{
79
- XDGLogger.Debug($"刷新FB updateThirdPlatformTokenWithCallback: false");
80
- }
81
- });
82
- } catch (Exception e){
83
- XDGLogger.Warn("刷新FB token失败:" + e.Message);
84
- }
85
- }
86
-
87
- public static long getFacebookRefreshTime(){
88
- var timeStr = DataStorage.LoadString(RefreshFacebookDateKey);
89
- if (string.IsNullOrEmpty(timeStr)){
90
- return 0;
91
- }
92
-
93
- try{
94
- return long.Parse(timeStr);
95
- } catch (Exception e){
96
- XDGLogger.Warn($"long parse 解析失败:timeStr = {timeStr} msg: {e.Message}");
97
- return 0;
98
- }
99
- }
100
-
101
- public static void updateFacebookRefreshTime(){
102
- var time = getCurrentSecond() + "";
103
- DataStorage.SaveString(RefreshFacebookDateKey, time);
104
- }
105
-
106
- public static long getCurrentSecond(){ //获取当前时间 秒
107
- var timeSpan = DateTime.Now.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, 0);
108
- try{
109
- return Convert.ToInt64(timeSpan.TotalSeconds);
110
- } catch (Exception e){
111
- XDGLogger.Warn($"生成时间戳失败:timeSpan{timeSpan} msg:{e.Message}");
112
- return 0;
113
- }
114
- }
115
- }
116
- }
@@ -1,11 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: a9d57fcbb26a4e508a8b7883d7e2033e
3
- MonoImporter:
4
- externalObjects: {}
5
- serializedVersion: 2
6
- defaultReferences: []
7
- executionOrder: 0
8
- icon: {instanceID: 0}
9
- userData:
10
- assetBundleName:
11
- assetBundleVariant: