update: 升级 ApplovinMax 的 Unity 插件至 12.5.0

--story=1020573 --user=yufei.hu 【中台】【广告】ApplovinMax 广告插件升级到 6.5.2 (双端:12.5.0) https://www.tapd.cn/33527076/s/1150750
dev
胡宇飞 2024-06-17 10:26:57 +08:00
parent f5d927536d
commit 974d8927f6
53 changed files with 260 additions and 138 deletions

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<dependencies>
<androidPackages>
<androidPackage spec="com.applovin:applovin-sdk:12.4.2" />
<androidPackage spec="com.applovin:applovin-sdk:12.5.0" />
</androidPackages>
<iosPods>
<iosPod name="AppLovinSDK" version="12.4.1" />
<iosPod name="AppLovinSDK" version="12.5.0" />
</iosPods>
</dependencies>

View File

@ -5,7 +5,7 @@
#import "MAUnityAdManager.h"
#define VERSION @"6.4.3"
#define VERSION @"6.5.2"
#define KEY_WINDOW [UIApplication sharedApplication].keyWindow
#define DEVICE_SPECIFIC_ADVIEW_AD_FORMAT ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) ? MAAdFormat.leader : MAAdFormat.banner
@ -21,14 +21,8 @@ extern "C" {
UIWindow* UnityGetMainWindow(void);
// life cycle management
int UnityIsPaused(void);
void UnityPause(int pause);
void UnitySendMessage(const char* obj, const char* method, const char* msg);
static const char * cStringCopy(NSString *string)
{
const char *value = string.UTF8String;
return value ? strdup(value) : NULL;
}
void max_unity_dispatch_on_main_thread(dispatch_block_t block)
{
@ -79,6 +73,9 @@ extern "C" {
@property (nonatomic, strong) NSMutableDictionary<NSString *, MAAd *> *adInfoDict;
@property (nonatomic, strong) NSObject *adInfoDictLock;
@property (nonatomic, strong) NSOperationQueue *backgroundCallbackEventsQueue;
@property (nonatomic, assign) BOOL resumeUnityAfterApplicationBecomesActive;
@end
// Internal
@ -132,6 +129,9 @@ static ALUnityBackgroundCallback backgroundCallback;
self.adInfoDict = [NSMutableDictionary dictionary];
self.adInfoDictLock = [[NSObject alloc] init];
self.backgroundCallbackEventsQueue = [[NSOperationQueue alloc] init];
self.backgroundCallbackEventsQueue.maxConcurrentOperationCount = 1;
max_unity_dispatch_on_main_thread(^{
self.safeAreaBackground = [[UIView alloc] init];
self.safeAreaBackground.hidden = YES;
@ -154,6 +154,31 @@ static ALUnityBackgroundCallback backgroundCallback;
[self positionAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: self.verticalAdViewFormats[adUnitIdentifier]];
}
}];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(applicationPaused:)
name: UIApplicationDidEnterBackgroundNotification
object: nil];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(applicationResumed:)
name: UIApplicationDidBecomeActiveNotification
object: nil];
[[NSNotificationCenter defaultCenter] addObserverForName: UIApplicationDidBecomeActiveNotification
object: nil
queue: [NSOperationQueue mainQueue]
usingBlock:^(NSNotification *notification) {
#if !IS_TEST_APP
if ( self.resumeUnityAfterApplicationBecomesActive && UnityIsPaused() )
{
UnityPause(NO);
}
#endif
self.backgroundCallbackEventsQueue.suspended = NO;
}];
}
return self;
}
@ -197,13 +222,13 @@ static ALUnityBackgroundCallback backgroundCallback;
NSString *consentFlowUserGeographyStr = @(configuration.consentFlowUserGeography).stringValue;
NSString *consentDialogStateStr = @(configuration.consentDialogState).stringValue;
NSString *appTrackingStatus = @(configuration.appTrackingTransparencyStatus).stringValue; // Deliberately name it `appTrackingStatus` to be a bit more generic (in case Android introduces a similar concept)
[MAUnityAdManager forwardUnityEventWithArgs: @{@"name" : @"OnSdkInitializedEvent",
@"consentFlowUserGeography" : consentFlowUserGeographyStr,
@"consentDialogState" : consentDialogStateStr,
@"countryCode" : configuration.countryCode,
@"appTrackingStatus" : appTrackingStatus,
@"isSuccessfullyInitialized" : @([self.sdk isInitialized]),
@"isTestModeEnabled" : @([configuration isTestModeEnabled])}];
[self forwardUnityEventWithArgs: @{@"name" : @"OnSdkInitializedEvent",
@"consentFlowUserGeography" : consentFlowUserGeographyStr,
@"consentDialogState" : consentDialogStateStr,
@"countryCode" : configuration.countryCode,
@"appTrackingStatus" : appTrackingStatus,
@"isSuccessfullyInitialized" : @([self.sdk isInitialized]),
@"isTestModeEnabled" : @([configuration isTestModeEnabled])}];
});
}];
@ -222,7 +247,7 @@ static ALUnityBackgroundCallback backgroundCallback;
[self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier] atPosition: DEFAULT_AD_VIEW_POSITION withOffset: CGPointMake(xOffset, yOffset)];
}
- (void)loadBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
- (void)loadBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{
[self loadAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]];
}
@ -710,7 +735,7 @@ static ALUnityBackgroundCallback backgroundCallback;
}
NSDictionary<NSString *, id> *args = [self defaultAdEventParametersForName: name withAd: ad];
[MAUnityAdManager forwardUnityEventWithArgs: args];
[self forwardUnityEventWithArgs: args];
});
}
@ -764,13 +789,13 @@ static ALUnityBackgroundCallback backgroundCallback;
[self.adInfoDict removeObjectForKey: adUnitIdentifier];
}
[MAUnityAdManager forwardUnityEventWithArgs: @{@"name" : name,
@"adUnitId" : adUnitIdentifier,
@"errorCode" : [@(error.code) stringValue],
@"errorMessage" : error.message,
@"waterfallInfo" : [self createAdWaterfallInfo: error.waterfall],
@"adLoadFailureInfo" : error.adLoadFailureInfo ?: @"",
@"latencyMillis" : [self requestLatencyMillisFromRequestLatency: error.requestLatency]}];
[self forwardUnityEventWithArgs: @{@"name" : name,
@"adUnitId" : adUnitIdentifier,
@"errorCode" : [@(error.code) stringValue],
@"errorMessage" : error.message,
@"waterfallInfo" : [self createAdWaterfallInfo: error.waterfall],
@"adLoadFailureInfo" : error.adLoadFailureInfo ?: @"",
@"latencyMillis" : [self requestLatencyMillisFromRequestLatency: error.requestLatency]}];
});
}
@ -811,7 +836,7 @@ static ALUnityBackgroundCallback backgroundCallback;
}
NSDictionary<NSString *, id> *args = [self defaultAdEventParametersForName: name withAd: ad];
[MAUnityAdManager forwardUnityEventWithArgs: args];
[self forwardUnityEventWithArgs: args];
});
}
@ -821,9 +846,9 @@ static ALUnityBackgroundCallback backgroundCallback;
MAAdFormat *adFormat = ad.format;
if ( ![adFormat isFullscreenAd] ) return;
// UnityPause needs to be called on the main thread.
#if !IS_TEST_APP
UnityPause(1);
// UnityPause needs to be called on the main thread.
UnityPause(YES);
#endif
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
@ -847,7 +872,7 @@ static ALUnityBackgroundCallback backgroundCallback;
}
NSDictionary<NSString *, id> *args = [self defaultAdEventParametersForName: name withAd: ad];
[MAUnityAdManager forwardUnityEventWithArgs: args];
[self forwardUnityEventWithArgs: args];
});
}
@ -884,7 +909,7 @@ static ALUnityBackgroundCallback backgroundCallback;
args[@"mediatedNetworkErrorMessage"] = error.mediatedNetworkErrorMessage;
args[@"waterfallInfo"] = [self createAdWaterfallInfo: error.waterfall];
args[@"latencyMillis"] = [self requestLatencyMillisFromRequestLatency: error.requestLatency];
[MAUnityAdManager forwardUnityEventWithArgs: args];
[self forwardUnityEventWithArgs: args];
});
}
@ -894,9 +919,18 @@ static ALUnityBackgroundCallback backgroundCallback;
MAAdFormat *adFormat = ad.format;
if ( ![adFormat isFullscreenAd] ) return;
// UnityPause needs to be called on the main thread.
#if !IS_TEST_APP
UnityPause(0);
extern bool _didResignActive;
if ( _didResignActive )
{
// If the application is not active, we should wait until application becomes active to resume unity.
self.resumeUnityAfterApplicationBecomesActive = YES;
}
else
{
// UnityPause needs to be called on the main thread.
UnityPause(NO);
}
#endif
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
@ -920,7 +954,7 @@ static ALUnityBackgroundCallback backgroundCallback;
}
NSDictionary<NSString *, id> *args = [self defaultAdEventParametersForName: name withAd: ad];
[MAUnityAdManager forwardUnityEventWithArgs: args];
[self forwardUnityEventWithArgs: args];
});
}
@ -933,9 +967,9 @@ static ALUnityBackgroundCallback backgroundCallback;
return;
}
// UnityPause needs to be called on the main thread.
#if !IS_TEST_APP
UnityPause(1);
// UnityPause needs to be called on the main thread.
UnityPause(YES);
#endif
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
@ -951,7 +985,7 @@ static ALUnityBackgroundCallback backgroundCallback;
}
NSDictionary<NSString *, id> *args = [self defaultAdEventParametersForName: name withAd: ad];
[MAUnityAdManager forwardUnityEventWithArgs: args];
[self forwardUnityEventWithArgs: args];
});
}
@ -964,9 +998,18 @@ static ALUnityBackgroundCallback backgroundCallback;
return;
}
// UnityPause needs to be called on the main thread.
#if !IS_TEST_APP
UnityPause(0);
extern bool _didResignActive;
if ( _didResignActive )
{
// If the application is not active, we should wait until application becomes active to resume unity.
self.resumeUnityAfterApplicationBecomesActive = YES;
}
else
{
// UnityPause needs to be called on the main thread.
UnityPause(NO);
}
#endif
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
@ -982,7 +1025,7 @@ static ALUnityBackgroundCallback backgroundCallback;
}
NSDictionary<NSString *, id> *args = [self defaultAdEventParametersForName: name withAd: ad];
[MAUnityAdManager forwardUnityEventWithArgs: args];
[self forwardUnityEventWithArgs: args];
});
}
@ -1017,7 +1060,7 @@ static ALUnityBackgroundCallback backgroundCallback;
NSMutableDictionary<NSString *, id> *args = [self defaultAdEventParametersForName: name withAd: ad];
args[@"rewardLabel"] = rewardLabel;
args[@"rewardAmount"] = rewardAmount;
[MAUnityAdManager forwardUnityEventWithArgs: args];
[self forwardUnityEventWithArgs: args];
});
}
@ -1059,7 +1102,7 @@ static ALUnityBackgroundCallback backgroundCallback;
NSMutableDictionary<NSString *, id> *args = [self defaultAdEventParametersForName: name withAd: ad];
args[@"keepInBackground"] = @([adFormat isFullscreenAd]);
[MAUnityAdManager forwardUnityEventWithArgs: args];
[self forwardUnityEventWithArgs: args];
});
}
@ -1098,9 +1141,9 @@ static ALUnityBackgroundCallback backgroundCallback;
NSMutableDictionary<NSString *, id> *args = [self defaultAdEventParametersForName: name withAd: ad];
args[@"adReviewCreativeId"] = creativeIdentifier;
args[@"keepInBackground"] = @([adFormat isFullscreenAd]);
// Forward the event in background for fullscreen ads so that the user gets the callback even while the ad is playing.
[MAUnityAdManager forwardUnityEventWithArgs: args];
[self forwardUnityEventWithArgs: args];
});
}
@ -1939,24 +1982,19 @@ static ALUnityBackgroundCallback backgroundCallback;
return UnityGetGLViewController() ?: UnityGetMainWindow().rootViewController ?: [KEY_WINDOW rootViewController];
}
+ (void)forwardUnityEventWithArgs:(NSDictionary<NSString *, id> *)args
- (void)forwardUnityEventWithArgs:(NSDictionary<NSString *, id> *)args
{
#if !IS_TEST_APP
void (^runnable)(void) = ^{
const char *serializedParameters = cStringCopy([self serializeParameters: args]);
backgroundCallback(serializedParameters);
};
// Always forward in background - we push it back to the main thread in Unity
if ( [NSThread isMainThread] )
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), runnable);
}
else
{
runnable();
}
extern bool _didResignActive;
// We should not call any script callbacks when application is not active. Suspend the callback queue if resign is active.
// We'll resume the queue once the application becomes active again.
self.backgroundCallbackEventsQueue.suspended = _didResignActive;
#endif
[self.backgroundCallbackEventsQueue addOperationWithBlock:^{
NSString *serializedParameters = [MAUnityAdManager serializeParameters: args];
backgroundCallback(serializedParameters.UTF8String);
}];
}
+ (NSString *)serializeParameters:(NSDictionary<NSString *, id> *)dict
@ -2011,7 +2049,7 @@ static ALUnityBackgroundCallback backgroundCallback;
- (void)didDismissUserConsentDialog
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[MAUnityAdManager forwardUnityEventWithArgs: @{@"name" : @"OnSdkConsentDialogDismissedEvent"}];
[self forwardUnityEventWithArgs: @{@"name" : @"OnSdkConsentDialogDismissedEvent"}];
});
}
@ -2020,7 +2058,7 @@ static ALUnityBackgroundCallback backgroundCallback;
- (void)showCMPForExistingUser
{
[self.sdk.cmpService showCMPForExistingUserWithCompletion:^(ALCMPError * _Nullable error) {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSMutableDictionary<NSString *, id> *args = [NSMutableDictionary dictionaryWithCapacity: 2];
args[@"name"] = @"OnCmpCompletedEvent";
@ -2034,11 +2072,31 @@ static ALUnityBackgroundCallback backgroundCallback;
@"keepInBackground": @(YES)};
}
[MAUnityAdManager forwardUnityEventWithArgs: args];
[self forwardUnityEventWithArgs: args];
});
}];
}
#pragma mark - Application
- (void)applicationPaused:(NSNotification *)notification
{
[self notifyApplicationStateChangedEventForPauseState: YES];
}
- (void)applicationResumed:(NSNotification *)notification
{
[self notifyApplicationStateChangedEventForPauseState: NO];
}
- (void)notifyApplicationStateChangedEventForPauseState:(BOOL)isPaused
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[self forwardUnityEventWithArgs: @{@"name": @"OnApplicationStateChanged",
@"isPaused": @(isPaused)}];
});
}
- (MAAd *)adWithAdUnitIdentifier:(NSString *)adUnitIdentifier
{
@synchronized ( self.adInfoDictLock )

View File

@ -357,7 +357,7 @@ extern "C"
void _MaxShowConsentDialog()
{
NSLog(@"[%@] Failed to show consent dialog - Unavailable on iOS, please use the consent flow: https://dash.applovin.com/documentation/mediation/unity/getting-started/consent-flow", TAG);
NSLog(@"[%@] Failed to show consent dialog - Unavailable on iOS, please use the consent flow: https://developers.applovin.com/en/unity/overview/terms-and-privacy-policy-flow", TAG);
}
int _MaxConsentDialogState()

View File

@ -184,13 +184,10 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
/// <summary>
/// Whether or not the plugin is under the Assets/ folder.
/// </summary>
//--- INJECT PluginOutside START ---
public static bool IsPluginOutsideAssetsDirectory
{ get => !(PluginParentDirectory.StartsWith("Assets") || PluginParentDirectory.StartsWith("Packages")); }
//--- INJECT PluginOutside OVER ---
// {
// get { return !PluginParentDirectory.StartsWith("Assets"); }
// }
{
get { return !PluginParentDirectory.StartsWith("Assets"); }
}
/// <summary>
/// Whether or not gradle build system is enabled.

View File

@ -18,15 +18,13 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
{
public class AppLovinIntegrationManagerWindow : EditorWindow
{
private const string keyNewLocalizationsMarked = "com.applovin.new_localizations_marked_v0"; // Update the key version each time new localizations are added.
private const string windowTitle = "AppLovin Integration Manager";
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://dash.applovin.com/documentation/mediation/ios/getting-started/terms-and-privacy-policy-flow";
private const string documentationAdaptersLink = "https://dash.applovin.com/documentation/mediation/unity/mediation-adapters";
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 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 alertIconExportPath = "MaxSdk/Resources/Images/alert_icon.png";
@ -899,7 +897,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
GUILayout.Space(5);
AppLovinSettings.Instance.AddApsSkAdNetworkIds = DrawOtherSettingsToggle(AppLovinSettings.Instance.AddApsSkAdNetworkIds, " Add Amazon Publisher Services SKAdNetworkID's");
GUILayout.Space(5);
var autoUpdateEnabled = DrawOtherSettingsToggle(EditorPrefs.GetBool(AppLovinAutoUpdater.KeyAutoUpdateEnabled, true), " Enable Auto Update");
var autoUpdateEnabled = DrawOtherSettingsToggle(EditorPrefs.GetBool(AppLovinAutoUpdater.KeyAutoUpdateEnabled, true), " Enable Auto Update", "Checks for AppLovin MAX plugin updates and notifies you when an update is available.");
EditorPrefs.SetBool(AppLovinAutoUpdater.KeyAutoUpdateEnabled, autoUpdateEnabled);
GUILayout.Space(5);
var verboseLoggingEnabled = DrawOtherSettingsToggle(EditorPrefs.GetBool(MaxSdkLogger.KeyVerboseLoggingEnabled, false), " Enable Verbose Logging");
@ -914,12 +912,13 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
GUILayout.EndHorizontal();
}
private bool DrawOtherSettingsToggle(bool value, string text)
private bool DrawOtherSettingsToggle(bool value, string text, string tooltip = "")
{
using (new EditorGUILayout.HorizontalScope())
{
GUILayout.Space(4);
var toggleValue = GUILayout.Toggle(value, text);
var content = MaxSdkUtils.IsValidString(tooltip) ? new GUIContent(text, tooltip) : new GUIContent(text);
var toggleValue = GUILayout.Toggle(value, content);
GUILayout.Space(4);
return toggleValue;

View File

@ -31,7 +31,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
[MenuItem("AppLovin/Documentation")]
private static void Documentation()
{
Application.OpenURL("https://dash.applovin.com/documentation/mediation/unity/getting-started");
Application.OpenURL("https://developers.applovin.com/en/unity/overview/integration");
}
[MenuItem("AppLovin/Contact Us")]

View File

@ -1,10 +1,14 @@
fileFormatVersion: 2
guid: 028aec80942df459ab226487b786042c
guid: 02c2d277874f649d18a59d382420bf65
labels:
- al_max
- al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinMenuItems.cs.backup
DefaultImporter:
- al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinMenuItems.cs
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -90,6 +90,33 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
dynamicLibrariesToEmbed.Add("IASDKCore.xcframework");
}
if (AppLovinIntegrationManager.IsAdapterInstalled("InMobi", "10.7.2.0"))
{
dynamicLibrariesToEmbed.Add("InMobiSDK.xcframework");
}
if (AppLovinIntegrationManager.IsAdapterInstalled("Smaato", "22.8.3.0"))
{
dynamicLibrariesToEmbed.AddRange(new List<string>()
{
"SmaatoSDKBanner.xcframework",
"SmaatoSDKCore.xcframework",
"SmaatoSDKInAppBidding.xcframework",
"SmaatoSDKInterstitial.xcframework",
"SmaatoSDKNative.xcframework",
"SmaatoSDKOpenMeasurement.xcframework",
"SmaatoSDKOutstream.xcframework",
"SmaatoSDKRewardedAds.xcframework",
"SmaatoSDKRichMedia.xcframework",
"SmaatoSDKVideo.xcframework"
});
}
if (AppLovinIntegrationManager.IsAdapterInstalled("Verve", "3.0.0.0"))
{
dynamicLibrariesToEmbed.Add("ATOM.xcframework");
}
return dynamicLibrariesToEmbed;
}
}

View File

@ -38,6 +38,10 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
private const string KeyConsentFlowTermsOfService = "consent_flow_terms_of_service";
private const string KeyConsentFlowPrivacyPolicy = "consent_flow_privacy_policy";
private const string KeyConsentFlowDebugUserGeography = "consent_flow_debug_user_geography";
private const string UmpLegacyDependencyLine = "<androidPackage spec=\"com.google.android.ump:user-messaging-platform:2.1.0\" />";
private const string UmpDependencyLine = "<androidPackage spec=\"com.google.android.ump:user-messaging-platform:2.+\" />";
private const string AndroidPackagesContainerElementString = "androidPackages";
public void OnPreprocessBuild(BuildReport report)
{
@ -181,16 +185,16 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
private static void AddGoogleCmpDependencyIfNeeded()
{
const string umpDependencyLine = "<androidPackage spec=\"com.google.android.ump:user-messaging-platform:2.1.0\" />";
const string containerElementString = "androidPackages";
// Remove the legacy fixed UMP version if it exists, we'll add the dependency with a dynamic version below.
TryRemoveStringFromDependencyFile(UmpLegacyDependencyLine, AndroidPackagesContainerElementString);
if (AppLovinInternalSettings.Instance.ConsentFlowEnabled)
{
TryAddStringToDependencyFile(umpDependencyLine, containerElementString);
TryAddStringToDependencyFile(UmpDependencyLine, AndroidPackagesContainerElementString);
}
else
{
TryRemoveStringFromDependencyFile(umpDependencyLine, containerElementString);
TryRemoveStringFromDependencyFile(UmpDependencyLine, AndroidPackagesContainerElementString);
}
}

View File

@ -20,18 +20,22 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
AddGoogleCmpDependencyIfNeeded();
}
private const string UmpLegacyDependencyLine = "<iosPod name=\"GoogleUserMessagingPlatform\" version=\"2.1.0\" />";
private const string UmpDependencyLine = "<iosPod name=\"GoogleUserMessagingPlatform\" version=\"~&gt; 2.1\" />";
private const string IosPodsContainerElementString = "iosPods";
private static void AddGoogleCmpDependencyIfNeeded()
{
const string umpDependencyLine = "<iosPod name=\"GoogleUserMessagingPlatform\" version=\"2.1.0\" />";
const string containerElementString = "iosPods";
// Remove the legacy fixed UMP version if it exists, we'll add the dependency with a dynamic version below.
TryRemoveStringFromDependencyFile(UmpLegacyDependencyLine, IosPodsContainerElementString);
if (AppLovinInternalSettings.Instance.ConsentFlowEnabled)
{
TryAddStringToDependencyFile(umpDependencyLine, containerElementString);
TryAddStringToDependencyFile(UmpDependencyLine, IosPodsContainerElementString);
}
else
{
TryRemoveStringFromDependencyFile(umpDependencyLine, containerElementString);
TryRemoveStringFromDependencyFile(UmpDependencyLine, IosPodsContainerElementString);
}
}

View File

@ -44,7 +44,7 @@ namespace AppLovinMax.Internal
#region Public API
#if UNITY_EDITOR
#if UNITY_EDITOR || !(UNITY_ANDROID || UNITY_IPHONE || UNITY_IOS)
public static MaxEventExecutor Instance
{
get

View File

@ -18,7 +18,7 @@ public class MaxSdk :
MaxSdkUnityEditor
#endif
{
private const string _version = "6.4.3";
private const string _version = "6.5.2";
/// <summary>
/// Returns the current plugin version.

View File

@ -532,6 +532,11 @@ public abstract class MaxSdkBase
}
}
/// <summary>
/// Determines whether ad events raised by the AppLovin's Unity plugin should be invoked on the Unity main thread.
/// </summary>
public static bool? InvokeEventsOnUnityMainThread { get; set; }
/// <summary>
/// The CMP service, which provides direct APIs for interfacing with the Google-certified CMP installed, if any.
/// </summary>

View File

@ -43,6 +43,24 @@ public static class MaxSdkCallbacks
}
}
private static Action<bool> _onApplicationStateChangedEvent;
/// <summary>
/// Fired when the application is paused or resumed.
/// </summary>
public static event Action<bool> OnApplicationStateChangedEvent
{
add
{
LogSubscribedToEvent("OnApplicationStateChangedEvent");
_onApplicationStateChangedEvent += value;
}
remove
{
LogUnsubscribedToEvent("OnApplicationStateChangedEvent");
_onApplicationStateChangedEvent -= value;
}
}
private static Action<string, MaxSdkBase.AdInfo> _onInterstitialAdLoadedEventV2;
private static Action<string, MaxSdkBase.ErrorInfo> _onInterstitialAdLoadFailedEventV2;
private static Action<string, MaxSdkBase.AdInfo> _onInterstitialAdDisplayedEventV2;
@ -1227,6 +1245,11 @@ public static class MaxSdkCallbacks
var errorProps = MaxSdkUtils.GetDictionaryFromDictionary(eventProps, "error");
MaxCmpService.NotifyCompletedIfNeeded(errorProps);
}
else if (eventName == "OnApplicationStateChanged")
{
var isPaused = MaxSdkUtils.GetBoolFromDictionary(eventProps, "isPaused");
InvokeEvent(_onApplicationStateChangedEvent, isPaused, eventName, keepInBackground);
}
// Ad Events
else
{
@ -1505,7 +1528,7 @@ public static class MaxSdkCallbacks
if (!CanInvokeEvent(evt)) return;
MaxSdkLogger.UserDebug("Invoking event: " + eventName);
if (keepInBackground)
if (ShouldInvokeInBackground(keepInBackground))
{
try
{
@ -1528,7 +1551,7 @@ public static class MaxSdkCallbacks
if (!CanInvokeEvent(evt)) return;
MaxSdkLogger.UserDebug("Invoking event: " + eventName + ". Param: " + param);
if (keepInBackground)
if (ShouldInvokeInBackground(keepInBackground))
{
try
{
@ -1551,7 +1574,7 @@ public static class MaxSdkCallbacks
if (!CanInvokeEvent(evt)) return;
MaxSdkLogger.UserDebug("Invoking event: " + eventName + ". Params: " + param1 + ", " + param2);
if (keepInBackground)
if (ShouldInvokeInBackground(keepInBackground))
{
try
{
@ -1574,7 +1597,7 @@ public static class MaxSdkCallbacks
if (!CanInvokeEvent(evt)) return;
MaxSdkLogger.UserDebug("Invoking event: " + eventName + ". Params: " + param1 + ", " + param2 + ", " + param3);
if (keepInBackground)
if (ShouldInvokeInBackground(keepInBackground))
{
try
{
@ -1605,6 +1628,11 @@ public static class MaxSdkCallbacks
return true;
}
private static bool ShouldInvokeInBackground(bool keepInBackground)
{
return MaxSdkBase.InvokeEventsOnUnityMainThread == null ? keepInBackground : !MaxSdkBase.InvokeEventsOnUnityMainThread.Value;
}
private static void LogSubscribedToEvent(string eventName)
{
MaxSdkLogger.D("Listener has been added to callback: " + eventName);

View File

@ -1,3 +1,3 @@
# AppLovin MAX Unity Plugin
To get the latest changes, see the [AppLovin MAX Unity Changelog](https://dash.applovin.com/documentation/mediation/unity/changelog).
To get the latest changes, see the [AppLovin MAX Unity Changelog](https://developers.applovin.com/en/unity/changelog).

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ef04dde3d80394693b97aba6bf4e2043
guid: cb8583c72675544e2a48b72f5842b9d4
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/BidMachine

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 1e265a814936d4d91b402d94d1ef176f
guid: 738f8b304e76240d9a74d548a9ef1eac
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/BidMachine/Editor

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 5004667ee59064c0598e9e12aa1b90f9
guid: 389e8627385e74195aea66b9f27a6c92
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/BidMachine/Editor/Dependencies.xml

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 4c565d72fc59a44ee8a7b0b01944da99
guid: e2630939c2c7c4a4d8f68c0be1326912
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/ByteDance

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 2bab5733093d84253a54126c0fde0044
guid: c3a7d329dc2ad4d6b812c867563af411
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/ByteDance/Editor

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 3720d1ce9b160432187c6dacef4b9370
guid: 5a0754b40d15d4f3bbd74daa8ae53760
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Chartboost

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 82f22185cdb654c04836a4fd200201e4
guid: 5f0d60b541006441b81dc6337d7cf525
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Chartboost/Editor

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 1eef95c344aae49a5bb8428ff0ba76dc
guid: 7d6a70451ec9e474abcbe1c2312930ee
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Facebook

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f8555a3feb92149ada8f408e4d7915ed
guid: 3eef9cb24832346bba46bd0e2b68804c
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Facebook/Editor

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 0ca570c2a4f50446da716526b4aeb949
guid: b69bcc046a0f942b083c5d524acd0e05
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Fyber

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: c45e6d13ddd03462f9c9755967048be6
guid: 9353a92ae275b4ad290817705802cfd5
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Fyber/Editor

View File

@ -1,7 +1,8 @@
fileFormatVersion: 2
guid: d737ad63861574b64918b243b237f6d9
guid: a1291a5ea371742a0a61d7558959ddb4
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Fyber/Editor/PrivacyInfo.xcprivacy
- al_max_export_path-MaxSdk/Mediation~HEAD/Fyber/Editor/PrivacyInfo.xcprivacy
PluginImporter:
externalObjects: {}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a4cf14586b32143de98b48c60866011c
guid: 6ad5197cdbf644485847d8fb29a420b6
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Google

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 0995f7e77088b4f40a6998621a23fec2
guid: dbd0fba122c414a7495b270531c03d1f
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Google/Editor

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 7f0088cb5366b45a8bd47dc6d39a9104
guid: 5a2b43e1f3e144dbcbc6aa5b450c0e16
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/GoogleAdManager

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 60f175d291bde48c793c288610f7cf5e
guid: 60cbbf6fbf3594ee88384433b9016bf7
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/GoogleAdManager/Editor

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: c7bce7d750720455c9b0ea3f0cce9a25
guid: 6d6669637ce0e45d990df0a9744e3718
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/InMobi

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 1af6490c6fb17409bad05988e30e0e98
guid: 84e8f70cb0db54f8bbc5a31fcee4dd24
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/InMobi/Editor

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 5b895a8b08f2a4ef291dd5f37cba8ca7
guid: 233710faa34714ebe849e87e116ec944
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/IronSource

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 2a009f22f000b4c9c84d8c47e1acf89e
guid: 34f3ea4ef9439473ca8a8001a452714d
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/IronSource/Editor

View File

@ -1,11 +1,6 @@
fileFormatVersion: 2
guid: 366e0bcbac9c54cc7b41e7ebfe209ca8
guid: de3543045917044cc9b1e19d4ba05d0a
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/MediationAdapters.txt
- al_max_export_path-MaxSdk/Mediation~HEAD/MediationAdapters.txt
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
timeCreated: 1609308536

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a6f1152190c9f4005b77172b3f827bfe
guid: 21a7fc0e7ca48454ea08a21213aed628
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Mintegral

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 894c254f71da34a2bb91fb723eccd3dd
guid: bf7e53ef2815a4ce4a353006a74ece94
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Mintegral/Editor

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: aecddbfd152b9436b9e40009c599c234
guid: e8bbe95079060473eabef2f7cccd9d8d
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/MobileFuse

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: b84c70e1357e34ae68f0388870358e2b
guid: f565c966cedfc4a718c125c9a4495640
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/MobileFuse/Editor

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: b6fba7e0473954c51b60d721c20de4cd
guid: b3a52c271286d41e1964d237053cf4ed
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/OguryPresage

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a9e2390d8d3224b58883953bb5b51b5a
guid: 86c4224b9f5c8449389e50e4bec806c8
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/OguryPresage/Editor

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 4bfd64ef2dea145b585f5aea1e581bc3
guid: 015ddda2fe4ea49d1b0f6497631cf958
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Smaato

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 55c60994832f74b64851b3d475107739
guid: 06993d059a7b94369949fedf7b0efd26
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Smaato/Editor

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 5375c0d27756a4bd88d6bea312d5c439
guid: 1fc688f4b8aa64db7bdeedb2c2060f8f
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/UnityAds

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 14028cfd09e304c79b5c811e9a726a53
guid: c3db447ec84cc42cb95c7000d150daef
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/UnityAds/Editor

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 63ff722812e014ffd9af97864371c197
guid: 89598f675be104b839df7dae952b604a
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Verve

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 58e5159adc8ba4666a19524426e952e2
guid: 0e49c9d97ef9d4150a0335ec0c80bc3d
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Verve/Editor

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: cffd18767184a494dad8f019037ab252
guid: 42c233349e3b2436185ff3675e888d03
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Vungle

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 1010e8092f71d45ffa740fa3bc771d1c
guid: 1f6e04ca16cdf4e28ba652b7dad6839c
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Vungle/Editor

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 2a2fecdf1505e42a9ba7b317b3d09b22
guid: 5cacd558d9a7740979f9a443f45c507b
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Yandex

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: cde9fb1c1947341e2b53c30db0318c7d
guid: a13c4ded03b88486cb4b7f7f6cbe0df3
labels:
- al_max
- al_max_export_path-MaxSdk/Mediation/Yandex/Editor