[M] sync n3

This commit is contained in:
2024-12-09 16:54:19 +08:00
parent c90bbe86e7
commit 05331e6286
845 changed files with 6138 additions and 1307 deletions

View File

@@ -26,19 +26,27 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
// TODO: Make this list dynamic.
public static readonly Dictionary<string, string> MinAdapterVersions = new Dictionary<string, string>()
{
{"ADMOB_NETWORK", "android_19.3.0.3_ios_7.65.0.0"},
{"CHARTBOOST_NETWORK", "android_8.1.0.7_ios_8.2.1.3"},
{"FACEBOOK_MEDIATE", "android_6.0.0.1_ios_6.0.0.3"},
{"FYBER_NETWORK", "android_7.7.0.1_ios_7.6.4.1"},
{"GOOGLE_AD_MANAGER_NETWORK", "android_19.3.0.3_ios_7.65.0.0"},
{"INMOBI_NETWORK", "android_9.0.9.2_ios_9.0.7.9"},
{"IRONSOURCE_NETWORK", "android_7.0.1.1.1_ios_7.0.1.0.1"},
{"MYTARGET_NETWORK", "android_5.9.1.2_ios_5.7.5.1"},
{"SMAATO_NETWORK", "android_21.5.2.5_ios_21.5.2.3"},
{"TIKTOK_NETWORK", "android_3.1.0.1.6_ios_3.2.5.1.1"},
{"UNITY_NETWORK", "android_3.4.8.2_ios_3.4.8.2"},
{"VUNGLE_NETWORK", "android_6.7.1.2_ios_6.7.1.3"},
{"YANDEX_NETWORK", "android_2.170.2_ios_2.18.0.1"}
{"ADMOB_NETWORK", "android_23.3.0.1_ios_11.9.0.1"},
{"BIDMACHINE_NETWORK", "android_3.0.1.1_ios_3.0.0.0.1"},
{"CHARTBOOST_NETWORK", "android_9.7.0.3_ios_9.7.0.2"},
{"FACEBOOK_MEDIATE", "android_6.17.0.1_ios_6.15.2.1"},
{"FYBER_NETWORK", "android_8.3.1.1_ios_8.3.2.1"},
{"GOOGLE_AD_MANAGER_NETWORK", "android_23.3.0.1_ios_11.9.0.1"},
{"HYPRMX_NETWORK", "android_6.4.2.1_ios_6.4.1.0.1"},
{"INMOBI_NETWORK", "android_10.7.7.1_ios_10.7.5.1"},
{"IRONSOURCE_NETWORK", "android_8.3.0.0.2_ios_8.3.0.0.1"},
{"LINE_NETWORK", "android_2024.8.27.1_ios_2.8.20240827.1"},
{"MINTEGRAL_NETWORK", "android_16.8.51.1_ios_7.7.2.0.1"},
{"MOBILEFUSE_NETWORK", "android_1.7.6.1_ios_1.7.6.1"},
{"MOLOCO_NETWORK", "android_3.1.0.1_ios_3.1.3.1"},
{"MYTARGET_NETWORK", "android_5.22.1.1_ios_5.21.7.1"},
{"PUBMATIC_NETWORK", "android_3.9.0.2_ios_3.9.0.2"},
{"SMAATO_NETWORK", "android_22.7.0.1_ios_22.8.4.1"},
{"TIKTOK_NETWORK", "android_6.2.0.5.2_ios_6.2.0.7.2"},
{"UNITY_NETWORK", "android_4.12.2.1_ios_4.12.2.1"},
{"VERVE_NETWORK", "android_3.0.4.1_ios_3.0.4.1"},
{"VUNGLE_NETWORK", "android_7.4.1.1_ios_7.4.1.1"},
{"YANDEX_NETWORK", "android_7.4.0.1_ios_2.18.0.1"},
};
/// <summary>

View File

@@ -56,6 +56,8 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
private const string KeyConsentFlowPrivacyPolicy = "consent_flow_privacy_policy";
private const string KeyConsentFlowDebugUserGeography = "consent_flow_debug_user_geography";
private const string KeyRenderOutsideSafeArea = "render_outside_safe_area";
#if UNITY_2022_3_OR_NEWER
// To match "'com.android.library' version '7.3.1'" line in build.gradle
private static readonly Regex TokenGradleVersionLibrary = new Regex(".*id ['\"]com\\.android\\.library['\"] version");
@@ -354,6 +356,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
// Add the SDK key to the SDK settings.
appLovinSdkSettings[KeySdkKey] = AppLovinSettings.Instance.SdkKey;
appLovinSdkSettings[KeyRenderOutsideSafeArea] = PlayerSettings.Android.renderOutsideSafeArea;
// Add the Consent/Terms flow settings if needed.
if (AppLovinInternalSettings.Instance.ConsentFlowEnabled)

View File

