com.taptap.sdk.login 4.8.4-beta.0 → 4.8.4-beta.2
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/Mobile/Editor/NativeDependencies.xml +3 -4
- package/Mobile/Editor/TapLoginIOSProcessor.cs +107 -49
- package/Mobile/Editor/TapLoginMobileProcessBuild.cs +20 -20
- package/Mobile/Runtime/AccountWrapper.cs +108 -5
- package/Mobile/Runtime/TapTapLoginImpl.cs +98 -8
- package/Runtime/Public/TapTapLogin.cs +1 -1
- package/Standalone/Editor/TapLoginStandaloneProcessBuild.cs +21 -21
- package/Standalone/Runtime/Internal2/Http/Response/ProfileResponse.cs +23 -23
- package/Standalone/Runtime/Internal2/Http/Response/QRCodeResponse.cs +16 -16
- package/Standalone/Runtime/Internal2/Http/Response/TokenResponse.cs +28 -28
- package/Standalone/Runtime/Internal2/LoginService.cs +192 -192
- package/Standalone/Runtime/Internal2/QRCodeUtils.cs +50 -50
- package/Standalone/Runtime/Internal2/UI/ClientButtonListener.cs +20 -20
- package/Standalone/Runtime/Internal2/UI/LoginPanelController.cs +71 -71
- package/Standalone/Runtime/Internal2/UI/QRCodeController.cs +180 -180
- package/Standalone/Runtime/Internal2/UI/TitleController.cs +20 -20
- package/Standalone/Runtime/Internal2/UI/WebController.cs +128 -128
- package/Standalone/Runtime/TapSDK.Login.Standalone.Runtime.asmdef +0 -2
- package/package.json +9 -9
- package/link.xml +0 -4
- package/link.xml.meta +0 -7
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
2
2
|
<dependencies>
|
|
3
3
|
<androidPackages>
|
|
4
4
|
<repositories>
|
|
5
5
|
<repository>https://repo.maven.apache.org/maven2</repository>
|
|
6
6
|
</repositories>
|
|
7
|
-
<androidPackage spec="com.taptap.sdk:tap-login-unity:4.8.4
|
|
7
|
+
<androidPackage spec="com.taptap.sdk:tap-login-unity:4.8.4" />
|
|
8
8
|
</androidPackages>
|
|
9
9
|
<iosPods>
|
|
10
10
|
<sources>
|
|
11
11
|
<source>https://github.com/CocoaPods/Specs.git</source>
|
|
12
12
|
</sources>
|
|
13
|
-
<iosPod addToAllTargets="false" bitcodeEnabled="false" name="
|
|
14
|
-
<iosPod addToAllTargets="false" bitcodeEnabled="false" name="TapTapGidSDK" version="4.8.4-beta.0"/>
|
|
13
|
+
<iosPod addToAllTargets="false" bitcodeEnabled="false" name="TapTapSDK/Login" version="4.8.4" />
|
|
15
14
|
</iosPods>
|
|
16
15
|
</dependencies>
|
|
@@ -11,81 +11,139 @@ using UnityEngine;
|
|
|
11
11
|
namespace TapSDK.Login.Editor
|
|
12
12
|
{
|
|
13
13
|
#if UNITY_IOS || UNITY_STANDALONE_OSX
|
|
14
|
+
/// <summary>
|
|
15
|
+
/// TapTap Login iOS/macOS 平台构建后处理器
|
|
16
|
+
/// 用于在 Unity 构建完成后自动配置 Xcode 项目:
|
|
17
|
+
/// 1. 合并 TDS-Info.plist 配置到应用的 Info.plist
|
|
18
|
+
/// 2. 添加 TapTapLoginResource.bundle 资源包到 Xcode 项目
|
|
19
|
+
/// </summary>
|
|
14
20
|
public static class TapLoginIOSProcessor
|
|
15
21
|
{
|
|
16
|
-
|
|
22
|
+
#region Constants
|
|
23
|
+
|
|
24
|
+
/// <summary>TapSDK 配置文件名</summary>
|
|
25
|
+
private const string TDS_INFO_PLIST_NAME = "TDS-Info.plist";
|
|
26
|
+
|
|
27
|
+
/// <summary>TapSDK 配置文件搜索路径(相对于项目根目录)</summary>
|
|
28
|
+
private const string TDS_INFO_SEARCH_PATH = "/Assets/Plugins/";
|
|
29
|
+
|
|
30
|
+
/// <summary>TapTap Login 资源包名称</summary>
|
|
31
|
+
private const string LOGIN_RESOURCE_BUNDLE_NAME = "TapTapLoginResource";
|
|
32
|
+
|
|
33
|
+
/// <summary>TapTap Login 包标识符</summary>
|
|
34
|
+
private const string LOGIN_PACKAGE_ID = "com.taptap.sdk.login";
|
|
35
|
+
|
|
36
|
+
/// <summary>TapTap Login 模块名称</summary>
|
|
37
|
+
private const string LOGIN_MODULE_NAME = "Login";
|
|
38
|
+
|
|
39
|
+
/// <summary>TapTap Login 资源包文件名</summary>
|
|
40
|
+
private const string LOGIN_RESOURCE_BUNDLE_FILE = "TapTapLoginResource.bundle";
|
|
41
|
+
|
|
42
|
+
/// <summary>Xcode 项目文件扩展名</summary>
|
|
43
|
+
private const string XCODE_PROJECT_EXTENSION = ".xcodeproj";
|
|
44
|
+
|
|
45
|
+
/// <summary>Xcode 项目配置文件名</summary>
|
|
46
|
+
private const string XCODE_PROJECT_FILE = "project.pbxproj";
|
|
47
|
+
|
|
48
|
+
#endregion
|
|
49
|
+
|
|
50
|
+
/// <summary>
|
|
51
|
+
/// Unity 构建后处理回调
|
|
52
|
+
/// 在 iOS 或 macOS 平台构建完成后自动执行,配置 Xcode 项目
|
|
53
|
+
/// </summary>
|
|
54
|
+
/// <param name="buildTarget">构建目标平台</param>
|
|
55
|
+
/// <param name="path">构建输出路径(iOS 为 Xcode 项目目录,macOS 为 .app 路径)</param>
|
|
17
56
|
[PostProcessBuild(103)]
|
|
18
57
|
public static void OnPostprocessBuild(BuildTarget buildTarget, string path)
|
|
19
58
|
{
|
|
20
|
-
|
|
59
|
+
// 只处理 iOS 和 macOS 平台
|
|
60
|
+
if (buildTarget != BuildTarget.iOS && buildTarget != BuildTarget.StandaloneOSX)
|
|
61
|
+
{
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
21
64
|
|
|
22
|
-
|
|
65
|
+
// 查找 TDS-Info.plist 配置文件
|
|
66
|
+
var parentFolder = Directory.GetParent(Application.dataPath)?.FullName;
|
|
67
|
+
var plistSearchPath = parentFolder + TDS_INFO_SEARCH_PATH;
|
|
68
|
+
var plistFile = TapFileHelper.RecursionFilterFile(plistSearchPath, TDS_INFO_PLIST_NAME);
|
|
23
69
|
|
|
24
70
|
if (plistFile == null || !plistFile.Exists)
|
|
25
71
|
{
|
|
26
|
-
Debug.LogError("TapSDK Can't find
|
|
72
|
+
Debug.LogError($"TapSDK Can't find {TDS_INFO_PLIST_NAME} in {plistSearchPath}!");
|
|
73
|
+
return;
|
|
27
74
|
}
|
|
28
75
|
|
|
29
|
-
|
|
30
|
-
if (buildTarget
|
|
76
|
+
// 处理 iOS 平台
|
|
77
|
+
if (buildTarget == BuildTarget.iOS)
|
|
31
78
|
{
|
|
32
79
|
#if UNITY_IOS
|
|
33
|
-
|
|
80
|
+
// 合并 TDS-Info.plist 到 iOS 应用的 Info.plist
|
|
81
|
+
TapSDKCoreCompile.HandlerPlist(Path.GetFullPath(path), plistFile.FullName);
|
|
82
|
+
|
|
83
|
+
// 添加 TapTapLoginResource.bundle 到 Xcode 项目
|
|
84
|
+
AddLoginResourceBundle(path);
|
|
34
85
|
#endif
|
|
35
86
|
}
|
|
36
|
-
|
|
87
|
+
// 处理 macOS 平台
|
|
88
|
+
else if (buildTarget == BuildTarget.StandaloneOSX)
|
|
37
89
|
{
|
|
38
|
-
Debug.Log($"path:{path}");
|
|
39
|
-
Debug.Log($"path:{Path.GetFullPath(path)}");
|
|
40
|
-
Debug.Log($"dir:{Path.GetDirectoryName(path)}");
|
|
41
|
-
Debug.Log($"dir:{Path.GetFileName(path)}");
|
|
42
|
-
// 获得工程路径
|
|
43
|
-
#if UNITY_2020_1_OR_NEWER
|
|
44
|
-
var directory = Path.GetDirectoryName(path);
|
|
45
|
-
if (string.IsNullOrEmpty(directory))
|
|
46
|
-
{
|
|
47
|
-
directory = "";
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
var fileName = Path.GetFileName(path);
|
|
51
|
-
if (!fileName.EndsWith(".xcodeproj"))
|
|
52
|
-
{
|
|
53
|
-
fileName += ".xcodeproj";
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
var projPath = Path.Combine(directory, $"{fileName}/project.pbxproj");
|
|
57
|
-
#elif UNITY_2019_1_OR_NEWER
|
|
58
|
-
var projPath = Path.Combine(path, "project.pbxproj");
|
|
59
|
-
#else
|
|
60
|
-
#endif
|
|
61
90
|
#if UNITY_IOS
|
|
91
|
+
// 合并 TDS-Info.plist 到 macOS 应用的 Info.plist
|
|
62
92
|
TapSDKCoreCompile.HandlerPlist(Path.GetFullPath(path), plistFile.FullName, true);
|
|
63
93
|
#endif
|
|
64
94
|
}
|
|
65
|
-
|
|
95
|
+
}
|
|
96
|
+
|
|
66
97
|
#if UNITY_IOS
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
98
|
+
/// <summary>
|
|
99
|
+
/// 将 TapTapLoginResource.bundle 添加到 iOS Xcode 项目
|
|
100
|
+
/// 包含登录界面所需的图片、文本等资源
|
|
101
|
+
/// </summary>
|
|
102
|
+
/// <param name="buildPath">Xcode 项目构建路径</param>
|
|
103
|
+
private static void AddLoginResourceBundle(string buildPath)
|
|
104
|
+
{
|
|
105
|
+
try
|
|
71
106
|
{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
107
|
+
// 获取 Xcode 项目文件路径
|
|
108
|
+
var projPath = TapSDKCoreCompile.GetProjPath(buildPath);
|
|
109
|
+
var proj = TapSDKCoreCompile.ParseProjPath(projPath);
|
|
110
|
+
|
|
111
|
+
// 获取 Unity-iPhone target
|
|
112
|
+
var target = TapSDKCoreCompile.GetUnityTarget(proj);
|
|
113
|
+
if (TapSDKCoreCompile.CheckTarget(target))
|
|
114
|
+
{
|
|
115
|
+
Debug.LogError("TapLogin: Unity-iPhone target is null, cannot add resource bundle");
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// 添加资源包到 Xcode 项目
|
|
120
|
+
bool success = TapSDKCoreCompile.HandlerIOSSetting(
|
|
121
|
+
buildPath,
|
|
76
122
|
Application.dataPath,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
new[] {
|
|
81
|
-
target,
|
|
123
|
+
LOGIN_RESOURCE_BUNDLE_NAME,
|
|
124
|
+
LOGIN_PACKAGE_ID,
|
|
125
|
+
LOGIN_MODULE_NAME,
|
|
126
|
+
new[] { LOGIN_RESOURCE_BUNDLE_FILE },
|
|
127
|
+
target,
|
|
128
|
+
projPath,
|
|
129
|
+
proj
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
if (success)
|
|
133
|
+
{
|
|
134
|
+
Debug.Log($"TapLogin: Successfully added {LOGIN_RESOURCE_BUNDLE_FILE} to Xcode project");
|
|
135
|
+
}
|
|
136
|
+
else
|
|
137
|
+
{
|
|
138
|
+
Debug.LogWarning($"TapLogin: Failed to add {LOGIN_RESOURCE_BUNDLE_FILE} to Xcode project");
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch (Exception ex)
|
|
82
142
|
{
|
|
83
|
-
Debug.
|
|
84
|
-
return;
|
|
143
|
+
Debug.LogError($"TapLogin: Exception while adding resource bundle: {ex.Message}");
|
|
85
144
|
}
|
|
86
|
-
Debug.LogWarning("TapLogin add Bundle Failed!");
|
|
87
|
-
#endif
|
|
88
145
|
}
|
|
146
|
+
#endif
|
|
89
147
|
}
|
|
90
148
|
#endif
|
|
91
149
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
using System;
|
|
2
|
-
using UnityEditor.Build.Reporting;
|
|
3
|
-
using TapSDK.Core.Editor;
|
|
4
|
-
|
|
5
|
-
namespace TapSDK.Login.Mobile.Editor {
|
|
6
|
-
public class TapLoginMobileProcessBuild : SDKLinkProcessBuild {
|
|
7
|
-
public override int callbackOrder => 0;
|
|
8
|
-
|
|
9
|
-
public override string LinkPath => "TapSDK/Login/link.xml";
|
|
10
|
-
|
|
11
|
-
public override LinkedAssembly[] LinkedAssemblies => new LinkedAssembly[] {
|
|
12
|
-
new LinkedAssembly { Fullname = "TapSDK.Login.Runtime" },
|
|
13
|
-
new LinkedAssembly { Fullname = "TapSDK.Login.Mobile.Runtime" }
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
public override Func<BuildReport, bool> IsTargetPlatform => (report) => {
|
|
17
|
-
return BuildTargetUtils.IsSupportMobile(report.summary.platform);
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
}
|
|
1
|
+
using System;
|
|
2
|
+
using UnityEditor.Build.Reporting;
|
|
3
|
+
using TapSDK.Core.Editor;
|
|
4
|
+
|
|
5
|
+
namespace TapSDK.Login.Mobile.Editor {
|
|
6
|
+
public class TapLoginMobileProcessBuild : SDKLinkProcessBuild {
|
|
7
|
+
public override int callbackOrder => 0;
|
|
8
|
+
|
|
9
|
+
public override string LinkPath => "TapSDK/Login/link.xml";
|
|
10
|
+
|
|
11
|
+
public override LinkedAssembly[] LinkedAssemblies => new LinkedAssembly[] {
|
|
12
|
+
new LinkedAssembly { Fullname = "TapSDK.Login.Runtime" },
|
|
13
|
+
new LinkedAssembly { Fullname = "TapSDK.Login.Mobile.Runtime" }
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
public override Func<BuildReport, bool> IsTargetPlatform => (report) => {
|
|
17
|
+
return BuildTargetUtils.IsSupportMobile(report.summary.platform);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -3,6 +3,7 @@ using JetBrains.Annotations;
|
|
|
3
3
|
using TapSDK.Core;
|
|
4
4
|
using TapSDK.Login;
|
|
5
5
|
using UnityEngine;
|
|
6
|
+
using TapSDK.Core.Internal.Log;
|
|
6
7
|
|
|
7
8
|
namespace TapSDK.Login.Mobile.Runtime
|
|
8
9
|
{
|
|
@@ -16,17 +17,119 @@ namespace TapSDK.Login.Mobile.Runtime
|
|
|
16
17
|
|
|
17
18
|
public AccountWrapper(string json)
|
|
18
19
|
{
|
|
20
|
+
TapLog.Log("🔧 [AccountWrapper] Constructor called");
|
|
21
|
+
TapLog.Log("🔍 [AccountWrapper] Input JSON: '" + (json ?? "null") + "'");
|
|
22
|
+
TapLog.Log("🔍 [AccountWrapper] Input JSON length: " + (json?.Length ?? 0));
|
|
23
|
+
|
|
19
24
|
if (string.IsNullOrEmpty(json))
|
|
20
25
|
{
|
|
26
|
+
TapLog.Log("❌ [AccountWrapper] JSON is null or empty, returning with defaults");
|
|
21
27
|
return;
|
|
22
28
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
message = SafeDictionary.GetValue<string>(dict, "message");
|
|
26
|
-
if (dict.ContainsKey("content") && dict["content"] is Dictionary<string, object> accountDict)
|
|
29
|
+
|
|
30
|
+
try
|
|
27
31
|
{
|
|
28
|
-
|
|
32
|
+
TapLog.Log("🔧 [AccountWrapper] Deserializing JSON...");
|
|
33
|
+
var dict = Json.Deserialize(json) as Dictionary<string, object>;
|
|
34
|
+
TapLog.Log("🔍 [AccountWrapper] Deserialization result: " + (dict != null ? "Success" : "Failed"));
|
|
35
|
+
|
|
36
|
+
if (dict != null)
|
|
37
|
+
{
|
|
38
|
+
TapLog.Log("🔍 [AccountWrapper] Dictionary keys: [" + string.Join(", ", dict.Keys) + "]");
|
|
39
|
+
|
|
40
|
+
// 提取code
|
|
41
|
+
if (dict.ContainsKey("code"))
|
|
42
|
+
{
|
|
43
|
+
var codeValue = dict["code"];
|
|
44
|
+
TapLog.Log("🔍 [AccountWrapper] Raw code value: " + codeValue + " (type: " + codeValue?.GetType().Name + ")");
|
|
45
|
+
code = SafeDictionary.GetValue<int>(dict, "code");
|
|
46
|
+
TapLog.Log("🔍 [AccountWrapper] Parsed code: " + code);
|
|
47
|
+
}
|
|
48
|
+
else
|
|
49
|
+
{
|
|
50
|
+
TapLog.Log("⚠️ [AccountWrapper] No 'code' key found in dictionary");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// 提取message
|
|
54
|
+
if (dict.ContainsKey("message"))
|
|
55
|
+
{
|
|
56
|
+
var messageValue = dict["message"];
|
|
57
|
+
TapLog.Log("🔍 [AccountWrapper] Raw message value: " + messageValue + " (type: " + messageValue?.GetType().Name + ")");
|
|
58
|
+
message = SafeDictionary.GetValue<string>(dict, "message");
|
|
59
|
+
TapLog.Log("🔍 [AccountWrapper] Parsed message: '" + (message ?? "null") + "'");
|
|
60
|
+
}
|
|
61
|
+
else
|
|
62
|
+
{
|
|
63
|
+
TapLog.Log("⚠️ [AccountWrapper] No 'message' key found in dictionary");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// 提取content (account data)
|
|
67
|
+
if (dict.ContainsKey("content"))
|
|
68
|
+
{
|
|
69
|
+
var contentValue = dict["content"];
|
|
70
|
+
TapLog.Log("🔍 [AccountWrapper] Raw content value type: " + contentValue?.GetType().Name);
|
|
71
|
+
TapLog.Log("🔍 [AccountWrapper] Content value: " + contentValue);
|
|
72
|
+
|
|
73
|
+
if (contentValue is Dictionary<string, object> accountDict)
|
|
74
|
+
{
|
|
75
|
+
TapLog.Log("✅ [AccountWrapper] Content is Dictionary<string, object>");
|
|
76
|
+
TapLog.Log("🔍 [AccountWrapper] Account dict keys: [" + string.Join(", ", accountDict.Keys) + "]");
|
|
77
|
+
|
|
78
|
+
try
|
|
79
|
+
{
|
|
80
|
+
TapLog.Log("🔧 [AccountWrapper] Creating TapTapAccount...");
|
|
81
|
+
account = new TapTapAccount(accountDict);
|
|
82
|
+
TapLog.Log("✅ [AccountWrapper] TapTapAccount created successfully");
|
|
83
|
+
|
|
84
|
+
if (account != null)
|
|
85
|
+
{
|
|
86
|
+
TapLog.Log("🔍 [AccountWrapper] Account created with:");
|
|
87
|
+
TapLog.Log("🔍 [AccountWrapper] - Name: '" + (account.name ?? "null") + "'");
|
|
88
|
+
TapLog.Log("🔍 [AccountWrapper] - OpenId: '" + (account.openId ?? "null") + "'");
|
|
89
|
+
TapLog.Log("🔍 [AccountWrapper] - UnionId: '" + (account.unionId ?? "null") + "'");
|
|
90
|
+
TapLog.Log("🔍 [AccountWrapper] - Email: '" + (account.email ?? "null") + "'");
|
|
91
|
+
TapLog.Log("🔍 [AccountWrapper] - Avatar: '" + (account.avatar ?? "null") + "'");
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
catch (System.Exception ex)
|
|
95
|
+
{
|
|
96
|
+
TapLog.Log("💥 [AccountWrapper] Exception creating TapTapAccount: " + ex.Message);
|
|
97
|
+
TapLog.Log("💥 [AccountWrapper] Stack trace: " + ex.StackTrace);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else
|
|
101
|
+
{
|
|
102
|
+
TapLog.Log("❌ [AccountWrapper] Content is not Dictionary<string, object>");
|
|
103
|
+
TapLog.Log("🔍 [AccountWrapper] Content actual type: " + (contentValue?.GetType().FullName ?? "null"));
|
|
104
|
+
|
|
105
|
+
// 尝试其他可能的类型
|
|
106
|
+
if (contentValue is string contentStr)
|
|
107
|
+
{
|
|
108
|
+
TapLog.Log("🔍 [AccountWrapper] Content is string: '" + contentStr + "'");
|
|
109
|
+
}
|
|
110
|
+
else if (contentValue is Dictionary<object, object> objDict)
|
|
111
|
+
{
|
|
112
|
+
TapLog.Log("🔍 [AccountWrapper] Content is Dictionary<object, object> with " + objDict.Count + " items");
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
else
|
|
117
|
+
{
|
|
118
|
+
TapLog.Log("⚠️ [AccountWrapper] No 'content' key found in dictionary");
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
else
|
|
122
|
+
{
|
|
123
|
+
TapLog.Log("❌ [AccountWrapper] Failed to deserialize JSON to dictionary");
|
|
124
|
+
}
|
|
29
125
|
}
|
|
126
|
+
catch (System.Exception ex)
|
|
127
|
+
{
|
|
128
|
+
TapLog.Log("💥 [AccountWrapper] Exception in constructor: " + ex.Message);
|
|
129
|
+
TapLog.Log("💥 [AccountWrapper] Stack trace: " + ex.StackTrace);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
TapLog.Log("✅ [AccountWrapper] Constructor completed - code: " + code + ", account: " + (account != null ? "present" : "null"));
|
|
30
133
|
}
|
|
31
134
|
}
|
|
32
135
|
}
|
|
@@ -44,18 +44,74 @@ namespace TapSDK.Login.Mobile
|
|
|
44
44
|
.CommandBuilder(),
|
|
45
45
|
result =>
|
|
46
46
|
{
|
|
47
|
+
TapLog.Log("🔍 [Unity Login] Raw callback result received:");
|
|
48
|
+
TapLog.Log("🔍 [Unity Login] result != null: " + (result != null));
|
|
49
|
+
if (result != null)
|
|
50
|
+
{
|
|
51
|
+
TapLog.Log("🔍 [Unity Login] result.content != null: " + (result.content != null));
|
|
52
|
+
TapLog.Log("🔍 [Unity Login] result.content type: " + (result.content?.GetType().Name ?? "null"));
|
|
53
|
+
TapLog.Log("🔍 [Unity Login] result.content length: " + (result.content?.Length ?? 0));
|
|
54
|
+
TapLog.Log("🔍 [Unity Login] result.content value: '" + (result.content ?? "null") + "'");
|
|
55
|
+
|
|
56
|
+
// 检查是否包含预期的关键字
|
|
57
|
+
if (!string.IsNullOrEmpty(result.content))
|
|
58
|
+
{
|
|
59
|
+
TapLog.Log("🔍 [Unity Login] Contains 'code': " + result.content.Contains("code"));
|
|
60
|
+
TapLog.Log("🔍 [Unity Login] Contains 'content': " + result.content.Contains("content"));
|
|
61
|
+
TapLog.Log("🔍 [Unity Login] Contains 'message': " + result.content.Contains("message"));
|
|
62
|
+
TapLog.Log("🔍 [Unity Login] Contains 'name': " + result.content.Contains("name"));
|
|
63
|
+
TapLog.Log("🔍 [Unity Login] Contains 'openid': " + result.content.Contains("openid"));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
47
67
|
TapLog.Log("Login result: " + result.content);
|
|
48
|
-
|
|
49
|
-
if (
|
|
68
|
+
|
|
69
|
+
if (string.IsNullOrEmpty(result.content))
|
|
50
70
|
{
|
|
51
|
-
|
|
52
|
-
|
|
71
|
+
TapLog.Log("❌ [Unity Login] ERROR: result.content is null or empty!");
|
|
72
|
+
tsc.TrySetException(new Exception("Login result content is null or empty"));
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
try
|
|
53
77
|
{
|
|
54
|
-
|
|
78
|
+
TapLog.Log("🔧 [Unity Login] Creating AccountWrapper...");
|
|
79
|
+
var wrapper = new AccountWrapper(result.content);
|
|
80
|
+
TapLog.Log("✅ [Unity Login] AccountWrapper created successfully");
|
|
81
|
+
TapLog.Log("🔍 [Unity Login] wrapper.code: " + wrapper.code);
|
|
82
|
+
TapLog.Log("🔍 [Unity Login] wrapper.message: '" + (wrapper.message ?? "null") + "'");
|
|
83
|
+
TapLog.Log("🔍 [Unity Login] wrapper.account != null: " + (wrapper.account != null));
|
|
84
|
+
|
|
85
|
+
if (wrapper.account != null)
|
|
86
|
+
{
|
|
87
|
+
TapLog.Log("🔍 [Unity Login] Account details:");
|
|
88
|
+
TapLog.Log("🔍 [Unity Login] - Name: '" + (wrapper.account.name ?? "null") + "'");
|
|
89
|
+
TapLog.Log("🔍 [Unity Login] - OpenId: '" + (wrapper.account.openId ?? "null") + "'");
|
|
90
|
+
TapLog.Log("🔍 [Unity Login] - UnionId: '" + (wrapper.account.unionId ?? "null") + "'");
|
|
91
|
+
TapLog.Log("🔍 [Unity Login] - Email: '" + (wrapper.account.email ?? "null") + "'");
|
|
92
|
+
TapLog.Log("🔍 [Unity Login] - Avatar: '" + (wrapper.account.avatar ?? "null") + "'");
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (wrapper.code == 1)
|
|
96
|
+
{
|
|
97
|
+
TapLog.Log("🚫 [Unity Login] Login was canceled (code=1)");
|
|
98
|
+
tsc.TrySetCanceled();
|
|
99
|
+
} else if (wrapper.code == 0)
|
|
100
|
+
{
|
|
101
|
+
TapLog.Log("✅ [Unity Login] Login successful (code=0), setting result");
|
|
102
|
+
tsc.TrySetResult(wrapper.account);
|
|
103
|
+
}
|
|
104
|
+
else
|
|
105
|
+
{
|
|
106
|
+
TapLog.Log("❌ [Unity Login] Login failed with code: " + wrapper.code + ", message: " + wrapper.message);
|
|
107
|
+
tsc.TrySetException(new Exception(wrapper.message));
|
|
108
|
+
}
|
|
55
109
|
}
|
|
56
|
-
|
|
110
|
+
catch (System.Exception ex)
|
|
57
111
|
{
|
|
58
|
-
|
|
112
|
+
TapLog.Log("💥 [Unity Login] Exception in AccountWrapper processing: " + ex.Message);
|
|
113
|
+
TapLog.Log("💥 [Unity Login] Exception stack trace: " + ex.StackTrace);
|
|
114
|
+
tsc.TrySetException(ex);
|
|
59
115
|
}
|
|
60
116
|
});
|
|
61
117
|
return tsc.Task;
|
|
@@ -71,14 +127,48 @@ namespace TapSDK.Login.Mobile
|
|
|
71
127
|
|
|
72
128
|
public async Task<TapTapAccount> GetCurrentAccount()
|
|
73
129
|
{
|
|
130
|
+
TapLog.Log("🔍 [Unity Login] GetCurrentAccount called");
|
|
131
|
+
|
|
74
132
|
Result result = await EngineBridge.GetInstance().Emit(new Command.Builder()
|
|
75
133
|
.Service(SERVICE_NAME)
|
|
76
134
|
.Method("getCurrentTapAccount")
|
|
77
135
|
.Callback(true)
|
|
78
136
|
.OnceTime(true)
|
|
79
137
|
.CommandBuilder());
|
|
138
|
+
|
|
139
|
+
TapLog.Log("🔍 [Unity Login] GetCurrentAccount result received:");
|
|
140
|
+
TapLog.Log("🔍 [Unity Login] result != null: " + (result != null));
|
|
141
|
+
if (result != null)
|
|
142
|
+
{
|
|
143
|
+
TapLog.Log("🔍 [Unity Login] result.content != null: " + (result.content != null));
|
|
144
|
+
TapLog.Log("🔍 [Unity Login] result.content type: " + (result.content?.GetType().Name ?? "null"));
|
|
145
|
+
TapLog.Log("🔍 [Unity Login] result.content length: " + (result.content?.Length ?? 0));
|
|
146
|
+
|
|
147
|
+
// 显示前200个字符,避免过长的日志
|
|
148
|
+
if (!string.IsNullOrEmpty(result.content))
|
|
149
|
+
{
|
|
150
|
+
var preview = result.content.Length > 200 ? result.content.Substring(0, 200) + "..." : result.content;
|
|
151
|
+
TapLog.Log("🔍 [Unity Login] result.content preview: '" + preview + "'");
|
|
152
|
+
}
|
|
153
|
+
else
|
|
154
|
+
{
|
|
155
|
+
TapLog.Log("🔍 [Unity Login] result.content is null or empty!");
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
80
159
|
TapLog.Log("Current account: " + result.content);
|
|
81
|
-
|
|
160
|
+
|
|
161
|
+
try
|
|
162
|
+
{
|
|
163
|
+
var wrapper = new AccountWrapper(result.content);
|
|
164
|
+
TapLog.Log("🔍 [Unity Login] AccountWrapper created, account: " + (wrapper.account != null ? "present" : "null"));
|
|
165
|
+
return wrapper.account;
|
|
166
|
+
}
|
|
167
|
+
catch (Exception ex)
|
|
168
|
+
{
|
|
169
|
+
TapLog.Log("💥 [Unity Login] Exception in GetCurrentAccount: " + ex.Message);
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
82
172
|
}
|
|
83
173
|
}
|
|
84
174
|
}
|
|
@@ -7,7 +7,7 @@ namespace TapSDK.Login
|
|
|
7
7
|
public class TapTapLogin
|
|
8
8
|
{
|
|
9
9
|
|
|
10
|
-
public static readonly string Version = "4.8.4
|
|
10
|
+
public static readonly string Version = "4.8.4";
|
|
11
11
|
|
|
12
12
|
public const string TAP_LOGIN_SCOPE_BASIC_INFO = "basic_info";
|
|
13
13
|
public const string TAP_LOGIN_SCOPE_PUBLIC_PROFILE = "public_profile";
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
using System;
|
|
2
|
-
using UnityEditor.Build.Reporting;
|
|
3
|
-
using TapSDK.Core.Editor;
|
|
4
|
-
|
|
5
|
-
namespace TapSDK.Login.Editor
|
|
6
|
-
{
|
|
7
|
-
public class TapLoginStandaloneProcessBuild : SDKLinkProcessBuild
|
|
8
|
-
{
|
|
9
|
-
public override int callbackOrder => 0;
|
|
10
|
-
|
|
11
|
-
public override string LinkPath => "TapSDK/Login/link.xml";
|
|
12
|
-
|
|
13
|
-
public override LinkedAssembly[] LinkedAssemblies => new LinkedAssembly[] {
|
|
14
|
-
new LinkedAssembly { Fullname = "TapSDK.Login.Runtime" },
|
|
15
|
-
new LinkedAssembly { Fullname = "TapSDK.Login.Standalone.Runtime" }
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
public override Func<BuildReport, bool> IsTargetPlatform => (report) => {
|
|
19
|
-
return BuildTargetUtils.IsSupportStandalone(report.summary.platform);
|
|
20
|
-
};
|
|
21
|
-
}
|
|
1
|
+
using System;
|
|
2
|
+
using UnityEditor.Build.Reporting;
|
|
3
|
+
using TapSDK.Core.Editor;
|
|
4
|
+
|
|
5
|
+
namespace TapSDK.Login.Editor
|
|
6
|
+
{
|
|
7
|
+
public class TapLoginStandaloneProcessBuild : SDKLinkProcessBuild
|
|
8
|
+
{
|
|
9
|
+
public override int callbackOrder => 0;
|
|
10
|
+
|
|
11
|
+
public override string LinkPath => "TapSDK/Login/link.xml";
|
|
12
|
+
|
|
13
|
+
public override LinkedAssembly[] LinkedAssemblies => new LinkedAssembly[] {
|
|
14
|
+
new LinkedAssembly { Fullname = "TapSDK.Login.Runtime" },
|
|
15
|
+
new LinkedAssembly { Fullname = "TapSDK.Login.Standalone.Runtime" }
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
public override Func<BuildReport, bool> IsTargetPlatform => (report) => {
|
|
19
|
+
return BuildTargetUtils.IsSupportStandalone(report.summary.platform);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
22
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
using Newtonsoft.Json;
|
|
2
|
-
|
|
3
|
-
namespace TapSDK.Login.Internal.Http {
|
|
4
|
-
public class ProfileData {
|
|
5
|
-
[JsonProperty("openid")]
|
|
6
|
-
public string OpenId { get; set; }
|
|
7
|
-
|
|
8
|
-
[JsonProperty("unionid")]
|
|
9
|
-
public string UnionId { get; set; }
|
|
10
|
-
|
|
11
|
-
[JsonProperty("name")]
|
|
12
|
-
public string Name { get; set; }
|
|
13
|
-
|
|
14
|
-
[JsonProperty("gender")]
|
|
15
|
-
public string Gender { get; set; }
|
|
16
|
-
|
|
17
|
-
[JsonProperty("avatar")]
|
|
18
|
-
public string Avatar { get; set; }
|
|
19
|
-
|
|
20
|
-
[JsonProperty("email")]
|
|
21
|
-
public string Email { get; set; }
|
|
22
|
-
}
|
|
23
|
-
}
|
|
1
|
+
using Newtonsoft.Json;
|
|
2
|
+
|
|
3
|
+
namespace TapSDK.Login.Internal.Http {
|
|
4
|
+
public class ProfileData {
|
|
5
|
+
[JsonProperty("openid")]
|
|
6
|
+
public string OpenId { get; set; }
|
|
7
|
+
|
|
8
|
+
[JsonProperty("unionid")]
|
|
9
|
+
public string UnionId { get; set; }
|
|
10
|
+
|
|
11
|
+
[JsonProperty("name")]
|
|
12
|
+
public string Name { get; set; }
|
|
13
|
+
|
|
14
|
+
[JsonProperty("gender")]
|
|
15
|
+
public string Gender { get; set; }
|
|
16
|
+
|
|
17
|
+
[JsonProperty("avatar")]
|
|
18
|
+
public string Avatar { get; set; }
|
|
19
|
+
|
|
20
|
+
[JsonProperty("email")]
|
|
21
|
+
public string Email { get; set; }
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
using Newtonsoft.Json;
|
|
2
|
-
|
|
3
|
-
namespace TapSDK.Login.Internal.Http {
|
|
4
|
-
public class QRCodeData {
|
|
5
|
-
[JsonProperty("device_code")]
|
|
6
|
-
public string DeviceCode { get; set; }
|
|
7
|
-
|
|
8
|
-
[JsonProperty("expires_in")]
|
|
9
|
-
public int ExpiresIn { get; set; }
|
|
10
|
-
|
|
11
|
-
[JsonProperty("qrcode_url")]
|
|
12
|
-
public string Url { get; set; }
|
|
13
|
-
|
|
14
|
-
[JsonProperty("interval")]
|
|
15
|
-
public int Interval { get; set; }
|
|
16
|
-
}
|
|
1
|
+
using Newtonsoft.Json;
|
|
2
|
+
|
|
3
|
+
namespace TapSDK.Login.Internal.Http {
|
|
4
|
+
public class QRCodeData {
|
|
5
|
+
[JsonProperty("device_code")]
|
|
6
|
+
public string DeviceCode { get; set; }
|
|
7
|
+
|
|
8
|
+
[JsonProperty("expires_in")]
|
|
9
|
+
public int ExpiresIn { get; set; }
|
|
10
|
+
|
|
11
|
+
[JsonProperty("qrcode_url")]
|
|
12
|
+
public string Url { get; set; }
|
|
13
|
+
|
|
14
|
+
[JsonProperty("interval")]
|
|
15
|
+
public int Interval { get; set; }
|
|
16
|
+
}
|
|
17
17
|
}
|