[U] copy from n3 client
This commit is contained in:
@@ -6,12 +6,21 @@ using UnityEditor.iOS.Xcode;
|
||||
using UnityEditor;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace tysdk.editor
|
||||
{
|
||||
|
||||
public class iOSPostBuildProcessor
|
||||
{
|
||||
|
||||
//[MenuItem("Tools/XcodeProcessTest")]
|
||||
//public static void Test()
|
||||
//{
|
||||
//var path = Path.Join(Directory.GetCurrentDirectory(),"bin/ft_xcode_0_26_20250512133516");
|
||||
//ProcessXCodeProj(path);
|
||||
//}
|
||||
|
||||
[PostProcessBuild(1000)]
|
||||
public static void ChangeXcodeSettings(BuildTarget buildTarget, string pathToBuiltProject)
|
||||
{
|
||||
@@ -37,10 +46,26 @@ namespace tysdk.editor
|
||||
UnityEngine.Debug.Log($"XCodeProj {pbxprojPath}");
|
||||
File.WriteAllText(pbxprojPath, proj.WriteToString());
|
||||
|
||||
ProcessLocalization(pbxprojPath);
|
||||
|
||||
ProcessPlist(pathToBuiltProject);
|
||||
|
||||
}
|
||||
|
||||
const string knowRegions = "knownRegions = (\n\t\t\t\ten,\n\t\t\t\tfr,\n\t\t\t\tde,\n\t\t\t\tes,\n\t\t\t\tid,\n\t\t\t\t\"zh-Hans\",\n\t\t\t\t\"zh-Hant\",\n\t\t\t);";
|
||||
|
||||
const string developmentRegion = "developmentRegion = en;";
|
||||
|
||||
private static void ProcessLocalization(string pbxProjPath)
|
||||
{
|
||||
var raw = File.ReadAllText(pbxProjPath);
|
||||
Regex developmentRegionRegex = new Regex(@"developmentRegion\s*=\s*(\w+);");
|
||||
Regex knownRegionsRegex = new Regex(@"knownRegions\s*=\s*\(([^)]+)\);");
|
||||
raw = developmentRegionRegex.Replace(raw, developmentRegion);
|
||||
raw = knownRegionsRegex.Replace(raw, knowRegions);
|
||||
File.WriteAllText(pbxProjPath, raw);
|
||||
}
|
||||
|
||||
private static void XcodeOverwriteFiles(string projPath, PBXProject proj)
|
||||
{
|
||||
|
||||
@@ -186,6 +211,15 @@ namespace tysdk.editor
|
||||
}
|
||||
AddSKAdNetworkIdentifier(infoDict);
|
||||
|
||||
var localization = infoDict.CreateArray("CFBundleLocalizations");
|
||||
localization.AddString("en");
|
||||
localization.AddString("fr");
|
||||
localization.AddString("de");
|
||||
localization.AddString("es");
|
||||
localization.AddString("id");
|
||||
localization.AddString("zh_CN");
|
||||
localization.AddString("zh_TW");
|
||||
|
||||
File.WriteAllText(plistPath, plist.WriteToString());
|
||||
}
|
||||
|
||||
@@ -227,7 +261,6 @@ namespace tysdk.editor
|
||||
{
|
||||
items.AddDict().SetString(key, identifier);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void CreateURLTypes(PlistElementDict dict, string name, string scheme1)
|
||||
|
||||
@@ -404,7 +404,7 @@ public class SDKManager {
|
||||
ShareDialog dialog = new ShareDialog(activity);
|
||||
ShareLinkContent linkContent = new ShareLinkContent.Builder()
|
||||
.setQuote(content)
|
||||
.setContentUrl(Uri.parse("http://developers.facebook.com/android"))
|
||||
.setContentUrl(Uri.parse(url))
|
||||
.build();
|
||||
dialog.show(linkContent);
|
||||
}
|
||||
@@ -421,7 +421,7 @@ public class SDKManager {
|
||||
Activity activity = UnityPlayer.currentActivity;
|
||||
ShareLinkContent linkContent = new ShareLinkContent.Builder()
|
||||
.setQuote(content)
|
||||
.setContentUrl(Uri.parse("http://developers.facebook.com/android"))
|
||||
.setContentUrl(Uri.parse(url))
|
||||
.build();
|
||||
MessageDialog.show(activity,linkContent);
|
||||
}
|
||||
|
||||
@@ -109,7 +109,6 @@ namespace tysdk
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
public class SKUDetail
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user