[WIP] firebase init Error

This commit is contained in:
2024-08-02 20:09:59 +08:00
commit b77fd9f498
7087 changed files with 1466846 additions and 0 deletions

View File

@@ -0,0 +1,102 @@
#if UNITY_IOS
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
using UnityEditor;
using System.IO;
namespace tysdk.editor
{
public class iOSPostBuildProcessor
{
[PostProcessBuild(1000)]
public static void ChangeXcodeSettings(BuildTarget buildTarget, string pathToBuiltProject)
{
if (buildTarget == BuildTarget.iOS)
{
UnityEngine.Debug.Log($"ChangeXcodeSettings {pathToBuiltProject}");
ProcessXCodeProj(pathToBuiltProject);
}
}
private static void ProcessXCodeProj(string pathToBuiltProject)
{
string pbxprojPath = PBXProject.GetPBXProjectPath(pathToBuiltProject);
PBXProject proj = new PBXProject();
proj.ReadFromFile(pbxprojPath);
string target = proj.GetUnityMainTargetGuid();
XCodeSetSigingAndCapbilities(target, proj, pathToBuiltProject);
ProcessBuildSettings(proj);
XcodeOverwriteFiles(pathToBuiltProject, proj);
UnityEngine.Debug.Log($"XCodeProj {pbxprojPath}");
File.WriteAllText(pbxprojPath, proj.WriteToString());
//ProcessPlist(projPath);
}
private static void XcodeOverwriteFiles(string projPath, PBXProject proj)
{
var mainAppPath = Path.Combine(projPath, "Classes", "Preprocessor.h");
var mainContent = File.ReadAllText(mainAppPath);
var newContent = mainContent.Replace("#define UNITY_USES_REMOTE_NOTIFICATIONS 0", "#define UNITY_USES_REMOTE_NOTIFICATIONS 1");
File.WriteAllText(mainAppPath, newContent);
}
private static void XCodeSetSigingAndCapbilities(string target, PBXProject proj, string root)
{
var entitlementsContent = File.ReadAllText("Packages/tysdk/Files/Unity-iPhone.entitlements");
File.WriteAllText($"{root}/Unity-iPhone/Unity-iPhone.entitlements", entitlementsContent);
proj.AddCapability(target, PBXCapabilityType.KeychainSharing, "Unity-iPhone/Unity-iPhone.entitlements");
proj.AddCapability(target, PBXCapabilityType.PushNotifications, "Unity-iPhone/Unity-iPhone.entitlements");
//proj.AddCapability(target, PBXCapabilityType.AssociatedDomains, "Unity-iPhone/Unity-iPhone.entitlements");
}
private static void ProcessBuildSettings(PBXProject proj)
{
string target = proj.TargetGuidByName("GameAssembly");
proj.AddBuildProperty(target, "OTHER_LDFLAGS", "-all_load");
target = proj.TargetGuidByName("UnityFramework");
proj.AddBuildProperty(target, "OTHER_LDFLAGS", "-ObjC");
proj.AddFrameworkToProject(target, "AppTrackingTransparency.framework", false);
proj.AddFrameworkToProject(target,"StoreKit.framework", false);
proj.AddFrameworkToProject(target,"CFNetwork.framework", false);
proj.AddFrameworkToProject(target,"CoreTelephony.framework", false);
proj.AddFrameworkToProject(target,"Security.framework", false);
proj.AddFrameworkToProject(target,"SystemConfiguration.framework", false);
proj.AddFrameworkToProject(target,"libc++.tbd", false);
proj.AddFrameworkToProject(target,"libsqlite3.tbd", false);
proj.AddFrameworkToProject(target,"libz.tbd", false);
proj.AddFrameworkToProject(target,"Accelerate.framework", false);
proj.AddFrameworkToProject(target,"AuthenticationServices.framework", false);
proj.AddFrameworkToProject(target,"SafariServices.framework", false);
proj.AddFrameworkToProject(target,"LocalAuthentication.framework", false);
proj.AddFrameworkToProject(target,"CoreGraphics.framework", false);
proj.AddFrameworkToProject(target,"WebKit.framework", false);
}
private static void ProcessPlist(string root)
{
var trackingDescription = "Data will be used to deliver personalized content to you";
var photoLibraryUsageDescription = "The app requires your consent to add photos or videos to the photo gallery so that you can manage and share them more easily. We are committed to protecting your privacy and complying with relevant laws and regulations.";
string plistPath = root + "/Info.plist";
PlistDocument plist = new PlistDocument();
plist.ReadFromString(File.ReadAllText(plistPath));
PlistElementDict infoDict = plist.root;
infoDict.SetString("NSUserTrackingUsageDescription", trackingDescription);
infoDict.SetBoolean("UIFileSharingEnabled", true);
infoDict.SetBoolean("PHPhotoLibraryPreventAutomaticLimitedAccessAlert", true);
infoDict.SetString("NSPhotoLibraryUsageDescription", photoLibraryUsageDescription);
File.WriteAllText(plistPath, plist.WriteToString());
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 468d2681067c74abb878906d38bdedde
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,16 @@
{
"name": "tysdk.editor",
"rootNamespace": "tysdk.editor",
"references": [],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6a774485133c74ca3b9d9c2727879d3a
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: