Skip to content

Commit

Permalink
demoapp/bump_applovin_plugin_6.4.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins committed May 6, 2024
1 parent 07378ee commit 20dde17
Show file tree
Hide file tree
Showing 19 changed files with 69 additions and 47 deletions.
2 changes: 1 addition & 1 deletion DemoApp/Assets/MaxSdk/AppLovin.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion DemoApp/Assets/MaxSdk/AppLovin/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions DemoApp/Assets/MaxSdk/AppLovin/Editor/Dependencies.xml
Original file line number Diff line number Diff line change
@@ -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.4.3" />
</androidPackages>
<iosPods>
<iosPod name="AppLovinSDK" version="12.4.1" />
<iosPod name="AppLovinSDK" version="12.4.2" />
</iosPods>
</dependencies>
2 changes: 1 addition & 1 deletion DemoApp/Assets/MaxSdk/AppLovin/Plugins.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion DemoApp/Assets/MaxSdk/AppLovin/Plugins/Android.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
2 changes: 1 addition & 1 deletion DemoApp/Assets/MaxSdk/AppLovin/Plugins/iOS.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 4 additions & 22 deletions DemoApp/Assets/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#import "MAUnityAdManager.h"

#define VERSION @"6.4.3"
#define VERSION @"6.4.4"

#define KEY_WINDOW [UIApplication sharedApplication].keyWindow
#define DEVICE_SPECIFIC_ADVIEW_AD_FORMAT ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) ? MAAdFormat.leader : MAAdFormat.banner
Expand All @@ -24,12 +24,6 @@
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)
{
if ( block )
Expand Down Expand Up @@ -1713,7 +1707,7 @@ - (void)positionAdViewForAdUnitIdentifier:(NSString *)adUnitIdentifier adFormat:
// All positions have constant height
NSMutableArray<NSLayoutConstraint *> *constraints = [NSMutableArray arrayWithObject: [adView.heightAnchor constraintEqualToConstant: adViewSize.height]];

UILayoutGuide *layoutGuide = superview.safeAreaLayoutGuide;
UILayoutGuide *layoutGuide = superview.window.safeAreaLayoutGuide ?: superview.safeAreaLayoutGuide;

if ( [adViewPosition isEqual: @"top_center"] || [adViewPosition isEqual: @"bottom_center"] )
{
Expand Down Expand Up @@ -1942,20 +1936,8 @@ - (UIViewController *)unityViewController
+ (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();
}
NSString *serializedParameters = [self serializeParameters: args];
backgroundCallback(serializedParameters.UTF8String);
#endif
}

Expand Down
2 changes: 1 addition & 1 deletion DemoApp/Assets/MaxSdk/Prefabs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion DemoApp/Assets/MaxSdk/Resources.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion DemoApp/Assets/MaxSdk/Resources/Images.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion DemoApp/Assets/MaxSdk/Scripts.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,28 @@ private static List<string> DynamicLibrariesToEmbed
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"
});
}

return dynamicLibrariesToEmbed;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public class AppLovinPreProcessAndroid : AppLovinProcessGradleBuildFile, IPrepro
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)
{
Expand Down Expand Up @@ -181,16 +185,16 @@ private static void RemoveAppLovinSettingsRawResourceFileIfNeeded(string rawReso

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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,22 @@ public void OnPreprocessBuild(BuildReport report)
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);
}
}

Expand Down
2 changes: 1 addition & 1 deletion DemoApp/Assets/MaxSdk/Scripts/MaxEventExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static void InitializeIfNeeded()

#region Public API

#if UNITY_EDITOR
#if UNITY_EDITOR || !(UNITY_ANDROID || UNITY_IPHONE || UNITY_IOS)
public static MaxEventExecutor Instance
{
get
Expand Down
2 changes: 1 addition & 1 deletion DemoApp/Assets/MaxSdk/Scripts/MaxSdk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class MaxSdk :
MaxSdkUnityEditor
#endif
{
private const string _version = "6.4.3";
private const string _version = "6.4.4";

/// <summary>
/// Returns the current plugin version.
Expand Down
5 changes: 5 additions & 0 deletions DemoApp/Assets/MaxSdk/Scripts/MaxSdkBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,11 @@ public override string ToString()
}
}

/// <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>
Expand Down
13 changes: 9 additions & 4 deletions DemoApp/Assets/MaxSdk/Scripts/MaxSdkCallbacks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,7 @@ private static void InvokeEvent(Action evt, string eventName, bool keepInBackgro
if (!CanInvokeEvent(evt)) return;

MaxSdkLogger.UserDebug("Invoking event: " + eventName);
if (keepInBackground)
if (ShouldInvokeInBackground(keepInBackground))
{
try
{
Expand All @@ -1528,7 +1528,7 @@ private static void InvokeEvent<T>(Action<T> evt, T param, string eventName, boo
if (!CanInvokeEvent(evt)) return;

MaxSdkLogger.UserDebug("Invoking event: " + eventName + ". Param: " + param);
if (keepInBackground)
if (ShouldInvokeInBackground(keepInBackground))
{
try
{
Expand All @@ -1551,7 +1551,7 @@ private static void InvokeEvent<T1, T2>(Action<T1, T2> evt, T1 param1, T2 param2
if (!CanInvokeEvent(evt)) return;

MaxSdkLogger.UserDebug("Invoking event: " + eventName + ". Params: " + param1 + ", " + param2);
if (keepInBackground)
if (ShouldInvokeInBackground(keepInBackground))
{
try
{
Expand All @@ -1574,7 +1574,7 @@ private static void InvokeEvent<T1, T2, T3>(Action<T1, T2, T3> evt, T1 param1, T
if (!CanInvokeEvent(evt)) return;

MaxSdkLogger.UserDebug("Invoking event: " + eventName + ". Params: " + param1 + ", " + param2 + ", " + param3);
if (keepInBackground)
if (ShouldInvokeInBackground(keepInBackground))
{
try
{
Expand Down Expand Up @@ -1605,6 +1605,11 @@ private static bool CanInvokeEvent(Delegate evt)
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);
Expand Down

0 comments on commit 20dde17

Please sign in to comment.