com.taptap.sdk.core 4.8.1 → 4.8.3
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/Editor/TapSDKCoreCompile.cs +214 -19
- package/Editor/TapSDKCoreIOSProcessor.cs +32 -4
- package/Mobile/Editor/NativeDependencies.xml +2 -2
- package/Runtime/Public/TapLocalizeManager.cs +31 -31
- package/Runtime/Public/TapTapSDK.cs +1 -1
- package/package.json +1 -1
- package/Runtime/Public/TapLanguage.cs +0 -21
- package/Runtime/Public/TapLanguage.cs.meta +0 -11
|
@@ -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
|
}
|
|
@@ -96,7 +102,7 @@ namespace TapSDK.Core.Editor
|
|
|
96
102
|
|
|
97
103
|
var parentFolder = Directory.GetParent(appDataPath).FullName;
|
|
98
104
|
|
|
99
|
-
Debug.Log($"ProjectFolder path:{parentFolder}" + " resourcePath: " + resourcePath + " parentFolder: " + parentFolder);
|
|
105
|
+
UnityEngine.Debug.Log($"ProjectFolder path:{parentFolder}" + " resourcePath: " + resourcePath + " parentFolder: " + parentFolder);
|
|
100
106
|
|
|
101
107
|
if (Directory.Exists(resourcePath))
|
|
102
108
|
{
|
|
@@ -108,7 +114,7 @@ namespace TapSDK.Core.Editor
|
|
|
108
114
|
if (podSpecName != null && podSpecName.Length > 0 && Directory.Exists(podSpecPath))
|
|
109
115
|
{
|
|
110
116
|
resourcePath = Path.Combine(path + "/Pods", podSpecName + "/Frameworks");
|
|
111
|
-
Debug.Log($"Find {moduleName} use pods resourcePath:{resourcePath}");
|
|
117
|
+
UnityEngine.Debug.Log($"Find {moduleName} use pods resourcePath:{resourcePath}");
|
|
112
118
|
}
|
|
113
119
|
else
|
|
114
120
|
{
|
|
@@ -119,7 +125,7 @@ namespace TapSDK.Core.Editor
|
|
|
119
125
|
|
|
120
126
|
var localPackagePath = TapFileHelper.FilterFileByPrefix(parentFolder, moduleName);
|
|
121
127
|
|
|
122
|
-
Debug.Log($"Find {moduleName} path: remote = {remotePackagePath} asset = {assetLocalPackagePath} local = {localPackagePath}");
|
|
128
|
+
UnityEngine.Debug.Log($"Find {moduleName} path: remote = {remotePackagePath} asset = {assetLocalPackagePath} local = {localPackagePath}");
|
|
123
129
|
var tdsResourcePath = "";
|
|
124
130
|
|
|
125
131
|
if (!string.IsNullOrEmpty(remotePackagePath))
|
|
@@ -142,7 +148,7 @@ namespace TapSDK.Core.Editor
|
|
|
142
148
|
|
|
143
149
|
tdsResourcePath = $"{tdsResourcePath}/Plugins/iOS/Resource";
|
|
144
150
|
|
|
145
|
-
Debug.Log($"Find {moduleName} path:{tdsResourcePath}");
|
|
151
|
+
UnityEngine.Debug.Log($"Find {moduleName} path:{tdsResourcePath}");
|
|
146
152
|
|
|
147
153
|
if (!Directory.Exists(tdsResourcePath))
|
|
148
154
|
{
|
|
@@ -154,8 +160,11 @@ namespace TapSDK.Core.Editor
|
|
|
154
160
|
foreach (var name in bundleNames)
|
|
155
161
|
{
|
|
156
162
|
var relativePath = GetRelativePath(Path.Combine(resourcePath, name), path);
|
|
157
|
-
|
|
158
|
-
|
|
163
|
+
if (!proj.ContainsFileByRealPath(relativePath))
|
|
164
|
+
{
|
|
165
|
+
var fileGuid = proj.AddFile(relativePath, relativePath, PBXSourceTree.Source);
|
|
166
|
+
proj.AddFileToBuild(target, fileGuid);
|
|
167
|
+
}
|
|
159
168
|
}
|
|
160
169
|
|
|
161
170
|
File.WriteAllText(projPath, proj.WriteToString());
|
|
@@ -171,7 +180,7 @@ namespace TapSDK.Core.Editor
|
|
|
171
180
|
Uri aboslutePathUri = new Uri(absolutePath);
|
|
172
181
|
Uri rootPathUri = new Uri(rootPath);
|
|
173
182
|
var relateivePath = rootPathUri.MakeRelativeUri(aboslutePathUri).ToString();
|
|
174
|
-
Debug.LogFormat($"[TapSDKCoreCompile] GetRelativePath absolutePath:{absolutePath} rootPath:{rootPath} relateivePath:{relateivePath} ");
|
|
183
|
+
UnityEngine.Debug.LogFormat($"[TapSDKCoreCompile] GetRelativePath absolutePath:{absolutePath} rootPath:{rootPath} relateivePath:{relateivePath} ");
|
|
175
184
|
return relateivePath;
|
|
176
185
|
}
|
|
177
186
|
|
|
@@ -205,7 +214,7 @@ namespace TapSDK.Core.Editor
|
|
|
205
214
|
: macosXCodePlistPath;
|
|
206
215
|
}
|
|
207
216
|
|
|
208
|
-
Debug.Log($"plist path:{plistPath}");
|
|
217
|
+
UnityEngine.Debug.Log($"plist path:{plistPath}");
|
|
209
218
|
|
|
210
219
|
var plist = new PlistDocument();
|
|
211
220
|
plist.ReadFromString(File.ReadAllText(plistPath));
|
|
@@ -222,16 +231,19 @@ namespace TapSDK.Core.Editor
|
|
|
222
231
|
{
|
|
223
232
|
plistElementList = rootDic.CreateArray("LSApplicationQueriesSchemes");
|
|
224
233
|
}
|
|
225
|
-
|
|
234
|
+
|
|
226
235
|
string listData = "";
|
|
227
|
-
foreach (var item in plistElementList.values)
|
|
228
|
-
|
|
236
|
+
foreach (var item in plistElementList.values)
|
|
237
|
+
{
|
|
238
|
+
if (item is PlistElementString)
|
|
239
|
+
{
|
|
229
240
|
listData += item.AsString() + ";";
|
|
230
241
|
}
|
|
231
242
|
}
|
|
232
243
|
foreach (var t in items)
|
|
233
244
|
{
|
|
234
|
-
if (!listData.Contains(t + ";"))
|
|
245
|
+
if (!listData.Contains(t + ";"))
|
|
246
|
+
{
|
|
235
247
|
plistElementList.AddString(t);
|
|
236
248
|
}
|
|
237
249
|
}
|
|
@@ -278,7 +290,7 @@ namespace TapSDK.Core.Editor
|
|
|
278
290
|
array2.AddString($"open-taptap-{taptapId}");
|
|
279
291
|
}
|
|
280
292
|
|
|
281
|
-
Debug.Log("TapSDK change plist Success");
|
|
293
|
+
UnityEngine.Debug.Log("TapSDK change plist Success");
|
|
282
294
|
File.WriteAllText(plistPath, plist.WriteToString());
|
|
283
295
|
return true;
|
|
284
296
|
}
|
|
@@ -293,6 +305,189 @@ namespace TapSDK.Core.Editor
|
|
|
293
305
|
var dic = (Dictionary<string, object>)Plist.readPlist(infoPlistPath);
|
|
294
306
|
return (from item in dic where item.Key.Equals(key) select (string)item.Value).FirstOrDefault();
|
|
295
307
|
}
|
|
308
|
+
|
|
309
|
+
public static void ExecutePodCommand(string command, string workingDirectory)
|
|
310
|
+
{
|
|
311
|
+
string podPath = FindPodPath();
|
|
312
|
+
if (string.IsNullOrEmpty(podPath))
|
|
313
|
+
{
|
|
314
|
+
UnityEngine.Debug.LogError("[CocoaPods] search pod install path failed");
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
UnityEngine.Debug.Log("[CocoaPods] search pod install path :" + podPath);
|
|
318
|
+
command = command.Replace("pod", podPath);
|
|
319
|
+
command = "export LANG=en_US.UTF-8 && " + command;
|
|
320
|
+
var process = new Process
|
|
321
|
+
{
|
|
322
|
+
StartInfo = new ProcessStartInfo
|
|
323
|
+
{
|
|
324
|
+
FileName = "/bin/bash",
|
|
325
|
+
Arguments = $"-c \"{command}\"",
|
|
326
|
+
WorkingDirectory = workingDirectory,
|
|
327
|
+
RedirectStandardOutput = true,
|
|
328
|
+
RedirectStandardError = true,
|
|
329
|
+
UseShellExecute = false,
|
|
330
|
+
CreateNoWindow = true
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
process.Start();
|
|
335
|
+
process.WaitForExit();
|
|
336
|
+
|
|
337
|
+
string output = process.StandardOutput.ReadToEnd();
|
|
338
|
+
string error = process.StandardError.ReadToEnd();
|
|
339
|
+
|
|
340
|
+
if (!string.IsNullOrEmpty(output))
|
|
341
|
+
UnityEngine.Debug.Log($"[CocoaPods] Output: {output}");
|
|
342
|
+
|
|
343
|
+
if (!string.IsNullOrEmpty(error))
|
|
344
|
+
UnityEngine.Debug.LogError($"[CocoaPods] Error: {error}");
|
|
345
|
+
|
|
346
|
+
if (process.ExitCode == 0)
|
|
347
|
+
UnityEngine.Debug.Log($"[CocoaPods] Success: {command}");
|
|
348
|
+
else
|
|
349
|
+
UnityEngine.Debug.LogError($"[CocoaPods] Failed: {command} (Exit code: {process.ExitCode})");
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
private static string FindPodPath()
|
|
353
|
+
{
|
|
354
|
+
string whichResult = RunBashCommand("-l -c \"which pod\"");
|
|
355
|
+
whichResult = whichResult.Replace("\n", "");
|
|
356
|
+
if (!string.IsNullOrEmpty(whichResult) && File.Exists(whichResult))
|
|
357
|
+
{
|
|
358
|
+
UnityEngine.Debug.Log($"[PodFinder] Found pod at which result: {whichResult}");
|
|
359
|
+
return whichResult;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
string[] CommonPaths = new string[]
|
|
363
|
+
{
|
|
364
|
+
"/usr/local/bin",
|
|
365
|
+
"/usr/bin",
|
|
366
|
+
"/opt/homebrew/bin"
|
|
367
|
+
};
|
|
368
|
+
// 1. 先在常见路径查找 pod
|
|
369
|
+
foreach (var path in CommonPaths)
|
|
370
|
+
{
|
|
371
|
+
string podPath = Path.Combine(path, "pod");
|
|
372
|
+
if (File.Exists(podPath))
|
|
373
|
+
{
|
|
374
|
+
UnityEngine.Debug.Log($"[PodFinder] Found pod at common path: {podPath}");
|
|
375
|
+
return podPath;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
// 2. 如果没找到,执行 gem environment 查找
|
|
379
|
+
string gemEnvOutput = RunBashCommand("-l -c \"gem environment\"");
|
|
380
|
+
|
|
381
|
+
if (string.IsNullOrEmpty(gemEnvOutput))
|
|
382
|
+
{
|
|
383
|
+
UnityEngine.Debug.LogWarning("[PodFinder] gem environment output is empty.");
|
|
384
|
+
return null;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// 3. 解析 EXECUTABLE DIRECTORY
|
|
388
|
+
string execDir = ParseGemEnvironment(gemEnvOutput, @"EXECUTABLE DIRECTORY:\s*(.+)");
|
|
389
|
+
if (!string.IsNullOrEmpty(execDir))
|
|
390
|
+
{
|
|
391
|
+
string podPath = Path.Combine(execDir.Trim(), "pod");
|
|
392
|
+
if (File.Exists(podPath))
|
|
393
|
+
{
|
|
394
|
+
UnityEngine.Debug.Log($"[PodFinder] Found pod via EXECUTABLE DIRECTORY: {podPath}");
|
|
395
|
+
return podPath;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// 4. 解析 GEM PATHS,尝试从每个路径下的 bin 文件夹查找 pod
|
|
400
|
+
var gemPaths = ParseGemEnvironmentMultiple(gemEnvOutput, @"GEM PATHS:\s*((?:- .+\n)+)");
|
|
401
|
+
if (gemPaths != null)
|
|
402
|
+
{
|
|
403
|
+
foreach (var gemPath in gemPaths)
|
|
404
|
+
{
|
|
405
|
+
// 一般 pod 会在 bin 文件夹或同级目录中
|
|
406
|
+
string podPath1 = Path.Combine(gemPath.Trim(), "bin", "pod");
|
|
407
|
+
string podPath2 = Path.Combine(gemPath.Trim(), "pod"); // 备选路径
|
|
408
|
+
|
|
409
|
+
if (File.Exists(podPath1))
|
|
410
|
+
{
|
|
411
|
+
UnityEngine.Debug.Log($"[PodFinder] Found pod via GEM PATHS (bin): {podPath1}");
|
|
412
|
+
return podPath1;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
if (File.Exists(podPath2))
|
|
416
|
+
{
|
|
417
|
+
UnityEngine.Debug.Log($"[PodFinder] Found pod via GEM PATHS: {podPath2}");
|
|
418
|
+
return podPath2;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
UnityEngine.Debug.LogWarning("[PodFinder] pod executable not found.");
|
|
424
|
+
return null;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
private static string RunBashCommand(string arguments)
|
|
428
|
+
{
|
|
429
|
+
try
|
|
430
|
+
{
|
|
431
|
+
using (var process = new Process())
|
|
432
|
+
{
|
|
433
|
+
process.StartInfo.FileName = "/bin/bash";
|
|
434
|
+
process.StartInfo.Arguments = arguments;
|
|
435
|
+
process.StartInfo.RedirectStandardOutput = true;
|
|
436
|
+
process.StartInfo.RedirectStandardError = true;
|
|
437
|
+
process.StartInfo.UseShellExecute = false;
|
|
438
|
+
process.StartInfo.CreateNoWindow = true;
|
|
439
|
+
|
|
440
|
+
process.Start();
|
|
441
|
+
string output = process.StandardOutput.ReadToEnd();
|
|
442
|
+
string err = process.StandardError.ReadToEnd();
|
|
443
|
+
process.WaitForExit();
|
|
444
|
+
|
|
445
|
+
if (!string.IsNullOrEmpty(err))
|
|
446
|
+
{
|
|
447
|
+
UnityEngine.Debug.LogWarning($"[PodFinder] bash error: {err}");
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
return output;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
catch (Exception e)
|
|
454
|
+
{
|
|
455
|
+
UnityEngine.Debug.LogError($"[PodFinder] Exception running bash command: {e}");
|
|
456
|
+
return null;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
private static string ParseGemEnvironment(string input, string pattern)
|
|
461
|
+
{
|
|
462
|
+
var match = Regex.Match(input, pattern);
|
|
463
|
+
if (match.Success && match.Groups.Count > 1)
|
|
464
|
+
{
|
|
465
|
+
return match.Groups[1].Value.Trim();
|
|
466
|
+
}
|
|
467
|
+
return null;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
private static string[] ParseGemEnvironmentMultiple(string input, string pattern)
|
|
471
|
+
{
|
|
472
|
+
var match = Regex.Match(input, pattern, RegexOptions.Multiline);
|
|
473
|
+
if (!match.Success || match.Groups.Count < 2) return null;
|
|
474
|
+
|
|
475
|
+
string block = match.Groups[1].Value;
|
|
476
|
+
|
|
477
|
+
// 每行格式是类似 "- /path/to/gem"
|
|
478
|
+
var lines = block.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
|
|
479
|
+
var paths = new System.Collections.Generic.List<string>();
|
|
480
|
+
foreach (var line in lines)
|
|
481
|
+
{
|
|
482
|
+
string trimmed = line.Trim();
|
|
483
|
+
if (trimmed.StartsWith("- "))
|
|
484
|
+
{
|
|
485
|
+
paths.Add(trimmed.Substring(2).Trim());
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
return paths.ToArray();
|
|
490
|
+
}
|
|
296
491
|
#endif
|
|
297
492
|
}
|
|
298
493
|
}
|
|
@@ -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,16 +30,18 @@ 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
|
-
proj.SetBuildProperty(target, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "YES");
|
|
37
|
+
// proj.SetBuildProperty(target, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "YES");
|
|
37
38
|
proj.SetBuildProperty(target, "SWIFT_VERSION", "5.0");
|
|
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
|
|
|
@@ -55,6 +58,31 @@ namespace TapSDK.Core.Editor
|
|
|
55
58
|
proj.AddFileToBuild(unityFrameworkTarget,
|
|
56
59
|
proj.AddFile("usr/lib/libsqlite3.tbd", "libsqlite3.tbd", PBXSourceTree.Sdk));
|
|
57
60
|
|
|
61
|
+
proj.WriteToFile(projPath);
|
|
62
|
+
// PodFile 使用动态库
|
|
63
|
+
string podfilePath = Path.Combine(path, "Podfile");
|
|
64
|
+
if (!File.Exists(podfilePath))
|
|
65
|
+
{
|
|
66
|
+
Debug.LogWarning("Podfile not found.");
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
string podfileContent = File.ReadAllText(podfilePath);
|
|
71
|
+
|
|
72
|
+
// // 替换 use_frameworks! 的设置(默认是 static)
|
|
73
|
+
// if (podfileContent.Contains("use_frameworks! :linkage => :static"))
|
|
74
|
+
// {
|
|
75
|
+
// podfileContent = podfileContent.Replace("use_frameworks! :linkage => :static", "use_frameworks! :linkage => :dynamic");
|
|
76
|
+
// }
|
|
77
|
+
// else if (!podfileContent.Contains("use_frameworks!"))
|
|
78
|
+
// {
|
|
79
|
+
// // 插入 use_frameworks! 如果没有
|
|
80
|
+
// podfileContent = podfileContent.Replace("platform :ios, '13.0'", "platform :ios, '13.0'\nuse_frameworks!");
|
|
81
|
+
// }
|
|
82
|
+
podfileContent += "\ninstall! 'cocoapods', :warn_for_unused_master_specs_repo => false";
|
|
83
|
+
|
|
84
|
+
File.WriteAllText(podfilePath, podfileContent);
|
|
85
|
+
Debug.Log("Podfile modified to use dynamic frameworks.");
|
|
58
86
|
// if (TapSDKCoreCompile.HandlerIOSSetting(path,
|
|
59
87
|
// Application.dataPath,
|
|
60
88
|
// "TapCommonResource",
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
<repositories>
|
|
5
5
|
<repository>https://repo.maven.apache.org/maven2</repository>
|
|
6
6
|
</repositories>
|
|
7
|
-
<androidPackage spec="com.taptap.sdk:tap-core-unity:4.8.
|
|
7
|
+
<androidPackage spec="com.taptap.sdk:tap-core-unity:4.8.3"/>
|
|
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="TapTapCoreSDK" version="4.8.
|
|
13
|
+
<iosPod addToAllTargets="false" bitcodeEnabled="false" name="TapTapCoreSDK" version="4.8.3"/>
|
|
14
14
|
</iosPods>
|
|
15
15
|
</dependencies>
|
|
@@ -24,7 +24,7 @@ namespace TapSDK.Core
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
private
|
|
27
|
+
private TapTapLanguageType _language = TapTapLanguageType.Auto;
|
|
28
28
|
private bool _regionIsCn;
|
|
29
29
|
|
|
30
30
|
public static void SetCurrentRegion(bool isCn)
|
|
@@ -32,39 +32,39 @@ namespace TapSDK.Core
|
|
|
32
32
|
Instance._regionIsCn = isCn;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
public static void SetCurrentLanguage(
|
|
35
|
+
public static void SetCurrentLanguage(TapTapLanguageType language)
|
|
36
36
|
{
|
|
37
37
|
Instance._language = language;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
public static
|
|
40
|
+
public static TapTapLanguageType GetCurrentLanguage()
|
|
41
41
|
{
|
|
42
|
-
if (Instance._language !=
|
|
42
|
+
if (Instance._language != TapTapLanguageType.Auto) return Instance._language;
|
|
43
43
|
Instance._language = GetSystemLanguage();
|
|
44
|
-
if (Instance._language ==
|
|
44
|
+
if (Instance._language == TapTapLanguageType.Auto)
|
|
45
45
|
{
|
|
46
|
-
Instance._language = Instance._regionIsCn ?
|
|
46
|
+
Instance._language = Instance._regionIsCn ? TapTapLanguageType.zh_Hans : TapTapLanguageType.en;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
return Instance._language;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
public static string GetCurrentLanguageString() {
|
|
53
|
-
|
|
53
|
+
TapTapLanguageType lang = GetCurrentLanguage();
|
|
54
54
|
switch (lang) {
|
|
55
|
-
case
|
|
55
|
+
case TapTapLanguageType.zh_Hans:
|
|
56
56
|
return "zh_CN";
|
|
57
|
-
case
|
|
57
|
+
case TapTapLanguageType.en:
|
|
58
58
|
return "en_US";
|
|
59
|
-
case
|
|
59
|
+
case TapTapLanguageType.zh_Hant:
|
|
60
60
|
return "zh_TW";
|
|
61
|
-
case
|
|
61
|
+
case TapTapLanguageType.ja:
|
|
62
62
|
return "ja_JP";
|
|
63
|
-
case
|
|
63
|
+
case TapTapLanguageType.ko:
|
|
64
64
|
return "ko_KR";
|
|
65
|
-
case
|
|
65
|
+
case TapTapLanguageType.th:
|
|
66
66
|
return "th_TH";
|
|
67
|
-
case
|
|
67
|
+
case TapTapLanguageType.id:
|
|
68
68
|
return "id_ID";
|
|
69
69
|
default:
|
|
70
70
|
return null;
|
|
@@ -72,53 +72,53 @@ namespace TapSDK.Core
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
public static string GetCurrentLanguageString2() {
|
|
75
|
-
|
|
75
|
+
TapTapLanguageType lang = GetCurrentLanguage();
|
|
76
76
|
switch (lang) {
|
|
77
|
-
case
|
|
77
|
+
case TapTapLanguageType.zh_Hans:
|
|
78
78
|
return "zh-CN";
|
|
79
|
-
case
|
|
79
|
+
case TapTapLanguageType.en:
|
|
80
80
|
return "en-US";
|
|
81
|
-
case
|
|
81
|
+
case TapTapLanguageType.zh_Hant:
|
|
82
82
|
return "zh-TW";
|
|
83
|
-
case
|
|
83
|
+
case TapTapLanguageType.ja:
|
|
84
84
|
return "ja-JP";
|
|
85
|
-
case
|
|
85
|
+
case TapTapLanguageType.ko:
|
|
86
86
|
return "ko-KR";
|
|
87
|
-
case
|
|
87
|
+
case TapTapLanguageType.th:
|
|
88
88
|
return "th-TH";
|
|
89
|
-
case
|
|
89
|
+
case TapTapLanguageType.id:
|
|
90
90
|
return "id-ID";
|
|
91
91
|
default:
|
|
92
92
|
return null;
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
private static
|
|
96
|
+
private static TapTapLanguageType GetSystemLanguage()
|
|
97
97
|
{
|
|
98
|
-
var lang =
|
|
98
|
+
var lang = TapTapLanguageType.Auto;
|
|
99
99
|
var sysLanguage = Application.systemLanguage;
|
|
100
100
|
switch (sysLanguage)
|
|
101
101
|
{
|
|
102
102
|
case SystemLanguage.ChineseSimplified:
|
|
103
|
-
lang =
|
|
103
|
+
lang = TapTapLanguageType.zh_Hans;
|
|
104
104
|
break;
|
|
105
105
|
case SystemLanguage.English:
|
|
106
|
-
lang =
|
|
106
|
+
lang = TapTapLanguageType.en;
|
|
107
107
|
break;
|
|
108
108
|
case SystemLanguage.ChineseTraditional:
|
|
109
|
-
lang =
|
|
109
|
+
lang = TapTapLanguageType.zh_Hant;
|
|
110
110
|
break;
|
|
111
111
|
case SystemLanguage.Japanese:
|
|
112
|
-
lang =
|
|
112
|
+
lang = TapTapLanguageType.ja;
|
|
113
113
|
break;
|
|
114
114
|
case SystemLanguage.Korean:
|
|
115
|
-
lang =
|
|
115
|
+
lang = TapTapLanguageType.ko;
|
|
116
116
|
break;
|
|
117
117
|
case SystemLanguage.Thai:
|
|
118
|
-
lang =
|
|
118
|
+
lang = TapTapLanguageType.th;
|
|
119
119
|
break;
|
|
120
120
|
case SystemLanguage.Indonesian:
|
|
121
|
-
lang =
|
|
121
|
+
lang = TapTapLanguageType.id;
|
|
122
122
|
break;
|
|
123
123
|
}
|
|
124
124
|
|
package/package.json
CHANGED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
namespace TapSDK.Core
|
|
2
|
-
{
|
|
3
|
-
public enum TapLanguage
|
|
4
|
-
{
|
|
5
|
-
AUTO = 0,
|
|
6
|
-
ZH_HANS = 1,
|
|
7
|
-
EN = 2,
|
|
8
|
-
ZH_HANT = 3,
|
|
9
|
-
JA = 4,
|
|
10
|
-
KO = 5,
|
|
11
|
-
TH = 6,
|
|
12
|
-
ID = 7,
|
|
13
|
-
DE = 8,
|
|
14
|
-
ES = 9,
|
|
15
|
-
FR = 10,
|
|
16
|
-
PT = 11,
|
|
17
|
-
RU = 12,
|
|
18
|
-
TR = 13,
|
|
19
|
-
VI = 14
|
|
20
|
-
}
|
|
21
|
-
}
|