com.taptap.sdk.login 4.8.4-beta.1 → 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.
@@ -1,15 +1,15 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
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="TapTapSDK/Login" version="4.8.4"/>
13
+ <iosPod addToAllTargets="false" bitcodeEnabled="false" name="TapTapSDK/Login" version="4.8.4" />
14
14
  </iosPods>
15
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
- // 添加标签,unity导出工程后自动执行该函数
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
- var parentFolder = Directory.GetParent(Application.dataPath)?.FullName;
59
+ // 只处理 iOS 和 macOS 平台
60
+ if (buildTarget != BuildTarget.iOS && buildTarget != BuildTarget.StandaloneOSX)
61
+ {
62
+ return;
63
+ }
21
64
 
22
- var plistFile = TapFileHelper.RecursionFilterFile(parentFolder + "/Assets/Plugins/", "TDS-Info.plist");
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 TDS-Info.plist in Project/Assets/Plugins/!");
72
+ Debug.LogError($"TapSDK Can't find {TDS_INFO_PLIST_NAME} in {plistSearchPath}!");
73
+ return;
27
74
  }
28
75
 
29
-
30
- if (buildTarget is BuildTarget.iOS)
76
+ // 处理 iOS 平台
77
+ if (buildTarget == BuildTarget.iOS)
31
78
  {
32
79
  #if UNITY_IOS
33
- TapSDKCoreCompile.HandlerPlist(Path.GetFullPath(path), plistFile?.FullName ?? null);
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
- else if (buildTarget is BuildTarget.StandaloneOSX)
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
- var projPath1 = TapSDKCoreCompile.GetProjPath(path);
68
- var proj = TapSDKCoreCompile.ParseProjPath(projPath1);
69
- var target = TapSDKCoreCompile.GetUnityTarget(proj);
70
- if (TapSDKCoreCompile.CheckTarget(target))
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
- Debug.LogError("Unity-iPhone is NUll");
73
- return;
74
- }
75
- if (TapSDKCoreCompile.HandlerIOSSetting(path,
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
- "TapTapLoginResource",
78
- "com.taptap.sdk.login",
79
- "Login",
80
- new[] {"TapTapLoginResource.bundle"},
81
- target, projPath1, proj))
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.Log("TapLogin add Bundle Success!");
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
+ }
@@ -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-beta.1";
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
  }
@@ -1,28 +1,28 @@
1
- using System.Collections.Generic;
2
- using Newtonsoft.Json;
3
-
4
- namespace TapSDK.Login.Internal.Http {
5
- public class TokenData {
6
- [JsonProperty("kid")]
7
- public string Kid { get; set; }
8
-
9
- [JsonProperty("access_token")]
10
- public string Token { get; set; }
11
-
12
- [JsonProperty("token_type")]
13
- public string TokenType { get; set; }
14
-
15
- [JsonProperty("mac_key")]
16
- public string MacKey { get; set; }
17
-
18
- [JsonProperty("mac_algorithm")]
19
- public string MacAlgorithm { get; set; }
20
-
21
- [JsonProperty("scope")]
22
- public string Scope { get; set; }
23
-
24
- [JsonIgnore]
25
- public HashSet<string> Scopes => !string.IsNullOrEmpty(Scope) ?
26
- new HashSet<string>(Scope.Split(' ')) : new HashSet<string>();
27
- }
28
- }
1
+ using System.Collections.Generic;
2
+ using Newtonsoft.Json;
3
+
4
+ namespace TapSDK.Login.Internal.Http {
5
+ public class TokenData {
6
+ [JsonProperty("kid")]
7
+ public string Kid { get; set; }
8
+
9
+ [JsonProperty("access_token")]
10
+ public string Token { get; set; }
11
+
12
+ [JsonProperty("token_type")]
13
+ public string TokenType { get; set; }
14
+
15
+ [JsonProperty("mac_key")]
16
+ public string MacKey { get; set; }
17
+
18
+ [JsonProperty("mac_algorithm")]
19
+ public string MacAlgorithm { get; set; }
20
+
21
+ [JsonProperty("scope")]
22
+ public string Scope { get; set; }
23
+
24
+ [JsonIgnore]
25
+ public HashSet<string> Scopes => !string.IsNullOrEmpty(Scope) ?
26
+ new HashSet<string>(Scope.Split(' ')) : new HashSet<string>();
27
+ }
28
+ }