@@ -10,7 +10,6 @@
using System.IO;
using UnityEditor.Android;
using UnityEngine;
namespace AppLovinMax.Scripts.IntegrationManager.Editor
{
@@ -27,15 +26,21 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
// On Unity 2019.3+, the path returned is the path to the unityLibrary's module.
// The AppLovin Quality Service buildscript closure related lines need to be added to the root build.gradle file.
var rootGradleBuildFilePath = Path.Combine(path, "../build.gradle");
#if UNITY_2022_2_OR_NEWER
if (!AddPluginToRootGradleBuildFile(rootGradleBuildFilePath)) return;
var rootSettingsGradleFilePath = Path.Combine(path, "../settings.gradle");
if (!AddAppLovinRepository(rootSettingsGradleFilePath)) return;
#else
// For 2022.2 and newer and 2021.3.41+
var qualityServiceAdded = AddPluginToRootGradleBuildFile(rootGradleBuildFilePath);
var appLovinRepositoryAdded = AddAppLovinRepository(rootSettingsGradleFilePath);
// For 2021.3.40 and older and 2022.0 - 2022.1.x
var buildScriptChangesAdded = AddQualityServiceBuildScriptLines(rootGradleBuildFilePath);
if (!buildScriptChangesAdded) return;
#endif
var failedToAddPlugin = !buildScriptChangesAdded && !(qualityServiceAdded && appLovinRepositoryAdded);
if (failedToAddPlugin)
{
MaxSdkLogger.UserWarning("Failed to add AppLovin Quality Service plugin to the gradle project.");
return;
}
// The plugin needs to be added to the application module (named launcher)
var applicationGradleBuildFilePath = Path.Combine(path, "../launcher/build.gradle");

View File

@@ -39,13 +39,15 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
#if !UNITY_2019_3_OR_NEWER
private const string UnityMainTargetName = "Unity-iPhone";
#endif
// Use a priority of 90 to have AppLovin embed frameworks after Pods are installed (EDM finishes installing Pods at priority 60) and before Firebase Crashlytics runs their scripts (at priority 100).
private const int AppLovinEmbedFrameworksPriority = 90;
private const string TargetUnityIphonePodfileLine = "target 'Unity-iPhone' do";
private const string UseFrameworksPodfileLine = "use_frameworks!";
private const string UseFrameworksDynamicPodfileLine = "use_frameworks! :linkage => :dynamic";
private const string UseFrameworksStaticPodfileLine = "use_frameworks! :linkage => :static";
private const string LegacyResourcesDirectoryName = "Resources";
private const string ResourcesDirectoryName = "Resources";
private const string AppLovinMaxResourcesDirectoryName = "AppLovinMAXResources";
private const string AppLovinAdvertisingAttributionEndpoint = "https://postbacks-app.com";
@@ -80,7 +82,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
/// 1. Downloads the Quality Service ruby script.
/// 2. Runs the script using Ruby which integrates AppLovin Quality Service to the project.
/// </summary>
//[PostProcessBuild(int.MaxValue)] // We want to run Quality Service script last.
[PostProcessBuild(int.MaxValue)] // We want to run Quality Service script last.
public static void OnPostProcessBuild(BuildTarget buildTarget, string buildPath)
{
if (!AppLovinSettings.Instance.QualityServiceEnabled) return;
@@ -146,7 +148,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
}
}
[PostProcessBuild(int.MaxValue)]
[PostProcessBuild(AppLovinEmbedFrameworksPriority)]
public static void MaxPostProcessPbxProject(BuildTarget buildTarget, string buildPath)
{
var projectPath = PBXProject.GetPBXProjectPath(buildPath);
@@ -365,9 +367,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
private static void LocalizeUserTrackingDescriptionIfNeeded(string localizedUserTrackingDescription, string localeCode, string buildPath, PBXProject project, string targetGuid)
{
// Use the legacy resources directory name if the build is being appended (the "Resources" directory already exists if it is an incremental build).
var resourcesDirectoryName = Directory.Exists(Path.Combine(buildPath, LegacyResourcesDirectoryName)) ? LegacyResourcesDirectoryName : AppLovinMaxResourcesDirectoryName;
var resourcesDirectoryPath = Path.Combine(buildPath, resourcesDirectoryName);
var resourcesDirectoryPath = Path.Combine(buildPath, AppLovinMaxResourcesDirectoryName);
var localeSpecificDirectoryName = localeCode + ".lproj";
var localeSpecificDirectoryPath = Path.Combine(resourcesDirectoryPath, localeSpecificDirectoryName);
var infoPlistStringsFilePath = Path.Combine(localeSpecificDirectoryPath, "InfoPlist.strings");
@@ -381,6 +381,15 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
return;
}
// Log an error if we detect a localization file for this language in the `Resources` directory
var legacyResourcedDirectoryPath = Path.Combine(buildPath, ResourcesDirectoryName);
var localeSpecificLegacyDirectoryPath = Path.Combine(legacyResourcedDirectoryPath, localeSpecificDirectoryName);
if (Directory.Exists(localeSpecificLegacyDirectoryPath))
{
MaxSdkLogger.UserError("Detected existing localization resource for \"" + localeCode + "\" locale. Skipping localization for User Tracking Usage Description. Please disable localization in AppLovin Integration manager and add the localizations to your existing resource.");
return;
}
// Create intermediate directories as needed.
if (!Directory.Exists(resourcesDirectoryPath))
{
@@ -425,7 +434,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
File.WriteAllText(infoPlistStringsFilePath, "/* Localized versions of Info.plist keys - Generated by AL MAX plugin */\n" + localizedDescriptionLine);
}
var localeSpecificDirectoryRelativePath = Path.Combine(resourcesDirectoryName, localeSpecificDirectoryName);
var localeSpecificDirectoryRelativePath = Path.Combine(AppLovinMaxResourcesDirectoryName, localeSpecificDirectoryName);
var guid = project.AddFolderReference(localeSpecificDirectoryRelativePath, localeSpecificDirectoryRelativePath);
project.AddFileToBuild(targetGuid, guid);
}

