fix:1、修复bug 2、删除不用的代码和资源,sdk等

This commit is contained in:
2026-05-07 14:56:44 +08:00
parent 99145facbd
commit 28d582c373
378 changed files with 79341 additions and 86716 deletions
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<androidPackages>
<androidPackage spec="com.applovin:applovin-sdk:13.4.0" />
</androidPackages>
<iosPods>
<iosPod name="AppLovinSDK" version="13.4.0" />
</iosPods>
</dependencies>
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<androidPackages>
<androidPackage spec="com.applovin:applovin-sdk:13.6.2" />
</androidPackages>
<iosPods>
<iosPod name="AppLovinSDK" version="13.6.2" />
</iosPods>
</dependencies>
@@ -8,7 +8,7 @@
#import "MAUnityAdManager.h"
#define VERSION @"8.4.2"
#define VERSION @"8.6.2"
#define NSSTRING(_X) ( (_X != NULL) ? [NSString stringWithCString: _X encoding: NSStringEncodingConversionAllowLossy].al_stringByTrimmingWhitespace : nil)
@interface NSString (ALUtils)
+1 -1
View File
@@ -1,3 +1,3 @@
# AppLovin MAX Unity Plugin
To get the latest changes, see the [AppLovin MAX Unity Changelog](https://developers.applovin.com/en/max/unity/changelog).
To get the latest changes, see the [AppLovin MAX Unity Changelog](https://support.axon.ai/en/max/unity/changelog).
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 88f5a5df66b84495994d8c5158dbf06f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 1235281c630214a8999b2185ceba6388
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/BigoAds/Editor
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<androidPackages>
<androidPackage spec="com.applovin.mediation:bigoads-adapter:5.5.1.1" />
</androidPackages>
<iosPods>
<iosPod name="AppLovinMediationBigoAdsAdapter" version="4.9.1.1" />
</iosPods>
</dependencies>
@@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: fba397d5cac8648fea9b0fe82e201e63
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/BigoAds/Editor/Dependencies.xml
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: e9e7a40681aa348b5b01d7d0cee0874a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: ef8467ffb0e4447b79a8804884a7520a
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/ByteDance/Editor
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<androidPackages>
<androidPackage spec="com.applovin.mediation:bytedance-adapter:7.6.0.2.0">
<repositories>
<repository>https://artifact.bytedance.com/repository/pangle</repository>
</repositories>
</androidPackage>
</androidPackages>
<iosPods>
<iosPod name="AppLovinMediationByteDanceAdapter" version="7.6.0.6.0" />
</iosPods>
</dependencies>
@@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 0828555cb1ce94702a4af6f3dce3d735
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/ByteDance/Editor/Dependencies.xml
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 1d0957814f8454a9ab250990a53ba013
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a90f13141c35746f5a2996c8ad068fe9
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Chartboost/Editor
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<androidPackages>
<androidPackage spec="com.applovin.mediation:chartboost-adapter:9.9.2.1">
<repositories>
<repository>https://cboost.jfrog.io/artifactory/chartboost-ads/</repository>
</repositories>
</androidPackage>
<androidPackage spec="com.google.android.gms:play-services-base:16.1.0" />
</androidPackages>
<iosPods>
<iosPod name="AppLovinMediationChartboostAdapter" version="9.9.2.1" />
</iosPods>
</dependencies>
@@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 93b0a4618bd884871af0981a7867bb2f
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Chartboost/Editor/Dependencies.xml
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 4db04422e184f41ea82fff24c3c6358f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 28880992a399a48b7abe95b66649d711
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Facebook/Editor
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<androidPackages>
<!-- Ensure that Resolver doesn't inadvertently pull Facebook's beta versions of the SDK by forcing a specific version.
Since FAN SDK depends on older versions of a few support and play service versions
`com.applovin.mediation:facebook-adapter:x.y.z.a` resolves to `com.applovin.mediation:facebook-adapter:+` which pulls down the beta versions of FAN SDK.
Note that forcing the adapter is enough to stop Jar Resolver from pulling the latest FAN SDK. -->
<androidPackage spec="com.applovin.mediation:facebook-adapter:[6.20.0.0]" />
</androidPackages>
<iosPods>
<iosPod name="AppLovinMediationFacebookAdapter" version="6.20.1.0" />
</iosPods>
</dependencies>
@@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: aea9bdf974328420db5ae118ef0d2b87
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Facebook/Editor/Dependencies.xml
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 61a57c7ea96624f62b6d255abbeea40e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-11
View File
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: e076e4ef7e2874ba69b108cc7a346c2a
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Fyber/Editor
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<androidPackages>
<androidPackage spec="com.applovin.mediation:fyber-adapter:8.3.8.0"/>
</androidPackages>
<iosPods>
<iosPod name="AppLovinMediationFyberAdapter" version="8.3.8.0"/>
</iosPods>
</dependencies>
@@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 5e123cdc08e804dffb2c40c4fbc83caf
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Fyber/Editor/Dependencies.xml
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: f4430d8e4f65345669cea12967ee37d8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: e8015bd045cea462c8f39c8a05867d08
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Google/Editor
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<androidPackages>
<!-- Ensure that Resolver doesn't inadvertently pull the latest Play Services Ads' SDK that we haven't certified against. -->
<androidPackage spec="com.applovin.mediation:google-adapter:[24.7.0.0]" />
</androidPackages>
<iosPods>
<iosPod name="AppLovinMediationGoogleAdapter" version="12.12.0.0" />
</iosPods>
</dependencies>
@@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 053b810d3594744e38b6fd0fa378fb57
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Google/Editor/Dependencies.xml
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 39b56a44ededf4f189a8a636562be06e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: a141703acd55a48c2a3e6e6599f90c64
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/InMobi/Editor
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<androidPackages>
<androidPackage spec="com.applovin.mediation:inmobi-adapter:10.8.7.0" />
<androidPackage spec="com.squareup.picasso:picasso:2.71828" />
<androidPackage spec="com.android.support:recyclerview-v7:28.+" />
<androidPackage spec="com.android.support:customtabs:28.+" />
</androidPackages>
<iosPods>
<iosPod name="AppLovinMediationInMobiAdapter" version="10.8.6.0" />
</iosPods>
</dependencies>
@@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: bc66a0ef4503843ee9b1bf1b1e867367
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/InMobi/Editor/Dependencies.xml
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: ad5d928511bea4a388d08d5e9ce48e3b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 531d860cac61f47d19e32f526470ae43
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/IronSource/Editor
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<androidPackages>
<androidPackage spec="com.applovin.mediation:ironsource-adapter:8.10.0.0.0" />
</androidPackages>
<iosPods>
<iosPod name="AppLovinMediationIronSourceAdapter" version="8.10.0.0.0" />
</iosPods>
</dependencies>
@@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 19262406303f04f05b14b31b3c734d35
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/IronSource/Editor/Dependencies.xml
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 2b675df2ca27e4ee6a573411e6023520
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: db1de4066dc4e4290b3879b34fa87de2
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Mintegral/Editor
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<androidPackages>
<androidPackage spec="com.applovin.mediation:mintegral-adapter:16.9.91.0">
<repositories>
<repository>https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea</repository>
</repositories>
</androidPackage>
<androidPackage spec="androidx.recyclerview:recyclerview:1.2.1" />
</androidPackages>
<iosPods>
<iosPod name="AppLovinMediationMintegralAdapter" version="7.7.9.0.0" />
</iosPods>
</dependencies>
@@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 221b2a20a58a04f2cb4afb0779587206
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Mintegral/Editor/Dependencies.xml
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 0284843f4258d4c359b8cc15db28700e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 9ecadc3649c184389b90252aa2a2b448
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Moloco/Editor
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<androidPackages>
<androidPackage spec="com.applovin.mediation:moloco-adapter:4.1.0.0" />
</androidPackages>
<iosPods>
<iosPod name="AppLovinMediationMolocoAdapter" version="3.13.0.0" />
</iosPods>
</dependencies>
@@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 0f5b2cb1209274ba18b234b42d2efe96
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Moloco/Editor/Dependencies.xml
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<androidPackages>
<androidPackage spec="com.applovin.mediation:unityads-adapter:4.16.1.0" />
</androidPackages>
<iosPods>
<iosPod name="AppLovinMediationUnityAdsAdapter" version="4.16.1.0" />
</iosPods>
</dependencies>
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<androidPackages>
<androidPackage spec="com.applovin.mediation:unityads-adapter:4.18.0.0" />
</androidPackages>
<iosPods>
<iosPod name="AppLovinMediationUnityAdsAdapter" version="4.17.0.0" />
</iosPods>
</dependencies>
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 3abedb062e5ab47939dc811a59a7aeaf
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 77b6ea05736a9458f8ef8762ee9b64bb
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Vungle/Editor
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<androidPackages>
<androidPackage spec="com.applovin.mediation:vungle-adapter:7.5.1.0" />
</androidPackages>
<iosPods>
<iosPod name="AppLovinMediationVungleAdapter" version="7.5.3.0" />
</iosPods>
</dependencies>
@@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 0d8ad3a6ddc4f44fab2efe607fe14f26
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Vungle/Editor/Dependencies.xml
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: b1f7767a7bccd4bffa303fb61c32dadb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 277e2383262e844708fc74a6104f4985
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Yandex/Editor
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<androidPackages>
<androidPackage spec="com.applovin.mediation:yandex-adapter:7.15.1.0" />
</androidPackages>
<iosPods>
<iosPod name="AppLovinMediationYandexAdapter" version="7.16.0.0" />
</iosPods>
</dependencies>
@@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: a77aaf886990c4e6ba469a4f083b9284
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Yandex/Editor/Dependencies.xml
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 6bc964da2fb23fd49a53465f0140317d
guid: 572fee4574afa4f6dbf2846e0c152fe8
labels:
- al_max
- al_max_export_path-MaxSdk/Resources/Images/error_icon.png
@@ -73,9 +73,14 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
"MaxSdk/Version.md.meta",
// The alert_icon.png has been renamed to error_icon.png.
"MaxSdk/Resources/Images/alert_icon.png"
"MaxSdk/Resources/Images/alert_icon.png",
"MaxSdk/Resources/Images/alert_icon.png.meta",
// TODO: Add MaxTargetingData and MaxUserSegment when the plugin has enough traction.
// `TargetingData` has been removed and we no longer set `UserSegment` through the Unity Plugin.
"MaxSdk/Scripts/MaxUserSegment.cs",
"MaxSdk/Scripts/MaxUserSegment.cs.meta",
"MaxSdk/Scripts/MaxTargetingData.cs",
"MaxSdk/Scripts/MaxTargetingData.cs.meta"
};
static AppLovinInitialize()
@@ -97,6 +97,10 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
public string Title;
public string Message;
public string Url;
public string MinimumPluginVersion;
public string MaximumPluginVersion;
public string MinimumUnityVersion;
public string MaximumUnityVersion;
public Severity Severity;
@@ -119,6 +123,13 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
break;
}
}
public bool ShouldShowAlert()
{
var pluginVersionValid = MaxSdkUtils.IsVersionInRange(MaxSdk.Version, MinimumPluginVersion, MaximumPluginVersion);
var unityVersionValid = MaxSdkUtils.IsVersionInRange(Application.unityVersion, MinimumUnityVersion, MaximumUnityVersion);
return pluginVersionValid && unityVersionValid;
}
}
/// <summary>
@@ -390,9 +401,12 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
AppLovinPackageManager.UpdateCurrentVersions(network);
}
foreach (var partnerMicroSdk in pluginData.PartnerMicroSdks)
if (pluginData.PartnerMicroSdks != null)
{
AppLovinPackageManager.UpdateCurrentVersions(partnerMicroSdk);
foreach (var partnerMicroSdk in pluginData.PartnerMicroSdks)
{
AppLovinPackageManager.UpdateCurrentVersions(partnerMicroSdk);
}
}
if (pluginData.Alerts == null) return pluginData;
@@ -8,6 +8,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEditor;
@@ -22,8 +23,8 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
private const string AppLovinSdkKeyLink = "https://dash.applovin.com/o/account#keys";
private const string UserTrackingUsageDescriptionDocsLink = "https://developer.apple.com/documentation/bundleresources/information_property_list/nsusertrackingusagedescription";
private const string DocumentationTermsAndPrivacyPolicyFlow = "https://developers.applovin.com/en/unity/overview/terms-and-privacy-policy-flow";
private const string DocumentationAdaptersLink = "https://developers.applovin.com/en/unity/preparing-mediated-networks";
private const string DocumentationTermsAndPrivacyPolicyFlow = "https://support.axon.ai/en/max/unity/overview/terms-and-privacy-policy-flow";
private const string DocumentationAdaptersLink = "https://support.axon.ai/en/max/unity/preparing-mediated-networks";
private const string DocumentationNote = "Please ensure that integration instructions (e.g. permissions, ATS settings, etc) specific to each network are implemented as well. Click the link below for more info:";
private const string UninstallIconExportPath = "MaxSdk/Resources/Images/uninstall_icon.png";
private const string InfoIconExportPath = "MaxSdk/Resources/Images/info_icon.png";
@@ -223,22 +224,26 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
DrawPluginDetails();
// Draw alerts
if (pluginData != null && pluginData.Alerts != null && pluginData.Alerts.Length > 0)
if (pluginData != null && pluginData.Alerts != null)
{
EditorGUILayout.BeginHorizontal();
var showAlertDetails = DrawExpandCollapseButton(KeyShowAlerts);
EditorGUILayout.LabelField("Alerts", titleLabelStyle, GUILayout.Width(45));
DrawAlertCount();
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
if (showAlertDetails)
var alertsToShow = pluginData.Alerts.Where(alert => alert.ShouldShowAlert()).ToList();
if (alertsToShow.Count > 0)
{
DrawAlerts();
EditorGUILayout.BeginHorizontal();
var showAlertDetails = DrawExpandCollapseButton(KeyShowAlerts);
EditorGUILayout.LabelField("Alerts", titleLabelStyle, GUILayout.Width(45));
DrawAlertCount(alertsToShow);
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
if (showAlertDetails)
{
DrawAlerts(alertsToShow);
}
}
}
// Draw Micro SDK Partners
if (pluginData != null && pluginData.PartnerMicroSdks != null)
if (pluginData != null && !MaxSdkUtils.IsNullOrEmpty(pluginData.PartnerMicroSdks))
{
DrawCollapsibleSection(KeyShowMicroSdkPartners, "AppLovin Micro SDK Partners", DrawPartnerMicroSdks);
}
@@ -255,13 +260,11 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
DrawMediatedNetworks();
}
#if UNITY_2019_2_OR_NEWER
if (!AppLovinIntegrationManager.IsPluginInPackageManager)
{
EditorGUILayout.LabelField("Unity Package Manager Migration", titleLabelStyle);
DrawPluginMigrationHelper();
}
#endif
// Draw AppLovin Quality Service settings
DrawCollapsibleSection(KeyShowSdkSettings, "SDK Settings", DrawQualityServiceSettings);
@@ -388,13 +391,13 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
/// <summary>
/// Draw the number of each alert type next to the alert section header.
/// </summary>
private void DrawAlertCount()
private void DrawAlertCount(List<Alert> alerts)
{
if (pluginData == null) return;
var infoAlertsCount = pluginData.Alerts.Count(alert => alert.Severity == Severity.Info);
var warningAlertsCount = pluginData.Alerts.Count(alert => alert.Severity == Severity.Warning);
var errorAlertsCount = pluginData.Alerts.Count(alert => alert.Severity == Severity.Error);
var infoAlertsCount = alerts.Count(alert => alert.Severity == Severity.Info);
var warningAlertsCount = alerts.Count(alert => alert.Severity == Severity.Warning);
var errorAlertsCount = alerts.Count(alert => alert.Severity == Severity.Error);
GUILayout.Label(infoIcon, GUILayout.Width(20), GUILayout.Height(20));
EditorGUILayout.LabelField(AlertCountToString(infoAlertsCount), GUILayout.Width(20));
@@ -407,24 +410,24 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
/// <summary>
/// Draw the list of alerts grouped by severity.
/// </summary>
private void DrawAlerts()
private void DrawAlerts(List<Alert> alerts)
{
GUILayout.BeginHorizontal();
GUILayout.Space(10);
using (new EditorGUILayout.VerticalScope("box"))
{
DrawAlertsOfType(Severity.Error);
DrawAlertsOfType(Severity.Warning);
DrawAlertsOfType(Severity.Info);
DrawAlertsOfType(alerts, Severity.Error);
DrawAlertsOfType(alerts, Severity.Warning);
DrawAlertsOfType(alerts, Severity.Info);
}
GUILayout.Space(5);
GUILayout.EndHorizontal();
}
private void DrawAlertsOfType(Severity severity)
private void DrawAlertsOfType(List<Alert> alerts, Severity severity)
{
var alertsOfType = pluginData.Alerts.Where(alert => alert.Severity == severity).ToList();
var alertsOfType = alerts.Where(alert => alert.Severity == severity).ToList();
foreach (var alert in alertsOfType)
{
DrawAlert(alert);
@@ -642,9 +645,9 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
GUI.enabled = networkButtonsEnabled && isInstalled;
if (GUILayout.Button(new GUIContent {image = uninstallIcon, tooltip = "Uninstall"}, iconStyle))
{
EditorUtility.DisplayProgressBar("Integration Manager", "Deleting " + network.Name + "...", 0.5f);
AppLovinPackageManager.RemoveNetwork(network);
EditorUtility.ClearProgressBar();
AppLovinPackageManager.UpdateCurrentVersions(network);
UpdateShouldShowGoogleWarningIfNeeded();
}
GUI.enabled = true;
@@ -706,7 +709,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
GUILayout.Space(10);
}
#if UNITY_2019_2_OR_NEWER
private void DrawPluginMigrationHelper()
{
GUILayout.BeginHorizontal();
@@ -753,7 +755,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
GUILayout.Space(5);
GUILayout.EndHorizontal();
}
#endif
private void DrawQualityServiceSettings()
{
@@ -31,7 +31,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
[MenuItem("AppLovin/Documentation")]
private static void Documentation()
{
Application.OpenURL("https://developers.applovin.com/en/unity/overview/integration");
Application.OpenURL("https://support.axon.ai/en/max/unity/overview/integration");
}
[MenuItem("AppLovin/Contact Us")]
@@ -31,20 +31,14 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
{
private const string AppLovinMediationAmazonAdapterDependenciesPath = "Amazon/Scripts/Mediations/AppLovinMediation/Editor/Dependencies.xml";
#if UNITY_2019_2_OR_NEWER
private static readonly IPackageManagerClient _upmPackageManager = new AppLovinUpmPackageManager();
#endif
private static readonly IPackageManagerClient _assetsPackageManager = new AppLovinAssetsPackageManager();
private static IPackageManagerClient PackageManagerClient
{
get
{
#if UNITY_2019_2_OR_NEWER
return AppLovinIntegrationManager.IsPluginInPackageManager ? _upmPackageManager : _assetsPackageManager;
#else
return _assetsPackageManager;
#endif
}
}
@@ -110,10 +104,8 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
var installedNetworksInAssets = AppLovinAssetsPackageManager.GetInstalledMediationNetworks();
installedNetworks.AddRange(installedNetworksInAssets);
#if UNITY_2019_2_OR_NEWER
var installedNetworksInPackages = AppLovinUpmPackageManager.GetInstalledMediationNetworks();
installedNetworks.AddRange(installedNetworksInPackages);
#endif
if (IsAmazonAppLovinAdapterInstalled())
{
@@ -174,12 +166,10 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
internal static void UpdateCurrentVersions(Network network)
{
var assetPaths = GetAssetPathListForExportPath(network.DependenciesFilePath);
#if UNITY_2019_2_OR_NEWER
if (HasDuplicateAdapters(assetPaths))
{
ShowDeleteDuplicateAdapterPrompt(network);
}
#endif
var currentVersions = GetCurrentVersions(assetPaths);
network.CurrentVersions = currentVersions;
@@ -237,7 +227,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
}
}
#if UNITY_2019_2_OR_NEWER
/// <summary>
/// Checks whether a network has duplicate adapters installed in both the Assets folder and via UPM.
/// </summary>
@@ -274,6 +263,9 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
/// otherwise, deletes the adapter from the Assets folder.</param>
internal static void DeleteDuplicateAdapter(Network network, bool keepAssetsAdapter)
{
// Skip duplicate removal logic for our plugin.
if (network.Name.Equals("APPLOVIN_NETWORK")) return;
if (keepAssetsAdapter)
{
var appLovinManifest = AppLovinUpmManifest.Load();
@@ -292,7 +284,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
AppLovinUpmPackageManager.ResolvePackageManager();
}
#endif
/// <summary>
/// Gets the current versions for a given network's dependency file paths. UPM will have multiple paths
@@ -426,7 +417,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
#endregion
}
#if UNITY_2019_2_OR_NEWER
public class AppLovinUpmPackageManager : IPackageManagerClient
{
public const string PackageNamePrefixAppLovin = "com.applovin.mediation.ads";
@@ -595,8 +585,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
}
}
#endif
public class AppLovinAssetsPackageManager : IPackageManagerClient
{
public static List<string> GetInstalledMediationNetworks()
@@ -4,7 +4,6 @@ using System.Linq;
using UnityEditor;
using UnityEngine;
#if UNITY_2019_2_OR_NEWER
namespace AppLovinMax.Scripts.IntegrationManager.Editor
{
/// <summary>
@@ -165,4 +164,3 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
#endregion
}
}
#endif
@@ -24,11 +24,9 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
/// </summary>
public class AppLovinPostProcessAndroid : IPostGenerateGradleAndroidProject
{
#if UNITY_2019_3_OR_NEWER
private const string PropertyAndroidX = "android.useAndroidX";
private const string PropertyJetifier = "android.enableJetifier";
private const string EnableProperty = "=true";
#endif
private const string PropertyDexingArtifactTransform = "android.enableDexingArtifactTransform";
private const string DisableProperty = "=false";
@@ -70,15 +68,9 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
public void OnPostGenerateGradleAndroidProject(string path)
{
#if UNITY_2019_3_OR_NEWER
var rootGradleBuildFilePath = Path.Combine(path, "../build.gradle");
var gradlePropertiesPath = Path.Combine(path, "../gradle.properties");
var gradleWrapperPropertiesPath = Path.Combine(path, "../gradle/wrapper/gradle-wrapper.properties");
#else
var rootGradleBuildFilePath = Path.Combine(path, "build.gradle");
var gradlePropertiesPath = Path.Combine(path, "gradle.properties");
var gradleWrapperPropertiesPath = Path.Combine(path, "gradle/wrapper/gradle-wrapper.properties");
#endif
UpdateGradleVersionsIfNeeded(gradleWrapperPropertiesPath, rootGradleBuildFilePath);
@@ -89,20 +81,13 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
{
var lines = File.ReadAllLines(gradlePropertiesPath);
#if UNITY_2019_3_OR_NEWER
// Add all properties except AndroidX, Jetifier, and DexingArtifactTransform since they may already exist. We will re-add them below.
gradlePropertiesUpdated.AddRange(lines.Where(line => !line.Contains(PropertyAndroidX) && !line.Contains(PropertyJetifier) && !line.Contains(PropertyDexingArtifactTransform)));
#else
// Add all properties except DexingArtifactTransform since it may already exist. We will re-add it below.
gradlePropertiesUpdated.AddRange(lines.Where(line => !line.Contains(PropertyDexingArtifactTransform)));
#endif
}
#if UNITY_2019_3_OR_NEWER
// Enable AndroidX and Jetifier properties
gradlePropertiesUpdated.Add(PropertyAndroidX + EnableProperty);
gradlePropertiesUpdated.Add(PropertyJetifier + EnableProperty);
#endif
// `DexingArtifactTransform` has been removed in Gradle 8+ which is the default Gradle version for Unity 6.
#if !UNITY_6000_0_OR_NEWER
@@ -22,28 +22,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
{
if (!AppLovinSettings.Instance.QualityServiceEnabled) return;
#if UNITY_2019_3_OR_NEWER
// 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");
var shouldAddQualityServiceToDependencies = ShouldAddQualityServiceToDependencies(rootGradleBuildFilePath);
var failedToAddPlugin = false;
if (shouldAddQualityServiceToDependencies)
{
// Add the Quality Service Plugin to the dependencies block in the root build.gradle file
var buildScriptChangesAdded = AddQualityServiceBuildScriptLines(rootGradleBuildFilePath);
failedToAddPlugin = !buildScriptChangesAdded;
}
else
{
// Add the Quality Service Plugin to the plugin block in the root build.gradle file
var rootSettingsGradleFilePath = Path.Combine(path, "../settings.gradle");
var qualityServiceAdded = AddPluginToRootGradleBuildFile(rootGradleBuildFilePath);
var appLovinRepositoryAdded = AddAppLovinRepository(rootSettingsGradleFilePath);
failedToAddPlugin = !(qualityServiceAdded && appLovinRepositoryAdded);
}
var failedToAddPlugin = !AddQualityServiceToRootGradleFile(path);
if (failedToAddPlugin)
{
MaxSdkLogger.UserWarning("Failed to add AppLovin Quality Service plugin to the gradle project.");
@@ -52,12 +31,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
// The plugin needs to be added to the application module (named launcher)
var applicationGradleBuildFilePath = Path.Combine(path, "../launcher/build.gradle");
#else
// If Gradle template is enabled, we would have already updated the plugin.
if (AppLovinIntegrationManager.GradleTemplateEnabled) return;
var applicationGradleBuildFilePath = Path.Combine(path, "build.gradle");
#endif
if (!File.Exists(applicationGradleBuildFilePath))
{
@@ -9,19 +9,14 @@
#if UNITY_IOS || UNITY_IPHONE
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using AppLovinMax.Internal;
using UnityEditor;
using UnityEditor.Callbacks;
#if UNITY_2019_3_OR_NEWER
using UnityEditor.iOS.Xcode.Extensions;
#endif
using UnityEditor.iOS.Xcode;
using UnityEditor.PackageManager;
using UnityEngine;
using UnityEngine.Networking;
@@ -37,9 +32,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
{
private const string OutputFileName = "AppLovinQualityServiceSetup.rb";
#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;
@@ -107,30 +99,29 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
webRequestConfig.Headers.Add("Content-Type", "application/json");
var maxWebRequest = new MaxWebRequest(webRequestConfig);
AppLovinEditorCoroutine.StartCoroutine(maxWebRequest.Send(webResponse =>
var webResponse = maxWebRequest.SendSync();
if (!webResponse.IsSuccess)
{
if (!webResponse.IsSuccess)
{
MaxSdkLogger.UserError("AppLovin Quality Service installation failed. Failed to download script with error: " + webResponse.ErrorMessage);
return;
}
MaxSdkLogger.UserError("AppLovin Quality Service installation failed. Failed to download script with error: " + webResponse.ErrorMessage);
return;
}
// Check if Ruby is installed
var rubyVersion = AppLovinCommandLine.Run("ruby", "--version", buildPath);
if (rubyVersion.ExitCode != 0)
{
MaxSdkLogger.UserError("AppLovin Quality Service installation requires Ruby. Please install Ruby, export it to your system PATH and re-export the project.");
return;
}
// Check if Ruby is installed
var rubyVersion = AppLovinCommandLine.Run("ruby", "--version", buildPath);
if (rubyVersion.ExitCode != 0)
{
MaxSdkLogger.UserError("AppLovin Quality Service installation requires Ruby. Please install Ruby, export it to your system PATH and re-export the project.");
return;
}
// Ruby is installed, run `ruby AppLovinQualityServiceSetup.rb`
var result = AppLovinCommandLine.Run("ruby", OutputFileName, buildPath);
// Ruby is installed, run `ruby AppLovinQualityServiceSetup.rb`
var result = AppLovinCommandLine.Run("ruby", OutputFileName, buildPath);
// Check if we have an error.
if (result.ExitCode != 0) MaxSdkLogger.UserError("Failed to set up AppLovin Quality Service");
// Check if we have an error.
if (result.ExitCode != 0) MaxSdkLogger.UserError("Failed to set up AppLovin Quality Service");
MaxSdkLogger.UserDebug(result.Message);
}));
MaxSdkLogger.UserDebug(result.Message);
}
[PostProcessBuild(AppLovinEmbedFrameworksPriority)]
@@ -140,13 +131,9 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
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);
LocalizeUserTrackingDescriptionIfNeeded(AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionDe, "de", buildPath, project, unityMainTargetGuid);
@@ -173,23 +160,11 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
var dynamicLibraryPathsToEmbed = GetDynamicLibraryPathsToEmbed(podsDirectory, buildPath);
if (dynamicLibraryPathsToEmbed == null || dynamicLibraryPathsToEmbed.Count == 0) return;
#if UNITY_2019_3_OR_NEWER
foreach (var dynamicLibraryPath in dynamicLibraryPathsToEmbed)
{
var fileGuid = project.AddFile(dynamicLibraryPath, dynamicLibraryPath);
project.AddFileToEmbedFrameworks(targetGuid, fileGuid);
}
#else
string runpathSearchPaths;
runpathSearchPaths = project.GetBuildPropertyForAnyConfig(targetGuid, "LD_RUNPATH_SEARCH_PATHS");
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
}
/// <summary>
@@ -309,13 +284,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
var currentIosVersion = network.CurrentVersions.Ios;
if (string.IsNullOrEmpty(currentIosVersion)) return false;
var minIosVersion = libraryToEmbed.MinVersion;
var maxIosVersion = libraryToEmbed.MaxVersion;
var greaterThanOrEqualToMinVersion = string.IsNullOrEmpty(minIosVersion) || MaxSdkUtils.CompareVersions(currentIosVersion, minIosVersion) != MaxSdkUtils.VersionComparisonResult.Lesser;
var lessThanOrEqualToMaxVersion = string.IsNullOrEmpty(maxIosVersion) || MaxSdkUtils.CompareVersions(currentIosVersion, maxIosVersion) != MaxSdkUtils.VersionComparisonResult.Greater;
return greaterThanOrEqualToMinVersion && lessThanOrEqualToMaxVersion;
return MaxSdkUtils.IsVersionInRange(currentIosVersion, libraryToEmbed.MinVersion, libraryToEmbed.MaxVersion);
}
private static List<string> GetDynamicLibraryPathsInProjectToEmbed(string podsDirectory, List<string> dynamicLibrariesToEmbed)
@@ -566,11 +535,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
var project = new PBXProject();
project.ReadFromFile(projectPath);
#if UNITY_2019_3_OR_NEWER
var unityMainTargetGuid = project.GetUnityMainTargetGuid();
#else
var unityMainTargetGuid = project.TargetGuidByName(UnityMainTargetName);
#endif
var guid = project.AddFile(AppLovinSettingsPlistFileName, AppLovinSettingsPlistFileName);
project.AddFileToBuild(unityMainTargetGuid, guid);
@@ -23,7 +23,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
private const string ElementNameAndroidPackage = "androidPackage";
private const string AttributeNameSpec = "spec";
private const string UmpDependencyPackage = "com.google.android.ump:user-messaging-platform:";
private const string UmpDependencyVersion = "2.1.0";
private const string UmpDependencyVersion = "4.0.0";
public void OnPreprocessBuild(BuildReport report)
{
@@ -36,13 +36,9 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
// We can only process gradle template file here. If it is not available, we will try again in post build on Unity IDEs newer than 2018_2 (see AppLovinPostProcessGradleProject).
if (!AppLovinIntegrationManager.GradleTemplateEnabled) return;
#if UNITY_2019_3_OR_NEWER
// The publisher could be migrating from older Unity versions to 2019_3 or newer.
// If so, we should delete the plugin from the template. The plugin will be added to the project's application module in the post processing script (AppLovinPostProcessGradleProject).
RemoveAppLovinQualityServiceOrSafeDkPlugin(AppLovinIntegrationManager.GradleTemplatePath);
#else
AddAppLovinQualityServicePlugin(AppLovinIntegrationManager.GradleTemplatePath);
#endif
}
private static void AddGoogleCmpDependencyIfNeeded()
@@ -26,7 +26,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
private const string AttributeNameName = "name";
private const string AttributeNameVersion = "version";
private const string UmpDependencyPod = "GoogleUserMessagingPlatform";
private const string UmpDependencyVersion = "~> 2.1";
private const string UmpDependencyVersion = "~> 3.1";
private static void AddGoogleCmpDependencyIfNeeded()
{
@@ -6,17 +6,14 @@
#if UNITY_ANDROID
using System.Text;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using AppLovinMax.Internal;
using UnityEditorInternal;
using UnityEngine;
using UnityEngine.Networking;
using Debug = UnityEngine.Debug;
using UnityEngine.PlayerLoop;
namespace AppLovinMax.Scripts.IntegrationManager.Editor
{
@@ -59,6 +56,29 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
private const string SafeDkLegacyMavenRepo = "http://download.safedk.com";
private const string SafeDkLegacyDependencyClassPath = "com.safedk:SafeDKGradlePlugin:";
/// <summary>
/// Adds the Quality Service plugin to the root gradle file.
/// </summary>
/// <param name="path">The path to the unityLibrary's module.</param>
/// <returns>True if the plugin was added successfully, otherwise return false</returns>
protected static bool AddQualityServiceToRootGradleFile(string path)
{
var rootGradleBuildFilePath = Path.Combine(path, "../build.gradle");
var shouldAddQualityServiceToDependencies = ShouldAddQualityServiceToDependencies(rootGradleBuildFilePath);
if (shouldAddQualityServiceToDependencies)
{
// Add the Quality Service Plugin to the dependencies block in the root build.gradle file
return AddQualityServiceBuildScriptLines(rootGradleBuildFilePath);
}
// Add the Quality Service Plugin to the plugin block in the root build.gradle file
var rootSettingsGradleFilePath = Path.Combine(path, "../settings.gradle");
var qualityServiceAdded = AddPluginToRootGradleBuildFile(rootGradleBuildFilePath);
var appLovinRepositoryAdded = AddAppLovinRepository(rootSettingsGradleFilePath);
return qualityServiceAdded && appLovinRepositoryAdded;
}
/// <summary>
/// Determines whether the AppLovin Quality Service plugin should be added to the
/// dependencies block in the root build.gradle file or to the plugins block.
@@ -84,7 +104,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
/// </summary>
/// <param name="rootGradleBuildFile">The path to project's root build.gradle file.</param>
/// <returns><c>true</c> if the file contains a `dependencies` block, indicating an older Gradle version</returns>
protected static bool ShouldAddQualityServiceToDependencies(string rootGradleBuildFile)
private static bool ShouldAddQualityServiceToDependencies(string rootGradleBuildFile)
{
var lines = File.ReadAllLines(rootGradleBuildFile).ToList();
return lines.Any(line => TokenBuildScriptDependencies.IsMatch(line));
@@ -120,11 +140,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
var outputLines = GenerateUpdatedBuildFileLines(
sanitizedLines,
apiKey,
#if UNITY_2019_3_OR_NEWER
false // On Unity 2019.3+, the buildscript closure related lines will to be added to the root build.gradle file.
#else
true
#endif
false // The buildscript closure related lines will to be added to the root build.gradle file.
);
// outputLines can be null if we couldn't add the plugin.
if (outputLines == null) return;
@@ -155,7 +171,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
/// </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>
protected bool AddPluginToRootGradleBuildFile(string rootGradleBuildFile)
private static bool AddPluginToRootGradleBuildFile(string rootGradleBuildFile)
{
var lines = File.ReadAllLines(rootGradleBuildFile).ToList();
@@ -215,7 +231,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
/// </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>
protected bool AddAppLovinRepository(string settingsGradleFile)
private static bool AddAppLovinRepository(string settingsGradleFile)
{
var lines = File.ReadLines(settingsGradleFile).ToList();
var outputLines = new List<string>();
@@ -277,7 +293,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
return true;
}
#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:
@@ -298,7 +313,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
/// </summary>
/// <param name="rootGradleBuildFile">The root build.gradle file path</param>
/// <returns><c>true</c> if the build script lines were applied correctly.</returns>
protected bool AddQualityServiceBuildScriptLines(string rootGradleBuildFile)
private static bool AddQualityServiceBuildScriptLines(string rootGradleBuildFile)
{
var lines = File.ReadAllLines(rootGradleBuildFile).ToList();
var outputLines = GenerateUpdatedBuildFileLines(lines, null, true);
@@ -340,7 +355,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
Console.WriteLine(exception);
}
}
#endif
private static AppLovinQualityServiceData RetrieveQualityServiceData(string sdkKey)
{
@@ -436,7 +450,13 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
private static List<string> GenerateUpdatedBuildFileLines(List<string> lines, string apiKey, bool addBuildScriptLines)
{
var addPlugin = MaxSdkUtils.IsValidString(apiKey);
// Check if the plugin exists, if so, update the SDK Key.
var pluginExists = lines.Any(line => TokenAppLovinPlugin.IsMatch(line));
return pluginExists ? UpdateExistingPlugin(lines, apiKey) : AddPluginAndBuildScript(lines, apiKey, addBuildScriptLines);
}
private static List<string> UpdateExistingPlugin(List<string> lines, string apiKey)
{
// A sample of the template file.
// ...
// allprojects {
@@ -457,149 +477,162 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
// **DEPS**}
// ...
var outputLines = new List<string>();
// Check if the plugin exists, if so, update the SDK Key.
var pluginExists = lines.Any(line => TokenAppLovinPlugin.IsMatch(line));
if (pluginExists)
var pluginMatched = false;
var insideAppLovinClosure = false;
var updatedApiKey = false;
var mavenRepoUpdated = false;
var dependencyClassPathUpdated = false;
foreach (var line in lines)
{
var pluginMatched = false;
var insideAppLovinClosure = false;
var updatedApiKey = false;
var mavenRepoUpdated = false;
var dependencyClassPathUpdated = false;
foreach (var line in lines)
// Bintray maven repo is no longer being used. Update to s3 maven repo with regex check
if (!mavenRepoUpdated && (line.Contains(QualityServiceBintrayMavenRepo) || line.Contains(QualityServiceNoRegexMavenRepo)))
{
// Bintray maven repo is no longer being used. Update to s3 maven repo with regex check
if (!mavenRepoUpdated && (line.Contains(QualityServiceBintrayMavenRepo) || line.Contains(QualityServiceNoRegexMavenRepo)))
{
outputLines.Add(GetFormattedBuildScriptLine(QualityServiceMavenRepo));
mavenRepoUpdated = true;
continue;
}
// We no longer use version specific dependency class path. Just use + for version to always pull the latest.
if (!dependencyClassPathUpdated && line.Contains(QualityServiceDependencyClassPathV3))
{
outputLines.Add(GetFormattedBuildScriptLine(QualityServiceDependencyClassPath));
dependencyClassPathUpdated = true;
continue;
}
if (!pluginMatched && line.Contains(QualityServicePlugin))
{
insideAppLovinClosure = true;
pluginMatched = true;
}
if (insideAppLovinClosure && line.Contains("}"))
{
insideAppLovinClosure = false;
}
// Update the API key.
if (insideAppLovinClosure && !updatedApiKey && TokenApiKey.IsMatch(line))
{
outputLines.Add(string.Format(QualityServiceApiKey, apiKey));
updatedApiKey = true;
}
// Keep adding the line until we find and update the plugin.
else
{
outputLines.Add(line);
}
outputLines.Add(GetFormattedBuildScriptLine(QualityServiceMavenRepo));
mavenRepoUpdated = true;
continue;
}
}
// Plugin hasn't been added yet, add it.
else
{
var buildScriptClosureDepth = 0;
var insideBuildScriptClosure = false;
var buildScriptMatched = false;
var qualityServiceRepositoryAdded = false;
var qualityServiceDependencyClassPathAdded = false;
var qualityServicePluginAdded = false;
foreach (var line in lines)
// We no longer use version specific dependency class path. Just use + for version to always pull the latest.
if (!dependencyClassPathUpdated && line.Contains(QualityServiceDependencyClassPathV3))
{
outputLines.Add(GetFormattedBuildScriptLine(QualityServiceDependencyClassPath));
dependencyClassPathUpdated = true;
continue;
}
if (!pluginMatched && line.Contains(QualityServicePlugin))
{
insideAppLovinClosure = true;
pluginMatched = true;
}
if (insideAppLovinClosure && line.Contains("}"))
{
insideAppLovinClosure = false;
}
// Update the API key.
if (insideAppLovinClosure && !updatedApiKey && TokenApiKey.IsMatch(line))
{
outputLines.Add(string.Format(QualityServiceApiKey, apiKey));
updatedApiKey = true;
}
// Keep adding the line until we find and update the plugin.
else
{
// Add the line to the output lines.
outputLines.Add(line);
// Check if we need to add the build script lines and add them.
if (addBuildScriptLines)
{
if (!buildScriptMatched && line.Contains(BuildScriptMatcher))
{
buildScriptMatched = true;
insideBuildScriptClosure = true;
}
// Match the parenthesis to track if we are still inside the buildscript closure.
if (insideBuildScriptClosure)
{
if (line.Contains("{"))
{
buildScriptClosureDepth++;
}
if (line.Contains("}"))
{
buildScriptClosureDepth--;
}
if (buildScriptClosureDepth == 0)
{
insideBuildScriptClosure = false;
// There may be multiple buildscript closures and we need to keep looking until we added both the repository and classpath.
buildScriptMatched = qualityServiceRepositoryAdded && qualityServiceDependencyClassPathAdded;
}
}
if (insideBuildScriptClosure)
{
// Add the build script dependency repositories.
if (!qualityServiceRepositoryAdded && TokenBuildScriptRepositories.IsMatch(line))
{
outputLines.Add(GetFormattedBuildScriptLine(QualityServiceMavenRepo));
qualityServiceRepositoryAdded = true;
}
// Add the build script dependencies.
else if (!qualityServiceDependencyClassPathAdded && TokenBuildScriptDependencies.IsMatch(line))
{
outputLines.Add(GetFormattedBuildScriptLine(QualityServiceDependencyClassPath));
qualityServiceDependencyClassPathAdded = true;
}
}
}
// Check if we need to add the plugin and add it.
if (addPlugin)
{
// Add the plugin.
if (!qualityServicePluginAdded && TokenApplicationPlugin.IsMatch(line))
{
outputLines.Add(QualityServiceApplyPlugin);
outputLines.AddRange(GenerateAppLovinPluginClosure(apiKey));
qualityServicePluginAdded = true;
}
}
}
if ((addBuildScriptLines && (!qualityServiceRepositoryAdded || !qualityServiceDependencyClassPathAdded)) || (addPlugin && !qualityServicePluginAdded))
{
return null;
}
}
return outputLines;
}
private static List<string> AddPluginAndBuildScript(List<string> lines, string apiKey, bool addBuildScriptLines)
{
var shouldAddPlugin = MaxSdkUtils.IsValidString(apiKey);
if (shouldAddPlugin)
{
lines = AddPlugin(lines, apiKey);
if (lines == null) return null;
}
if (!addBuildScriptLines) return lines;
lines = AddBuildScript(lines);
return lines;
}
private static List<string> AddBuildScript(List<string> lines)
{
var outputLines = new List<string>();
var buildScriptClosureDepth = 0;
var insideBuildScriptClosure = false;
var buildScriptMatched = false;
var qualityServiceRepositoryAdded = false;
var qualityServiceDependencyClassPathAdded = false;
foreach (var line in lines)
{
// Add the line to the output lines.
outputLines.Add(line);
if (!buildScriptMatched && line.Contains(BuildScriptMatcher))
{
buildScriptMatched = true;
insideBuildScriptClosure = true;
}
// Match the parenthesis to track if we are still inside the buildscript closure.
if (insideBuildScriptClosure)
{
if (line.Contains("{"))
{
buildScriptClosureDepth++;
}
if (line.Contains("}"))
{
buildScriptClosureDepth--;
}
if (buildScriptClosureDepth == 0)
{
insideBuildScriptClosure = false;
// There may be multiple buildscript closures and we need to keep looking until we added both the repository and classpath.
buildScriptMatched = qualityServiceRepositoryAdded && qualityServiceDependencyClassPathAdded;
}
}
if (insideBuildScriptClosure)
{
// Add the build script dependency repositories.
if (!qualityServiceRepositoryAdded && TokenBuildScriptRepositories.IsMatch(line))
{
outputLines.Add(GetFormattedBuildScriptLine(QualityServiceMavenRepo));
qualityServiceRepositoryAdded = true;
}
// Add the build script dependencies.
else if (!qualityServiceDependencyClassPathAdded && TokenBuildScriptDependencies.IsMatch(line))
{
outputLines.Add(GetFormattedBuildScriptLine(QualityServiceDependencyClassPath));
qualityServiceDependencyClassPathAdded = true;
}
}
}
if (!qualityServiceRepositoryAdded || !qualityServiceDependencyClassPathAdded)
{
return null;
}
return outputLines;
}
private static List<string> AddPlugin(List<string> lines, string apiKey)
{
var outputLines = new List<string>();
var qualityServicePluginAdded = false;
foreach (var line in lines)
{
outputLines.Add(line);
// Add the plugin.
if (qualityServicePluginAdded || !TokenApplicationPlugin.IsMatch(line)) continue;
outputLines.Add(QualityServiceApplyPlugin);
outputLines.AddRange(GenerateAppLovinPluginClosure(apiKey));
qualityServicePluginAdded = true;
}
return qualityServicePluginAdded ? outputLines : null;
}
public static string GetFormattedBuildScriptLine(string buildScriptLine)
{
#if UNITY_2022_2_OR_NEWER
return " "
#elif UNITY_2019_3_OR_NEWER
return " "
#else
return " "
return " "
#endif
+ buildScriptLine;
}
@@ -1,4 +1,3 @@
#if UNITY_2019_2_OR_NEWER
using System;
using System.Collections.Generic;
using System.IO;
@@ -189,4 +188,3 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
#endregion
}
}
#endif
+1 -1
View File
@@ -14,7 +14,7 @@ public class MaxSdk :
MaxSdkUnityEditor
#endif
{
private const string _version = "8.4.2";
private const string _version = "8.6.2";
/// <summary>
/// Returns the current plugin version.
+3 -1
View File
@@ -812,7 +812,9 @@ public class MaxSdkAndroid : MaxSdkBase
/// <param name="parameters">A dictionary containing key-value pairs further describing this event.</param>
public static void TrackEvent(string name, IDictionary<string, string> parameters = null)
{
MaxUnityPluginClass.CallStatic("trackEvent", name, Json.Serialize(parameters));
// Convert null to "{}" to avoid Unity sending the literal "null" to Android.
var jsonString = ( parameters == null ) ? EmptyJson : Json.Serialize(parameters);
MaxUnityPluginClass.CallStatic("trackEvent", name, jsonString);
}
#endregion
+2
View File
@@ -14,6 +14,8 @@ using System.Runtime.InteropServices;
public abstract class MaxSdkBase
{
protected const string EmptyJson = "{}";
/// <summary>
/// This enum represents the user's geography used to determine the type of consent flow shown to the user.
/// </summary>
+1 -1
View File
@@ -1082,7 +1082,7 @@ public static class MaxSdkCallbacks
MaxSdkLogger.D("Listener has been removed from callback: " + eventName);
}
#if UNITY_EDITOR && UNITY_2019_2_OR_NEWER
#if UNITY_EDITOR
/// <summary>
/// Resets static event handlers so they still get reset even if Domain Reloading is disabled
/// </summary>
+3 -3
View File
@@ -23,7 +23,7 @@ public class MaxSdkLogger
/// </summary>
public static void D(string message)
{
if (MaxSdk.DisableAllLogs && !MaxSdk.IsVerboseLoggingEnabled()) return;
if (MaxSdk.DisableAllLogs || !MaxSdk.IsVerboseLoggingEnabled()) return;
Debug.Log("Debug [" + SdkTag + "] " + message);
}
@@ -45,7 +45,7 @@ public class MaxSdkLogger
/// </summary>
public static void W(string message)
{
if (MaxSdk.DisableAllLogs && !MaxSdk.IsVerboseLoggingEnabled()) return;
if (MaxSdk.DisableAllLogs || !MaxSdk.IsVerboseLoggingEnabled()) return;
Debug.LogWarning("Warning [" + SdkTag + "] " + message);
}
@@ -67,7 +67,7 @@ public class MaxSdkLogger
/// </summary>
public static void E(string message)
{
if (MaxSdk.DisableAllLogs && !MaxSdk.IsVerboseLoggingEnabled()) return;
if (MaxSdk.DisableAllLogs || !MaxSdk.IsVerboseLoggingEnabled()) return;
Debug.LogError("Error [" + SdkTag + "] " + message);
}
+18 -1
View File
@@ -12,7 +12,7 @@ using UnityEditor;
#endif
public class MaxSdkUtils
public static class MaxSdkUtils
{
/// <summary>
/// An Enum to be used when comparing two versions.
@@ -488,6 +488,13 @@ public class MaxSdkUtils
}
}
public static bool IsVersionInRange(string currentVersion, string minVersion, string maxVersion)
{
var greaterThanOrEqualToMin = string.IsNullOrEmpty(minVersion) || MaxSdkUtils.CompareVersions(currentVersion, minVersion) != MaxSdkUtils.VersionComparisonResult.Lesser;
var lessThanOrEqualToMax = string.IsNullOrEmpty(maxVersion) || MaxSdkUtils.CompareVersions(currentVersion, maxVersion) != MaxSdkUtils.VersionComparisonResult.Greater;
return greaterThanOrEqualToMin && lessThanOrEqualToMax;
}
/// <summary>
/// Compares its two arguments for order. Returns <see cref="VersionComparisonResult.Lesser"/>, <see cref="VersionComparisonResult.Equal"/>,
/// or <see cref="VersionComparisonResult.Greater"/> as the first version is less than, equal to, or greater than the second.
@@ -573,6 +580,16 @@ public class MaxSdkUtils
return !string.IsNullOrEmpty(toCheck);
}
/// <summary>
/// Check if the given array is null or empty.
/// </summary>
/// <param name="array">The array to be checked.</param>
/// <returns><c>true</c> if the given array is <c>null</c> or has zero length.</returns>
public static bool IsNullOrEmpty<T>(T[] array)
{
return array == null || array.Length == 0;
}
#if UNITY_EDITOR
/// <summary>
/// Gets the path of the asset in the project for a given MAX plugin export path.
+3 -1
View File
@@ -1027,7 +1027,9 @@ public class MaxSdkiOS : MaxSdkBase
/// <param name="parameters">A dictionary containing key-value pairs further describing this event.</param>
public static void TrackEvent(string name, IDictionary<string, string> parameters = null)
{
_MaxTrackEvent(name, Json.Serialize(parameters));
// Convert null to "{}" to avoid Unity sending the literal "null" to iOS.
var jsonString = ( parameters == null ) ? EmptyJson : Json.Serialize(parameters);
_MaxTrackEvent(name, jsonString);
}
#endregion
@@ -1 +0,0 @@
// This file has been deprecated and will be removed in a future plugin release.
@@ -1,14 +0,0 @@
fileFormatVersion: 2
guid: 409fe14211f31433da09f5b4bd5467b9
labels:
- al_max
- al_max_export_path-MaxSdk/Scripts/MaxTargetingData.cs
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
-1
View File
@@ -1 +0,0 @@
// This file has been deprecated and will be removed in a future plugin release.
@@ -1,14 +0,0 @@
fileFormatVersion: 2
guid: 8fb1f6f31b19c407b9d3fa62557d373a
labels:
- al_max
- al_max_export_path-MaxSdk/Scripts/MaxUserSegment.cs
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: