diff --git a/Assets/Editor/JenkinsAdapter.cs b/Assets/Editor/JenkinsAdapter.cs index 241c19913..2a8997b4d 100644 --- a/Assets/Editor/JenkinsAdapter.cs +++ b/Assets/Editor/JenkinsAdapter.cs @@ -27,8 +27,8 @@ public class JenkinsAdapter { // 设置版本号 PlayerSettings.bundleVersion = buildInfo.version; - //Jenkins要求自动构建最低ios8.0 - PlayerSettings.iOS.targetOSVersionString = "12.0"; + //SDK要求 + PlayerSettings.iOS.targetOSVersionString = "13.0"; //设置Build,每次需要增加 PlayerSettings.iOS.buildNumber = versionCode.ToString(); // 隐藏ios的横条 diff --git a/Assets/ThirdParty/IronSource/Moloco.meta b/Assets/ThirdParty/IronSource/Moloco.meta new file mode 100644 index 000000000..1e78536c3 --- /dev/null +++ b/Assets/ThirdParty/IronSource/Moloco.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 670c734afec8948daad6b8918af41394 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ThirdParty/IronSource/Moloco/Android.meta b/Assets/ThirdParty/IronSource/Moloco/Android.meta new file mode 100644 index 000000000..9e4d7b34b --- /dev/null +++ b/Assets/ThirdParty/IronSource/Moloco/Android.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: af13f2fbe7195455d9536a2fe52da40a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ThirdParty/IronSource/Moloco/Android/AndroidDelegate.cs b/Assets/ThirdParty/IronSource/Moloco/Android/AndroidDelegate.cs new file mode 100644 index 000000000..0313551c2 --- /dev/null +++ b/Assets/ThirdParty/IronSource/Moloco/Android/AndroidDelegate.cs @@ -0,0 +1,42 @@ +// https://stackoverflow.com/questions/55492214/the-annotation-for-nullable-reference-types-should-only-be-used-in-code-within-a +#nullable enable + +using UnityEngine; +using System; + +namespace MolocoSdk +{ + public class AndroidDelegate : PlatformDelegate + { + internal const string PACKAGE_PREFIX = "com.moloco.sdk.publisher"; + + public void SetPrivacy(PrivacySettings privacySettings){ + var molocoPrivacyJavaClasspath = "com.moloco.sdk.adapter.MolocoPrivacy"; + + using (var MolocoPrivacyJavaClass = new AndroidJavaClass(molocoPrivacyJavaClasspath)) + using (var privacySettingsJavaObject = new AndroidJavaObject($"{molocoPrivacyJavaClasspath}$PrivacySettings")) + { + privacySettingsJavaObject.Set("isUserConsent", privacySettings.IsUserConsent.ToBooleanJavaObject()); + privacySettingsJavaObject.Set("isAgeRestrictedUser", privacySettings.IsAgeRestrictedUser.ToBooleanJavaObject()); + privacySettingsJavaObject.Set("isDoNotSell", privacySettings.IsDoNotSell.ToBooleanJavaObject()); + + MolocoPrivacyJavaClass.CallStatic("setPrivacy", privacySettingsJavaObject); + } + } + } + internal static class BooleanExtensions + { + internal static AndroidJavaObject? ToBooleanJavaObject(this Boolean? me) + { + using (var BooleanJavaClass = new AndroidJavaClass("java.lang.Boolean")){ + var trueJavaObject = BooleanJavaClass.GetStatic("TRUE"); + var falseJavaObject = BooleanJavaClass.GetStatic("FALSE"); + + if (me == true) return trueJavaObject; + if (me == false) return falseJavaObject; + } + + return null; + } + } +} diff --git a/Assets/ThirdParty/IronSource/Moloco/Android/AndroidDelegate.cs.meta b/Assets/ThirdParty/IronSource/Moloco/Android/AndroidDelegate.cs.meta new file mode 100644 index 000000000..abc71b15c --- /dev/null +++ b/Assets/ThirdParty/IronSource/Moloco/Android/AndroidDelegate.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bdacfb2821b5a4918826f91ba4729b3b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ThirdParty/IronSource/Moloco/Editor.meta b/Assets/ThirdParty/IronSource/Moloco/Editor.meta new file mode 100644 index 000000000..d51a76c8f --- /dev/null +++ b/Assets/ThirdParty/IronSource/Moloco/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bffe607feaf904ee290c809158c77c3e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ThirdParty/IronSource/Moloco/Editor/ISMolocoAdapterDependencies.xml b/Assets/ThirdParty/IronSource/Moloco/Editor/ISMolocoAdapterDependencies.xml new file mode 100644 index 000000000..929763355 --- /dev/null +++ b/Assets/ThirdParty/IronSource/Moloco/Editor/ISMolocoAdapterDependencies.xml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/Assets/ThirdParty/IronSource/Moloco/Editor/ISMolocoAdapterDependencies.xml.meta b/Assets/ThirdParty/IronSource/Moloco/Editor/ISMolocoAdapterDependencies.xml.meta new file mode 100644 index 000000000..c624c38ba --- /dev/null +++ b/Assets/ThirdParty/IronSource/Moloco/Editor/ISMolocoAdapterDependencies.xml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 899fc029e9d4a447982d2cbb27acbb2e +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ThirdParty/IronSource/Moloco/Moloco.cs b/Assets/ThirdParty/IronSource/Moloco/Moloco.cs new file mode 100644 index 000000000..9ee3cef8e --- /dev/null +++ b/Assets/ThirdParty/IronSource/Moloco/Moloco.cs @@ -0,0 +1,37 @@ +using UnityEngine; +using System; + +namespace MolocoSdk +{ + public static class MolocoSDK + { + private static readonly PlatformDelegate platformDelegate; + + static MolocoSDK() + { + #if UNITY_ANDROID + platformDelegate = new AndroidDelegate(); + #endif + + #if UNITY_IOS + platformDelegate = new IOSDelegate(); + #endif + } + + public static void SetPrivacy(PrivacySettings privacySettings) + { + platformDelegate.SetPrivacy(privacySettings); + } + } + + public class PrivacySettings + { + public Boolean? IsUserConsent = null; + public Boolean? IsAgeRestrictedUser = null; + public Boolean? IsDoNotSell = null; + } + + interface PlatformDelegate { + void SetPrivacy(PrivacySettings privacySettings); + } +} diff --git a/Assets/ThirdParty/IronSource/Moloco/Moloco.cs.meta b/Assets/ThirdParty/IronSource/Moloco/Moloco.cs.meta new file mode 100644 index 000000000..bb9e15193 --- /dev/null +++ b/Assets/ThirdParty/IronSource/Moloco/Moloco.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5930914c0f5874f3899743518ce73c90 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Moloco.meta b/Assets/ThirdParty/MaxSdk/Mediation/Moloco.meta new file mode 100644 index 000000000..a8c56fe47 --- /dev/null +++ b/Assets/ThirdParty/MaxSdk/Mediation/Moloco.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a6e954e58c56fb2438b5c2f66d8666e8 +labels: +- al_max +- al_max_export_path-MaxSdk\Mediation\Moloco +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Editor.meta b/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Editor.meta new file mode 100644 index 000000000..cdd157397 --- /dev/null +++ b/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Editor.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 426b254cd1fef6e4db1a41f112457ab2 +labels: +- al_max +- al_max_export_path-MaxSdk\Mediation\Moloco\Editor +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Editor/ALMolocoAdapterDependencies.xml b/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Editor/ALMolocoAdapterDependencies.xml new file mode 100644 index 000000000..1566f6355 --- /dev/null +++ b/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Editor/ALMolocoAdapterDependencies.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Editor/ALMolocoAdapterDependencies.xml.meta b/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Editor/ALMolocoAdapterDependencies.xml.meta new file mode 100644 index 000000000..8b298a7fa --- /dev/null +++ b/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Editor/ALMolocoAdapterDependencies.xml.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: b8ccb62a3dfc260408cd3e5c0301f442 +labels: +- al_max +- al_max_export_path-MaxSdk\Mediation\Moloco\Editor\ALMolocoAdapterDependencies.xml +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Scripts.meta b/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Scripts.meta new file mode 100644 index 000000000..0ce0ef0ef --- /dev/null +++ b/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Scripts.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5a5da0169be5d8043a9f70b3d4e5c4f2 +labels: +- al_max +- al_max_export_path-MaxSdk\Mediation\Moloco\Scripts +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Scripts/Editor.meta b/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Scripts/Editor.meta new file mode 100644 index 000000000..f42dd22c4 --- /dev/null +++ b/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Scripts/Editor.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5a4d578a58b1e00428f053687d290717 +labels: +- al_max +- al_max_export_path-MaxSdk\Mediation\Moloco\Scripts\Editor +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Scripts/Editor/MolocoPostProcessBuildiOS.cs b/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Scripts/Editor/MolocoPostProcessBuildiOS.cs new file mode 100644 index 000000000..d2c0610f4 --- /dev/null +++ b/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Scripts/Editor/MolocoPostProcessBuildiOS.cs @@ -0,0 +1,90 @@ +#if UNITY_IOS || UNITY_IPHONE + +using System.Collections.Generic; +using System.IO; +using UnityEditor; +using UnityEditor.Callbacks; +using UnityEditor.iOS.Xcode; +using UnityEditor.iOS.Xcode.Extensions; + +namespace Moloco.IOS.Scripts.Editor +{ + public class MolocoPostProcessBuildiOS + { +#if !UNITY_2019_3_OR_NEWER + private const string UnityMainTargetName = "Unity-iPhone"; +#endif + + private static readonly List DynamicLibrariesToEmbed = new List + { + "MolocoSDK.xcframework", + "MolocoCustomAdapter.xcframework" + }; + + private static void EmbedDynamicLibrariesIfNeeded(string buildPath, PBXProject project, string targetGuid) + { + // Check that the Pods directory exists (it might not if a publisher is building with Generate Podfile setting disabled in EDM). + var podsDirectory = Path.Combine(buildPath, "Pods"); + if (!Directory.Exists(podsDirectory)) return; + + var dynamicLibraryPathsPresentInProject = new List(); + foreach (var dynamicLibraryToSearch in DynamicLibrariesToEmbed) + { + // both .framework and .xcframework are directories, not files + var directories = + Directory.GetDirectories(podsDirectory, dynamicLibraryToSearch, SearchOption.AllDirectories); + if (directories.Length <= 0) continue; + + var dynamicLibraryAbsolutePath = directories[0]; + var index = dynamicLibraryAbsolutePath.LastIndexOf("Pods"); + var relativePath = dynamicLibraryAbsolutePath.Substring(index); + dynamicLibraryPathsPresentInProject.Add(relativePath); + } + + if (dynamicLibraryPathsPresentInProject.Count <= 0) return; + +#if UNITY_2019_3_OR_NEWER + foreach (var dynamicLibraryPath in dynamicLibraryPathsPresentInProject) + { + var fileGuid = project.AddFile(dynamicLibraryPath, dynamicLibraryPath); + project.AddFileToEmbedFrameworks(targetGuid, fileGuid); + } +#else + string runpathSearchPaths; +#if UNITY_2018_2_OR_NEWER + runpathSearchPaths = project.GetBuildPropertyForAnyConfig(targetGuid, "LD_RUNPATH_SEARCH_PATHS"); +#else + runpathSearchPaths = "$(inherited)"; +#endif + runpathSearchPaths += string.IsNullOrEmpty(runpathSearchPaths) ? "" : " "; + + // Check if runtime search paths already contains the required search paths for dynamic libraries. + if (runpathSearchPaths.Contains("@executable_path/Frameworks")) + return; + + runpathSearchPaths += "@executable_path/Frameworks"; + project.SetBuildProperty(targetGuid, "LD_RUNPATH_SEARCH_PATHS", runpathSearchPaths); +#endif + } + + [PostProcessBuildAttribute(int.MaxValue)] + public static void MolocoPostProcessPbxProject(BuildTarget buildTarget, string buildPath) + { + var projectPath = PBXProject.GetPBXProjectPath(buildPath); + var project = new PBXProject(); + project.ReadFromFile(projectPath); + +#if UNITY_2019_3_OR_NEWER + var unityMainTargetGuid = project.GetUnityMainTargetGuid(); + var unityFrameworkTargetGuid = project.GetUnityFrameworkTargetGuid(); +#else + var unityMainTargetGuid = project.TargetGuidByName(UnityMainTargetName); + var unityFrameworkTargetGuid = project.TargetGuidByName(UnityMainTargetName); +#endif + EmbedDynamicLibrariesIfNeeded(buildPath, project, unityMainTargetGuid); + project.WriteToFile(projectPath); + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Scripts/Editor/MolocoPostProcessBuildiOS.cs.meta b/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Scripts/Editor/MolocoPostProcessBuildiOS.cs.meta new file mode 100644 index 000000000..2af1563cc --- /dev/null +++ b/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Scripts/Editor/MolocoPostProcessBuildiOS.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: c29941b1bf9c06a498d360afd9b42404 +labels: +- al_max +- al_max_export_path-MaxSdk\Mediation\Moloco\Scripts\Editor\MolocoPostProcessBuildiOS.cs +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Scripts/Editor/PodfileEditor.cs b/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Scripts/Editor/PodfileEditor.cs new file mode 100644 index 000000000..1dae9c8d4 --- /dev/null +++ b/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Scripts/Editor/PodfileEditor.cs @@ -0,0 +1,63 @@ +#if UNITY_IOS || UNITY_IPHONE + +using System.IO; +using System.Linq; +using UnityEditor; +using UnityEditor.Callbacks; +using UnityEngine; + +namespace Moloco.Scripts.Editor +{ + public class PodfileEditor + { + [PostProcessBuild(45)] // Add to the Podfile after it's generated (40) but before "pod install" (50) + public static void OnPostProcessBuild(BuildTarget buildTarget, string pathToBuiltProject) + { + if (buildTarget != BuildTarget.iOS) + { + return; + } + + string podfilePath = Path.Combine(pathToBuiltProject, "Podfile"); + + if (File.Exists(podfilePath)) + { + var codeSigningStyle = PlayerSettings.iOS.appleEnableAutomaticSigning ? "Automatic" : "Manual"; + var teamId = PlayerSettings.iOS.appleDeveloperTeamID; + var provisioningProfileId = PlayerSettings.iOS.iOSManualProvisioningProfileID; + var provisioningProfileType = PlayerSettings.iOS.iOSManualProvisioningProfileType; + + string[] molocoTargets = + { + "MolocoSDKiOS-MolocoSDK", + "MolocoCustomAdapter-MolocoCustomAdapter", + "MolocoCustomAdapterAppLovin-MolocoCustomAdapterAppLovin", + "MolocoCustomAdapterIronSource-MolocoCustomAdapterIronSource" + }; + var molocoTargetsString = string.Join(", ", molocoTargets.Select(element => $"'{element}'")); + + using var sw = File.AppendText(podfilePath); + sw.WriteLine("\n\n\npost_install do |installer|"); + sw.WriteLine(" installer.pods_project.targets.each do |target|"); + sw.WriteLine(" target.build_configurations.each do |config|"); + sw.WriteLine(" if [" + molocoTargetsString + "].include? target.name"); + sw.WriteLine(" config.build_settings['CODE_SIGN_STYLE'] = '" + codeSigningStyle + "'"); + sw.WriteLine(" config.build_settings['DEVELOPMENT_TEAM'] = '" + teamId + "'"); + if (!PlayerSettings.iOS.appleEnableAutomaticSigning) + { + sw.WriteLine(" config.build_settings['PROVISIONING_PROFILE_APP'] = '" + provisioningProfileId + "\'"); + } + sw.WriteLine(" end"); + sw.WriteLine(" end"); + sw.WriteLine(" end"); + sw.WriteLine("end"); + } + else + { + Debug.LogWarning("Podfile not found in the Xcode project."); + } + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Scripts/Editor/PodfileEditor.cs.meta b/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Scripts/Editor/PodfileEditor.cs.meta new file mode 100644 index 000000000..04b687b9e --- /dev/null +++ b/Assets/ThirdParty/MaxSdk/Mediation/Moloco/Scripts/Editor/PodfileEditor.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: f16af8bc1a3477645ad5e39ea50117c4 +labels: +- al_max +- al_max_export_path-MaxSdk\Mediation\Moloco\Scripts\Editor\PodfileEditor.cs +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: