com.xd.sdk.tap 4.8.1-xd.2 → 4.9.0-xd.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.
- package/Compliance/Mobile/Editor/iOS/BuidPostProcessor.cs +1 -1
- package/Compliance/Mobile/Runtime/ComplianceMobileBridge.cs +23 -1
- package/Compliance/Runtime/Public/TapTapCompliance.cs +1 -1
- package/Compliance/package.json +12 -0
- package/{Core/link.xml.meta → Compliance/package.json.meta} +1 -1
- package/Core/Editor/TapSDKCoreCompile.cs +219 -24
- package/Core/Editor/TapSDKCoreIOSProcessor.cs +18 -17
- package/Core/Mobile/Runtime/BridgeIOS.cs +13 -2
- package/Core/Runtime/Public/TapLocalizeManager.cs +31 -31
- package/Core/Runtime/Public/TapTapSDK.cs +1 -1
- package/Core/Standalone/Runtime/Public/TapClientStandalone.cs +9 -0
- package/Core/package.json +11 -0
- package/{Compliance/link.xml.meta → Core/package.json.meta} +1 -1
- package/Editor/Android/TapWrapperAndroidGradleProcessor.cs +1 -3
- package/Editor/XD.SDK.Tap.Editor.asmdef +18 -0
- package/Editor/XD.SDK.Tap.Editor.asmdef.meta +7 -0
- package/License/Runtime/Public/TapTapLicense.cs +1 -1
- package/License/package.json +11 -0
- package/License/{link.xml.meta → package.json.meta} +1 -1
- package/Login/Mobile/Editor/TapLoginIOSProcessor.cs +1 -1
- package/Login/Mobile/Runtime/AccountWrapper.cs +108 -5
- package/Login/Mobile/Runtime/TapTapLoginImpl.cs +98 -8
- package/Login/Runtime/Public/TapTapLogin.cs +1 -1
- package/Login/Standalone/Runtime/Internal/LoginLanguage.cs +15 -15
- package/Login/Standalone/Runtime/Internal2/UI/QRCodeController.cs +1 -1
- package/Login/Standalone/Runtime/TapSDK.Login.Standalone.Runtime.asmdef +0 -2
- package/Login/package.json +11 -0
- package/Login/{link.xml.meta → package.json.meta} +1 -1
- package/Moment/Mobile/Editor/TapMomentIOSProcessor.cs +1 -1
- package/Moment/Runtime/Public/TapTapMoment.cs +1 -1
- package/Moment/Standalone/Runtime/TapSDK.Moment.Standalone.Runtime.asmdef +0 -1
- package/Moment/package.json +12 -0
- package/Moment/package.json.meta +7 -0
- package/Review/Runtime/Public/TapTapReview.cs +1 -1
- package/Review/package.json +11 -0
- package/Review/package.json.meta +7 -0
- package/Runtime/Internal/TapComplianceHelper.cs +8 -0
- package/Runtime/Public/TapSDKEventHandler.cs +16 -5
- package/Update/Mobile/Editor/TapAndroidProvider.txt +58 -0
- package/Update/Mobile/Editor/TapAndroidProvider.txt.meta +7 -0
- package/Update/Runtime/Public/TapTapUpdate.cs +1 -1
- package/Update/package.json +11 -0
- package/Update/package.json.meta +7 -0
- package/package.json +1 -1
- package/Compliance/link.xml +0 -5
- package/Core/Runtime/Public/TapLanguage.cs +0 -21
- package/Core/Runtime/Public/TapLanguage.cs.meta +0 -11
- package/Core/link.xml +0 -4
- package/License/link.xml +0 -4
- package/Login/link.xml +0 -4
- package/Moment/link.xml +0 -4
- package/Moment/link.xml.meta +0 -7
- package/Review/link.xml +0 -3
- package/Review/link.xml.meta +0 -7
- package/Update/link.xml +0 -3
- package/Update/link.xml.meta +0 -7
- /package/Plugins/Android/{XDGBridgeTapTapWrapper_v7_7.0.1.aar → XDGBridgeTapTapWrapper_v7_7.1.2.aar} +0 -0
- /package/Plugins/Android/{XDGBridgeTapTapWrapper_v7_7.0.1.aar.meta → XDGBridgeTapTapWrapper_v7_7.1.2.aar.meta} +0 -0
|
@@ -32,7 +32,7 @@ public class BuildPostProcessor
|
|
|
32
32
|
"com.taptap.sdk.compliance",
|
|
33
33
|
"Compliance",
|
|
34
34
|
new[] {"TapTapComplianceResource.bundle"},
|
|
35
|
-
target, projPath, proj
|
|
35
|
+
target, projPath, proj))
|
|
36
36
|
{
|
|
37
37
|
Debug.Log("TapCompliance add Bundle Success!");
|
|
38
38
|
return;
|
|
@@ -78,9 +78,31 @@ namespace TapSDK.Compliance.Mobile.Runtime
|
|
|
78
78
|
ComplianceCallbackData callbackData = new ComplianceCallbackData();
|
|
79
79
|
#if UNITY_IOS
|
|
80
80
|
result.content = RemoveFontColor(result.content);
|
|
81
|
+
|
|
82
|
+
// 修复:在RemoveFontColor之后再次检查content,防止null导致反序列化失败
|
|
83
|
+
if (string.IsNullOrEmpty(result.content))
|
|
84
|
+
{
|
|
85
|
+
TapLog.Error("[Unity:Compliance] callback content is null or empty after RemoveFontColor");
|
|
86
|
+
callbackList.ForEach((item) =>
|
|
87
|
+
{
|
|
88
|
+
item?.Invoke(-1, "[Unity:Compliance] callback content is empty after processing");
|
|
89
|
+
});
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
81
93
|
var callbackOriginData = JsonConvert.DeserializeObject<ComplianceCallbackOriginData>(result.content);
|
|
82
94
|
callbackData.code = callbackOriginData.code;
|
|
83
|
-
|
|
95
|
+
|
|
96
|
+
// 修复:检查extras是否为null或空,防止反序列化失败
|
|
97
|
+
if (!string.IsNullOrEmpty(callbackOriginData.extras))
|
|
98
|
+
{
|
|
99
|
+
callbackData.extras = JsonConvert.DeserializeObject<MsgExtraParams>(callbackOriginData.extras);
|
|
100
|
+
}
|
|
101
|
+
else
|
|
102
|
+
{
|
|
103
|
+
TapLog.Log("[Unity:Compliance] callback extras is null or empty, using default MsgExtraParams");
|
|
104
|
+
callbackData.extras = new MsgExtraParams();
|
|
105
|
+
}
|
|
84
106
|
#else
|
|
85
107
|
callbackData = JsonConvert.DeserializeObject<ComplianceCallbackData>(result.content);
|
|
86
108
|
#endif
|
|
@@ -10,7 +10,7 @@ namespace TapSDK.Compliance
|
|
|
10
10
|
public static class TapTapCompliance
|
|
11
11
|
{
|
|
12
12
|
|
|
13
|
-
public static readonly string Version = "4.
|
|
13
|
+
public static readonly string Version = "4.9.0";
|
|
14
14
|
|
|
15
15
|
public static void RegisterComplianceCallback(Action<int, string> callback)
|
|
16
16
|
{
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "com.taptap.sdk.compliance",
|
|
3
|
+
"displayName": "TapTapSDK Compliance",
|
|
4
|
+
"description": "TapTapSDK Compliance",
|
|
5
|
+
"version": "4.9.0",
|
|
6
|
+
"unity": "2019.4",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"com.taptap.sdk.core": "4.9.0",
|
|
10
|
+
"com.taptap.sdk.login": "4.9.0"
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -4,8 +4,14 @@ using System.Linq;
|
|
|
4
4
|
using UnityEditor;
|
|
5
5
|
using UnityEditor.PackageManager;
|
|
6
6
|
using UnityEngine;
|
|
7
|
+
using System.Diagnostics;
|
|
8
|
+
using System.Text.RegularExpressions;
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
7
12
|
#if UNITY_IOS
|
|
8
13
|
using System;
|
|
14
|
+
// using Google;
|
|
9
15
|
using UnityEditor.iOS.Xcode;
|
|
10
16
|
|
|
11
17
|
#endif
|
|
@@ -17,13 +23,13 @@ namespace TapSDK.Core.Editor
|
|
|
17
23
|
#if UNITY_IOS
|
|
18
24
|
public static string GetProjPath(string path)
|
|
19
25
|
{
|
|
20
|
-
Debug.Log($"SDX , GetProjPath path:{path}");
|
|
26
|
+
UnityEngine.Debug.Log($"SDX , GetProjPath path:{path}");
|
|
21
27
|
return PBXProject.GetPBXProjectPath(path);
|
|
22
28
|
}
|
|
23
29
|
|
|
24
30
|
public static PBXProject ParseProjPath(string path)
|
|
25
31
|
{
|
|
26
|
-
Debug.Log($"SDX , ParseProjPath path:{path}");
|
|
32
|
+
UnityEngine.Debug.Log($"SDX , ParseProjPath path:{path}");
|
|
27
33
|
var proj = new PBXProject();
|
|
28
34
|
proj.ReadFromString(File.ReadAllText(path));
|
|
29
35
|
return proj;
|
|
@@ -32,11 +38,11 @@ namespace TapSDK.Core.Editor
|
|
|
32
38
|
public static string GetUnityFrameworkTarget(PBXProject proj)
|
|
33
39
|
{
|
|
34
40
|
#if UNITY_2019_3_OR_NEWER
|
|
35
|
-
Debug.Log("SDX , GetUnityFrameworkTarget UNITY_2019_3_OR_NEWER");
|
|
41
|
+
UnityEngine.Debug.Log("SDX , GetUnityFrameworkTarget UNITY_2019_3_OR_NEWER");
|
|
36
42
|
string target = proj.GetUnityFrameworkTargetGuid();
|
|
37
43
|
return target;
|
|
38
44
|
#endif
|
|
39
|
-
Debug.Log("SDX , GetUnityFrameworkTarget");
|
|
45
|
+
UnityEngine.Debug.Log("SDX , GetUnityFrameworkTarget");
|
|
40
46
|
var unityPhoneTarget = proj.TargetGuidByName("Unity-iPhone");
|
|
41
47
|
return unityPhoneTarget;
|
|
42
48
|
}
|
|
@@ -44,11 +50,11 @@ namespace TapSDK.Core.Editor
|
|
|
44
50
|
public static string GetUnityTarget(PBXProject proj)
|
|
45
51
|
{
|
|
46
52
|
#if UNITY_2019_3_OR_NEWER
|
|
47
|
-
Debug.Log("SDX , GetUnityTarget UNITY_2019_3_OR_NEWER");
|
|
53
|
+
UnityEngine.Debug.Log("SDX , GetUnityTarget UNITY_2019_3_OR_NEWER");
|
|
48
54
|
string target = proj.GetUnityMainTargetGuid();
|
|
49
55
|
return target;
|
|
50
56
|
#endif
|
|
51
|
-
Debug.Log("SDX , GetUnityTarget");
|
|
57
|
+
UnityEngine.Debug.Log("SDX , GetUnityTarget");
|
|
52
58
|
var unityPhoneTarget = proj.TargetGuidByName("Unity-iPhone");
|
|
53
59
|
return unityPhoneTarget;
|
|
54
60
|
}
|
|
@@ -89,8 +95,8 @@ namespace TapSDK.Core.Editor
|
|
|
89
95
|
|
|
90
96
|
public static bool HandlerIOSSetting(string path, string appDataPath, string resourceName,
|
|
91
97
|
string modulePackageName,
|
|
92
|
-
string moduleName, string[] bundleNames, string target, string projPath, PBXProject proj
|
|
93
|
-
{
|
|
98
|
+
string moduleName, string[] bundleNames, string target, string projPath, PBXProject proj)
|
|
99
|
+
{
|
|
94
100
|
// TIPS: bundle 资源会被 XDSDK 脚本处理,这里直接屏蔽相关逻辑
|
|
95
101
|
return true;
|
|
96
102
|
|
|
@@ -98,19 +104,19 @@ namespace TapSDK.Core.Editor
|
|
|
98
104
|
|
|
99
105
|
var parentFolder = Directory.GetParent(appDataPath).FullName;
|
|
100
106
|
|
|
101
|
-
Debug.Log($"ProjectFolder path:{parentFolder}" + " resourcePath: " + resourcePath + " parentFolder: " + parentFolder);
|
|
107
|
+
UnityEngine.Debug.Log($"ProjectFolder path:{parentFolder}" + " resourcePath: " + resourcePath + " parentFolder: " + parentFolder);
|
|
102
108
|
|
|
103
109
|
if (Directory.Exists(resourcePath))
|
|
104
110
|
{
|
|
105
111
|
Directory.Delete(resourcePath, true);
|
|
106
112
|
}
|
|
107
113
|
|
|
108
|
-
var podSpecPath = Path.Combine(path + "/Pods",
|
|
114
|
+
var podSpecPath = Path.Combine(path + "/Pods", "TapTapSDK");
|
|
109
115
|
//使用 cocospod 远程依赖
|
|
110
|
-
if (
|
|
116
|
+
if (Directory.Exists(podSpecPath))
|
|
111
117
|
{
|
|
112
|
-
resourcePath = Path.Combine(path + "/Pods",
|
|
113
|
-
Debug.Log($"Find {moduleName} use pods resourcePath:{resourcePath}");
|
|
118
|
+
resourcePath = Path.Combine(path + "/Pods", "TapTapSDK/Frameworks");
|
|
119
|
+
UnityEngine.Debug.Log($"Find {moduleName} use pods resourcePath:{resourcePath}");
|
|
114
120
|
}
|
|
115
121
|
else
|
|
116
122
|
{
|
|
@@ -121,7 +127,7 @@ namespace TapSDK.Core.Editor
|
|
|
121
127
|
|
|
122
128
|
var localPackagePath = TapFileHelper.FilterFileByPrefix(parentFolder, moduleName);
|
|
123
129
|
|
|
124
|
-
Debug.Log($"Find {moduleName} path: remote = {remotePackagePath} asset = {assetLocalPackagePath} local = {localPackagePath}");
|
|
130
|
+
UnityEngine.Debug.Log($"Find {moduleName} path: remote = {remotePackagePath} asset = {assetLocalPackagePath} local = {localPackagePath}");
|
|
125
131
|
var tdsResourcePath = "";
|
|
126
132
|
|
|
127
133
|
if (!string.IsNullOrEmpty(remotePackagePath))
|
|
@@ -144,7 +150,7 @@ namespace TapSDK.Core.Editor
|
|
|
144
150
|
|
|
145
151
|
tdsResourcePath = $"{tdsResourcePath}/Plugins/iOS/Resource";
|
|
146
152
|
|
|
147
|
-
Debug.Log($"Find {moduleName} path:{tdsResourcePath}");
|
|
153
|
+
UnityEngine.Debug.Log($"Find {moduleName} path:{tdsResourcePath}");
|
|
148
154
|
|
|
149
155
|
if (!Directory.Exists(tdsResourcePath))
|
|
150
156
|
{
|
|
@@ -156,8 +162,11 @@ namespace TapSDK.Core.Editor
|
|
|
156
162
|
foreach (var name in bundleNames)
|
|
157
163
|
{
|
|
158
164
|
var relativePath = GetRelativePath(Path.Combine(resourcePath, name), path);
|
|
159
|
-
|
|
160
|
-
|
|
165
|
+
if (!proj.ContainsFileByRealPath(relativePath))
|
|
166
|
+
{
|
|
167
|
+
var fileGuid = proj.AddFile(relativePath, relativePath, PBXSourceTree.Source);
|
|
168
|
+
proj.AddFileToBuild(target, fileGuid);
|
|
169
|
+
}
|
|
161
170
|
}
|
|
162
171
|
|
|
163
172
|
File.WriteAllText(projPath, proj.WriteToString());
|
|
@@ -173,7 +182,7 @@ namespace TapSDK.Core.Editor
|
|
|
173
182
|
Uri aboslutePathUri = new Uri(absolutePath);
|
|
174
183
|
Uri rootPathUri = new Uri(rootPath);
|
|
175
184
|
var relateivePath = rootPathUri.MakeRelativeUri(aboslutePathUri).ToString();
|
|
176
|
-
Debug.LogFormat($"[TapSDKCoreCompile] GetRelativePath absolutePath:{absolutePath} rootPath:{rootPath} relateivePath:{relateivePath} ");
|
|
185
|
+
UnityEngine.Debug.LogFormat($"[TapSDKCoreCompile] GetRelativePath absolutePath:{absolutePath} rootPath:{rootPath} relateivePath:{relateivePath} ");
|
|
177
186
|
return relateivePath;
|
|
178
187
|
}
|
|
179
188
|
|
|
@@ -207,7 +216,7 @@ namespace TapSDK.Core.Editor
|
|
|
207
216
|
: macosXCodePlistPath;
|
|
208
217
|
}
|
|
209
218
|
|
|
210
|
-
Debug.Log($"plist path:{plistPath}");
|
|
219
|
+
UnityEngine.Debug.Log($"plist path:{plistPath}");
|
|
211
220
|
|
|
212
221
|
var plist = new PlistDocument();
|
|
213
222
|
plist.ReadFromString(File.ReadAllText(plistPath));
|
|
@@ -224,16 +233,19 @@ namespace TapSDK.Core.Editor
|
|
|
224
233
|
{
|
|
225
234
|
plistElementList = rootDic.CreateArray("LSApplicationQueriesSchemes");
|
|
226
235
|
}
|
|
227
|
-
|
|
236
|
+
|
|
228
237
|
string listData = "";
|
|
229
|
-
foreach (var item in plistElementList.values)
|
|
230
|
-
|
|
238
|
+
foreach (var item in plistElementList.values)
|
|
239
|
+
{
|
|
240
|
+
if (item is PlistElementString)
|
|
241
|
+
{
|
|
231
242
|
listData += item.AsString() + ";";
|
|
232
243
|
}
|
|
233
244
|
}
|
|
234
245
|
foreach (var t in items)
|
|
235
246
|
{
|
|
236
|
-
if (!listData.Contains(t + ";"))
|
|
247
|
+
if (!listData.Contains(t + ";"))
|
|
248
|
+
{
|
|
237
249
|
plistElementList.AddString(t);
|
|
238
250
|
}
|
|
239
251
|
}
|
|
@@ -280,7 +292,7 @@ namespace TapSDK.Core.Editor
|
|
|
280
292
|
array2.AddString($"open-taptap-{taptapId}");
|
|
281
293
|
}
|
|
282
294
|
|
|
283
|
-
Debug.Log("TapSDK change plist Success");
|
|
295
|
+
UnityEngine.Debug.Log("TapSDK change plist Success");
|
|
284
296
|
File.WriteAllText(plistPath, plist.WriteToString());
|
|
285
297
|
return true;
|
|
286
298
|
}
|
|
@@ -295,6 +307,189 @@ namespace TapSDK.Core.Editor
|
|
|
295
307
|
var dic = (Dictionary<string, object>)Plist.readPlist(infoPlistPath);
|
|
296
308
|
return (from item in dic where item.Key.Equals(key) select (string)item.Value).FirstOrDefault();
|
|
297
309
|
}
|
|
310
|
+
|
|
311
|
+
public static void ExecutePodCommand(string command, string workingDirectory)
|
|
312
|
+
{
|
|
313
|
+
string podPath = FindPodPath();
|
|
314
|
+
if (string.IsNullOrEmpty(podPath))
|
|
315
|
+
{
|
|
316
|
+
UnityEngine.Debug.LogError("[CocoaPods] search pod install path failed");
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
UnityEngine.Debug.Log("[CocoaPods] search pod install path :" + podPath);
|
|
320
|
+
command = command.Replace("pod", podPath);
|
|
321
|
+
command = "export LANG=en_US.UTF-8 && " + command;
|
|
322
|
+
var process = new Process
|
|
323
|
+
{
|
|
324
|
+
StartInfo = new ProcessStartInfo
|
|
325
|
+
{
|
|
326
|
+
FileName = "/bin/bash",
|
|
327
|
+
Arguments = $"-c \"{command}\"",
|
|
328
|
+
WorkingDirectory = workingDirectory,
|
|
329
|
+
RedirectStandardOutput = true,
|
|
330
|
+
RedirectStandardError = true,
|
|
331
|
+
UseShellExecute = false,
|
|
332
|
+
CreateNoWindow = true
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
process.Start();
|
|
337
|
+
process.WaitForExit();
|
|
338
|
+
|
|
339
|
+
string output = process.StandardOutput.ReadToEnd();
|
|
340
|
+
string error = process.StandardError.ReadToEnd();
|
|
341
|
+
|
|
342
|
+
if (!string.IsNullOrEmpty(output))
|
|
343
|
+
UnityEngine.Debug.Log($"[CocoaPods] Output: {output}");
|
|
344
|
+
|
|
345
|
+
if (!string.IsNullOrEmpty(error))
|
|
346
|
+
UnityEngine.Debug.LogError($"[CocoaPods] Error: {error}");
|
|
347
|
+
|
|
348
|
+
if (process.ExitCode == 0)
|
|
349
|
+
UnityEngine.Debug.Log($"[CocoaPods] Success: {command}");
|
|
350
|
+
else
|
|
351
|
+
UnityEngine.Debug.LogError($"[CocoaPods] Failed: {command} (Exit code: {process.ExitCode})");
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
private static string FindPodPath()
|
|
355
|
+
{
|
|
356
|
+
string whichResult = RunBashCommand("-l -c \"which pod\"");
|
|
357
|
+
whichResult = whichResult.Replace("\n", "");
|
|
358
|
+
if (!string.IsNullOrEmpty(whichResult) && File.Exists(whichResult))
|
|
359
|
+
{
|
|
360
|
+
UnityEngine.Debug.Log($"[PodFinder] Found pod at which result: {whichResult}");
|
|
361
|
+
return whichResult;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
string[] CommonPaths = new string[]
|
|
365
|
+
{
|
|
366
|
+
"/usr/local/bin",
|
|
367
|
+
"/usr/bin",
|
|
368
|
+
"/opt/homebrew/bin"
|
|
369
|
+
};
|
|
370
|
+
// 1. 先在常见路径查找 pod
|
|
371
|
+
foreach (var path in CommonPaths)
|
|
372
|
+
{
|
|
373
|
+
string podPath = Path.Combine(path, "pod");
|
|
374
|
+
if (File.Exists(podPath))
|
|
375
|
+
{
|
|
376
|
+
UnityEngine.Debug.Log($"[PodFinder] Found pod at common path: {podPath}");
|
|
377
|
+
return podPath;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
// 2. 如果没找到,执行 gem environment 查找
|
|
381
|
+
string gemEnvOutput = RunBashCommand("-l -c \"gem environment\"");
|
|
382
|
+
|
|
383
|
+
if (string.IsNullOrEmpty(gemEnvOutput))
|
|
384
|
+
{
|
|
385
|
+
UnityEngine.Debug.LogWarning("[PodFinder] gem environment output is empty.");
|
|
386
|
+
return null;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// 3. 解析 EXECUTABLE DIRECTORY
|
|
390
|
+
string execDir = ParseGemEnvironment(gemEnvOutput, @"EXECUTABLE DIRECTORY:\s*(.+)");
|
|
391
|
+
if (!string.IsNullOrEmpty(execDir))
|
|
392
|
+
{
|
|
393
|
+
string podPath = Path.Combine(execDir.Trim(), "pod");
|
|
394
|
+
if (File.Exists(podPath))
|
|
395
|
+
{
|
|
396
|
+
UnityEngine.Debug.Log($"[PodFinder] Found pod via EXECUTABLE DIRECTORY: {podPath}");
|
|
397
|
+
return podPath;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// 4. 解析 GEM PATHS,尝试从每个路径下的 bin 文件夹查找 pod
|
|
402
|
+
var gemPaths = ParseGemEnvironmentMultiple(gemEnvOutput, @"GEM PATHS:\s*((?:- .+\n)+)");
|
|
403
|
+
if (gemPaths != null)
|
|
404
|
+
{
|
|
405
|
+
foreach (var gemPath in gemPaths)
|
|
406
|
+
{
|
|
407
|
+
// 一般 pod 会在 bin 文件夹或同级目录中
|
|
408
|
+
string podPath1 = Path.Combine(gemPath.Trim(), "bin", "pod");
|
|
409
|
+
string podPath2 = Path.Combine(gemPath.Trim(), "pod"); // 备选路径
|
|
410
|
+
|
|
411
|
+
if (File.Exists(podPath1))
|
|
412
|
+
{
|
|
413
|
+
UnityEngine.Debug.Log($"[PodFinder] Found pod via GEM PATHS (bin): {podPath1}");
|
|
414
|
+
return podPath1;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
if (File.Exists(podPath2))
|
|
418
|
+
{
|
|
419
|
+
UnityEngine.Debug.Log($"[PodFinder] Found pod via GEM PATHS: {podPath2}");
|
|
420
|
+
return podPath2;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
UnityEngine.Debug.LogWarning("[PodFinder] pod executable not found.");
|
|
426
|
+
return null;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
private static string RunBashCommand(string arguments)
|
|
430
|
+
{
|
|
431
|
+
try
|
|
432
|
+
{
|
|
433
|
+
using (var process = new Process())
|
|
434
|
+
{
|
|
435
|
+
process.StartInfo.FileName = "/bin/bash";
|
|
436
|
+
process.StartInfo.Arguments = arguments;
|
|
437
|
+
process.StartInfo.RedirectStandardOutput = true;
|
|
438
|
+
process.StartInfo.RedirectStandardError = true;
|
|
439
|
+
process.StartInfo.UseShellExecute = false;
|
|
440
|
+
process.StartInfo.CreateNoWindow = true;
|
|
441
|
+
|
|
442
|
+
process.Start();
|
|
443
|
+
string output = process.StandardOutput.ReadToEnd();
|
|
444
|
+
string err = process.StandardError.ReadToEnd();
|
|
445
|
+
process.WaitForExit();
|
|
446
|
+
|
|
447
|
+
if (!string.IsNullOrEmpty(err))
|
|
448
|
+
{
|
|
449
|
+
UnityEngine.Debug.LogWarning($"[PodFinder] bash error: {err}");
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
return output;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
catch (Exception e)
|
|
456
|
+
{
|
|
457
|
+
UnityEngine.Debug.LogError($"[PodFinder] Exception running bash command: {e}");
|
|
458
|
+
return null;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
private static string ParseGemEnvironment(string input, string pattern)
|
|
463
|
+
{
|
|
464
|
+
var match = Regex.Match(input, pattern);
|
|
465
|
+
if (match.Success && match.Groups.Count > 1)
|
|
466
|
+
{
|
|
467
|
+
return match.Groups[1].Value.Trim();
|
|
468
|
+
}
|
|
469
|
+
return null;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
private static string[] ParseGemEnvironmentMultiple(string input, string pattern)
|
|
473
|
+
{
|
|
474
|
+
var match = Regex.Match(input, pattern, RegexOptions.Multiline);
|
|
475
|
+
if (!match.Success || match.Groups.Count < 2) return null;
|
|
476
|
+
|
|
477
|
+
string block = match.Groups[1].Value;
|
|
478
|
+
|
|
479
|
+
// 每行格式是类似 "- /path/to/gem"
|
|
480
|
+
var lines = block.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
|
|
481
|
+
var paths = new System.Collections.Generic.List<string>();
|
|
482
|
+
foreach (var line in lines)
|
|
483
|
+
{
|
|
484
|
+
string trimmed = line.Trim();
|
|
485
|
+
if (trimmed.StartsWith("- "))
|
|
486
|
+
{
|
|
487
|
+
paths.Add(trimmed.Substring(2).Trim());
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
return paths.ToArray();
|
|
492
|
+
}
|
|
298
493
|
#endif
|
|
299
494
|
}
|
|
300
495
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
using System.IO;
|
|
2
|
+
using System.Linq;
|
|
2
3
|
using UnityEditor;
|
|
3
4
|
# if UNITY_IOS
|
|
4
5
|
using UnityEditor.Callbacks;
|
|
@@ -29,8 +30,8 @@ namespace TapSDK.Core.Editor
|
|
|
29
30
|
return;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
proj.AddBuildProperty(target, "OTHER_LDFLAGS", "-ObjC");
|
|
33
|
-
proj.AddBuildProperty(unityFrameworkTarget, "OTHER_LDFLAGS", "-ObjC");
|
|
33
|
+
// proj.AddBuildProperty(target, "OTHER_LDFLAGS", "-ObjC");
|
|
34
|
+
// proj.AddBuildProperty(unityFrameworkTarget, "OTHER_LDFLAGS", "-ObjC");
|
|
34
35
|
|
|
35
36
|
proj.SetBuildProperty(target, "ENABLE_BITCODE", "NO");
|
|
36
37
|
proj.SetBuildProperty(target, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "YES");
|
|
@@ -38,7 +39,9 @@ namespace TapSDK.Core.Editor
|
|
|
38
39
|
proj.SetBuildProperty(target, "CLANG_ENABLE_MODULES", "YES");
|
|
39
40
|
|
|
40
41
|
proj.SetBuildProperty(unityFrameworkTarget, "ENABLE_BITCODE", "NO");
|
|
41
|
-
proj.SetBuildProperty(unityFrameworkTarget, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "
|
|
42
|
+
proj.SetBuildProperty(unityFrameworkTarget, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "YES");
|
|
43
|
+
proj.SetBuildProperty(unityFrameworkTarget, "BUILD_LIBRARY_FOR_DISTRIBUTION", "YES");
|
|
44
|
+
|
|
42
45
|
proj.SetBuildProperty(unityFrameworkTarget, "SWIFT_VERSION", "5.0");
|
|
43
46
|
proj.SetBuildProperty(unityFrameworkTarget, "CLANG_ENABLE_MODULES", "YES");
|
|
44
47
|
|
|
@@ -47,7 +50,6 @@ namespace TapSDK.Core.Editor
|
|
|
47
50
|
proj.AddFrameworkToProject(unityFrameworkTarget, "Security.framework", false);
|
|
48
51
|
proj.AddFrameworkToProject(unityFrameworkTarget, "SystemConfiguration.framework", false);
|
|
49
52
|
proj.AddFrameworkToProject(unityFrameworkTarget, "CoreTelephony.framework", false);
|
|
50
|
-
proj.AddFrameworkToProject(unityFrameworkTarget, "SystemConfiguration.framework", false);
|
|
51
53
|
|
|
52
54
|
proj.AddFileToBuild(unityFrameworkTarget,
|
|
53
55
|
proj.AddFile("usr/lib/libc++.tbd", "libc++.tbd", PBXSourceTree.Sdk));
|
|
@@ -55,20 +57,19 @@ namespace TapSDK.Core.Editor
|
|
|
55
57
|
proj.AddFileToBuild(unityFrameworkTarget,
|
|
56
58
|
proj.AddFile("usr/lib/libsqlite3.tbd", "libsqlite3.tbd", PBXSourceTree.Sdk));
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// }
|
|
60
|
+
proj.WriteToFile(projPath);
|
|
61
|
+
string podfilePath = Path.Combine(path, "Podfile");
|
|
62
|
+
if (!File.Exists(podfilePath))
|
|
63
|
+
{
|
|
64
|
+
Debug.LogWarning("Podfile not found.");
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
string podfileContent = File.ReadAllText(podfilePath);
|
|
69
|
+
podfileContent += "\ninstall! 'cocoapods', :warn_for_unused_master_specs_repo => false";
|
|
69
70
|
|
|
70
|
-
|
|
71
|
+
File.WriteAllText(podfilePath, podfileContent);
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
#endif
|
|
74
|
-
}
|
|
75
|
+
}
|
|
@@ -38,7 +38,8 @@ namespace TapSDK.Core
|
|
|
38
38
|
|
|
39
39
|
Action<Result> action = null;
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
// 修复:检查callbackId是否为null或空,防止ArgumentNullException
|
|
42
|
+
if (actionDic != null && !string.IsNullOrEmpty(result.callbackId) && actionDic.ContainsKey(result.callbackId))
|
|
42
43
|
{
|
|
43
44
|
action = actionDic[result.callbackId];
|
|
44
45
|
}
|
|
@@ -46,12 +47,22 @@ namespace TapSDK.Core
|
|
|
46
47
|
if (action != null)
|
|
47
48
|
{
|
|
48
49
|
action(result);
|
|
49
|
-
if (result.onceTime && BridgeIOS.GetInstance().GetConcurrentDictionary()
|
|
50
|
+
if (result.onceTime && !string.IsNullOrEmpty(result.callbackId) && BridgeIOS.GetInstance().GetConcurrentDictionary()
|
|
50
51
|
.TryRemove(result.callbackId, out Action<Result> outAction))
|
|
51
52
|
{
|
|
52
53
|
TapLog.Log($"TapSDK resolved current Action:{result.callbackId}");
|
|
53
54
|
}
|
|
54
55
|
}
|
|
56
|
+
else if (string.IsNullOrEmpty(result.callbackId))
|
|
57
|
+
{
|
|
58
|
+
// 记录调试信息:当callbackId为空时
|
|
59
|
+
TapLog.Log($"TapSDK received result without callbackId, result: {resultJson}");
|
|
60
|
+
}
|
|
61
|
+
else
|
|
62
|
+
{
|
|
63
|
+
// 记录调试信息:当找不到对应的action时
|
|
64
|
+
TapLog.Log($"TapSDK no action found for callbackId: {result.callbackId}");
|
|
65
|
+
}
|
|
55
66
|
}
|
|
56
67
|
|
|
57
68
|
|