View File

@@ -37,11 +37,9 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
private static readonly Regex TokenApiKey = new Regex(".*apiKey.*");
private static readonly Regex TokenAppLovinPlugin = new Regex(".*apply plugin:.+?(?=applovin-quality-service).*");
#if UNITY_2022_2_OR_NEWER
private const string PluginsMatcher = "plugins";
private const string PluginManagementMatcher = "pluginManagement";
private const string QualityServicePluginRoot = " id 'com.applovin.quality' version '+' apply false // NOTE: Requires version 4.8.3+ for Gradle version 7.2+";
#endif
private const string BuildScriptMatcher = "buildscript";
private const string QualityServiceMavenRepo = "maven { url 'https://artifacts.applovin.com/android'; content { includeGroupByRegex 'com.applovin.*' } }";
@@ -108,9 +106,19 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
Console.WriteLine(exception);
}
}
#if UNITY_2022_2_OR_NEWER
/// <summary>
/// Adds AppLovin Quality Service plugin DSL element to the project's root build.gradle file.
/// Adds AppLovin Quality Service plugin DSL element to the project's root build.gradle file.
/// Sample build.gradle file after adding quality service:
/// plugins {
/// id 'com.android.application' version '7.4.2' apply false
/// id 'com.android.library' version '7.4.2' apply false
/// id 'com.applovin.quality' version '+' apply false
/// }
/// tasks.register('clean', Delete) {
/// delete rootProject.layout.buildDirectory
/// }
///
/// </summary>
/// <param name="rootGradleBuildFile">The path to project's root build.gradle file.</param>
/// <returns><c>true</c> when the plugin was added successfully.</returns>
@@ -141,11 +149,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
outputLines.Add(line);
}
if (!pluginAdded)
{
MaxSdkLogger.UserError("Failed to add AppLovin Quality Service plugin to root gradle file.");
return false;
}
if (!pluginAdded) return false;
try
{
@@ -163,6 +167,18 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
/// <summary>
/// Adds the AppLovin maven repository to the project's settings.gradle file.
/// Sample settings.gradle file after adding AppLovin Repository:
/// pluginManagement {
/// repositories {
/// maven { url 'https://artifacts.applovin.com/android'; content { includeGroupByRegex 'com.applovin.*' } }
///
/// gradlePluginPortal()
/// google()
/// mavenCentral()
/// }
/// }
/// ...
///
/// </summary>
/// <param name="settingsGradleFile">The path to the project's settings.gradle file.</param>
/// <returns><c>true</c> if the repository was added successfully.</returns>
@@ -212,11 +228,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
}
}
if (!mavenRepoAdded)
{
MaxSdkLogger.UserError("Failed to add AppLovin Quality Service plugin maven repo to settings gradle file.");
return false;
}
if (!mavenRepoAdded) return false;
try
{
@@ -231,11 +243,25 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
return true;
}
#endif
#if UNITY_2019_3_OR_NEWER
/// <summary>
/// Adds the necessary AppLovin Quality Service dependency and maven repo lines to the provided root build.gradle file.
/// Sample build.gradle file after adding quality service:
/// allprojects {
/// buildscript {
/// repositories {
/// maven { url 'https://artifacts.applovin.com/android'; content { includeGroupByRegex 'com.applovin.*' } }
/// google()
/// jcenter()
/// }
///
/// dependencies {
/// classpath 'com.android.tools.build:gradle:4.0.1'
/// classpath 'com.applovin.quality:AppLovinQualityServiceGradlePlugin:+'
/// }
/// ...
///
/// </summary>
/// <param name="rootGradleBuildFile">The root build.gradle file path</param>
/// <returns><c>true</c> if the build script lines were applied correctly.</returns>
@@ -536,7 +562,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
if ((addBuildScriptLines && (!qualityServiceRepositoryAdded || !qualityServiceDependencyClassPathAdded)) || (addPlugin && !qualityServicePluginAdded))
{
MaxSdkLogger.UserError("Failed to add AppLovin Quality Service plugin. Quality Service Plugin Added?: " + qualityServicePluginAdded + ", Quality Service Repo added?: " + qualityServiceRepositoryAdded + ", Quality Service dependency added?: " + qualityServiceDependencyClassPathAdded);
return null;
}
}