com.xd.sdk.account 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/Mobile/Editor/XD.SDK.Account.Mobile.Editor.asmdef +20 -0
  2. package/Mobile/Editor/XD.SDK.Account.Mobile.Editor.asmdef.meta +7 -0
  3. package/Mobile/Editor/XDAccountMobileProcessBuild.cs +20 -0
  4. package/Mobile/Editor/XDAccountMobileProcessBuild.cs.meta +11 -0
  5. package/Mobile/Editor.meta +8 -0
  6. package/Mobile/Http/XDGAccountHttpConfigMobile.cs +36 -0
  7. package/Mobile/Http/XDGAccountHttpConfigMobile.cs.meta +11 -0
  8. package/Mobile/Http.meta +8 -0
  9. package/Mobile/Plugins/Android/com/xd/account/bridge/XDGAccountBridge.java +15 -0
  10. package/Mobile/Plugins/Android/com/xd/account/bridge/XDGAccountBridge.java.meta +32 -0
  11. package/Mobile/Plugins/Android/com/xd/account/bridge.meta +8 -0
  12. package/Mobile/Plugins/Android/com/xd/account.meta +8 -0
  13. package/Mobile/Plugins/Android/com/xd.meta +8 -0
  14. package/Mobile/Plugins/Android/com.meta +8 -0
  15. package/Mobile/Plugins/Android.meta +8 -0
  16. package/Mobile/Plugins/iOS/XDAccountBridge.m +26 -0
  17. package/Mobile/Plugins/iOS/XDAccountBridge.m.meta +37 -0
  18. package/Mobile/Plugins/iOS.meta +8 -0
  19. package/Mobile/Plugins.meta +8 -0
  20. package/Mobile/User/UserManagerMobile.cs +45 -0
  21. package/Mobile/User/UserManagerMobile.cs.meta +3 -0
  22. package/Mobile/User.meta +3 -0
  23. package/Mobile/XD.SDK.Account.Mobile.asmdef +23 -0
  24. package/Mobile/XD.SDK.Account.Mobile.asmdef.meta +7 -0
  25. package/Mobile/XDGAccountMobile.cs +132 -0
  26. package/Mobile/XDGAccountMobile.cs.meta +11 -0
  27. package/Mobile/XDGAccountMobileImpl.cs +421 -0
  28. package/Mobile/XDGAccountMobileImpl.cs.meta +11 -0
  29. package/Mobile/XDGTokenManager.cs +116 -0
  30. package/Mobile/XDGTokenManager.cs.meta +3 -0
  31. package/Mobile/XDGUserWrapper.cs +167 -0
  32. package/Mobile/XDGUserWrapper.cs.meta +11 -0
  33. package/Mobile.meta +8 -0
  34. package/Plugins/Android/libs/XDGAccount_6.21.1.aar +0 -0
  35. package/Plugins/Android/libs/XDGAccount_6.21.1.aar.meta +32 -0
  36. package/Plugins/Android/libs.meta +8 -0
  37. package/Plugins/Android.meta +8 -0
  38. package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginHelper.h +61 -0
  39. package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginHelper.h.meta +7 -0
  40. package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginManager.h +47 -0
  41. package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginManager.h.meta +7 -0
  42. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK.h +24 -0
  43. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK.h.meta +7 -0
  44. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccount.h +69 -0
  45. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccount.h.meta +7 -0
  46. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountVersion.h +8 -0
  47. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountVersion.h.meta +7 -0
  48. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLogger+Account.h +21 -0
  49. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLogger+Account.h.meta +7 -0
  50. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLoginEntriesConfig.h +16 -0
  51. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLoginEntriesConfig.h.meta +7 -0
  52. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLoginService.h +47 -0
  53. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLoginService.h.meta +7 -0
  54. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGPhoneAuthManager.h +33 -0
  55. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGPhoneAuthManager.h.meta +7 -0
  56. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGTapLoginPermissionDialog.h +23 -0
  57. package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGTapLoginPermissionDialog.h.meta +7 -0
  58. package/Plugins/iOS/XDAccountSDK.framework/Headers.meta +8 -0
  59. package/Plugins/iOS/XDAccountSDK.framework/Info.plist +0 -0
  60. package/Plugins/iOS/XDAccountSDK.framework/Info.plist.meta +7 -0
  61. package/Plugins/iOS/XDAccountSDK.framework/Modules/module.modulemap +6 -0
  62. package/Plugins/iOS/XDAccountSDK.framework/Modules/module.modulemap.meta +7 -0
  63. package/Plugins/iOS/XDAccountSDK.framework/Modules.meta +8 -0
  64. package/Plugins/iOS/XDAccountSDK.framework/XDAccountSDK +0 -0
  65. package/Plugins/iOS/XDAccountSDK.framework/XDAccountSDK.meta +7 -0
  66. package/Plugins/iOS/XDAccountSDK.framework.meta +28 -0
  67. package/Plugins/iOS.meta +8 -0
  68. package/Plugins.meta +8 -0
  69. package/README.md +0 -0
  70. package/README.md.meta +7 -0
  71. package/Runtime/Editor/XD.SDK.Account.Editor.asmdef +19 -0
  72. package/Runtime/Editor/XD.SDK.Account.Editor.asmdef.meta +7 -0
  73. package/Runtime/Editor/XDAccountProcessBuild.cs +18 -0
  74. package/Runtime/Editor/XDAccountProcessBuild.cs.meta +11 -0
  75. package/Runtime/Editor.meta +8 -0
  76. package/Runtime/IXDGAccount.cs +42 -0
  77. package/Runtime/IXDGAccount.cs.meta +3 -0
  78. package/Runtime/Internal/Http/IXDAccountHttpConfig.cs +9 -0
  79. package/Runtime/Internal/Http/IXDAccountHttpConfig.cs.meta +11 -0
  80. package/Runtime/Internal/Http/XDAccountHttpConfig.cs +32 -0
  81. package/Runtime/Internal/Http/XDAccountHttpConfig.cs.meta +11 -0
  82. package/Runtime/Internal/Http.meta +8 -0
  83. package/Runtime/Internal/User/IUserManagerPlatformWrapper.cs +7 -0
  84. package/Runtime/Internal/User/IUserManagerPlatformWrapper.cs.meta +3 -0
  85. package/Runtime/Internal/User.meta +3 -0
  86. package/Runtime/Internal.meta +8 -0
  87. package/Runtime/UserManager.cs +35 -0
  88. package/Runtime/UserManager.cs.meta +3 -0
  89. package/Runtime/XD.SDK.Account.asmdef +16 -0
  90. package/Runtime/XD.SDK.Account.asmdef.meta +7 -0
  91. package/Runtime/XDGAccessToken.cs +18 -0
  92. package/Runtime/XDGAccessToken.cs.meta +3 -0
  93. package/Runtime/XDGAccount.cs +123 -0
  94. package/Runtime/XDGAccount.cs.meta +3 -0
  95. package/Runtime/XDGLoginType.cs +28 -0
  96. package/Runtime/XDGLoginType.cs.meta +3 -0
  97. package/Runtime/XDGUser.cs +30 -0
  98. package/Runtime/XDGUser.cs.meta +3 -0
  99. package/Runtime/XDGUserStatusCode.cs +16 -0
  100. package/Runtime/XDGUserStatusCode.cs.meta +3 -0
  101. package/Runtime.meta +3 -0
  102. package/package.json +11 -0
  103. package/package.json.meta +7 -0
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "XD.SDK.Account.Mobile.Editor",
3
+ "references": [
4
+ "GUID:616cea76def2d4f059b94440fc8cc03d",
5
+ "GUID:747e53b1749584bae9386571797e5eb5",
6
+ "GUID:0acc523941302664db1f4e527237feb3",
7
+ "GUID:27619889b8ba8c24980f49ee34dbb44a"
8
+ ],
9
+ "includePlatforms": [
10
+ "Editor"
11
+ ],
12
+ "excludePlatforms": [],
13
+ "allowUnsafeCode": false,
14
+ "overrideReferences": false,
15
+ "precompiledReferences": [],
16
+ "autoReferenced": true,
17
+ "defineConstraints": [],
18
+ "versionDefines": [],
19
+ "noEngineReferences": false
20
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 2d1b9e16f6d8a4232bb62304893cb98e
3
+ AssemblyDefinitionImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -0,0 +1,20 @@
1
+ using System;
2
+ using TapTap.Common.Editor;
3
+ using UnityEditor.Build.Reporting;
4
+
5
+ namespace XD.SDK.Account.Editor
6
+ {
7
+ public class XDAccountMobileProcessBuild : SDKLinkProcessBuild {
8
+ public override int callbackOrder => 6;
9
+
10
+ public override string LinkPath => "XDSDK/Gen/Account/Mobile/link.xml";
11
+
12
+ public override LinkedAssembly[] LinkedAssemblies => new LinkedAssembly[] {
13
+ new LinkedAssembly { Fullname = "XD.SDK.Account.Mobile" }
14
+ };
15
+
16
+ public override Func<BuildReport, bool> IsTargetPlatform => (report) => {
17
+ return BuildTargetUtils.IsSupportMobile(report.summary.platform);
18
+ };
19
+ }
20
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 9312dade9dc9241279a7e2f8b3b866a5
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: ae4b4cc27e35c4030a2c713e217de54e
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,36 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.Net.Http;
4
+ using System.Threading.Tasks;
5
+ using System.Runtime.InteropServices;
6
+ using UnityEngine;
7
+
8
+ namespace XD.SDK.Account.Internal {
9
+ public class XDGAccountHttpConfigMobile : IXDAccountHttpConfig {
10
+ public Task<Dictionary<string, string>> GetAuthorizationHeaders(HttpRequestMessage request, long timestamp) {
11
+ string url = request.RequestUri.AbsoluteUri;
12
+ string method = request.Method.ToString().ToUpper();
13
+ string authorization;
14
+ #if UNITY_ANDROID
15
+ using (AndroidJavaClass AccountBridgeClass = new AndroidJavaClass("com.xd.account.bridge.XDGAccountBridge")) {
16
+ authorization = AccountBridgeClass.CallStatic<string>("getAuthorization", url, method, timestamp);
17
+ }
18
+ #elif UNITY_IOS
19
+ IntPtr ptr = XDAccountBridgeGetAuthorization(url, method, timestamp);
20
+ authorization = Marshal.PtrToStringAnsi(ptr);
21
+ #endif
22
+ if (string.IsNullOrEmpty(authorization)) {
23
+ return Task.FromResult(new Dictionary<string, string>());
24
+ }
25
+
26
+ return Task.FromResult(new Dictionary<string, string> {
27
+ { "Authorization", authorization }
28
+ });
29
+ }
30
+
31
+ #if UNITY_IOS
32
+ [DllImport("__Internal")]
33
+ private static extern IntPtr XDAccountBridgeGetAuthorization(string url, string method, long timestamp);
34
+ #endif
35
+ }
36
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: ff0780c8218434a908fe4b7e3097cb2d
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: 5e058405fc5734ba4849a3614da3a161
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,15 @@
1
+ package com.xd.account.bridge;
2
+
3
+ import com.xd.intl.common.net.CommonParameterManager;
4
+ import com.xd.intl.common.bridge.BridgeUtil;
5
+ import com.xd.intl.common.global.GlobalUserStore;
6
+
7
+ public class XDGAccountBridge {
8
+ public static String getAuthorization(String url, String method, long timestamp) {
9
+ return CommonParameterManager.getInstance().getRequestAuthorizationHeaderString(url, method, timestamp * 1000);
10
+ }
11
+
12
+ public static String getCurrentUser() {
13
+ return BridgeUtil.convertUserJsonString4Bridge(GlobalUserStore.INSTANCE.getCurrentXDUser());
14
+ }
15
+ }
@@ -0,0 +1,32 @@
1
+ fileFormatVersion: 2
2
+ guid: e7e5e81c66cfd4d0ab0b2f51f07880b5
3
+ PluginImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ iconMap: {}
7
+ executionOrder: {}
8
+ defineConstraints: []
9
+ isPreloaded: 0
10
+ isOverridable: 0
11
+ isExplicitlyReferenced: 0
12
+ validateReferences: 1
13
+ platformData:
14
+ - first:
15
+ Android: Android
16
+ second:
17
+ enabled: 1
18
+ settings: {}
19
+ - first:
20
+ Any:
21
+ second:
22
+ enabled: 0
23
+ settings: {}
24
+ - first:
25
+ Editor: Editor
26
+ second:
27
+ enabled: 0
28
+ settings:
29
+ DefaultValueInitialized: true
30
+ userData:
31
+ assetBundleName:
32
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 55964ed8cbf6a4e9a9e371890f284232
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 421618a981cec439e86d2c118263feaf
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 0616f23585cd842d083cda282c97bb43
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: f3105b995c8bf4903867dd4b809ce180
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 1096511754b3f4862ac7f1e9e89c71f3
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,26 @@
1
+ //
2
+ // XDAccountBridge.m
3
+ // Unity-iPhone
4
+ //
5
+ // Created by oneRain on 2024/3/6.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+ #import <XDCommonSDK/XDGHttpRequest.h>
10
+ #import <XDCommonSDK/XDGUser.h>
11
+ #import <XDAccountSDK/XDGLoginService.h>
12
+ #import <XDCommonSDK/NSDictionary+TDSGlobalJson.h>
13
+
14
+ const char* XDAccountBridgeGetAuthorization(const char* url, const char* method, long timestamp) {
15
+ NSString *auth = [XDGHttpRequest getMactoken:[NSURL URLWithString:[NSString stringWithUTF8String:url]] method:[NSString stringWithUTF8String:method] time:[[NSNumber numberWithLong:timestamp] stringValue]];
16
+ return [auth UTF8String];
17
+ }
18
+
19
+ const char*XDAccountBridgeGetUser() {
20
+ XDGUser *user = [XDGUser currentUser];
21
+ if (user.userId == nil || user.userId.length == 0) {
22
+ return nil;
23
+ }
24
+ NSDictionary *userDic = [XDGLoginService bridgeUserDic:user];
25
+ return [userDic.tdsglobal_jsonString UTF8String];
26
+ }
@@ -0,0 +1,37 @@
1
+ fileFormatVersion: 2
2
+ guid: 66125dbb432024524bd6984a09e3deb3
3
+ PluginImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ iconMap: {}
7
+ executionOrder: {}
8
+ defineConstraints: []
9
+ isPreloaded: 0
10
+ isOverridable: 0
11
+ isExplicitlyReferenced: 0
12
+ validateReferences: 1
13
+ platformData:
14
+ - first:
15
+ Any:
16
+ second:
17
+ enabled: 0
18
+ settings: {}
19
+ - first:
20
+ Editor: Editor
21
+ second:
22
+ enabled: 0
23
+ settings:
24
+ DefaultValueInitialized: true
25
+ - first:
26
+ iPhone: iOS
27
+ second:
28
+ enabled: 1
29
+ settings: {}
30
+ - first:
31
+ tvOS: tvOS
32
+ second:
33
+ enabled: 1
34
+ settings: {}
35
+ userData:
36
+ assetBundleName:
37
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: b6128d4519c6346a8865694df8366f72
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 5a0325abf107a43c988e1612aeddd17b
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,45 @@
1
+ #if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
2
+ using System;
3
+ using System.Threading.Tasks;
4
+ using System.Runtime.InteropServices;
5
+ using UnityEngine;
6
+ using XD.SDK.Common;
7
+
8
+ namespace XD.SDK.Account.Internal
9
+ {
10
+ public class UserManagerMobile : IUserManagerPlatformWrapper
11
+ {
12
+ public XDGUser GetCurrentUser()
13
+ {
14
+ XDGUser resultUser = null;
15
+ string currentUserString = null;
16
+ #if UNITY_ANDROID
17
+ using (var accountBridgeClass = new AndroidJavaClass("com.xd.account.bridge.XDGAccountBridge"))
18
+ {
19
+ currentUserString = accountBridgeClass.CallStatic<string>("getCurrentUser");
20
+ }
21
+ #elif UNITY_IOS
22
+ IntPtr ptr = XDAccountBridgeGetUser();
23
+ currentUserString = Marshal.PtrToStringAnsi(ptr);
24
+ #endif
25
+ if (!string.IsNullOrEmpty(currentUserString))
26
+ {
27
+ try
28
+ {
29
+ resultUser = new XDGUserMobile(currentUserString);
30
+ }
31
+ catch (Exception e)
32
+ {
33
+ XDGLogger.Warn("convert current user error" + e.Message);
34
+ }
35
+ }
36
+ return resultUser;
37
+ }
38
+
39
+ #if UNITY_IOS
40
+ [DllImport("__Internal")]
41
+ private static extern IntPtr XDAccountBridgeGetUser();
42
+ #endif
43
+ }
44
+ }
45
+ #endif
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: eb185310da4348b9a6fefe0f29d3b396
3
+ timeCreated: 1716360010
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 2d55b9ee1dd240858288055da9b63fe8
3
+ timeCreated: 1716359995
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "XD.SDK.Account.Mobile",
3
+ "references": [
4
+ "GUID:c72576b1c89c54ea0a0d748ee92b35c2",
5
+ "GUID:271a06ab0780d4a5ea46c9c3be2ab5dc",
6
+ "GUID:d2c60bf9347574ed480e55a6682a81f4",
7
+ "GUID:0ab0f87386c0640798a09051c047d4ab",
8
+ "GUID:0b3f64ec33f5b4da98a17367a35b82f2",
9
+ "GUID:43c632eee0a6f42cdaf21080b154f3a1"
10
+ ],
11
+ "includePlatforms": [
12
+ "Android",
13
+ "iOS"
14
+ ],
15
+ "excludePlatforms": [],
16
+ "allowUnsafeCode": false,
17
+ "overrideReferences": false,
18
+ "precompiledReferences": [],
19
+ "autoReferenced": true,
20
+ "defineConstraints": [],
21
+ "versionDefines": [],
22
+ "noEngineReferences": false
23
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 8b2e8a99ce9ab457da469f8744959bc2
3
+ AssemblyDefinitionImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -0,0 +1,132 @@
1
+ #if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
2
+ using System;
3
+ using System.Collections.Generic;
4
+ using XD.SDK.Account;
5
+ using XD.SDK.Common;
6
+ using LoginType = XD.SDK.Account.LoginType;
7
+
8
+ namespace XD.SDK.Account{
9
+ public class XDGAccountMobile : IXDGAccount
10
+ {
11
+ public static void Login(List<LoginType> loginTypes, Action<XDGUser> callback, Action<XDGError> errorCallback){
12
+ XDGAccountMobileImpl.GetInstance().Login(loginTypes, (u) =>
13
+ {
14
+ XDGCommon.UserId = u.userId;
15
+ callback?.Invoke(u);
16
+ EventManager.LoginSuccessEvent();
17
+
18
+ if (u.loginType.ToLower().Equals("facebook")){
19
+ XDGTokenManager.updateFacebookRefreshTime();
20
+ }
21
+ }, (e) => {
22
+ errorCallback(e);
23
+ EventManager.LoginFailEvent(e.error_msg);
24
+ });
25
+ }
26
+
27
+ public static void LoginByType(LoginType loginType, Action<XDGUser> callback, Action<XDGError> errorCallback){
28
+ XDGAccountMobileImpl.GetInstance().LoginByType(loginType, (u) => {
29
+ XDGCommon.UserId = u.userId;
30
+ callback?.Invoke(u);
31
+ EventManager.LoginSuccessEvent();
32
+
33
+ if (loginType == XD.SDK.Account.LoginType.Default){ //自动登录需要异步刷 Facebook token
34
+ XDGTokenManager.updateFacebookToken(u);
35
+ } else if (loginType == XD.SDK.Account.LoginType.Facebook){
36
+ XDGTokenManager.updateFacebookRefreshTime();
37
+ }
38
+
39
+ }, (e) => {
40
+ errorCallback(e);
41
+ EventManager.LoginFailEvent(e.error_msg);
42
+ });
43
+ }
44
+
45
+ public static void Logout()
46
+ {
47
+ XDGCommon.UserId = null;
48
+ XDGAccountMobileImpl.GetInstance().Logout();
49
+ }
50
+
51
+ public static void AddUserStatusChangeCallback(Action<XDGUserStatusCodeType, string> callback){
52
+ XDGAccountMobileImpl.GetInstance().AddUserStatusChangeCallback(callback);
53
+ }
54
+
55
+ public static void OpenUserCenter(){
56
+ XDGAccountMobileImpl.GetInstance().OpenUserCenter();
57
+ }
58
+
59
+ public static void OpenUnregister(){
60
+ XDGAccountMobileImpl.GetInstance().OpenUnregister();
61
+ }
62
+
63
+ //641 FB token
64
+ public static void IsTokenActiveWithType(LoginType loginType, Action<bool> callback){
65
+ XDGAccountMobileImpl.GetInstance().IsTokenActiveWithType(loginType, callback);
66
+ }
67
+
68
+ #region Interface
69
+ void IXDGAccount.Login(List<LoginType> loginTypes, Action<XDGUser> callback, Action<XDGError> errorCallback)
70
+ {
71
+ Login(loginTypes, callback, (error)=> errorCallback(error as XDGError));
72
+ }
73
+
74
+ void IXDGAccount.LoginByType(LoginType loginType, Action<XDGUser> callback, Action<XDGError> errorCallback)
75
+ {
76
+ LoginByType(loginType, callback, (error)=> errorCallback(error as XDGError));
77
+ }
78
+
79
+ /// <summary>
80
+ /// 发行在主机(Steam/PS/Nintendo)上的游戏的自动登录接口
81
+ /// </summary>
82
+ /// <param name="successCallback">该主机的账号注册过心动账号,那么会返回登录成功(第二次登录的时候,如果主机账号没有发生改变,会直接返回登录成功,略过网络请求)</param>
83
+ /// <param name="failCallback">该主机的账号未注册过心动账号,那么会返回失败。这个时候需要调用LoginByType登录</param>
84
+ /// <param name="errorCallback">网络请求错误或者非主机平台的游戏调用,以及其他错误</param>
85
+ void IXDGAccount.LoginByConsole(Action<XDGUser> successCallback, Action failCallback, Action<XDGError> errorCallback)
86
+ {
87
+ UnityEngine.Debug.LogErrorFormat("NotImplementedException");
88
+ }
89
+
90
+ void IXDGAccount.Logout()
91
+ {
92
+ Logout();
93
+ }
94
+
95
+ void IXDGAccount.AddUserStatusChangeCallback(Action<XDGUserStatusCodeType, string> callback)
96
+ {
97
+ AddUserStatusChangeCallback(callback);
98
+ }
99
+
100
+ public void GetUser(Action<XDGUser> callback, Action<XDGError> errorCallback)
101
+ {
102
+ XDGAccountMobileImpl.GetInstance().GetUser((u) =>
103
+ {
104
+ XDGCommon.UserId = u.userId;
105
+ callback?.Invoke(u);
106
+ }, (error)=> errorCallback(error as XDGError));
107
+ }
108
+
109
+ void IXDGAccount.OpenUserCenter()
110
+ {
111
+ OpenUserCenter();
112
+ }
113
+
114
+ void IXDGAccount.OpenUnregister()
115
+ {
116
+ OpenUnregister();
117
+ }
118
+
119
+ void IXDGAccount.IsTokenActiveWithType(LoginType loginType, Action<bool> callback)
120
+ {
121
+ IsTokenActiveWithType(loginType, callback);
122
+ }
123
+
124
+ //除了 Default 和 Guest
125
+ public void BindByType(LoginType loginType, Action<bool, XDGError> callback)
126
+ {
127
+ XDGAccountMobileImpl.GetInstance().BindByType(loginType, (b, error)=> callback(b, error as XDGError));
128
+ }
129
+ #endregion
130
+ }
131
+ }
132
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 79e93cb99498a4778acc3f608e4f33cb
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant: