com.xd.sdk.account 6.29.0 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Plugins/Android/libs/XDGAccount_7.0.0.aar +0 -0
- package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGAccountBridge.java.meta → Plugins/Android/libs/XDGAccount_7.0.0.aar.meta} +2 -2
- package/Plugins/Android/libs/XDGBridgeAccount_v7_7.0.0.aar +0 -0
- package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnity.java.meta → Plugins/Android/libs/XDGBridgeAccount_v7_7.0.0.aar.meta} +2 -2
- package/Plugins/Android/libs/XDGSupport_7.0.0.aar +0 -0
- package/{Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnityImpl.java.meta → Plugins/Android/libs/XDGSupport_7.0.0.aar.meta} +2 -2
- package/Plugins/Android/libs.meta +1 -1
- package/Plugins/Android.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginHelper.h +2 -8
- package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginHelper.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK-Swift.h +329 -0
- package/Plugins/iOS/XDAccountSDK.framework/Headers/{TDSGlobalThirdPartyLoginManager.h.meta → XDAccountSDK-Swift.h.meta} +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK.h +1 -2
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDAccountSDK.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccount.h +29 -43
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccount.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountDefines.h +43 -0
- package/Plugins/iOS/XDAccountSDK.framework/Headers/{XDGPhoneAuthManager.h.meta → XDGAccountDefines.h.meta} +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountVersion.h +3 -3
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGAccountVersion.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLogger+Account.h +3 -0
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLogger+Account.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLoginEntriesConfig.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGLoginService.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGTapLoginPermissionDialog.h.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Headers.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Info.plist +0 -0
- package/Plugins/iOS/XDAccountSDK.framework/Info.plist.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo +0 -0
- package/Plugins/iOS/XDAccountSDK.framework/{Headers/XDGRoleInfo.h.meta → Modules/XDAccountSDK.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo.meta} +1 -1
- package/{Mobile/Http.meta → Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/Project.meta} +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.abi.json +9 -0
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.abi.json.meta +7 -0
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftdoc.meta +7 -0
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftmodule +0 -0
- package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftmodule.meta +7 -0
- package/{Mobile/Editor.meta → Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule.meta} +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Modules/module.modulemap.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/Modules.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework/XDAccountSDK +0 -0
- package/Plugins/iOS/XDAccountSDK.framework/XDAccountSDK.meta +1 -1
- package/Plugins/iOS/XDAccountSDK.framework.meta +4 -4
- package/Plugins/iOS.meta +1 -1
- package/Plugins.meta +1 -1
- package/Runtime/Internal/IXDGAccount.Extended.cs +11 -0
- package/{Mobile/Http/XDGAccountHttpConfigMobile.cs.meta → Runtime/Internal/IXDGAccount.Extended.cs.meta} +1 -1
- package/Runtime/Internal/Mobile/AccountFeaturesImpl.cs +348 -0
- package/{Mobile/User/UserManagerMobile.cs.meta → Runtime/Internal/Mobile/AccountFeaturesImpl.cs.meta} +1 -1
- package/Runtime/Internal/Mobile/Http/LoginSyncResponse.cs +14 -0
- package/Runtime/Internal/Mobile/Http/LoginSyncResponse.cs.meta +3 -0
- package/Runtime/Internal/Mobile/Http/MacAuthenticationInterceptor.cs +37 -0
- package/Runtime/Internal/Mobile/Http/MacAuthenticationInterceptor.cs.meta +3 -0
- package/Runtime/Internal/Mobile/Http.meta +3 -0
- package/{Mobile.meta → Runtime/Internal/Mobile.meta} +1 -1
- package/Runtime/Internal/Standalone/AccessToken/AccessTokenModule.cs +168 -0
- package/{Mobile/Editor/XDAccountMobileProcessBuild.cs.meta → Runtime/Internal/Standalone/AccessToken/AccessTokenModule.cs.meta} +1 -1
- package/Runtime/Internal/Standalone/AccessToken.meta +8 -0
- package/Runtime/Internal/Standalone/AccountCell.cs +143 -0
- package/{Mobile/XDGAccountMobile.cs.meta → Runtime/Internal/Standalone/AccountCell.cs.meta} +1 -1
- package/Runtime/Internal/Standalone/AccountFeaturesImpl.cs +461 -0
- package/Runtime/Internal/Standalone/AccountFeaturesImpl.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/AppleAuth.cs +27 -0
- package/Runtime/Internal/Standalone/Auth/AppleAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/FacebookAuth.cs +27 -0
- package/Runtime/Internal/Standalone/Auth/FacebookAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/GoogleAuth.cs +27 -0
- package/Runtime/Internal/Standalone/Auth/GoogleAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/GuestAuth.cs +22 -0
- package/Runtime/Internal/Standalone/Auth/GuestAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/PhoneAuth.cs +43 -0
- package/Runtime/Internal/Standalone/Auth/PhoneAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/SteamAuth.cs +90 -0
- package/Runtime/Internal/Standalone/Auth/SteamAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/TapAuth.cs +72 -0
- package/Runtime/Internal/Standalone/Auth/TapAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth/WebAuth.cs +144 -0
- package/Runtime/Internal/Standalone/Auth/WebAuth.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Auth.meta +8 -0
- package/Runtime/Internal/Standalone/Compliance/XDComplianceCode.cs +15 -0
- package/Runtime/Internal/Standalone/Compliance/XDComplianceCode.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Compliance.meta +8 -0
- package/Runtime/Internal/Standalone/LoginModule/Email/EmailModule.cs +374 -0
- package/Runtime/Internal/Standalone/LoginModule/Email/EmailModule.cs.meta +11 -0
- package/Runtime/Internal/Standalone/LoginModule/Email.meta +8 -0
- package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModule.cs +245 -0
- package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModule.cs.meta +11 -0
- package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModuleIO.cs +392 -0
- package/Runtime/Internal/Standalone/LoginModule/Phone/PhoneModuleIO.cs.meta +11 -0
- package/Runtime/Internal/Standalone/LoginModule/Phone.meta +8 -0
- package/Runtime/Internal/Standalone/LoginModule.meta +8 -0
- package/Runtime/Internal/Standalone/SupportModule/SupportModule.cs +228 -0
- package/Runtime/Internal/Standalone/SupportModule/SupportModule.cs.meta +3 -0
- package/Runtime/Internal/Standalone/SupportModule/SupportResponse.cs +27 -0
- package/Runtime/Internal/Standalone/SupportModule/SupportResponse.cs.meta +3 -0
- package/Runtime/Internal/Standalone/SupportModule.meta +3 -0
- package/Runtime/Internal/Standalone/Track/AliyunTrack.Login.cs +479 -0
- package/Runtime/Internal/Standalone/Track/AliyunTrack.Login.cs.meta +11 -0
- package/Runtime/Internal/Standalone/Track.meta +8 -0
- package/Runtime/Internal/Standalone/UI/CodeUnbindAlert.cs +156 -0
- package/Runtime/Internal/Standalone/UI/CodeUnbindAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/Email/EmailAlert.cs +295 -0
- package/Runtime/Internal/Standalone/UI/Email/EmailAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/Email.meta +8 -0
- package/Runtime/Internal/Standalone/UI/PhoneIO/AreaCodeCell.cs +46 -0
- package/Runtime/Internal/Standalone/UI/PhoneIO/AreaCodeCell.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/PhoneIO/PhoneAlertIO.cs +522 -0
- package/Runtime/Internal/Standalone/UI/PhoneIO/PhoneAlertIO.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/PhoneIO.meta +8 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/PhoneNumberInputAlert.cs +84 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/PhoneNumberInputAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/RiskControlAlert.cs +190 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/RiskControlAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/VerifyCodeInputAlert.cs +164 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification/VerifyCodeInputAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UI/PhoneVerification.meta +8 -0
- package/Runtime/Internal/Standalone/UI.meta +8 -0
- package/Runtime/Internal/Standalone/UserCenterAlert.cs +405 -0
- package/Runtime/Internal/Standalone/UserCenterAlert.cs.meta +11 -0
- package/Runtime/Internal/Standalone/UserModule.cs +604 -0
- package/Runtime/Internal/Standalone/UserModule.cs.meta +11 -0
- package/Runtime/Internal/Standalone/WebFunction/AccessTokenWebFunction.cs +47 -0
- package/Runtime/Internal/Standalone/WebFunction/AccessTokenWebFunction.cs.meta +3 -0
- package/Runtime/Internal/Standalone/WebFunction.meta +3 -0
- package/{Mobile/Plugins.meta → Runtime/Internal/Standalone.meta} +1 -1
- package/Runtime/Internal/XDGAccountEventHandler.cs +23 -0
- package/Runtime/Internal/XDGAccountEventHandler.cs.meta +3 -0
- package/Runtime/Internal/XDGAccountInternal.cs +86 -0
- package/Runtime/Internal/XDGAccountInternal.cs.meta +11 -0
- package/Runtime/Internal.meta +1 -1
- package/Runtime/Public/XDGAccount.Deprecated.cs +37 -0
- package/Runtime/Public/XDGAccount.Deprecated.cs.meta +11 -0
- package/Runtime/Public/XDGAccount.cs +107 -0
- package/Runtime/{XDGAccount.cs.meta → Public/XDGAccount.cs.meta} +1 -1
- package/Runtime/Public.meta +8 -0
- package/Runtime/XD.SDK.Account.asmdef +7 -2
- package/Runtime/XD.SDK.Account.asmdef.meta +1 -1
- package/Runtime.meta +1 -1
- package/package.json +5 -5
- package/package.json.meta +2 -2
- package/Mobile/Editor/XD.SDK.Account.Mobile.Editor.asmdef +0 -20
- package/Mobile/Editor/XD.SDK.Account.Mobile.Editor.asmdef.meta +0 -7
- package/Mobile/Editor/XDAccountMobileProcessBuild.cs +0 -20
- package/Mobile/Http/XDGAccountHttpConfigMobile.cs +0 -36
- package/Mobile/Plugins/Android/com/xd/account/bridge/XDGAccountBridge.java +0 -36
- package/Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnity.java +0 -16
- package/Mobile/Plugins/Android/com/xd/account/bridge/XDGLoginServiceUnityImpl.java +0 -20
- package/Mobile/Plugins/Android/com/xd/account/bridge.meta +0 -8
- package/Mobile/Plugins/Android/com/xd/account.meta +0 -8
- package/Mobile/Plugins/Android/com/xd.meta +0 -8
- package/Mobile/Plugins/Android/com.meta +0 -8
- package/Mobile/Plugins/Android.meta +0 -8
- package/Mobile/Plugins/iOS/XDAccountBridge.m +0 -29
- package/Mobile/Plugins/iOS/XDAccountBridge.m.meta +0 -37
- package/Mobile/Plugins/iOS/XDGLoginServiceUnity.h +0 -17
- package/Mobile/Plugins/iOS/XDGLoginServiceUnity.h.meta +0 -27
- package/Mobile/Plugins/iOS/XDGLoginServiceUnity.m +0 -23
- package/Mobile/Plugins/iOS/XDGLoginServiceUnity.m.meta +0 -37
- package/Mobile/Plugins/iOS.meta +0 -8
- package/Mobile/User/UserManagerMobile.cs +0 -45
- package/Mobile/User.meta +0 -8
- package/Mobile/XD.SDK.Account.Mobile.asmdef +0 -23
- package/Mobile/XD.SDK.Account.Mobile.asmdef.meta +0 -7
- package/Mobile/XDGAccountMobile.cs +0 -138
- package/Mobile/XDGAccountMobileImpl.cs +0 -444
- package/Mobile/XDGAccountMobileImpl.cs.meta +0 -11
- package/Mobile/XDGTokenManager.cs +0 -116
- package/Mobile/XDGTokenManager.cs.meta +0 -11
- package/Mobile/XDGUserWrapper.cs +0 -167
- package/Mobile/XDGUserWrapper.cs.meta +0 -11
- package/Plugins/Android/libs/XDGAccount_6.29.0.aar +0 -0
- package/Plugins/Android/libs/XDGAccount_6.29.0.aar.meta +0 -32
- package/Plugins/iOS/XDAccountSDK.framework/Headers/TDSGlobalThirdPartyLoginManager.h +0 -47
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGPhoneAuthManager.h +0 -33
- package/Plugins/iOS/XDAccountSDK.framework/Headers/XDGRoleInfo.h +0 -22
- package/README.md +0 -0
- package/README.md.meta +0 -7
- package/Runtime/Editor/XD.SDK.Account.Editor.asmdef +0 -19
- package/Runtime/Editor/XD.SDK.Account.Editor.asmdef.meta +0 -7
- package/Runtime/Editor/XDAccountProcessBuild.cs +0 -18
- package/Runtime/Editor/XDAccountProcessBuild.cs.meta +0 -11
- package/Runtime/Editor.meta +0 -8
- package/Runtime/IXDGAccount.cs +0 -44
- package/Runtime/IXDGAccount.cs.meta +0 -11
- package/Runtime/Internal/Http/IXDAccountHttpConfig.cs +0 -9
- package/Runtime/Internal/Http/IXDAccountHttpConfig.cs.meta +0 -11
- package/Runtime/Internal/Http/XDAccountHttpConfig.cs +0 -32
- package/Runtime/Internal/Http/XDAccountHttpConfig.cs.meta +0 -11
- package/Runtime/Internal/Http.meta +0 -8
- package/Runtime/Internal/User/IUserManagerPlatformWrapper.cs +0 -7
- package/Runtime/Internal/User/IUserManagerPlatformWrapper.cs.meta +0 -11
- package/Runtime/Internal/User.meta +0 -8
- package/Runtime/UserManager.cs +0 -35
- package/Runtime/UserManager.cs.meta +0 -11
- package/Runtime/XDGAccessToken.cs +0 -18
- package/Runtime/XDGAccessToken.cs.meta +0 -11
- package/Runtime/XDGAccount.cs +0 -130
- package/Runtime/XDGLoginType.cs +0 -17
- package/Runtime/XDGLoginType.cs.meta +0 -11
- package/Runtime/XDGRoleInfo.cs +0 -24
- package/Runtime/XDGRoleInfo.cs.meta +0 -11
- package/Runtime/XDGUser.cs +0 -30
- package/Runtime/XDGUser.cs.meta +0 -11
- package/Runtime/XDGUserStatusCode.cs +0 -16
- package/Runtime/XDGUserStatusCode.cs.meta +0 -11
|
Binary file
|
|
Binary file
|
package/Plugins/iOS/XDAccountSDK.framework/Modules/XDAccountSDK.swiftmodule/arm64-apple-ios.swiftdoc
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
fileFormatVersion: 2
|
|
2
|
-
guid:
|
|
3
|
-
folderAsset: yes
|
|
2
|
+
guid: 09e48b6e2e314ff5b645259afc9bedec
|
|
4
3
|
PluginImporter:
|
|
5
4
|
externalObjects: {}
|
|
6
5
|
serializedVersion: 2
|
|
@@ -8,7 +7,7 @@ PluginImporter:
|
|
|
8
7
|
executionOrder: {}
|
|
9
8
|
defineConstraints: []
|
|
10
9
|
isPreloaded: 0
|
|
11
|
-
isOverridable:
|
|
10
|
+
isOverridable: 1
|
|
12
11
|
isExplicitlyReferenced: 0
|
|
13
12
|
validateReferences: 1
|
|
14
13
|
platformData:
|
|
@@ -21,6 +20,7 @@ PluginImporter:
|
|
|
21
20
|
Exclude Editor: 1
|
|
22
21
|
Exclude Linux64: 1
|
|
23
22
|
Exclude OSXUniversal: 1
|
|
23
|
+
Exclude WebGL: 1
|
|
24
24
|
Exclude Win: 1
|
|
25
25
|
Exclude Win64: 1
|
|
26
26
|
Exclude iOS: 0
|
|
@@ -72,7 +72,7 @@ PluginImporter:
|
|
|
72
72
|
second:
|
|
73
73
|
enabled: 1
|
|
74
74
|
settings:
|
|
75
|
-
AddToEmbeddedBinaries:
|
|
75
|
+
AddToEmbeddedBinaries: true
|
|
76
76
|
CPU: AnyCPU
|
|
77
77
|
CompileFlags:
|
|
78
78
|
FrameworkDependencies:
|
package/Plugins/iOS.meta
CHANGED
package/Plugins.meta
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
using System.Collections.Generic;
|
|
2
|
+
using System.Net.Http;
|
|
3
|
+
using System.Threading.Tasks;
|
|
4
|
+
|
|
5
|
+
namespace XD.SDK.Account
|
|
6
|
+
{
|
|
7
|
+
interface IXDGAccountExtended : IXDGAccount
|
|
8
|
+
{
|
|
9
|
+
Task<Dictionary<string, string>> GetRequestAuthorizationHeader(HttpRequestMessage request, long timestamp);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
#if UNITY_ANDROID || UNITY_IOS
|
|
2
|
+
using System;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using System.Net.Http;
|
|
5
|
+
using System.Runtime.InteropServices;
|
|
6
|
+
using System.Threading.Tasks;
|
|
7
|
+
using Newtonsoft.Json;
|
|
8
|
+
using UnityEngine;
|
|
9
|
+
using XD.SDK.Account.Internal.Http;
|
|
10
|
+
using XD.SDK.Common;
|
|
11
|
+
using XD.SDK.Common.Internal;
|
|
12
|
+
using XD.SDK.Common.Internal.Events;
|
|
13
|
+
using XD.SDK.Common.Internal.Http;
|
|
14
|
+
using XD.SDK.Common.Internal.Mobile;
|
|
15
|
+
using XD.SDK.Common.Internal.Mobile.Bridge;
|
|
16
|
+
|
|
17
|
+
namespace XD.SDK.Account.Internal.Mobile
|
|
18
|
+
{
|
|
19
|
+
public class AccountFeaturesImpl : IXDGAccountExtended
|
|
20
|
+
{
|
|
21
|
+
private static AccountFeaturesImpl _instance;
|
|
22
|
+
|
|
23
|
+
private static readonly object LockObj = new object();
|
|
24
|
+
|
|
25
|
+
private const string LoginSynUrl = "/api/login/v1/syn";
|
|
26
|
+
|
|
27
|
+
private readonly Lazy<IHttpClient> defaultClient = new Lazy<IHttpClient>(() =>
|
|
28
|
+
XDHttpClientFactory.GetClient(nameof(AccountFeaturesImpl),
|
|
29
|
+
() =>
|
|
30
|
+
{
|
|
31
|
+
return XDHttpClientFactory.CreateClient(XDGHost.CreateBaseHost(XDGCommonInternal.IsCn()), builder =>
|
|
32
|
+
{
|
|
33
|
+
builder
|
|
34
|
+
.Timeout(TimeSpan.FromSeconds(10))
|
|
35
|
+
.WithLogging()
|
|
36
|
+
.AddInterceptor(new CommonParamsInterceptor())
|
|
37
|
+
.AddInterceptor(new UrlBuildInterceptor())
|
|
38
|
+
.AddInterceptor(new MacAuthenticationInterceptor())
|
|
39
|
+
.Build();
|
|
40
|
+
});
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
private IHttpClient HttpClient => defaultClient.Value;
|
|
45
|
+
|
|
46
|
+
public static AccountFeaturesImpl Instance
|
|
47
|
+
{
|
|
48
|
+
get
|
|
49
|
+
{
|
|
50
|
+
if (_instance == null)
|
|
51
|
+
{
|
|
52
|
+
lock (LockObj)
|
|
53
|
+
{
|
|
54
|
+
if (_instance == null)
|
|
55
|
+
{
|
|
56
|
+
_instance = new AccountFeaturesImpl();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return _instance;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
private AccountFeaturesImpl()
|
|
67
|
+
{
|
|
68
|
+
EngineBridge.GetInstance()
|
|
69
|
+
.Register(BridgeConstants.Account.ServiceName, BridgeConstants.Account.ServiceImpl);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public void AddUserStatusChangeCallback(Action<XDGUserStatusCodeType, string> callback)
|
|
73
|
+
{
|
|
74
|
+
var command = new Command.Builder()
|
|
75
|
+
.Service(BridgeConstants.Account.BridgeName)
|
|
76
|
+
.Method("addUserStatusChangeCallback")
|
|
77
|
+
.Callback(true)
|
|
78
|
+
.OnceTime(false)
|
|
79
|
+
.CommandBuilder();
|
|
80
|
+
EngineBridge.GetInstance().CallHandler(command, (result) =>
|
|
81
|
+
{
|
|
82
|
+
if (!XDGTool.CheckResultSuccess(result))
|
|
83
|
+
{
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
var dic = XDGJson.Deserialize(result.content) as Dictionary<string, object>;
|
|
88
|
+
var code = XDDictionary.GetValue<int>(dic, "code");
|
|
89
|
+
var message = XDDictionary.GetValue<string>(dic, "message");
|
|
90
|
+
callback((XDGUserStatusCodeType)code, message);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
public void LoginByType(LoginType loginType, Action<XDGUser> callback, Action<XDGError> errorCallback)
|
|
95
|
+
{
|
|
96
|
+
var command = new Command.Builder()
|
|
97
|
+
.Service(BridgeConstants.Account.BridgeName)
|
|
98
|
+
.Method("loginByType")
|
|
99
|
+
.Args("loginType", loginType.FormatString()) //和app交互用的是字符串,如TapTap
|
|
100
|
+
.Callback(true)
|
|
101
|
+
.OnceTime(true)
|
|
102
|
+
.CommandBuilder();
|
|
103
|
+
|
|
104
|
+
EngineBridge.GetInstance().CallHandler(command, async result =>
|
|
105
|
+
{
|
|
106
|
+
var xdgError = result.Parse2XDGError();
|
|
107
|
+
if (xdgError != null)
|
|
108
|
+
{
|
|
109
|
+
errorCallback(xdgError);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
var contentDic = XDGJson.Deserialize(result.content) as Dictionary<string, object>;
|
|
114
|
+
var userDic = XDDictionary.GetValue<Dictionary<string, object>>(contentDic, "user");
|
|
115
|
+
if (userDic != null)
|
|
116
|
+
{
|
|
117
|
+
var user = new XDGUser(userDic);
|
|
118
|
+
await SyncTdsUser(user);
|
|
119
|
+
if (loginType == LoginType.Default)
|
|
120
|
+
{
|
|
121
|
+
RefreshFacebookToken();
|
|
122
|
+
}
|
|
123
|
+
else if (loginType == LoginType.Facebook)
|
|
124
|
+
{
|
|
125
|
+
XDGEventBus.Publish(XDGEvents.TdsSDKRefreshFacebookTime);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
callback(user);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
errorCallback(new XDGError(ResponseCode.Common.Failed, "user is null"));
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
public void LoginByConsole(Action<XDGUser> successCallback, Action failCallback, Action<XDGError> errorCallback)
|
|
137
|
+
{
|
|
138
|
+
errorCallback(new XDGError(ResponseCode.Common.UnavailableService, "该平台不支持主机登录"));
|
|
139
|
+
Debug.LogError($"该平台:{Application.platform}不支持主机登录");
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
public void Logout()
|
|
143
|
+
{
|
|
144
|
+
var command = new Command.Builder()
|
|
145
|
+
.Service(BridgeConstants.Account.BridgeName)
|
|
146
|
+
.Method("logout")
|
|
147
|
+
.Callback(false)
|
|
148
|
+
.OnceTime(true)
|
|
149
|
+
.CommandBuilder();
|
|
150
|
+
EngineBridge.GetInstance().CallHandler(command);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
public XDGUser GetCurrentUser()
|
|
154
|
+
{
|
|
155
|
+
XDGUser resultUser = null;
|
|
156
|
+
string currentUserString = null;
|
|
157
|
+
#if UNITY_ANDROID
|
|
158
|
+
using (var accountBridgeClass = new AndroidJavaClass(BridgeConstants.Account.BridgeStaticImpl))
|
|
159
|
+
{
|
|
160
|
+
currentUserString = accountBridgeClass.CallStatic<string>("getCurrentUser");
|
|
161
|
+
}
|
|
162
|
+
#elif UNITY_IOS
|
|
163
|
+
IntPtr ptr = XDAccountBridgeGetUser();
|
|
164
|
+
currentUserString = Marshal.PtrToStringAnsi(ptr);
|
|
165
|
+
#endif
|
|
166
|
+
if (!string.IsNullOrEmpty(currentUserString))
|
|
167
|
+
{
|
|
168
|
+
try
|
|
169
|
+
{
|
|
170
|
+
resultUser = new XDGUser(currentUserString);
|
|
171
|
+
}
|
|
172
|
+
catch (Exception e)
|
|
173
|
+
{
|
|
174
|
+
XDGLogger.Warn("convert current user error" + e.Message);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return resultUser;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
#if UNITY_IOS
|
|
182
|
+
[DllImport("__Internal")]
|
|
183
|
+
private static extern IntPtr XDAccountBridgeGetUser();
|
|
184
|
+
#endif
|
|
185
|
+
|
|
186
|
+
public void OpenCustomerService(XDGRoleInfo roleInfo, string path, Dictionary<string, object> paramsMap)
|
|
187
|
+
{
|
|
188
|
+
var command = new Command.Builder()
|
|
189
|
+
.Service(BridgeConstants.Account.BridgeName)
|
|
190
|
+
.Method("openCustomerService")
|
|
191
|
+
.Args(XDUtility.BridgeArgToDictionary("openCustomerService", roleInfo))
|
|
192
|
+
.Args("path", path)
|
|
193
|
+
.Args("params", paramsMap)
|
|
194
|
+
.Callback(false)
|
|
195
|
+
.OnceTime(true)
|
|
196
|
+
.CommandBuilder();
|
|
197
|
+
EngineBridge.GetInstance().CallHandler(command);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
public void OpenUserCenter()
|
|
201
|
+
{
|
|
202
|
+
var command = new Command.Builder()
|
|
203
|
+
.Service(BridgeConstants.Account.BridgeName)
|
|
204
|
+
.Method("openUserCenter")
|
|
205
|
+
.Callback(false)
|
|
206
|
+
.OnceTime(true)
|
|
207
|
+
.CommandBuilder();
|
|
208
|
+
EngineBridge.GetInstance().CallHandler(command);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
public void OpenUserDashboard(XDGRoleInfo roleInfo)
|
|
212
|
+
{
|
|
213
|
+
var command = new Command.Builder()
|
|
214
|
+
.Service(BridgeConstants.Account.BridgeName)
|
|
215
|
+
.Method("openUserDashboard")
|
|
216
|
+
.Args(XDUtility.BridgeArgToDictionary("openUserDashboard", roleInfo))
|
|
217
|
+
.Callback(false)
|
|
218
|
+
.OnceTime(true)
|
|
219
|
+
.CommandBuilder();
|
|
220
|
+
EngineBridge.GetInstance().CallHandler(command);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
public void OpenAccountDeletion()
|
|
224
|
+
{
|
|
225
|
+
var command = new Command.Builder()
|
|
226
|
+
.Service(BridgeConstants.Account.BridgeName)
|
|
227
|
+
.Method("openAccountDeletion")
|
|
228
|
+
.Callback(false)
|
|
229
|
+
.OnceTime(true)
|
|
230
|
+
.CommandBuilder();
|
|
231
|
+
EngineBridge.GetInstance().CallHandler(command);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
public void BindByType(LoginType loginType, Action<bool, XDGError> callback)
|
|
235
|
+
{
|
|
236
|
+
var command = new Command.Builder()
|
|
237
|
+
.Service(BridgeConstants.Account.BridgeName)
|
|
238
|
+
.Method("bindByType")
|
|
239
|
+
.Args("bindByType", loginType.FormatString())
|
|
240
|
+
.Callback(true)
|
|
241
|
+
.OnceTime(true)
|
|
242
|
+
.CommandBuilder();
|
|
243
|
+
|
|
244
|
+
EngineBridge.GetInstance().CallHandler(command, result =>
|
|
245
|
+
{
|
|
246
|
+
XDGLogger.Debug("bindByType 方法结果: " + result.ToJson());
|
|
247
|
+
|
|
248
|
+
var xdgError = result.Parse2XDGError();
|
|
249
|
+
if (xdgError != null)
|
|
250
|
+
{
|
|
251
|
+
callback(false, xdgError);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
var contentDic = XDGJson.Deserialize(result.content) as Dictionary<string, object>;
|
|
256
|
+
var success = XDDictionary.GetValue<bool>(contentDic, "success");
|
|
257
|
+
|
|
258
|
+
callback(success, null);
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
public async Task<Dictionary<string, string>> GetRequestAuthorizationHeader(HttpRequestMessage request, long timestamp)
|
|
263
|
+
{
|
|
264
|
+
var url = request.RequestUri.AbsoluteUri;
|
|
265
|
+
var method = request.Method.ToString().ToUpper();
|
|
266
|
+
var authorization = "";
|
|
267
|
+
#if UNITY_ANDROID
|
|
268
|
+
using (var accountBridgeClass = new AndroidJavaClass(BridgeConstants.Account.BridgeStaticImpl))
|
|
269
|
+
{
|
|
270
|
+
authorization = accountBridgeClass.CallStatic<string>("getRequestAuthorizationHeaderString", url, method, timestamp);
|
|
271
|
+
}
|
|
272
|
+
#elif UNITY_IOS
|
|
273
|
+
IntPtr ptr = XDAccountBridgeGetAuthorization(url, method, timestamp);
|
|
274
|
+
authorization = Marshal.PtrToStringAnsi(ptr);
|
|
275
|
+
#endif
|
|
276
|
+
if (string.IsNullOrEmpty(authorization))
|
|
277
|
+
{
|
|
278
|
+
return new Dictionary<string, string>();
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
return new Dictionary<string, string>
|
|
282
|
+
{
|
|
283
|
+
{ "Authorization", authorization }
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
#if UNITY_IOS
|
|
287
|
+
[DllImport("__Internal")]
|
|
288
|
+
private static extern IntPtr XDAccountBridgeGetAuthorization(string url, string method, long timestamp);
|
|
289
|
+
#endif
|
|
290
|
+
|
|
291
|
+
private async Task SyncTdsUser(XDGUser user)
|
|
292
|
+
{
|
|
293
|
+
var bHasTdsUser = ReflectionUtils.FindType("TapTap.Bootstrap.TDSUser", "XD.SDK.TDSWrapper") != null;
|
|
294
|
+
if (!bHasTdsUser)
|
|
295
|
+
{
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
try
|
|
300
|
+
{
|
|
301
|
+
var result = await XDGEventBus.PublishAsync<Dictionary<string, object>>(XDGEvents.TdsSDKGetUser);
|
|
302
|
+
var objectId = XDDictionary.GetValue<string>(result, "objectId");
|
|
303
|
+
if (objectId == user.UserId)
|
|
304
|
+
{
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
//TODO 同步之前先退登 TDSUser
|
|
309
|
+
XDGEventBus.Publish(XDGEvents.TdsSDKLogout);
|
|
310
|
+
var response = await HttpClient.PostAsync<LoginSyncResponse>(LoginSynUrl);
|
|
311
|
+
var sessionToken = XDDictionary.GetValue<string>(response.Data, "sessionToken");
|
|
312
|
+
if (string.IsNullOrEmpty(sessionToken))
|
|
313
|
+
{
|
|
314
|
+
XDGLogger.Warn("[SyncTDSUser] sessionToken is Null!");
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
XDGEventBus.Publish(XDGEvents.TdsSDKSyncUser, sessionToken, user.UserId);
|
|
319
|
+
}
|
|
320
|
+
catch (Exception e)
|
|
321
|
+
{
|
|
322
|
+
XDGLogger.Warn($"[SyncTDSUser] error:{e.Message}");
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
private void RefreshFacebookToken()
|
|
327
|
+
{
|
|
328
|
+
#if UNITY_ANDROID
|
|
329
|
+
using (var accountBridgeClass = new AndroidJavaClass(BridgeConstants.Account.BridgeStaticImpl))
|
|
330
|
+
{
|
|
331
|
+
var fbToken = accountBridgeClass.CallStatic<string>("getFacebookToken");
|
|
332
|
+
XDGLogger.Debug($"[GetFacebookToken] fbToken:{fbToken}");
|
|
333
|
+
var tokenDic = JsonConvert.DeserializeObject<Dictionary<string, object>>(fbToken);
|
|
334
|
+
if (tokenDic.ContainsKey("error"))
|
|
335
|
+
{
|
|
336
|
+
XDGLogger.Warn($"[GetFacebookToken] error:{JsonConvert.SerializeObject(tokenDic)}");
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
var token = XDDictionary.GetValue<string>(tokenDic, "access_token");
|
|
340
|
+
var userId = XDDictionary.GetValue<string>(tokenDic, "userID");
|
|
341
|
+
XDGEventBus.Publish(XDGEvents.TdsSDKSyncFacebookToken, token, userId);
|
|
342
|
+
}
|
|
343
|
+
#endif
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
#endif
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#if UNITY_IOS || UNITY_ANDROID
|
|
2
|
+
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using Newtonsoft.Json;
|
|
5
|
+
using XD.SDK.Common.Internal;
|
|
6
|
+
|
|
7
|
+
namespace XD.SDK.Account.Internal.Http
|
|
8
|
+
{
|
|
9
|
+
public class LoginSyncResponse : BaseResponse
|
|
10
|
+
{
|
|
11
|
+
[JsonProperty("data")] public Dictionary<string, object> Data;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
#endif
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#if UNITY_IOS || UNITY_ANDROID
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.Net.Http;
|
|
4
|
+
using System.Threading;
|
|
5
|
+
using System.Threading.Tasks;
|
|
6
|
+
using Newtonsoft.Json;
|
|
7
|
+
using XD.SDK.Common;
|
|
8
|
+
using XD.SDK.Common.Internal;
|
|
9
|
+
using XD.SDK.Common.Internal.Http;
|
|
10
|
+
|
|
11
|
+
namespace XD.SDK.Account.Internal.Mobile
|
|
12
|
+
{
|
|
13
|
+
public class MacAuthenticationInterceptor : HttpInterceptor
|
|
14
|
+
{
|
|
15
|
+
protected override async Task BeforeRequestAsync(IHttpRequest request, CancellationToken cancellationToken)
|
|
16
|
+
{
|
|
17
|
+
XDGLogger.Debug($"[MacAuthenticationInterceptor] request Url: {JsonConvert.SerializeObject(request.Url)}");
|
|
18
|
+
|
|
19
|
+
var authDic = await GetMacToken(request.Url, request.Method);
|
|
20
|
+
var authToken = "";
|
|
21
|
+
authDic?.TryGetValue("Authorization", out authToken);
|
|
22
|
+
if (authToken != null && !string.IsNullOrEmpty(authToken))
|
|
23
|
+
{
|
|
24
|
+
request.Headers["Authorization"] = authToken;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
XDGLogger.Debug($"[MacAuthenticationInterceptor] request Headers: {JsonConvert.SerializeObject(request.Headers)}");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
private static Task<Dictionary<string, string>> GetMacToken(string requestUrl, HttpMethod method)
|
|
31
|
+
{
|
|
32
|
+
var httpMessage = new HttpRequestMessage(method, requestUrl);
|
|
33
|
+
return AccountFeaturesImpl.Instance.GetRequestAuthorizationHeader(httpMessage, ServerTime.GetTimestamp());
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
#endif
|