update: Max SDK 升级至 6.1.2

feature/ball_only_mintegral
胡宇飞 2024-01-26 12:24:22 +08:00
parent 5ab0b8da41
commit 2c505116b3
100 changed files with 1351 additions and 1124 deletions

View File

@ -36,6 +36,7 @@ namespace Guru.Editor.Max
private string _admobIOSId; private string _admobIOSId;
private bool _qualityServiceEnabled = true; private bool _qualityServiceEnabled = true;
private bool _setAttributionReportEndpoint = true; private bool _setAttributionReportEndpoint = true;
private bool _addApsSkAdNetworkIds = true;
private bool _isDirty; private bool _isDirty;
//------- AppLovinData -------- //------- AppLovinData --------
@ -43,8 +44,6 @@ namespace Guru.Editor.Max
private PluginData pluginData; private PluginData pluginData;
#region 生命周期 #region 生命周期
/// <summary> /// <summary>
/// 打开窗体 /// 打开窗体
@ -155,6 +154,7 @@ namespace Guru.Editor.Max
_admobIOSId = _settings.AdMobIosAppId; _admobIOSId = _settings.AdMobIosAppId;
_qualityServiceEnabled = _settings.QualityServiceEnabled; _qualityServiceEnabled = _settings.QualityServiceEnabled;
_setAttributionReportEndpoint = _settings.SetAttributionReportEndpoint; _setAttributionReportEndpoint = _settings.SetAttributionReportEndpoint;
_addApsSkAdNetworkIds = _settings.AddApsSkAdNetworkIds;
} }
else else
{ {
@ -177,6 +177,7 @@ namespace Guru.Editor.Max
_settings.AdMobIosAppId = _admobIOSId; _settings.AdMobIosAppId = _admobIOSId;
_settings.QualityServiceEnabled = _qualityServiceEnabled; _settings.QualityServiceEnabled = _qualityServiceEnabled;
_settings.SetAttributionReportEndpoint = _setAttributionReportEndpoint; _settings.SetAttributionReportEndpoint = _setAttributionReportEndpoint;
_settings.AddApsSkAdNetworkIds = _addApsSkAdNetworkIds;
EditorUtility.SetDirty(_settings); EditorUtility.SetDirty(_settings);
AssetDatabase.SaveAssetIfDirty(_settings); AssetDatabase.SaveAssetIfDirty(_settings);

View File

@ -16,7 +16,7 @@ namespace Guru.Editor.Max
{ {
// ------------ VERSION INFO ------------ // ------------ VERSION INFO ------------
public const string Version = "0.1.0"; public const string Version = "0.1.0";
public const string SdkVersion = "5.11.3"; public const string SdkVersion = "6.1.2";
// ------------ VERSION INFO ------------ // ------------ VERSION INFO ------------
public const string PackageName = "com.guru.unity.max"; public const string PackageName = "com.guru.unity.max";

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 24350f435b5f14067b88bad9e54f4776 guid: c443543f84b8b443bad7d9daa264ae4f
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/AppLovin - al_max_export_path-MaxSdk/AppLovin

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 0c096cc384c7446b5b962f359a291792 guid: 68a1e4d0fd5e8494684b435209c3a42d
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/AppLovin/Editor - al_max_export_path-MaxSdk/AppLovin/Editor

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a36972e13b9b64a87a11421020969d76 guid: 746da98302dc0402aaa37e8f7bd97e77
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/AppLovin/Editor/Dependencies.xml - al_max_export_path-MaxSdk/AppLovin/Editor/Dependencies.xml

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6f0263dd851654e7598f11593e8da7a8 guid: b0fe3bb045e0d4f6f91368c84f74412f
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/AppLovin/Plugins - al_max_export_path-MaxSdk/AppLovin/Plugins

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 9b47263f475c14ff8861bc3b40f416b9 guid: b5015a52575b74babb5884f37c45b263
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/AppLovin/Plugins/Android - al_max_export_path-MaxSdk/AppLovin/Plugins/Android

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 8283280d1ffc84ea1856f8d8982fc3be guid: 1db980bd612824d2097f78fd779e6051
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/AppLovin/Plugins/Android/applovin-max-unity-plugin.aar - al_max_export_path-MaxSdk/AppLovin/Plugins/Android/applovin-max-unity-plugin.aar

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6d1f80dfd5b7247ff9bcf9a5532eb9a3 guid: 35602bb97c21644338be36a4331c3874
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/AppLovin/Plugins/iOS - al_max_export_path-MaxSdk/AppLovin/Plugins/iOS

View File

@ -14,91 +14,91 @@ typedef void (*ALUnityBackgroundCallback)(const char* args);
- (ALSdk *)initializeSdkWithSettings:(ALSdkSettings *)settings backgroundCallback:(ALUnityBackgroundCallback)unityBackgroundCallback andCompletionHandler:(ALSdkInitializationCompletionHandler)completionHandler; - (ALSdk *)initializeSdkWithSettings:(ALSdkSettings *)settings backgroundCallback:(ALUnityBackgroundCallback)unityBackgroundCallback andCompletionHandler:(ALSdkInitializationCompletionHandler)completionHandler;
- (void)createBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier atPosition:(NSString *)bannerPosition; - (void)createBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier atPosition:(nullable NSString *)bannerPosition;
- (void)createBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset; - (void)createBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset;
- (void)loadBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)loadBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)setBannerBackgroundColorForAdUnitIdentifier:(NSString *)adUnitIdentifier hexColorCode:(NSString *)hexColorCode; - (void)setBannerBackgroundColorForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier hexColorCode:(nullable NSString *)hexColorCode;
- (void)setBannerPlacement:(nullable NSString *)placement forAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)setBannerPlacement:(nullable NSString *)placement forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)startBannerAutoRefreshForAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)startBannerAutoRefreshForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)stopBannerAutoRefreshForAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)stopBannerAutoRefreshForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)setBannerExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable NSString *)value; - (void)setBannerExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value;
- (void)setBannerLocalExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable id)value; - (void)setBannerLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value;
- (void)setBannerCustomData:(nullable NSString *)customData forAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)setBannerCustomData:(nullable NSString *)customData forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)setBannerWidth:(CGFloat)width forAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)setBannerWidth:(CGFloat)width forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)updateBannerPosition:(NSString *)bannerPosition forAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)updateBannerPosition:(nullable NSString *)bannerPosition forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)updateBannerPosition:(CGFloat)xOffset y:(CGFloat)yOffset forAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)updateBannerPosition:(CGFloat)xOffset y:(CGFloat)yOffset forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)showBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)showBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)destroyBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)destroyBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)hideBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)hideBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (NSString *)bannerLayoutForAdUnitIdentifier:(NSString *)adUnitIdentifier; - (NSString *)bannerLayoutForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
+ (CGFloat)adaptiveBannerHeightForWidth:(CGFloat)width; + (CGFloat)adaptiveBannerHeightForWidth:(CGFloat)width;
- (void)createMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier atPosition:(NSString *)mrecPosition; - (void)createMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier atPosition:(nullable NSString *)mrecPosition;
- (void)createMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset; - (void)createMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset;
- (void)loadMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)loadMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)setMRecPlacement:(nullable NSString *)placement forAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)setMRecPlacement:(nullable NSString *)placement forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)startMRecAutoRefreshForAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)startMRecAutoRefreshForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)stopMRecAutoRefreshForAdUnitIdentifier:(NSString *)adUnitIdentifer; - (void)stopMRecAutoRefreshForAdUnitIdentifier:(nullable NSString *)adUnitIdentifer;
- (void)setMRecExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable NSString *)value; - (void)setMRecExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value;
- (void)setMRecLocalExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable id)value; - (void)setMRecLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value;
- (void)setMRecCustomData:(nullable NSString *)customData forAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)setMRecCustomData:(nullable NSString *)customData forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)showMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)showMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)destroyMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)destroyMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)hideMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)hideMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)updateMRecPosition:(NSString *)mrecPosition forAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)updateMRecPosition:(nullable NSString *)mrecPosition forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)updateMRecPosition:(CGFloat)xOffset y:(CGFloat)yOffset forAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)updateMRecPosition:(CGFloat)xOffset y:(CGFloat)yOffset forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (NSString *)mrecLayoutForAdUnitIdentifier:(NSString *)adUnitIdentifier; - (NSString *)mrecLayoutForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)createCrossPromoAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset width:(CGFloat)width height:(CGFloat)height rotation:(CGFloat)rotation; - (void)createCrossPromoAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset width:(CGFloat)width height:(CGFloat)height rotation:(CGFloat)rotation;
- (void)setCrossPromoAdPlacement:(nullable NSString *)placement forAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)setCrossPromoAdPlacement:(nullable NSString *)placement forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)showCrossPromoAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)showCrossPromoAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)destroyCrossPromoAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)destroyCrossPromoAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)hideCrossPromoAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)hideCrossPromoAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)updateCrossPromoAdPositionForAdUnitIdentifier:(NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset width:(CGFloat)width height:(CGFloat)height rotation:(CGFloat)rotation; - (void)updateCrossPromoAdPositionForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset width:(CGFloat)width height:(CGFloat)height rotation:(CGFloat)rotation;
- (NSString *)crossPromoAdLayoutForAdUnitIdentifier:(NSString *)adUnitIdentifier; - (NSString *)crossPromoAdLayoutForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)loadInterstitialWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)loadInterstitialWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (BOOL)isInterstitialReadyWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (BOOL)isInterstitialReadyWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)showInterstitialWithAdUnitIdentifier:(NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData; - (void)showInterstitialWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData;
- (void)setInterstitialExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable NSString *)value; - (void)setInterstitialExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value;
- (void)setInterstitialLocalExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable id)value; - (void)setInterstitialLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value;
- (void)loadAppOpenAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)loadAppOpenAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (BOOL)isAppOpenAdReadyWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (BOOL)isAppOpenAdReadyWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)showAppOpenAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData; - (void)showAppOpenAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData;
- (void)setAppOpenAdExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable NSString *)value; - (void)setAppOpenAdExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value;
- (void)setAppOpenAdLocalExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable id)value; - (void)setAppOpenAdLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value;
- (void)loadRewardedAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)loadRewardedAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (BOOL)isRewardedAdReadyWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (BOOL)isRewardedAdReadyWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)showRewardedAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData; - (void)showRewardedAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData;
- (void)setRewardedAdExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable NSString *)value; - (void)setRewardedAdExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value;
- (void)setRewardedAdLocalExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable id)value; - (void)setRewardedAdLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value;
- (void)loadRewardedInterstitialAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)loadRewardedInterstitialAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (BOOL)isRewardedInterstitialAdReadyWithAdUnitIdentifier:(NSString *)adUnitIdentifier; - (BOOL)isRewardedInterstitialAdReadyWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
- (void)showRewardedInterstitialAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData; - (void)showRewardedInterstitialAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData;
- (void)setRewardedInterstitialAdExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable NSString *)value; - (void)setRewardedInterstitialAdExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value;
- (void)setRewardedInterstitialAdLocalExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable id)value; - (void)setRewardedInterstitialAdLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value;
// Event Tracking // Event Tracking
- (void)trackEvent:(NSString *)event parameters:(NSString *)parameters; - (void)trackEvent:(nullable NSString *)event parameters:(nullable NSString *)parameters;
// Ad Info // Ad Info
- (NSString *)adInfoForAdUnitIdentifier:(NSString *)adUnitIdentifier; - (NSString *)adInfoForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
// Ad Value // Ad Value
- (NSString *)adValueForAdUnitIdentifier:(NSString *)adUnitIdentifier withKey:(NSString *)key; - (NSString *)adValueForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier withKey:(nullable NSString *)key;
// User Service // User Service
- (void)didDismissUserConsentDialog; - (void)didDismissUserConsentDialog;
// Consent Flow // CMP Service
- (void)startConsentFlow; - (void)showCMPForExistingUser;
// Utils // Utils
+ (NSString *)serializeParameters:(NSDictionary<NSString *, id> *)dict; + (NSString *)serializeParameters:(NSDictionary<NSString *, id> *)dict;
+ (NSDictionary<NSString *, id> *)deserializeParameters:(NSString *)serialized; + (NSDictionary<NSString *, id> *)deserializeParameters:(nullable NSString *)serialized;
/** /**
* Creates an instance of @c MAUnityAdManager if needed and returns the singleton instance. * Creates an instance of @c MAUnityAdManager if needed and returns the singleton instance.
@ -109,8 +109,4 @@ typedef void (*ALUnityBackgroundCallback)(const char* args);
@end @end
@interface MAUnityAdManager(ALDeprecated)
- (void)loadVariables __deprecated_msg("This API has been deprecated. Please use our SDK's initialization callback to retrieve variables instead.");
@end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d3a319587a4a744d898e112357c46370 guid: 4209563f82b8a4f7dabf03705ab761c6
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.h - al_max_export_path-MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.h

View File

@ -5,7 +5,7 @@
#import "MAUnityAdManager.h" #import "MAUnityAdManager.h"
#define VERSION @"5.11.4" #define VERSION @"6.1.2"
#define KEY_WINDOW [UIApplication sharedApplication].keyWindow #define KEY_WINDOW [UIApplication sharedApplication].keyWindow
#define DEVICE_SPECIFIC_ADVIEW_AD_FORMAT ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) ? MAAdFormat.leader : MAAdFormat.banner #define DEVICE_SPECIFIC_ADVIEW_AD_FORMAT ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) ? MAAdFormat.leader : MAAdFormat.banner
@ -42,7 +42,7 @@ extern "C" {
} }
#endif #endif
@interface MAUnityAdManager()<MAAdDelegate, MAAdViewAdDelegate, MARewardedAdDelegate, MAAdRevenueDelegate, MAAdReviewDelegate, ALVariableServiceDelegate> @interface MAUnityAdManager()<MAAdDelegate, MAAdViewAdDelegate, MARewardedAdDelegate, MAAdRevenueDelegate, MAAdReviewDelegate>
// Parent Fields // Parent Fields
@property (nonatomic, weak) ALSdk *sdk; @property (nonatomic, weak) ALSdk *sdk;
@ -184,7 +184,6 @@ static ALUnityBackgroundCallback backgroundCallback;
self.sdk = [ALSdk sharedWithSettings: settings]; self.sdk = [ALSdk sharedWithSettings: settings];
} }
self.sdk.variableService.delegate = self;
[self.sdk setPluginVersion: [@"Max-Unity-" stringByAppendingString: VERSION]]; [self.sdk setPluginVersion: [@"Max-Unity-" stringByAppendingString: VERSION]];
self.sdk.mediationProvider = @"max"; self.sdk.mediationProvider = @"max";
[self.sdk initializeSdkWithCompletionHandler:^(ALSdkConfiguration *configuration) [self.sdk initializeSdkWithCompletionHandler:^(ALSdkConfiguration *configuration)
@ -192,9 +191,11 @@ static ALUnityBackgroundCallback backgroundCallback;
// Note: internal state should be updated first // Note: internal state should be updated first
completionHandler( configuration ); completionHandler( configuration );
NSString *consentFlowUserGeographyStr = @(configuration.consentFlowUserGeography).stringValue;
NSString *consentDialogStateStr = @(configuration.consentDialogState).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) 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", [MAUnityAdManager forwardUnityEventWithArgs: @{@"name" : @"OnSdkInitializedEvent",
@"consentFlowUserGeography" : consentFlowUserGeographyStr,
@"consentDialogState" : consentDialogStateStr, @"consentDialogState" : consentDialogStateStr,
@"countryCode" : configuration.countryCode, @"countryCode" : configuration.countryCode,
@"appTrackingStatus" : appTrackingStatus, @"appTrackingStatus" : appTrackingStatus,
@ -207,87 +208,93 @@ static ALUnityBackgroundCallback backgroundCallback;
#pragma mark - Banners #pragma mark - Banners
- (void)createBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier atPosition:(NSString *)bannerPosition - (void)createBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier atPosition:(nullable NSString *)bannerPosition
{ {
[self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier] atPosition: bannerPosition withOffset: CGPointZero]; [self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier] atPosition: bannerPosition withOffset: CGPointZero];
} }
- (void)createBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset - (void)createBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset
{ {
[self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier] atPosition: DEFAULT_AD_VIEW_POSITION withOffset: CGPointMake(xOffset, yOffset)]; [self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier] atPosition: DEFAULT_AD_VIEW_POSITION withOffset: CGPointMake(xOffset, yOffset)];
} }
- (void)loadBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)loadBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self loadAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]]; [self loadAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]];
} }
- (void)setBannerBackgroundColorForAdUnitIdentifier:(NSString *)adUnitIdentifier hexColorCode:(NSString *)hexColorCode - (void)setBannerBackgroundColorForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier hexColorCode:(nullable NSString *)hexColorCode
{ {
[self setAdViewBackgroundColorForAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier] hexColorCode: hexColorCode]; [self setAdViewBackgroundColorForAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier] hexColorCode: hexColorCode];
} }
- (void)setBannerPlacement:(nullable NSString *)placement forAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)setBannerPlacement:(nullable NSString *)placement forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self setAdViewPlacement: placement forAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]]; [self setAdViewPlacement: placement forAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]];
} }
- (void)startBannerAutoRefreshForAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)startBannerAutoRefreshForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self startAdViewAutoRefreshForAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]]; [self startAdViewAutoRefreshForAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]];
} }
- (void)stopBannerAutoRefreshForAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)stopBannerAutoRefreshForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self stopAdViewAutoRefreshForAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]]; [self stopAdViewAutoRefreshForAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]];
} }
- (void)setBannerWidth:(CGFloat)width forAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)setBannerWidth:(CGFloat)width forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self setAdViewWidth: width forAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]]; [self setAdViewWidth: width forAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]];
} }
- (void)updateBannerPosition:(NSString *)bannerPosition forAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)updateBannerPosition:(nullable NSString *)bannerPosition forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self updateAdViewPosition: bannerPosition withOffset: CGPointZero forAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]]; [self updateAdViewPosition: bannerPosition withOffset: CGPointZero forAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]];
} }
- (void)updateBannerPosition:(CGFloat)xOffset y:(CGFloat)yOffset forAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)updateBannerPosition:(CGFloat)xOffset y:(CGFloat)yOffset forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self updateAdViewPosition: DEFAULT_AD_VIEW_POSITION withOffset: CGPointMake(xOffset, yOffset) forAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]]; [self updateAdViewPosition: DEFAULT_AD_VIEW_POSITION withOffset: CGPointMake(xOffset, yOffset) forAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]];
} }
- (void)setBannerExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable NSString *)value - (void)setBannerExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value
{ {
[self setAdViewExtraParameterForAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier] key: key value: value]; [self setAdViewExtraParameterForAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier] key: key value: value];
} }
- (void)setBannerLocalExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable id)value - (void)setBannerLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value
{ {
if ( !key )
{
[self log: @"Failed to set local extra parameter: No key specified"];
return;
}
[self setAdViewLocalExtraParameterForAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier] key: key value: value]; [self setAdViewLocalExtraParameterForAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier] key: key value: value];
} }
- (void)setBannerCustomData:(nullable NSString *)customData forAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)setBannerCustomData:(nullable NSString *)customData forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self setAdViewCustomData: customData forAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]]; [self setAdViewCustomData: customData forAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]];
} }
- (void)showBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)showBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self showAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]]; [self showAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]];
} }
- (void)hideBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)hideBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self hideAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]]; [self hideAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]];
} }
- (NSString *)bannerLayoutForAdUnitIdentifier:(NSString *)adUnitIdentifier - (NSString *)bannerLayoutForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
return [self adViewLayoutForAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]]; return [self adViewLayoutForAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]];
} }
- (void)destroyBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)destroyBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self destroyAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]]; [self destroyAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]];
} }
@ -299,84 +306,90 @@ static ALUnityBackgroundCallback backgroundCallback;
#pragma mark - MRECs #pragma mark - MRECs
- (void)createMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier atPosition:(NSString *)mrecPosition - (void)createMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier atPosition:(nullable NSString *)mrecPosition
{ {
[self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec atPosition: mrecPosition withOffset: CGPointZero]; [self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec atPosition: mrecPosition withOffset: CGPointZero];
} }
- (void)createMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset - (void)createMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset
{ {
[self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec atPosition: DEFAULT_AD_VIEW_POSITION withOffset: CGPointMake(xOffset, yOffset)]; [self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec atPosition: DEFAULT_AD_VIEW_POSITION withOffset: CGPointMake(xOffset, yOffset)];
} }
- (void)loadMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)loadMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self loadAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec]; [self loadAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec];
} }
- (void)setMRecPlacement:(nullable NSString *)placement forAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)setMRecPlacement:(nullable NSString *)placement forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self setAdViewPlacement: placement forAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec]; [self setAdViewPlacement: placement forAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec];
} }
- (void)startMRecAutoRefreshForAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)startMRecAutoRefreshForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self startAdViewAutoRefreshForAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec]; [self startAdViewAutoRefreshForAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec];
} }
- (void)stopMRecAutoRefreshForAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)stopMRecAutoRefreshForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self stopAdViewAutoRefreshForAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec]; [self stopAdViewAutoRefreshForAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec];
} }
- (void)updateMRecPosition:(NSString *)mrecPosition forAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)updateMRecPosition:(nullable NSString *)mrecPosition forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self updateAdViewPosition: mrecPosition withOffset: CGPointZero forAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec]; [self updateAdViewPosition: mrecPosition withOffset: CGPointZero forAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec];
} }
- (void)updateMRecPosition:(CGFloat)xOffset y:(CGFloat)yOffset forAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)updateMRecPosition:(CGFloat)xOffset y:(CGFloat)yOffset forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self updateAdViewPosition: DEFAULT_AD_VIEW_POSITION withOffset: CGPointMake(xOffset, yOffset) forAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec]; [self updateAdViewPosition: DEFAULT_AD_VIEW_POSITION withOffset: CGPointMake(xOffset, yOffset) forAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec];
} }
- (void)setMRecExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable NSString *)value - (void)setMRecExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value
{ {
[self setAdViewExtraParameterForAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec key: key value: value]; [self setAdViewExtraParameterForAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec key: key value: value];
} }
- (void)setMRecLocalExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable id)value - (void)setMRecLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value
{ {
if ( !key )
{
[self log: @"Failed to set local extra parameter: No key specified"];
return;
}
[self setAdViewLocalExtraParameterForAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec key: key value: value]; [self setAdViewLocalExtraParameterForAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec key: key value: value];
} }
- (void)setMRecCustomData:(nullable NSString *)customData forAdUnitIdentifier:(NSString *)adUnitIdentifier; - (void)setMRecCustomData:(nullable NSString *)customData forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier;
{ {
[self setAdViewCustomData: customData forAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec]; [self setAdViewCustomData: customData forAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec];
} }
- (void)showMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)showMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self showAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec]; [self showAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec];
} }
- (void)destroyMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)destroyMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self destroyAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec]; [self destroyAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec];
} }
- (void)hideMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)hideMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self hideAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec]; [self hideAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec];
} }
- (NSString *)mrecLayoutForAdUnitIdentifier:(NSString *)adUnitIdentifier - (NSString *)mrecLayoutForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
return [self adViewLayoutForAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec]; return [self adViewLayoutForAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec];
} }
#pragma mark - Cross Promo Ads #pragma mark - Cross Promo Ads
- (void)createCrossPromoAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset width:(CGFloat)width height:(CGFloat)height rotation:(CGFloat)rotation - (void)createCrossPromoAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset width:(CGFloat)width height:(CGFloat)height rotation:(CGFloat)rotation
{ {
self.adViewWidths[adUnitIdentifier] = @(width); self.adViewWidths[adUnitIdentifier] = @(width);
self.crossPromoAdViewHeights[adUnitIdentifier] = @(height); self.crossPromoAdViewHeights[adUnitIdentifier] = @(height);
@ -384,12 +397,12 @@ static ALUnityBackgroundCallback backgroundCallback;
[self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.crossPromo atPosition: DEFAULT_AD_VIEW_POSITION withOffset: CGPointMake(xOffset, yOffset)]; [self createAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.crossPromo atPosition: DEFAULT_AD_VIEW_POSITION withOffset: CGPointMake(xOffset, yOffset)];
} }
- (void)setCrossPromoAdPlacement:(nullable NSString *)placement forAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)setCrossPromoAdPlacement:(nullable NSString *)placement forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self setAdViewPlacement: placement forAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.crossPromo]; [self setAdViewPlacement: placement forAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.crossPromo];
} }
- (void)updateCrossPromoAdPositionForAdUnitIdentifier:(NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset width:(CGFloat)width height:(CGFloat)height rotation:(CGFloat)rotation - (void)updateCrossPromoAdPositionForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset width:(CGFloat)width height:(CGFloat)height rotation:(CGFloat)rotation
{ {
self.adViewWidths[adUnitIdentifier] = @(width); self.adViewWidths[adUnitIdentifier] = @(width);
self.crossPromoAdViewHeights[adUnitIdentifier] = @(height); self.crossPromoAdViewHeights[adUnitIdentifier] = @(height);
@ -397,157 +410,181 @@ static ALUnityBackgroundCallback backgroundCallback;
[self updateAdViewPosition: DEFAULT_AD_VIEW_POSITION withOffset: CGPointMake(xOffset, yOffset) forAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.crossPromo]; [self updateAdViewPosition: DEFAULT_AD_VIEW_POSITION withOffset: CGPointMake(xOffset, yOffset) forAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.crossPromo];
} }
- (void)showCrossPromoAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)showCrossPromoAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self showAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.crossPromo]; [self showAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.crossPromo];
} }
- (void)destroyCrossPromoAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)destroyCrossPromoAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self destroyAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.crossPromo]; [self destroyAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.crossPromo];
} }
- (void)hideCrossPromoAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)hideCrossPromoAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
[self hideAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.crossPromo]; [self hideAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.crossPromo];
} }
- (NSString *)crossPromoAdLayoutForAdUnitIdentifier:(NSString *)adUnitIdentifier - (NSString *)crossPromoAdLayoutForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
return [self adViewLayoutForAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.crossPromo]; return [self adViewLayoutForAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.crossPromo];
} }
#pragma mark - Interstitials #pragma mark - Interstitials
- (void)loadInterstitialWithAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)loadInterstitialWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
MAInterstitialAd *interstitial = [self retrieveInterstitialForAdUnitIdentifier: adUnitIdentifier]; MAInterstitialAd *interstitial = [self retrieveInterstitialForAdUnitIdentifier: adUnitIdentifier];
[interstitial loadAd]; [interstitial loadAd];
} }
- (BOOL)isInterstitialReadyWithAdUnitIdentifier:(NSString *)adUnitIdentifier - (BOOL)isInterstitialReadyWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
MAInterstitialAd *interstitial = [self retrieveInterstitialForAdUnitIdentifier: adUnitIdentifier]; MAInterstitialAd *interstitial = [self retrieveInterstitialForAdUnitIdentifier: adUnitIdentifier];
return [interstitial isReady]; return [interstitial isReady];
} }
- (void)showInterstitialWithAdUnitIdentifier:(NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData - (void)showInterstitialWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData
{ {
MAInterstitialAd *interstitial = [self retrieveInterstitialForAdUnitIdentifier: adUnitIdentifier]; MAInterstitialAd *interstitial = [self retrieveInterstitialForAdUnitIdentifier: adUnitIdentifier];
[interstitial showAdForPlacement: placement customData: customData]; [interstitial showAdForPlacement: placement customData: customData];
} }
- (void)setInterstitialExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable NSString *)value - (void)setInterstitialExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value
{ {
MAInterstitialAd *interstitial = [self retrieveInterstitialForAdUnitIdentifier: adUnitIdentifier]; MAInterstitialAd *interstitial = [self retrieveInterstitialForAdUnitIdentifier: adUnitIdentifier];
[interstitial setExtraParameterForKey: key value: value]; [interstitial setExtraParameterForKey: key value: value];
} }
- (void)setInterstitialLocalExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable id)value - (void)setInterstitialLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value
{ {
if ( !key )
{
[self log: @"Failed to set local extra parameter: No key specified"];
return;
}
MAInterstitialAd *interstitial = [self retrieveInterstitialForAdUnitIdentifier: adUnitIdentifier]; MAInterstitialAd *interstitial = [self retrieveInterstitialForAdUnitIdentifier: adUnitIdentifier];
[interstitial setLocalExtraParameterForKey: key value: value]; [interstitial setLocalExtraParameterForKey: key value: value];
} }
#pragma mark - App Open Ads #pragma mark - App Open Ads
- (void)loadAppOpenAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)loadAppOpenAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
MAAppOpenAd *appOpenAd = [self retrieveAppOpenAdForAdUnitIdentifier: adUnitIdentifier]; MAAppOpenAd *appOpenAd = [self retrieveAppOpenAdForAdUnitIdentifier: adUnitIdentifier];
[appOpenAd loadAd]; [appOpenAd loadAd];
} }
- (BOOL)isAppOpenAdReadyWithAdUnitIdentifier:(NSString *)adUnitIdentifier - (BOOL)isAppOpenAdReadyWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
MAAppOpenAd *appOpenAd = [self retrieveAppOpenAdForAdUnitIdentifier: adUnitIdentifier]; MAAppOpenAd *appOpenAd = [self retrieveAppOpenAdForAdUnitIdentifier: adUnitIdentifier];
return [appOpenAd isReady]; return [appOpenAd isReady];
} }
- (void)showAppOpenAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData - (void)showAppOpenAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData
{ {
MAAppOpenAd *appOpenAd = [self retrieveAppOpenAdForAdUnitIdentifier: adUnitIdentifier]; MAAppOpenAd *appOpenAd = [self retrieveAppOpenAdForAdUnitIdentifier: adUnitIdentifier];
[appOpenAd showAdForPlacement: placement customData: customData]; [appOpenAd showAdForPlacement: placement customData: customData];
} }
- (void)setAppOpenAdExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable NSString *)value - (void)setAppOpenAdExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value
{ {
MAAppOpenAd *appOpenAd = [self retrieveAppOpenAdForAdUnitIdentifier: adUnitIdentifier]; MAAppOpenAd *appOpenAd = [self retrieveAppOpenAdForAdUnitIdentifier: adUnitIdentifier];
[appOpenAd setExtraParameterForKey: key value: value]; [appOpenAd setExtraParameterForKey: key value: value];
} }
- (void)setAppOpenAdLocalExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable id)value - (void)setAppOpenAdLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value
{ {
if ( !key )
{
[self log: @"Failed to set local extra parameter: No key specified"];
return;
}
MAAppOpenAd *appOpenAd = [self retrieveAppOpenAdForAdUnitIdentifier: adUnitIdentifier]; MAAppOpenAd *appOpenAd = [self retrieveAppOpenAdForAdUnitIdentifier: adUnitIdentifier];
[appOpenAd setLocalExtraParameterForKey: key value: value]; [appOpenAd setLocalExtraParameterForKey: key value: value];
} }
#pragma mark - Rewarded #pragma mark - Rewarded
- (void)loadRewardedAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)loadRewardedAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
MARewardedAd *rewardedAd = [self retrieveRewardedAdForAdUnitIdentifier: adUnitIdentifier]; MARewardedAd *rewardedAd = [self retrieveRewardedAdForAdUnitIdentifier: adUnitIdentifier];
[rewardedAd loadAd]; [rewardedAd loadAd];
} }
- (BOOL)isRewardedAdReadyWithAdUnitIdentifier:(NSString *)adUnitIdentifier - (BOOL)isRewardedAdReadyWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
MARewardedAd *rewardedAd = [self retrieveRewardedAdForAdUnitIdentifier: adUnitIdentifier]; MARewardedAd *rewardedAd = [self retrieveRewardedAdForAdUnitIdentifier: adUnitIdentifier];
return [rewardedAd isReady]; return [rewardedAd isReady];
} }
- (void)showRewardedAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData - (void)showRewardedAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData
{ {
MARewardedAd *rewardedAd = [self retrieveRewardedAdForAdUnitIdentifier: adUnitIdentifier]; MARewardedAd *rewardedAd = [self retrieveRewardedAdForAdUnitIdentifier: adUnitIdentifier];
[rewardedAd showAdForPlacement: placement customData: customData]; [rewardedAd showAdForPlacement: placement customData: customData];
} }
- (void)setRewardedAdExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable NSString *)value - (void)setRewardedAdExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value
{ {
MARewardedAd *rewardedAd = [self retrieveRewardedAdForAdUnitIdentifier: adUnitIdentifier]; MARewardedAd *rewardedAd = [self retrieveRewardedAdForAdUnitIdentifier: adUnitIdentifier];
[rewardedAd setExtraParameterForKey: key value: value]; [rewardedAd setExtraParameterForKey: key value: value];
} }
- (void)setRewardedAdLocalExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable id)value; - (void)setRewardedAdLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value;
{ {
if ( !key )
{
[self log: @"Failed to set local extra parameter: No key specified"];
return;
}
MARewardedAd *rewardedAd = [self retrieveRewardedAdForAdUnitIdentifier: adUnitIdentifier]; MARewardedAd *rewardedAd = [self retrieveRewardedAdForAdUnitIdentifier: adUnitIdentifier];
[rewardedAd setLocalExtraParameterForKey: key value: value]; [rewardedAd setLocalExtraParameterForKey: key value: value];
} }
#pragma mark - Rewarded Interstitials #pragma mark - Rewarded Interstitials
- (void)loadRewardedInterstitialAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier - (void)loadRewardedInterstitialAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
MARewardedInterstitialAd *rewardedInterstitialAd = [self retrieveRewardedInterstitialAdForAdUnitIdentifier: adUnitIdentifier]; MARewardedInterstitialAd *rewardedInterstitialAd = [self retrieveRewardedInterstitialAdForAdUnitIdentifier: adUnitIdentifier];
[rewardedInterstitialAd loadAd]; [rewardedInterstitialAd loadAd];
} }
- (BOOL)isRewardedInterstitialAdReadyWithAdUnitIdentifier:(NSString *)adUnitIdentifier - (BOOL)isRewardedInterstitialAdReadyWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
MARewardedInterstitialAd *rewardedInterstitialAd = [self retrieveRewardedInterstitialAdForAdUnitIdentifier: adUnitIdentifier]; MARewardedInterstitialAd *rewardedInterstitialAd = [self retrieveRewardedInterstitialAdForAdUnitIdentifier: adUnitIdentifier];
return [rewardedInterstitialAd isReady]; return [rewardedInterstitialAd isReady];
} }
- (void)showRewardedInterstitialAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData - (void)showRewardedInterstitialAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData
{ {
MARewardedInterstitialAd *rewardedInterstitialAd = [self retrieveRewardedInterstitialAdForAdUnitIdentifier: adUnitIdentifier]; MARewardedInterstitialAd *rewardedInterstitialAd = [self retrieveRewardedInterstitialAdForAdUnitIdentifier: adUnitIdentifier];
[rewardedInterstitialAd showAdForPlacement: placement customData: customData]; [rewardedInterstitialAd showAdForPlacement: placement customData: customData];
} }
- (void)setRewardedInterstitialAdExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable NSString *)value - (void)setRewardedInterstitialAdExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value
{ {
MARewardedInterstitialAd *rewardedInterstitialAd = [self retrieveRewardedInterstitialAdForAdUnitIdentifier: adUnitIdentifier]; MARewardedInterstitialAd *rewardedInterstitialAd = [self retrieveRewardedInterstitialAdForAdUnitIdentifier: adUnitIdentifier];
[rewardedInterstitialAd setExtraParameterForKey: key value: value]; [rewardedInterstitialAd setExtraParameterForKey: key value: value];
} }
- (void)setRewardedInterstitialAdLocalExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable id)value - (void)setRewardedInterstitialAdLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value
{ {
if ( !key )
{
[self log: @"Failed to set local extra parameter: No key specified"];
return;
}
MARewardedInterstitialAd *rewardedInterstitialAd = [self retrieveRewardedInterstitialAdForAdUnitIdentifier: adUnitIdentifier]; MARewardedInterstitialAd *rewardedInterstitialAd = [self retrieveRewardedInterstitialAdForAdUnitIdentifier: adUnitIdentifier];
[rewardedInterstitialAd setLocalExtraParameterForKey: key value: value]; [rewardedInterstitialAd setLocalExtraParameterForKey: key value: value];
} }
#pragma mark - Event Tracking #pragma mark - Event Tracking
- (void)trackEvent:(NSString *)event parameters:(NSString *)parameters - (void)trackEvent:(nullable NSString *)event parameters:(nullable NSString *)parameters
{ {
NSDictionary<NSString *, id> *deserializedParameters = [MAUnityAdManager deserializeParameters: parameters]; NSDictionary<NSString *, id> *deserializedParameters = [MAUnityAdManager deserializeParameters: parameters];
[self.sdk.eventService trackEvent: event parameters: deserializedParameters]; [self.sdk.eventService trackEvent: event parameters: deserializedParameters];
@ -555,9 +592,9 @@ static ALUnityBackgroundCallback backgroundCallback;
#pragma mark - Ad Info #pragma mark - Ad Info
- (NSString *)adInfoForAdUnitIdentifier:(NSString *)adUnitIdentifier - (NSString *)adInfoForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier
{ {
if ( adUnitIdentifier.length == 0 ) return @""; if ( [adUnitIdentifier al_isValidString] ) return @"";
MAAd *ad = [self adWithAdUnitIdentifier: adUnitIdentifier]; MAAd *ad = [self adWithAdUnitIdentifier: adUnitIdentifier];
if ( !ad ) return @""; if ( !ad ) return @"";
@ -644,9 +681,10 @@ static ALUnityBackgroundCallback backgroundCallback;
#pragma mark - Ad Value #pragma mark - Ad Value
- (NSString *)adValueForAdUnitIdentifier:(NSString *)adUnitIdentifier withKey:(NSString *)key - (NSString *)adValueForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier withKey:(nullable NSString *)key
{ {
if ( adUnitIdentifier.length == 0 ) return @""; if ( adUnitIdentifier == nil || adUnitIdentifier.length == 0 ) return @"";
if ( key == nil || key.length == 0 ) return @"";
MAAd *ad = [self adWithAdUnitIdentifier: adUnitIdentifier]; MAAd *ad = [self adWithAdUnitIdentifier: adUnitIdentifier];
if ( !ad ) return @""; if ( !ad ) return @"";
@ -1119,16 +1157,21 @@ static ALUnityBackgroundCallback backgroundCallback;
self.adViewAdFormats[adUnitIdentifier] = adFormat; self.adViewAdFormats[adUnitIdentifier] = adFormat;
[self positionAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat]; [self positionAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat];
// Enable adaptive banners by default. NSDictionary<NSString *, NSString *> *extraParameters = self.adViewExtraParametersToSetAfterCreate[adUnitIdentifier];
if ( ( self.adViewExtraParametersToSetAfterCreate[@"adaptive_banner"] != nil ) && ( adFormat == MAAdFormat.banner || adFormat == MAAdFormat.leader ) )
// Enable adaptive banners by default for banners and leaders.
if ( [adFormat isBannerOrLeaderAd] )
{ {
[adView setExtraParameterForKey: @"adaptive_banner" value: @"true"]; // Check if there is already a pending setting for adaptive banners. If not, enable them.
if ( !extraParameters[@"adaptive_banner"] )
{
[adView setExtraParameterForKey: @"adaptive_banner" value: @"true"];
}
} }
// Handle initial extra parameters if publisher sets it before creating ad view // Handle initial extra parameters if publisher sets it before creating ad view
if ( self.adViewExtraParametersToSetAfterCreate[adUnitIdentifier] ) if ( extraParameters )
{ {
NSDictionary<NSString *, NSString *> *extraParameters = self.adViewExtraParametersToSetAfterCreate[adUnitIdentifier];
for ( NSString *key in extraParameters ) for ( NSString *key in extraParameters )
{ {
[adView setExtraParameterForKey: key value: extraParameters[key]]; [adView setExtraParameterForKey: key value: extraParameters[key]];
@ -1186,7 +1229,7 @@ static ALUnityBackgroundCallback backgroundCallback;
MAAdView *adView = [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat]; MAAdView *adView = [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat];
if ( !adView ) if ( !adView )
{ {
[self log: @"%@ does not exist for ad unit identifier %@.", adFormat.label, adUnitIdentifier]; [self log: @"%@ does not exist for ad unit identifier \"%@\".", adFormat.label, adUnitIdentifier];
return; return;
} }
@ -1275,13 +1318,17 @@ static ALUnityBackgroundCallback backgroundCallback;
max_unity_dispatch_on_main_thread(^{ max_unity_dispatch_on_main_thread(^{
[self log: @"Setting width %f for \"%@\" with ad unit identifier \"%@\"", width, adFormat, adUnitIdentifier]; [self log: @"Setting width %f for \"%@\" with ad unit identifier \"%@\"", width, adFormat, adUnitIdentifier];
CGFloat minWidth = adFormat.size.width; BOOL isBannerOrLeader = adFormat.isBannerOrLeaderAd;
// Banners and leaders need to be at least 320pts wide.
CGFloat minWidth = isBannerOrLeader ? MAAdFormat.banner.size.width : adFormat.size.width;
if ( width < minWidth ) if ( width < minWidth )
{ {
[self log: @"The provided with: %f is smaller than the minimum required width: %f for ad format: %@. Please set the width higher than the minimum required.", width, minWidth, adFormat]; [self log: @"The provided width: %f is smaller than the minimum required width: %f for ad format: %@. Automatically setting width to %f.", width, minWidth, adFormat, minWidth];
} }
self.adViewWidths[adUnitIdentifier] = @(width); CGFloat widthToSet = MAX( minWidth, width );
self.adViewWidths[adUnitIdentifier] = @(widthToSet);
[self positionAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat]; [self positionAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat];
}); });
} }
@ -1307,7 +1354,7 @@ static ALUnityBackgroundCallback backgroundCallback;
} }
else else
{ {
[self log: @"%@ does not exist for ad unit identifier %@. Saving extra parameter to be set when it is created.", adFormat, adUnitIdentifier]; [self log: @"%@ does not exist for ad unit identifier \"%@\". Saving extra parameter to be set when it is created.", adFormat, adUnitIdentifier];
// The adView has not yet been created. Store the extra parameters, so that they can be added once the banner has been created. // The adView has not yet been created. Store the extra parameters, so that they can be added once the banner has been created.
NSMutableDictionary<NSString *, NSString *> *extraParameters = self.adViewExtraParametersToSetAfterCreate[adUnitIdentifier]; NSMutableDictionary<NSString *, NSString *> *extraParameters = self.adViewExtraParametersToSetAfterCreate[adUnitIdentifier];
@ -1340,7 +1387,7 @@ static ALUnityBackgroundCallback backgroundCallback;
} }
else else
{ {
[self log: @"%@ does not exist for ad unit identifier %@. Saving local extra parameter to be set when it is created.", adFormat, adUnitIdentifier]; [self log: @"%@ does not exist for ad unit identifier \"%@\". Saving local extra parameter to be set when it is created.", adFormat, adUnitIdentifier];
// The adView has not yet been created. Store the loca extra parameters, so that they can be added once the adview has been created. // The adView has not yet been created. Store the loca extra parameters, so that they can be added once the adview has been created.
NSMutableDictionary<NSString *, id> *localExtraParameters = self.adViewLocalExtraParametersToSetAfterCreate[adUnitIdentifier]; NSMutableDictionary<NSString *, id> *localExtraParameters = self.adViewLocalExtraParametersToSetAfterCreate[adUnitIdentifier];
@ -1698,15 +1745,7 @@ static ALUnityBackgroundCallback backgroundCallback;
// All positions have constant height // All positions have constant height
NSMutableArray<NSLayoutConstraint *> *constraints = [NSMutableArray arrayWithObject: [adView.heightAnchor constraintEqualToConstant: adViewSize.height]]; NSMutableArray<NSLayoutConstraint *> *constraints = [NSMutableArray arrayWithObject: [adView.heightAnchor constraintEqualToConstant: adViewSize.height]];
UILayoutGuide *layoutGuide; UILayoutGuide *layoutGuide = superview.safeAreaLayoutGuide;
if ( @available(iOS 11.0, *) )
{
layoutGuide = superview.safeAreaLayoutGuide;
}
else
{
layoutGuide = superview.layoutMarginsGuide;
}
if ( [adViewPosition isEqual: @"top_center"] || [adViewPosition isEqual: @"bottom_center"] ) if ( [adViewPosition isEqual: @"top_center"] || [adViewPosition isEqual: @"bottom_center"] )
{ {
@ -1963,7 +2002,7 @@ static ALUnityBackgroundCallback backgroundCallback;
return [[NSString alloc] initWithData: jsonData encoding: NSUTF8StringEncoding]; return [[NSString alloc] initWithData: jsonData encoding: NSUTF8StringEncoding];
} }
+ (NSDictionary<NSString *, id> *)deserializeParameters:(NSString *)serialized + (NSDictionary<NSString *, id> *)deserializeParameters:(nullable NSString *)serialized
{ {
if ( serialized.length > 0 ) if ( serialized.length > 0 )
{ {
@ -2004,37 +2043,27 @@ static ALUnityBackgroundCallback backgroundCallback;
[MAUnityAdManager forwardUnityEventWithArgs: @{@"name" : @"OnSdkConsentDialogDismissedEvent"}]; [MAUnityAdManager forwardUnityEventWithArgs: @{@"name" : @"OnSdkConsentDialogDismissedEvent"}];
} }
#pragma mark - Consent Flow #pragma mark - CMP Service
- (void)startConsentFlow - (void)showCMPForExistingUser
{ {
[self.sdk.cfService scfWithCompletionHander:^(ALCFError * _Nullable error) { [self.sdk.cmpService showCMPForExistingUserWithCompletion:^(ALCMPError * _Nullable error) {
NSMutableDictionary<NSString *, id> *args = [NSMutableDictionary dictionaryWithCapacity: 3]; NSMutableDictionary<NSString *, id> *args = [NSMutableDictionary dictionaryWithCapacity: 2];
args[@"name"] = @"OnSdkConsentFlowCompletedEvent"; args[@"name"] = @"OnCmpCompletedEvent";
if ( error ) if ( error )
{ {
args[@"code"] = @(error.code); args[@"error"] = @{@"code": @(error.code),
args[@"message"] = error.message; @"message": error.message,
@"cmpCode": @(error.cmpCode),
@"cmpMessage": error.cmpMessage};
} }
[MAUnityAdManager forwardUnityEventWithArgs: args]; [MAUnityAdManager forwardUnityEventWithArgs: args forwardInBackground: YES];
}]; }];
} }
#pragma mark - Variable Service (Deprecated)
- (void)loadVariables
{
[self.sdk.variableService loadVariables];
}
- (void)variableService:(ALVariableService *)variableService didUpdateVariables:(NSDictionary<NSString *, id> *)variables
{
[MAUnityAdManager forwardUnityEventWithArgs: @{@"name" : @"OnVariablesUpdatedEvent"}];
}
- (MAAd *)adWithAdUnitIdentifier:(NSString *)adUnitIdentifier - (MAAd *)adWithAdUnitIdentifier:(NSString *)adUnitIdentifier
{ {
@synchronized ( self.adInfoDictLock ) @synchronized ( self.adInfoDictLock )

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6106db18e3d7745c0a67bd23e2996272 guid: 2973e70bd2fa74984b35aea07ae9db52
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m - al_max_export_path-MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m

View File

@ -33,6 +33,7 @@ extern "C"
static NSString *_userIdentifierToSet; static NSString *_userIdentifierToSet;
static NSString *_userSegmentNameToSet; static NSString *_userSegmentNameToSet;
static NSArray<NSString *> *_testDeviceIdentifiersToSet; static NSArray<NSString *> *_testDeviceIdentifiersToSet;
static NSNumber *_mutedToSet;
static NSNumber *_verboseLoggingToSet; static NSNumber *_verboseLoggingToSet;
static NSNumber *_creativeDebuggerEnabledToSet; static NSNumber *_creativeDebuggerEnabledToSet;
static NSNumber *_exceptionHandlerEnabledToSet; static NSNumber *_exceptionHandlerEnabledToSet;
@ -50,12 +51,17 @@ extern "C"
// Helper method to create C string copy // Helper method to create C string copy
static const char * cStringCopy(NSString *string); static const char * cStringCopy(NSString *string);
// Helper method to log errors // Helper method to log errors
void logUninitializedAccessError(char *callingMethod); void logUninitializedAccessError(const char *callingMethod);
bool isPluginInitialized() bool isPluginInitialized()
{ {
return _isPluginInitialized; return _isPluginInitialized;
} }
bool isReadyToInteractWithSdk()
{
return isPluginInitialized() && _sdk;
}
void maybeInitializePlugin() void maybeInitializePlugin()
{ {
@ -65,12 +71,34 @@ extern "C"
_isPluginInitialized = true; _isPluginInitialized = true;
} }
id getLocalExtraParameterValue(const char *json)
{
NSData *jsonData = [NSSTRING(json) dataUsingEncoding: NSUTF8StringEncoding];
NSError *error;
NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData: jsonData
options: 0
error: &error];
if ( error )
{
return nil;
}
else
{
return jsonDict[@"value"];
}
}
NSArray<NSString *> * toStringArray(char **arrayPointer, int size) NSArray<NSString *> * toStringArray(char **arrayPointer, int size)
{ {
NSMutableArray<NSString *> *array = [NSMutableArray arrayWithCapacity: size]; NSMutableArray<NSString *> *array = [NSMutableArray arrayWithCapacity: size];
for ( int i = 0; i < size; i++ ) for ( int i = 0; i < size; i++ )
{ {
[array addObject: NSSTRING(arrayPointer[i])]; NSString *element = NSSTRING(arrayPointer[i]);
if ( element )
{
[array addObject: element];
}
} }
return array; return array;
@ -105,25 +133,31 @@ extern "C"
_testDeviceIdentifiersToSet = nil; _testDeviceIdentifiersToSet = nil;
} }
if ( _verboseLoggingToSet ) if ( _mutedToSet != nil)
{
settings.muted = _mutedToSet.boolValue;
_mutedToSet = nil;
}
if ( _verboseLoggingToSet != nil )
{ {
settings.verboseLoggingEnabled = _verboseLoggingToSet.boolValue; settings.verboseLoggingEnabled = _verboseLoggingToSet.boolValue;
_verboseLoggingToSet = nil; _verboseLoggingToSet = nil;
} }
if ( _creativeDebuggerEnabledToSet ) if ( _creativeDebuggerEnabledToSet != nil )
{ {
settings.creativeDebuggerEnabled = _creativeDebuggerEnabledToSet.boolValue; settings.creativeDebuggerEnabled = _creativeDebuggerEnabledToSet.boolValue;
_creativeDebuggerEnabledToSet = nil; _creativeDebuggerEnabledToSet = nil;
} }
if ( _exceptionHandlerEnabledToSet ) if ( _exceptionHandlerEnabledToSet != nil )
{ {
settings.exceptionHandlerEnabled = _exceptionHandlerEnabledToSet.boolValue; settings.exceptionHandlerEnabled = _exceptionHandlerEnabledToSet.boolValue;
_exceptionHandlerEnabledToSet = nil; _exceptionHandlerEnabledToSet = nil;
} }
if ( _locationCollectionEnabledToSet ) if ( _locationCollectionEnabledToSet != nil )
{ {
settings.locationCollectionEnabled = _locationCollectionEnabledToSet.boolValue; settings.locationCollectionEnabled = _locationCollectionEnabledToSet.boolValue;
_locationCollectionEnabledToSet = nil; _locationCollectionEnabledToSet = nil;
@ -214,7 +248,7 @@ extern "C"
_userSegmentNameToSet = nil; _userSegmentNameToSet = nil;
} }
if ( _targetingYearOfBirth ) if ( _targetingYearOfBirth != nil )
{ {
_sdk.targetingData.yearOfBirth = _targetingYearOfBirth.intValue <= 0 ? nil : _targetingYearOfBirth; _sdk.targetingData.yearOfBirth = _targetingYearOfBirth.intValue <= 0 ? nil : _targetingYearOfBirth;
_targetingYearOfBirth = nil; _targetingYearOfBirth = nil;
@ -226,7 +260,7 @@ extern "C"
_targetingGender = nil; _targetingGender = nil;
} }
if ( _targetingMaximumAdContentRating ) if ( _targetingMaximumAdContentRating != nil )
{ {
_sdk.targetingData.maximumAdContentRating = getAppLovinAdContentRating(_targetingMaximumAdContentRating.intValue); _sdk.targetingData.maximumAdContentRating = getAppLovinAdContentRating(_targetingMaximumAdContentRating.intValue);
_targetingMaximumAdContentRating = nil; _targetingMaximumAdContentRating = nil;
@ -453,10 +487,12 @@ extern "C"
return cStringCopy(@""); return cStringCopy(@"");
} }
NSString *consentFlowUserGeographyStr = @(_sdk.configuration.consentFlowUserGeography).stringValue;
NSString *consentDialogStateStr = @(_sdk.configuration.consentDialogState).stringValue; NSString *consentDialogStateStr = @(_sdk.configuration.consentDialogState).stringValue;
NSString *appTrackingStatus = @(_sdk.configuration.appTrackingTransparencyStatus).stringValue; // Deliberately name it `appTrackingStatus` to be a bit more generic (in case Android introduces a similar concept) NSString *appTrackingStatus = @(_sdk.configuration.appTrackingTransparencyStatus).stringValue; // Deliberately name it `appTrackingStatus` to be a bit more generic (in case Android introduces a similar concept)
return cStringCopy([MAUnityAdManager serializeParameters: @{@"consentDialogState" : consentDialogStateStr, return cStringCopy([MAUnityAdManager serializeParameters: @{@"consentFlowUserGeography" : consentFlowUserGeographyStr,
@"consentDialogState" : consentDialogStateStr,
@"countryCode" : _sdk.configuration.countryCode, @"countryCode" : _sdk.configuration.countryCode,
@"appTrackingStatus" : appTrackingStatus, @"appTrackingStatus" : appTrackingStatus,
@"isSuccessfullyInitialized" : @([_sdk isInitialized]), @"isSuccessfullyInitialized" : @([_sdk isInitialized]),
@ -564,10 +600,28 @@ extern "C"
void _MaxSetBannerLocalExtraParameter(const char *adUnitIdentifier, const char *key, MAUnityRef value) void _MaxSetBannerLocalExtraParameter(const char *adUnitIdentifier, const char *key, MAUnityRef value)
{ {
if ( !isReadyToInteractWithSdk() )
{
logUninitializedAccessError("_MaxSetBannerLocalExtraParameter");
}
[_adManager setBannerLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier) [_adManager setBannerLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier)
key: NSSTRING(key) key: NSSTRING(key)
value: (__bridge id) value]; value: (__bridge id) value];
} }
void _MaxSetBannerLocalExtraParameterJSON(const char *adUnitIdentifier, const char *key, const char *json)
{
if ( !isReadyToInteractWithSdk() )
{
logUninitializedAccessError("_MaxSetBannerLocalExtraParameter");
}
id value = getLocalExtraParameterValue(json);
[_adManager setBannerLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier)
key: NSSTRING(key)
value: value];
}
void _MaxSetBannerCustomData(const char *adUnitIdentifier, const char *customData) void _MaxSetBannerCustomData(const char *adUnitIdentifier, const char *customData)
{ {
@ -697,10 +751,28 @@ extern "C"
void _MaxSetMRecLocalExtraParameter(const char *adUnitIdentifier, const char *key, MAUnityRef value) void _MaxSetMRecLocalExtraParameter(const char *adUnitIdentifier, const char *key, MAUnityRef value)
{ {
if ( !isReadyToInteractWithSdk() )
{
logUninitializedAccessError("_MaxSetMRecLocalExtraParameter");
}
[_adManager setMRecLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier) [_adManager setMRecLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier)
key: NSSTRING(key) key: NSSTRING(key)
value: (__bridge id)value]; value: (__bridge id)value];
} }
void _MaxSetMRecLocalExtraParameterJSON(const char *adUnitIdentifier, const char *key, const char *json)
{
if ( !isReadyToInteractWithSdk() )
{
logUninitializedAccessError("_MaxSetMRecLocalExtraParameter");
}
id value = getLocalExtraParameterValue(json);
[_adManager setMRecLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier)
key: NSSTRING(key)
value: value];
}
void _MaxSetMRecCustomData(const char *adUnitIdentifier, const char *customData) void _MaxSetMRecCustomData(const char *adUnitIdentifier, const char *customData)
{ {
@ -775,11 +847,29 @@ extern "C"
void _MaxSetInterstitialLocalExtraParameter(const char *adUnitIdentifier, const char *key, MAUnityRef value) void _MaxSetInterstitialLocalExtraParameter(const char *adUnitIdentifier, const char *key, MAUnityRef value)
{ {
if ( !isReadyToInteractWithSdk() )
{
logUninitializedAccessError("_MaxSetInterstitialLocalExtraParameter");
}
[_adManager setInterstitialLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier) [_adManager setInterstitialLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier)
key: NSSTRING(key) key: NSSTRING(key)
value: (__bridge id)value]; value: (__bridge id)value];
} }
void _MaxSetInterstitialLocalExtraParameterJSON(const char *adUnitIdentifier, const char *key, const char *json)
{
if ( !isReadyToInteractWithSdk() )
{
logUninitializedAccessError("_MaxSetInterstitialLocalExtraParameter");
}
id value = getLocalExtraParameterValue(json);
[_adManager setInterstitialLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier)
key: NSSTRING(key)
value: value];
}
bool _MaxIsInterstitialReady(const char *adUnitIdentifier) bool _MaxIsInterstitialReady(const char *adUnitIdentifier)
{ {
if (!isPluginInitialized()) return false; if (!isPluginInitialized()) return false;
@ -810,10 +900,28 @@ extern "C"
void _MaxSetAppOpenAdLocalExtraParameter(const char *adUnitIdentifier, const char *key, MAUnityRef value) void _MaxSetAppOpenAdLocalExtraParameter(const char *adUnitIdentifier, const char *key, MAUnityRef value)
{ {
if ( !isReadyToInteractWithSdk() )
{
logUninitializedAccessError("_MaxSetAppOpenAdLocalExtraParameter");
}
[_adManager setAppOpenAdLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier) [_adManager setAppOpenAdLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier)
key: NSSTRING(key) key: NSSTRING(key)
value: (__bridge id)value]; value: (__bridge id)value];
} }
void _MaxSetAppOpenAdLocalExtraParameterJSON(const char *adUnitIdentifier, const char *key, const char *json)
{
if ( !isReadyToInteractWithSdk() )
{
logUninitializedAccessError("_MaxSetAppOpenAdLocalExtraParameter");
}
id value = getLocalExtraParameterValue(json);
[_adManager setAppOpenAdLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier)
key: NSSTRING(key)
value: value];
}
bool _MaxIsAppOpenAdReady(const char *adUnitIdentifier) bool _MaxIsAppOpenAdReady(const char *adUnitIdentifier)
{ {
@ -845,11 +953,29 @@ extern "C"
void _MaxSetRewardedAdLocalExtraParameter(const char *adUnitIdentifier, const char *key, MAUnityRef value) void _MaxSetRewardedAdLocalExtraParameter(const char *adUnitIdentifier, const char *key, MAUnityRef value)
{ {
if ( !isReadyToInteractWithSdk() )
{
logUninitializedAccessError("_MaxSetRewardedAdLocalExtraParameter");
}
[_adManager setRewardedAdLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier) [_adManager setRewardedAdLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier)
key: NSSTRING(key) key: NSSTRING(key)
value: (__bridge id)value]; value: (__bridge id)value];
} }
void _MaxSetRewardedAdLocalExtraParameterJSON(const char *adUnitIdentifier, const char *key, const char *json)
{
if ( !isReadyToInteractWithSdk() )
{
logUninitializedAccessError("_MaxSetRewardedAdLocalExtraParameter");
}
id value = getLocalExtraParameterValue(json);
[_adManager setRewardedAdLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier)
key: NSSTRING(key)
value: value];
}
bool _MaxIsRewardedAdReady(const char *adUnitIdentifier) bool _MaxIsRewardedAdReady(const char *adUnitIdentifier)
{ {
if (!isPluginInitialized()) return false; if (!isPluginInitialized()) return false;
@ -880,11 +1006,29 @@ extern "C"
void _MaxSetRewardedInterstitialAdLocalExtraParameter(const char *adUnitIdentifier, const char *key, MAUnityRef value) void _MaxSetRewardedInterstitialAdLocalExtraParameter(const char *adUnitIdentifier, const char *key, MAUnityRef value)
{ {
if ( !isReadyToInteractWithSdk() )
{
logUninitializedAccessError("_MaxSetRewardedInterstitialAdLocalExtraParameter");
}
[_adManager setRewardedInterstitialAdLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier) [_adManager setRewardedInterstitialAdLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier)
key: NSSTRING(key) key: NSSTRING(key)
value: (__bridge id)value]; value: (__bridge id)value];
} }
void _MaxSetRewardedInterstitialAdLocalExtraParameterJSON(const char *adUnitIdentifier, const char *key, const char *json)
{
if ( !isReadyToInteractWithSdk() )
{
logUninitializedAccessError("_MaxSetRewardedInterstitialAdLocalExtraParameter");
}
id value = getLocalExtraParameterValue(json);
[_adManager setRewardedInterstitialAdLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier)
key: NSSTRING(key)
value: value];
}
bool _MaxIsRewardedInterstitialAdReady(const char *adUnitIdentifier) bool _MaxIsRewardedInterstitialAdReady(const char *adUnitIdentifier)
{ {
if (!isPluginInitialized()) return false; if (!isPluginInitialized()) return false;
@ -905,20 +1049,6 @@ extern "C"
[_adManager trackEvent: NSSTRING(event) parameters: NSSTRING(parameters)]; [_adManager trackEvent: NSSTRING(event) parameters: NSSTRING(parameters)];
} }
bool _MaxGetBool(const char *key, bool defaultValue)
{
if ( !_sdk ) return defaultValue;
return [_sdk.variableService boolForKey: NSSTRING(key) defaultValue: defaultValue];
}
const char * _MaxGetString(const char *key, const char *defaultValue)
{
if ( !_sdk ) return defaultValue;
return cStringCopy([_sdk.variableService stringForKey: NSSTRING(key) defaultValue: NSSTRING(defaultValue)]);
}
bool _MaxIsTablet() bool _MaxIsTablet()
{ {
@ -929,6 +1059,32 @@ extern "C"
{ {
return !ALUtils.simulator; return !ALUtils.simulator;
} }
int _MaxGetTcfConsentStatus(int vendorIdentifier)
{
NSNumber *consentStatus = [ALUtils tcfConsentStatusForVendorIdentifier: vendorIdentifier];
if ( consentStatus )
{
return consentStatus.intValue;
}
else
{
return -1;
}
}
int _MaxGetAdditionalConsentStatus(int atpIdentifier)
{
NSNumber *consentStatus = [ALUtils additionalConsentStatusForATPIdentifier: atpIdentifier];
if ( consentStatus )
{
return consentStatus.intValue;
}
else
{
return -1;
}
}
static const char * cStringCopy(NSString *string) static const char * cStringCopy(NSString *string)
{ {
@ -938,16 +1094,29 @@ extern "C"
void _MaxSetMuted(bool muted) void _MaxSetMuted(bool muted)
{ {
if ( !_sdk ) return; if ( _sdk )
{
_sdk.settings.muted = muted; _sdk.settings.muted = muted;
_mutedToSet = nil;
}
else
{
_mutedToSet = @(muted);
}
} }
bool _MaxIsMuted() bool _MaxIsMuted()
{ {
if ( !_sdk ) return false; if ( _sdk )
{
return _sdk.settings.muted;
}
else if ( _mutedToSet != nil )
{
return _mutedToSet.boolValue;
}
return _sdk.settings.muted; return false;
} }
float _MaxScreenDensity() float _MaxScreenDensity()
@ -984,9 +1153,9 @@ extern "C"
{ {
return [_sdk.settings isVerboseLoggingEnabled]; return [_sdk.settings isVerboseLoggingEnabled];
} }
else if ( _verboseLoggingToSet ) else if ( _verboseLoggingToSet != nil )
{ {
return _verboseLoggingToSet; return _verboseLoggingToSet.boolValue;
} }
return false; return false;
@ -1060,27 +1229,27 @@ extern "C"
} }
} }
} }
const char * _MaxGetCFType() void _MaxShowCmpForExistingUser()
{
if ( !_sdk )
{
NSLog(@"[%@] Failed to get available mediated networks - please ensure the AppLovin MAX Unity Plugin has been initialized by calling 'MaxSdk.InitializeSdk();'!", TAG);
return cStringCopy(@(ALCFTypeUnknown).stringValue);
}
return cStringCopy(@(_sdk.cfService.cfType).stringValue);
}
void _MaxStartConsentFlow()
{ {
if (!isPluginInitialized()) if (!isPluginInitialized())
{ {
logUninitializedAccessError("_MaxStartConsentFlow"); logUninitializedAccessError("_MaxShowCmpForExistingUser");
return; return;
} }
[_adManager startConsentFlow]; [_adManager showCMPForExistingUser];
}
bool _MaxHasSupportedCmp()
{
if (!isPluginInitialized())
{
logUninitializedAccessError("_MaxHasSupportedCmp");
return false;
}
return [_sdk.cmpService hasSupportedCMP];
} }
float _MaxGetAdaptiveBannerHeight(const float width) float _MaxGetAdaptiveBannerHeight(const float width)
@ -1088,18 +1257,10 @@ extern "C"
return [MAUnityAdManager adaptiveBannerHeightForWidth: width]; return [MAUnityAdManager adaptiveBannerHeightForWidth: width];
} }
void logUninitializedAccessError(char *callingMethod) void logUninitializedAccessError(const char *callingMethod)
{ {
NSLog(@"[%@] Failed to execute: %s - please ensure the AppLovin MAX Unity Plugin has been initialized by calling 'MaxSdk.InitializeSdk();'!", TAG, callingMethod); NSLog(@"[%@] Failed to execute: %s - please ensure the AppLovin MAX Unity Plugin has been initialized by calling 'MaxSdk.InitializeSdk();'!", TAG, callingMethod);
} }
[[deprecated("This API has been deprecated. Please use our SDK's initialization callback to retrieve variables instead.")]]
void _MaxLoadVariables()
{
if (!isPluginInitialized()) return;
[_adManager loadVariables];
}
} }
#pragma clang diagnostic pop #pragma clang diagnostic pop

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 193b1bac1aa9a4e1292257dc02aa3ec5 guid: 7e373ed7168b243e6b706e991ab5a643
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/AppLovin/Plugins/iOS/MAUnityPlugin.mm - al_max_export_path-MaxSdk/AppLovin/Plugins/iOS/MAUnityPlugin.mm

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 2f02c68646b3246d1822c96d17458b4d guid: 60751ca71e0eb4db49941064964cb08c
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Prefabs - al_max_export_path-MaxSdk/Prefabs

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c40cd08161edf43b49140ec091e9f067 guid: 54c062c0526b148efa2ea2e9489b3aa0
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Prefabs/BannerBottom.prefab - al_max_export_path-MaxSdk/Prefabs/BannerBottom.prefab

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 9b4937edd18714f3ebeb656de6e4d54b guid: 6521750c87fd14f709d09a1e38ffde47
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Prefabs/BannerTop.prefab - al_max_export_path-MaxSdk/Prefabs/BannerTop.prefab

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 06407a673b7194053b3fb593a9933c95 guid: 3fc0c2627ce8a4490b8e319326f8a535
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Prefabs/Interstitial.prefab - al_max_export_path-MaxSdk/Prefabs/Interstitial.prefab

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 72244923a898c463c912b2675256c85c guid: a28c1544d6f094d5eafc8da2343c9119
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Prefabs/Rewarded.prefab - al_max_export_path-MaxSdk/Prefabs/Rewarded.prefab

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a1858b796f36642b8bcdcd9e7e3499e4 guid: 3d4208cf7aaa64c71b19b2d4468d029b
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Resources - al_max_export_path-MaxSdk/Resources

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: afea262d96e02419e89cbd76ec9c309b guid: 5c7cba3bc9ef5454ea7d5f9bd1dffd22
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Resources/Images - al_max_export_path-MaxSdk/Resources/Images

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 39fa469b3fe3544888d5f706a27da06f guid: 572fee4574afa4f6dbf2846e0c152fe8
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Resources/Images/alert_icon.png - al_max_export_path-MaxSdk/Resources/Images/alert_icon.png

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 63817ca5b9e284a488a67b769db18813 guid: d24994f48fdd0430692e3d49279cd782
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Resources/Images/uninstall_icon.png - al_max_export_path-MaxSdk/Resources/Images/uninstall_icon.png

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 966e6c9af57a640288672d89ee58a2fc guid: b504c956e7ed744b6b0e7f014e1cac5a
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Resources/Images/warning_icon.png - al_max_export_path-MaxSdk/Resources/Images/warning_icon.png

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: da3d2b54764a24ac0a8ce8394b67467f guid: 7f9882faebe0b4edaabf65e14a921fcb
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts - al_max_export_path-MaxSdk/Scripts

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 2b64bca2685cb419f847736eb5a1ac92 guid: b6903b66cb8984df289e6d66f9c52ddc
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/Editor - al_max_export_path-MaxSdk/Scripts/Editor

View File

@ -20,11 +20,11 @@ namespace AppLovinMax.Scripts.Editor
private static readonly List<string> ObsoleteNetworks = new List<string> private static readonly List<string> ObsoleteNetworks = new List<string>
{ {
"Snap", "Snap",
"Tapjoy",
"VerizonAds", "VerizonAds",
"VoodooAds" "VoodooAds"
}; };
#if UNITY_2018_2_OR_NEWER
private static readonly List<string> ObsoleteFileExportPathsToDelete = new List<string> private static readonly List<string> ObsoleteFileExportPathsToDelete = new List<string>
{ {
// The `EventSystemChecker` has been renamed to `MaxEventSystemChecker`. // The `EventSystemChecker` has been renamed to `MaxEventSystemChecker`.
@ -45,7 +45,7 @@ namespace AppLovinMax.Scripts.Editor
"Plugins/Android/MaxMediationGoogle.androidlib", "Plugins/Android/MaxMediationGoogle.androidlib",
"Plugins/Android/MaxMediationGoogle.androidlib.meta", "Plugins/Android/MaxMediationGoogle.androidlib.meta",
// Google Ad Manager adapter pre/post process scripts. The logic has been migrated to the main plugin // Google Ad Manager adapter pre/post process scripts. The logic has been migrated to the main plugin.
"MaxSdk/Mediation/GoogleAdManager/Editor/MaxGoogleAdManagerInitialize.cs", "MaxSdk/Mediation/GoogleAdManager/Editor/MaxGoogleAdManagerInitialize.cs",
"MaxSdk/Mediation/GoogleAdManager/Editor/MaxGoogleAdManagerInitialize.cs.meta", "MaxSdk/Mediation/GoogleAdManager/Editor/MaxGoogleAdManagerInitialize.cs.meta",
"MaxSdk/Mediation/GoogleAdManager/Editor/PostProcessor.cs", "MaxSdk/Mediation/GoogleAdManager/Editor/PostProcessor.cs",
@ -53,9 +53,16 @@ namespace AppLovinMax.Scripts.Editor
"MaxSdk/Mediation/GoogleAdManager/Editor/MaxSdk.Mediation.GoogleAdManager.Editor.asmdef", "MaxSdk/Mediation/GoogleAdManager/Editor/MaxSdk.Mediation.GoogleAdManager.Editor.asmdef",
"MaxSdk/Mediation/GoogleAdManager/Editor/MaxSdk.Mediation.GoogleAdManager.Editor.asmdef.meta", "MaxSdk/Mediation/GoogleAdManager/Editor/MaxSdk.Mediation.GoogleAdManager.Editor.asmdef.meta",
"Plugins/Android/MaxMediationGoogleAdManager.androidlib", "Plugins/Android/MaxMediationGoogleAdManager.androidlib",
"Plugins/Android/MaxMediationGoogleAdManager.androidlib.meta" "Plugins/Android/MaxMediationGoogleAdManager.androidlib.meta",
// The `VariableService` has been removed.
"MaxSdk/Scripts/MaxVariableServiceAndroid.cs",
"MaxSdk/Scripts/MaxVariableServiceAndroid.cs.meta",
"MaxSdk/Scripts/MaxVariableServiceiOS.cs",
"MaxSdk/Scripts/MaxVariableServiceiOS.cs.meta",
"MaxSdk/Scripts/MaxVariableServiceUnityEditor.cs",
"MaxSdk/Scripts/MaxVariableServiceUnityEditor.cs.meta"
}; };
#endif
static MaxInitialize() static MaxInitialize()
{ {
@ -84,7 +91,6 @@ namespace AppLovinMax.Scripts.Editor
AppLovinIntegrationManager.AddLabelsToAssetsIfNeeded(pluginParentDir, isPluginOutsideAssetsDir); AppLovinIntegrationManager.AddLabelsToAssetsIfNeeded(pluginParentDir, isPluginOutsideAssetsDir);
#if UNITY_2018_2_OR_NEWER
foreach (var obsoleteFileExportPathToDelete in ObsoleteFileExportPathsToDelete) foreach (var obsoleteFileExportPathToDelete in ObsoleteFileExportPathsToDelete)
{ {
var pathToDelete = MaxSdkUtils.GetAssetPathForExportPath(obsoleteFileExportPathToDelete); var pathToDelete = MaxSdkUtils.GetAssetPathForExportPath(obsoleteFileExportPathToDelete);
@ -95,7 +101,6 @@ namespace AppLovinMax.Scripts.Editor
changesMade = true; changesMade = true;
} }
} }
#endif
// Check if any obsolete networks are installed // Check if any obsolete networks are installed
foreach (var obsoleteNetwork in ObsoleteNetworks) foreach (var obsoleteNetwork in ObsoleteNetworks)

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 512169ab4bfaf406c81d28878b456b30 guid: bc0c5693335e0408a95293c0d7b61137
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/Editor/MaxInitialization.cs - al_max_export_path-MaxSdk/Scripts/Editor/MaxInitialization.cs

View File

@ -6,7 +6,7 @@
// Copyright © 2020 AppLovin. All rights reserved. // Copyright © 2020 AppLovin. All rights reserved.
// //
#if UNITY_ANDROID && UNITY_2018_2_OR_NEWER #if UNITY_ANDROID
using AppLovinMax.Scripts.IntegrationManager.Editor; using AppLovinMax.Scripts.IntegrationManager.Editor;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -93,9 +93,8 @@ namespace AppLovinMax.Scripts.Editor
ProcessAndroidManifest(path); ProcessAndroidManifest(path);
var rawResourceDirectory = Path.Combine(path, "src/main/res/raw"); var rawResourceDirectory = Path.Combine(path, "src/main/res/raw");
if (AppLovinSettings.Instance.ShowInternalSettingsInIntegrationManager) if (AppLovinInternalSettings.Instance.ConsentFlowEnabled)
{ {
// For Unity 2018.1 or older, the consent flow is enabled in AppLovinPreProcessAndroid.
AppLovinPreProcessAndroid.EnableConsentFlowIfNeeded(rawResourceDirectory); AppLovinPreProcessAndroid.EnableConsentFlowIfNeeded(rawResourceDirectory);
} }
else else

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 87732883951bc404e85f2a223d3bd7c8 guid: 75fed160a41749d4990cee871ee618a4
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/Editor/MaxPostProcessBuildAndroid.cs - al_max_export_path-MaxSdk/Scripts/Editor/MaxPostProcessBuildAndroid.cs

View File

@ -45,17 +45,21 @@ namespace AppLovinMax.Scripts.Editor
private const string KeyConsentFlowEnabled = "ConsentFlowEnabled"; private const string KeyConsentFlowEnabled = "ConsentFlowEnabled";
private const string KeyConsentFlowTermsOfService = "ConsentFlowTermsOfService"; private const string KeyConsentFlowTermsOfService = "ConsentFlowTermsOfService";
private const string KeyConsentFlowPrivacyPolicy = "ConsentFlowPrivacyPolicy"; private const string KeyConsentFlowPrivacyPolicy = "ConsentFlowPrivacyPolicy";
private const string KeyConsentFlowAdvertisingPartners = "ConsentFlowAdvertisingPartners"; private const string KeyConsentFlowDebugUserGeography = "ConsentFlowDebugUserGeography";
private const string KeyConsentFlowIncludeDefaultAdvertisingPartners = "ConsentFlowIncludeDefaultAdvertisingPartners";
private const string KeyConsentFlowAnalyticsPartners = "ConsentFlowAnalyticsPartners";
private const string KeyConsentFlowIncludeDefaultAnalyticsPartners = "ConsentFlowIncludeDefaultAnalyticsPartners";
private static readonly List<string> DynamicLibrariesToEmbed = new List<string> private static readonly List<string> DynamicLibrariesToEmbed = new List<string>
{ {
"DTBiOSSDK.xcframework", "DTBiOSSDK.xcframework",
"FBAEMKit.xcframework",
"FBSDKCoreKit_Basics.xcframework", "FBSDKCoreKit_Basics.xcframework",
"FBSDKCoreKit.xcframework",
"FBSDKGamingServicesKit.xcframework",
"FBSDKLoginKit.xcframework",
"FBSDKShareKit.xcframework",
"HyprMX.xcframework", "HyprMX.xcframework",
"LinkedinAudienceNetwork.xcframework",
"IASDKCore.xcframework", "IASDKCore.xcframework",
"Maio.xcframework",
"MobileFuseSDK.xcframework", "MobileFuseSDK.xcframework",
"OMSDK_Appodeal.xcframework", "OMSDK_Appodeal.xcframework",
"OMSDK_Ogury.xcframework", "OMSDK_Ogury.xcframework",
@ -63,31 +67,6 @@ namespace AppLovinMax.Scripts.Editor
"OMSDK_Smaato.xcframework" "OMSDK_Smaato.xcframework"
}; };
private static List<string> SwiftLanguageNetworks
{
get
{
var swiftLanguageNetworks = new List<string>();
if (AppLovinIntegrationManager.IsAdapterInstalled("Facebook", "6.9.0.0"))
{
swiftLanguageNetworks.Add("Facebook");
}
if (AppLovinIntegrationManager.IsAdapterInstalled("UnityAds", "4.4.0.0"))
{
swiftLanguageNetworks.Add("UnityAds");
}
return swiftLanguageNetworks;
}
}
private static readonly List<string> EmbedSwiftStandardLibrariesNetworks = new List<string>
{
"Facebook",
"UnityAds"
};
private static string PluginMediationDirectory private static string PluginMediationDirectory
{ {
get get
@ -113,7 +92,7 @@ namespace AppLovinMax.Scripts.Editor
#endif #endif
EmbedDynamicLibrariesIfNeeded(buildPath, project, unityMainTargetGuid); EmbedDynamicLibrariesIfNeeded(buildPath, project, unityMainTargetGuid);
var internalSettingsEnabled = AppLovinSettings.Instance.ShowInternalSettingsInIntegrationManager; var internalSettingsEnabled = AppLovinInternalSettings.Instance.ConsentFlowEnabled;
var userTrackingUsageDescriptionDe = internalSettingsEnabled ? AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionDe : AppLovinSettings.Instance.UserTrackingUsageDescriptionDe; var userTrackingUsageDescriptionDe = internalSettingsEnabled ? AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionDe : AppLovinSettings.Instance.UserTrackingUsageDescriptionDe;
LocalizeUserTrackingDescriptionIfNeeded(userTrackingUsageDescriptionDe, "de", buildPath, project, unityMainTargetGuid); LocalizeUserTrackingDescriptionIfNeeded(userTrackingUsageDescriptionDe, "de", buildPath, project, unityMainTargetGuid);
var userTrackingUsageDescriptionEn = internalSettingsEnabled ? AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionEn : AppLovinSettings.Instance.UserTrackingUsageDescriptionEn; var userTrackingUsageDescriptionEn = internalSettingsEnabled ? AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionEn : AppLovinSettings.Instance.UserTrackingUsageDescriptionEn;
@ -131,8 +110,7 @@ namespace AppLovinMax.Scripts.Editor
var userTrackingUsageDescriptionZhHant = internalSettingsEnabled ? AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionZhHant : AppLovinSettings.Instance.UserTrackingUsageDescriptionZhHant; var userTrackingUsageDescriptionZhHant = internalSettingsEnabled ? AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionZhHant : AppLovinSettings.Instance.UserTrackingUsageDescriptionZhHant;
LocalizeUserTrackingDescriptionIfNeeded(userTrackingUsageDescriptionZhHant, "zh-Hant", buildPath, project, unityMainTargetGuid); LocalizeUserTrackingDescriptionIfNeeded(userTrackingUsageDescriptionZhHant, "zh-Hant", buildPath, project, unityMainTargetGuid);
AddSwiftSupportIfNeeded(buildPath, project, unityFrameworkTargetGuid); AddSwiftSupport(buildPath, project, unityFrameworkTargetGuid, unityMainTargetGuid);
EmbedSwiftStandardLibrariesIfNeeded(buildPath, project, unityMainTargetGuid);
AddYandexSettingsIfNeeded(project, unityMainTargetGuid); AddYandexSettingsIfNeeded(project, unityMainTargetGuid);
project.WriteToFile(projectPath); project.WriteToFile(projectPath);
@ -171,11 +149,7 @@ namespace AppLovinMax.Scripts.Editor
} }
#else #else
string runpathSearchPaths; string runpathSearchPaths;
#if UNITY_2018_2_OR_NEWER
runpathSearchPaths = project.GetBuildPropertyForAnyConfig(targetGuid, "LD_RUNPATH_SEARCH_PATHS"); runpathSearchPaths = project.GetBuildPropertyForAnyConfig(targetGuid, "LD_RUNPATH_SEARCH_PATHS");
#else
runpathSearchPaths = "$(inherited)";
#endif
runpathSearchPaths += string.IsNullOrEmpty(runpathSearchPaths) ? "" : " "; runpathSearchPaths += string.IsNullOrEmpty(runpathSearchPaths) ? "" : " ";
// Check if runtime search paths already contains the required search paths for dynamic libraries. // Check if runtime search paths already contains the required search paths for dynamic libraries.
@ -258,77 +232,32 @@ namespace AppLovinMax.Scripts.Editor
if (string.IsNullOrEmpty(localizedUserTrackingDescription)) return true; if (string.IsNullOrEmpty(localizedUserTrackingDescription)) return true;
var settings = AppLovinSettings.Instance; var settings = AppLovinSettings.Instance;
var internalSettingsEnabled = settings.ShowInternalSettingsInIntegrationManager; var internalSettings = AppLovinInternalSettings.Instance;
if (internalSettingsEnabled)
{
var internalSettings = AppLovinInternalSettings.Instance;
return !internalSettings.ConsentFlowEnabled || !internalSettings.UserTrackingUsageLocalizationEnabled;
}
return !settings.ConsentFlowEnabled || !settings.UserTrackingUsageLocalizationEnabled; return (!internalSettings.ConsentFlowEnabled || !internalSettings.UserTrackingUsageLocalizationEnabled)
&& !settings.ConsentFlowEnabled || !settings.UserTrackingUsageLocalizationEnabled;
} }
private static void AddSwiftSupportIfNeeded(string buildPath, PBXProject project, string targetGuid) private static void AddSwiftSupport(string buildPath, PBXProject project, string unityFrameworkTargetGuid, string unityMainTargetGuid)
{ {
var swiftFileRelativePath = "Classes/MAXSwiftSupport.swift"; var swiftFileRelativePath = "Classes/MAXSwiftSupport.swift";
var swiftFilePath = Path.Combine(buildPath, swiftFileRelativePath); var swiftFilePath = Path.Combine(buildPath, swiftFileRelativePath);
var maxMediationDirectory = PluginMediationDirectory;
var hasSwiftLanguageNetworksInProject = SwiftLanguageNetworks.Any(network => Directory.Exists(Path.Combine(maxMediationDirectory, network)));
// Remove Swift file if no need to support Swift
if (!hasSwiftLanguageNetworksInProject)
{
if (File.Exists(swiftFilePath))
{
MaxSdkLogger.UserDebug("Removing Swift file references.");
var fileGuid = project.FindFileGuidByRealPath(swiftFilePath, PBXSourceTree.Source);
if (!string.IsNullOrEmpty(fileGuid))
{
project.RemoveFile(fileGuid);
project.RemoveFileFromBuild(targetGuid, fileGuid);
FileUtil.DeleteFileOrDirectory(swiftFilePath);
}
}
return;
}
// Add Swift file // Add Swift file
CreateSwiftFile(swiftFilePath); CreateSwiftFile(swiftFilePath);
var swiftFileGuid = project.AddFile(swiftFileRelativePath, swiftFileRelativePath, PBXSourceTree.Source); var swiftFileGuid = project.AddFile(swiftFileRelativePath, swiftFileRelativePath, PBXSourceTree.Source);
project.AddFileToBuild(targetGuid, swiftFileGuid); project.AddFileToBuild(unityFrameworkTargetGuid, swiftFileGuid);
// Add Swift version property if needed // Add Swift version property if needed
#if UNITY_2018_2_OR_NEWER var swiftVersion = project.GetBuildPropertyForAnyConfig(unityFrameworkTargetGuid, "SWIFT_VERSION");
var swiftVersion = project.GetBuildPropertyForAnyConfig(targetGuid, "SWIFT_VERSION");
#else
// Assume that swift version is not set on older versions of Unity.
const string swiftVersion = "";
#endif
if (string.IsNullOrEmpty(swiftVersion)) if (string.IsNullOrEmpty(swiftVersion))
{ {
project.SetBuildProperty(targetGuid, "SWIFT_VERSION", "5.0"); project.SetBuildProperty(unityFrameworkTargetGuid, "SWIFT_VERSION", "5.0");
} }
// Enable Swift modules // Enable Swift modules
project.AddBuildProperty(targetGuid, "CLANG_ENABLE_MODULES", "YES"); project.AddBuildProperty(unityFrameworkTargetGuid, "CLANG_ENABLE_MODULES", "YES");
} project.AddBuildProperty(unityMainTargetGuid, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "YES");
/// <summary>
/// For Swift 5+ code that uses the standard libraries, the Swift Standard Libraries MUST be embedded for iOS < 12.2
/// Swift 5 introduced ABI stability, which allowed iOS to start bundling the standard libraries in the OS starting with iOS 12.2
/// Issue Reference: https://github.com/facebook/facebook-sdk-for-unity/issues/506
/// </summary>
private static void EmbedSwiftStandardLibrariesIfNeeded(string buildPath, PBXProject project, string mainTargetGuid)
{
var maxMediationDirectory = PluginMediationDirectory;
var hasEmbedSwiftStandardLibrariesNetworksInProject = EmbedSwiftStandardLibrariesNetworks.Any(network => Directory.Exists(Path.Combine(maxMediationDirectory, network)));
if (!hasEmbedSwiftStandardLibrariesNetworksInProject) return;
// This needs to be added the main target. App Store may reject builds if added to UnityFramework (i.e. MoPub in FT).
project.AddBuildProperty(mainTargetGuid, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "YES");
} }
private static void CreateSwiftFile(string swiftFilePath) private static void CreateSwiftFile(string swiftFilePath)
@ -356,10 +285,8 @@ namespace AppLovinMax.Scripts.Editor
SetSdkKeyIfNeeded(plist); SetSdkKeyIfNeeded(plist);
SetAttributionReportEndpointIfNeeded(plist); SetAttributionReportEndpointIfNeeded(plist);
#if UNITY_2018_2_OR_NEWER
EnableVerboseLoggingIfNeeded(plist); EnableVerboseLoggingIfNeeded(plist);
AddGoogleApplicationIdIfNeeded(plist); AddGoogleApplicationIdIfNeeded(plist);
#endif
AddSdkSettingsIfNeeded(plist, path); AddSdkSettingsIfNeeded(plist, path);
EnableTermsFlowIfNeeded(plist); EnableTermsFlowIfNeeded(plist);
@ -396,7 +323,6 @@ namespace AppLovinMax.Scripts.Editor
} }
} }
#if UNITY_2018_2_OR_NEWER
private static void EnableVerboseLoggingIfNeeded(PlistDocument plist) private static void EnableVerboseLoggingIfNeeded(PlistDocument plist)
{ {
if (!EditorPrefs.HasKey(MaxSdkLogger.KeyVerboseLoggingEnabled)) return; if (!EditorPrefs.HasKey(MaxSdkLogger.KeyVerboseLoggingEnabled)) return;
@ -428,7 +354,6 @@ namespace AppLovinMax.Scripts.Editor
plist.root.SetString(googleApplicationIdentifier, appId); plist.root.SetString(googleApplicationIdentifier, appId);
} }
#endif
private static void AddYandexSettingsIfNeeded(PBXProject project, string unityMainTargetGuid) private static void AddYandexSettingsIfNeeded(PBXProject project, string unityMainTargetGuid)
{ {
@ -445,8 +370,6 @@ namespace AppLovinMax.Scripts.Editor
private static void AddSdkSettingsIfNeeded(PlistDocument infoPlist, string buildPath) private static void AddSdkSettingsIfNeeded(PlistDocument infoPlist, string buildPath)
{ {
if (!AppLovinSettings.Instance.ShowInternalSettingsInIntegrationManager) return;
// Right now internal settings is only needed for Consent Flow. Remove this setting once we add more settings. // Right now internal settings is only needed for Consent Flow. Remove this setting once we add more settings.
if (!AppLovinInternalSettings.Instance.ConsentFlowEnabled) return; if (!AppLovinInternalSettings.Instance.ConsentFlowEnabled) return;
@ -495,44 +418,22 @@ namespace AppLovinMax.Scripts.Editor
consentFlowInfoRoot.SetString(KeyConsentFlowPrivacyPolicy, privacyPolicyUrl); consentFlowInfoRoot.SetString(KeyConsentFlowPrivacyPolicy, privacyPolicyUrl);
var termsOfServiceUrl = AppLovinInternalSettings.Instance.ConsentFlowTermsOfServiceUrl; var termsOfServiceUrl = AppLovinInternalSettings.Instance.ConsentFlowTermsOfServiceUrl;
if (!string.IsNullOrEmpty(termsOfServiceUrl)) if (MaxSdkUtils.IsValidString(termsOfServiceUrl))
{ {
consentFlowInfoRoot.SetString(KeyConsentFlowTermsOfService, termsOfServiceUrl); consentFlowInfoRoot.SetString(KeyConsentFlowTermsOfService, termsOfServiceUrl);
} }
var advertisingPartnerUrls = AppLovinInternalSettings.Instance.ConsentFlowAdvertisingPartnerUrls; var debugUserGeography = AppLovinInternalSettings.Instance.DebugUserGeography;
if (MaxSdkUtils.IsValidString(advertisingPartnerUrls)) if (debugUserGeography == MaxSdkBase.ConsentFlowUserGeography.Gdpr)
{ {
var advertisingPartnerUrlsList = advertisingPartnerUrls.Split(','); consentFlowInfoRoot.SetString(KeyConsentFlowDebugUserGeography, "gdpr");
var advertisingPartnersArray = consentFlowInfoRoot.CreateArray(KeyConsentFlowAdvertisingPartners);
foreach (var advertisingPartner in advertisingPartnerUrlsList)
{
advertisingPartnersArray.AddString(advertisingPartner);
}
} }
consentFlowInfoRoot.SetBoolean(KeyConsentFlowIncludeDefaultAdvertisingPartners, AppLovinInternalSettings.Instance.ConsentFlowIncludeDefaultAdvertisingPartnerUrls);
var analyticsPartnerUrls = AppLovinInternalSettings.Instance.ConsentFlowAnalyticsPartnerUrls;
if (MaxSdkUtils.IsValidString(analyticsPartnerUrls))
{
var analyticsPartnerUrlsList = analyticsPartnerUrls.Split(',');
var analyticsPartnersArray = consentFlowInfoRoot.CreateArray(KeyConsentFlowAnalyticsPartners);
foreach (var analyticsPartnerUrl in analyticsPartnerUrlsList)
{
analyticsPartnersArray.AddString(analyticsPartnerUrl);
}
}
consentFlowInfoRoot.SetBoolean(KeyConsentFlowIncludeDefaultAnalyticsPartners, AppLovinInternalSettings.Instance.ConsentFlowIncludeDefaultAnalyticsPartnerUrls);
infoPlist.root.SetString("NSUserTrackingUsageDescription", userTrackingUsageDescription); infoPlist.root.SetString("NSUserTrackingUsageDescription", userTrackingUsageDescription);
} }
private static void EnableTermsFlowIfNeeded(PlistDocument plist) private static void EnableTermsFlowIfNeeded(PlistDocument plist)
{ {
if (AppLovinSettings.Instance.ShowInternalSettingsInIntegrationManager) return;
// Check if terms flow is enabled. No need to update info.plist if consent flow is disabled. // Check if terms flow is enabled. No need to update info.plist if consent flow is disabled.
var consentFlowEnabled = AppLovinSettings.Instance.ConsentFlowEnabled; var consentFlowEnabled = AppLovinSettings.Instance.ConsentFlowEnabled;
if (!consentFlowEnabled) return; if (!consentFlowEnabled) return;
@ -625,37 +526,36 @@ namespace AppLovinMax.Scripts.Editor
private static SkAdNetworkData GetSkAdNetworkData() private static SkAdNetworkData GetSkAdNetworkData()
{ {
var uriBuilder = new UriBuilder("https://dash.applovin.com/docs/v1/unity_integration_manager/sk_ad_networks_info"); var uriBuilder = new UriBuilder("https://unity.applovin.com/max/1.0/skadnetwork_ids");
// Get the list of installed ad networks to be passed up // Get the list of installed ad networks to be passed up
var maxMediationDirectory = PluginMediationDirectory; var maxMediationDirectory = PluginMediationDirectory;
if (Directory.Exists(maxMediationDirectory)) if (Directory.Exists(maxMediationDirectory))
{ {
var mediationNetworkDirectories = Directory.GetDirectories(maxMediationDirectory); var mediationNetworkDirectories = Directory.GetDirectories(maxMediationDirectory);
var installedNetworks = mediationNetworkDirectories.Select(Path.GetFileName).ToArray(); var installedNetworks = mediationNetworkDirectories.Select(Path.GetFileName).ToList();
var adNetworks = string.Join(",", installedNetworks); if (AppLovinSettings.Instance.AddApsSkAdNetworkIds)
{
installedNetworks.Add("AmazonPublisherServices");
}
var adNetworks = string.Join(",", installedNetworks.ToArray());
if (!string.IsNullOrEmpty(adNetworks)) if (!string.IsNullOrEmpty(adNetworks))
{ {
uriBuilder.Query += string.Format("adnetworks={0}", adNetworks); uriBuilder.Query += string.Format("ad_networks={0}", adNetworks);
} }
} }
using (var unityWebRequest = UnityWebRequest.Get(uriBuilder.ToString())) using (var unityWebRequest = UnityWebRequest.Get(uriBuilder.ToString()))
{ {
#if UNITY_2017_2_OR_NEWER
var operation = unityWebRequest.SendWebRequest(); var operation = unityWebRequest.SendWebRequest();
#else
var operation = unityWebRequest.Send();
#endif
// Wait for the download to complete or the request to timeout. // Wait for the download to complete or the request to timeout.
while (!operation.isDone) { } while (!operation.isDone) { }
#if UNITY_2020_1_OR_NEWER #if UNITY_2020_1_OR_NEWER
if (unityWebRequest.result != UnityWebRequest.Result.Success) if (unityWebRequest.result != UnityWebRequest.Result.Success)
#elif UNITY_2017_2_OR_NEWER
if (unityWebRequest.isNetworkError || unityWebRequest.isHttpError)
#else #else
if (unityWebRequest.isError) if (unityWebRequest.isNetworkError || unityWebRequest.isHttpError)
#endif #endif
{ {
MaxSdkLogger.UserError("Failed to retrieve SKAdNetwork IDs with error: " + unityWebRequest.error); MaxSdkLogger.UserError("Failed to retrieve SKAdNetwork IDs with error: " + unityWebRequest.error);

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e71caf465f5b24f848fa05c337203e79 guid: 29959b3cd36c484a9d57d6b7ca7f7bfa
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/Editor/MaxPostProcessBuildiOS.cs - al_max_export_path-MaxSdk/Scripts/Editor/MaxPostProcessBuildiOS.cs

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 75f93d930c51d43579f691746bd04a70 guid: 691e0eb4b7a542dba2219d48c3254f1c
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/Editor/MaxSdk.Scripts.Editor.asmdef - al_max_export_path-MaxSdk/Scripts/Editor/MaxSdk.Scripts.Editor.asmdef

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 9903db0d6994746d4bee2e4ac615e8ef guid: e01816bc45c944d03afb95d035caf0e1
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/IntegrationManager - al_max_export_path-MaxSdk/Scripts/IntegrationManager

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 735b8675e6ac746d0ac244312653f7f2 guid: 0da229e279400497786c39933fe02e52
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor

View File

@ -19,9 +19,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
public class AppLovinAutoUpdater public class AppLovinAutoUpdater
{ {
public const string KeyAutoUpdateEnabled = "com.applovin.auto_update_enabled"; public const string KeyAutoUpdateEnabled = "com.applovin.auto_update_enabled";
#if !UNITY_2018_2_OR_NEWER
private const string KeyOldUnityVersionWarningShown = "com.applovin.old_unity_version_warning_shown";
#endif
private const string KeyLastUpdateCheckTime = "com.applovin.last_update_check_time_v2"; // Updated to v2 to force adapter version checks in plugin version 3.1.10. private const string KeyLastUpdateCheckTime = "com.applovin.last_update_check_time_v2"; // Updated to v2 to force adapter version checks in plugin version 3.1.10.
private static readonly DateTime EpochTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); private static readonly DateTime EpochTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
private static readonly int SecondsInADay = (int) TimeSpan.FromDays(1).TotalSeconds; private static readonly int SecondsInADay = (int) TimeSpan.FromDays(1).TotalSeconds;
@ -39,7 +36,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
{"IRONSOURCE_NETWORK", "android_7.0.1.1.1_ios_7.0.1.0.1"}, {"IRONSOURCE_NETWORK", "android_7.0.1.1.1_ios_7.0.1.0.1"},
{"MYTARGET_NETWORK", "android_5.9.1.2_ios_5.7.5.1"}, {"MYTARGET_NETWORK", "android_5.9.1.2_ios_5.7.5.1"},
{"SMAATO_NETWORK", "android_21.5.2.5_ios_21.5.2.3"}, {"SMAATO_NETWORK", "android_21.5.2.5_ios_21.5.2.3"},
{"TAPJOY_NETWORK", "android_12.6.1.5_ios_12.6.1.6"},
{"TIKTOK_NETWORK", "android_3.1.0.1.6_ios_3.2.5.1.1"}, {"TIKTOK_NETWORK", "android_3.1.0.1.6_ios_3.2.5.1.1"},
{"UNITY_NETWORK", "android_3.4.8.2_ios_3.4.8.2"}, {"UNITY_NETWORK", "android_3.4.8.2_ios_3.4.8.2"},
{"VERIZON_NETWORK", "android_1.6.0.5_ios_1.7.1.1"}, {"VERIZON_NETWORK", "android_1.6.0.5_ios_1.7.1.1"},
@ -64,10 +60,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
// Update last checked time. // Update last checked time.
EditorPrefs.SetInt(KeyLastUpdateCheckTime, now); EditorPrefs.SetInt(KeyLastUpdateCheckTime, now);
#if !UNITY_2018_2_OR_NEWER
ShowNotSupportingOldUnityVersionsIfNeeded();
#endif
// Load the plugin data // Load the plugin data
AppLovinEditorCoroutine.StartCoroutine(AppLovinIntegrationManager.Instance.LoadPluginData(data => AppLovinEditorCoroutine.StartCoroutine(AppLovinIntegrationManager.Instance.LoadPluginData(data =>
{ {
@ -156,27 +148,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
AppLovinIntegrationManager.ShowBuildFailureDialog(message); AppLovinIntegrationManager.ShowBuildFailureDialog(message);
} }
#if !UNITY_2018_2_OR_NEWER
private static void ShowNotSupportingOldUnityVersionsIfNeeded()
{
// Check if publisher has seen the warning before
if (EditorPrefs.GetBool(KeyOldUnityVersionWarningShown, false)) return;
// Show a dialog if they haven't seen the warning yet.
var option = EditorUtility.DisplayDialog(
"WARNING: Old Unity Version Detected",
"AppLovin MAX Unity plugin will soon require Unity 2018.2 or newer to function. Please upgrade to a newer Unity version.",
"Ok",
"Don't Ask Again"
);
if (!option) // 'false' means `Don't Ask Again` was clicked.
{
EditorPrefs.SetBool(KeyOldUnityVersionWarningShown, true);
}
}
#endif
private static bool GoogleNetworkAdaptersCompatible(string googleVersion, string googleAdManagerVersion, string breakingVersion) private static bool GoogleNetworkAdaptersCompatible(string googleVersion, string googleAdManagerVersion, string breakingVersion)
{ {
var googleResult = MaxSdkUtils.CompareVersions(googleVersion, breakingVersion); var googleResult = MaxSdkUtils.CompareVersions(googleVersion, breakingVersion);

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: cad9b94a708924ff0a04401d8fe8f91e guid: 8bcdd5226273242c5bd9ec79568202e6
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinAutoUpdater.cs - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinAutoUpdater.cs

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 869a2cef2a7a64292929ad064f924d02 guid: 2d0aa55f9a7d2440f871dfb256372a33
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinCommandLine.cs - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinCommandLine.cs

View File

@ -1,75 +0,0 @@
//
// AppLovinDownloadHandler.cs
// AppLovin MAX Unity Plugin
//
// Created by Santosh Bagadi on 7/26/19.
// Copyright © 2019 AppLovin. All rights reserved.
//
#if !UNITY_2017_2_OR_NEWER
using System;
using System.IO;
using UnityEngine.Networking;
namespace AppLovinMax.Scripts.IntegrationManager.Editor
{
public class AppLovinDownloadHandler : DownloadHandlerScript
{
// Required by DownloadHandler base class. Called when you address the 'bytes' property.
protected override byte[] GetData()
{
return null;
}
private FileStream fileStream;
public AppLovinDownloadHandler(string path) : base(new byte[2048])
{
var downloadDirectory = Path.GetDirectoryName(path);
if (!Directory.Exists(downloadDirectory))
{
Directory.CreateDirectory(downloadDirectory);
}
try
{
//Open the current file to write to
fileStream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite);
}
catch (Exception exception)
{
MaxSdkLogger.UserError(string.Format("Failed to create file at {0}\n{1}", path, exception.Message));
}
}
protected override bool ReceiveData(byte[] byteFromServer, int dataLength)
{
if (byteFromServer == null || byteFromServer.Length < 1 || fileStream == null)
{
return false;
}
try
{
//Write the current data to the file
fileStream.Write(byteFromServer, 0, dataLength);
}
catch (Exception exception)
{
fileStream.Close();
fileStream = null;
MaxSdkLogger.UserError(string.Format("Failed to download file{0}", exception.Message));
}
return true;
}
protected override void CompleteContent()
{
fileStream.Close();
}
}
}
#endif

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 3c817f90804464e0b85d008d27c91f9e guid: 95747c688378548eeb92aeb528ac96ff
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinEditorCoroutine.cs - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinEditorCoroutine.cs

View File

@ -24,6 +24,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
{ {
public Network AppLovinMax; public Network AppLovinMax;
public Network[] MediatedNetworks; public Network[] MediatedNetworks;
public Network[] PartnerMicroSdks;
} }
[Serializable] [Serializable]
@ -183,14 +184,10 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
/// <summary> /// <summary>
/// Whether or not the plugin is under the Assets/ folder. /// Whether or not the plugin is under the Assets/ folder.
/// </summary> /// </summary>
//--- INJECT PluginOutside START ---
public static bool IsPluginOutsideAssetsDirectory 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> /// <summary>
/// Whether or not gradle build system is enabled. /// Whether or not gradle build system is enabled.
@ -213,7 +210,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
/// </summary> /// </summary>
public static bool CanProcessAndroidQualityServiceSettings public static bool CanProcessAndroidQualityServiceSettings
{ {
get { return GradleTemplateEnabled || (GradleBuildEnabled && IsUnity2018_2OrNewer()); } get { return GradleTemplateEnabled || GradleBuildEnabled; }
} }
/// <summary> /// <summary>
@ -283,23 +280,17 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
/// <param name="callback">Callback to be called once the plugin data download completes.</param> /// <param name="callback">Callback to be called once the plugin data download completes.</param>
public IEnumerator LoadPluginData(Action<PluginData> callback) public IEnumerator LoadPluginData(Action<PluginData> callback)
{ {
var url = string.Format("https://dash.applovin.com/docs/v1/unity_integration_manager?plugin_version={0}", GetPluginVersionForUrl()); var url = string.Format("https://unity.applovin.com/max/1.0/integration_manager_info?plugin_version={0}", MaxSdk.Version);
using (var www = UnityWebRequest.Get(url)) using (var www = UnityWebRequest.Get(url))
{ {
#if UNITY_2017_2_OR_NEWER
var operation = www.SendWebRequest(); var operation = www.SendWebRequest();
#else
var operation = www.Send();
#endif
while (!operation.isDone) yield return new WaitForSeconds(0.1f); // Just wait till www is done. Our coroutine is pretty rudimentary. while (!operation.isDone) yield return new WaitForSeconds(0.1f); // Just wait till www is done. Our coroutine is pretty rudimentary.
#if UNITY_2020_1_OR_NEWER #if UNITY_2020_1_OR_NEWER
if (www.result != UnityWebRequest.Result.Success) if (www.result != UnityWebRequest.Result.Success)
#elif UNITY_2017_2_OR_NEWER
if (www.isNetworkError || www.isHttpError)
#else #else
if (www.isError) if (www.isNetworkError || www.isHttpError)
#endif #endif
{ {
callback(null); callback(null);
@ -329,6 +320,11 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
{ {
UpdateCurrentVersions(network, mediationPluginParentDirectory); UpdateCurrentVersions(network, mediationPluginParentDirectory);
} }
foreach (var partnerMicroSdk in pluginData.PartnerMicroSdks)
{
UpdateCurrentVersions(partnerMicroSdk, mediationPluginParentDirectory);
}
} }
callback(pluginData); callback(pluginData);
@ -410,22 +406,14 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
public IEnumerator DownloadPlugin(Network network, bool showImport = true) public IEnumerator DownloadPlugin(Network network, bool showImport = true)
{ {
var path = Path.Combine(Application.temporaryCachePath, GetPluginFileName(network)); // TODO: Maybe delete plugin file after finishing import. var path = Path.Combine(Application.temporaryCachePath, GetPluginFileName(network)); // TODO: Maybe delete plugin file after finishing import.
#if UNITY_2017_2_OR_NEWER
var downloadHandler = new DownloadHandlerFile(path); var downloadHandler = new DownloadHandlerFile(path);
#else
var downloadHandler = new AppLovinDownloadHandler(path);
#endif
webRequest = new UnityWebRequest(network.DownloadUrl) webRequest = new UnityWebRequest(network.DownloadUrl)
{ {
method = UnityWebRequest.kHttpVerbGET, method = UnityWebRequest.kHttpVerbGET,
downloadHandler = downloadHandler downloadHandler = downloadHandler
}; };
#if UNITY_2017_2_OR_NEWER
var operation = webRequest.SendWebRequest(); var operation = webRequest.SendWebRequest();
#else
var operation = webRequest.Send();
#endif
while (!operation.isDone) while (!operation.isDone)
{ {
yield return new WaitForSeconds(0.1f); // Just wait till webRequest is completed. Our coroutine is pretty rudimentary. yield return new WaitForSeconds(0.1f); // Just wait till webRequest is completed. Our coroutine is pretty rudimentary.
@ -434,10 +422,8 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
#if UNITY_2020_1_OR_NEWER #if UNITY_2020_1_OR_NEWER
if (webRequest.result != UnityWebRequest.Result.Success) if (webRequest.result != UnityWebRequest.Result.Success)
#elif UNITY_2017_2_OR_NEWER
if (webRequest.isNetworkError || webRequest.isHttpError)
#else #else
if (webRequest.isError) if (webRequest.isNetworkError || webRequest.isHttpError)
#endif #endif
{ {
MaxSdkLogger.UserError(webRequest.error); MaxSdkLogger.UserError(webRequest.error);
@ -593,16 +579,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
return importingNetwork != null && GetPluginFileName(importingNetwork).Contains(packageName); return importingNetwork != null && GetPluginFileName(importingNetwork).Contains(packageName);
} }
/// <summary>
/// Returns a URL friendly version string by replacing periods with underscores.
/// </summary>
private static string GetPluginVersionForUrl()
{
var version = MaxSdk.Version;
var versionsSplit = version.Split('.');
return string.Join("_", versionsSplit);
}
/// <summary> /// <summary>
/// Adds labels to assets so that they can be easily found. /// Adds labels to assets so that they can be easily found.
/// </summary> /// </summary>
@ -795,15 +771,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
return defaultValue; return defaultValue;
} }
private static bool IsUnity2018_2OrNewer()
{
#if UNITY_2018_2_OR_NEWER
return true;
#else
return false;
#endif
}
private static string GetPluginFileName(Network network) private static string GetPluginFileName(Network network)
{ {
return network.Name.ToLowerInvariant() + "_" + network.LatestVersions.Unity + ".unitypackage"; return network.Name.ToLowerInvariant() + "_" + network.LatestVersions.Unity + ".unitypackage";

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: da789f9f05f40451a9e20176746ee18d guid: c5b874c1e65274159bcc0dc15d9458cc
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManager.cs - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManager.cs

View File

@ -25,6 +25,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
private const string appLovinSdkKeyLink = "https://dash.applovin.com/o/account#keys"; 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 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 documentationAdaptersLink = "https://dash.applovin.com/documentation/mediation/unity/mediation-adapters";
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 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 uninstallIconExportPath = "MaxSdk/Resources/Images/uninstall_icon.png";
@ -33,8 +34,9 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
private const string qualityServiceRequiresGradleBuildErrorMsg = "AppLovin Quality Service integration via AppLovin Integration Manager requires Custom Gradle Template enabled or Unity 2018.2 or higher.\n" + private const string qualityServiceRequiresGradleBuildErrorMsg = "AppLovin Quality Service integration via AppLovin Integration Manager requires Custom Gradle Template enabled or Unity 2018.2 or higher.\n" +
"If you would like to continue using your existing setup, please add Quality Service Plugin to your build.gradle manually."; "If you would like to continue using your existing setup, please add Quality Service Plugin to your build.gradle manually.";
private readonly string[] termsFlowPlatforms = new string[3] {"Both", "Android", "iOS"}; private readonly string[] termsFlowPlatforms = new string[3] {"Both", "Android", "iOS"};
private readonly string[] debugUserGeographies = new string[2] {"Not Set", "GDPR"};
private Vector2 scrollPosition; private Vector2 scrollPosition;
private static readonly Vector2 windowMinSize = new Vector2(750, 750); private static readonly Vector2 windowMinSize = new Vector2(750, 750);
@ -146,10 +148,11 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
// Plugin downloaded and imported. Update current versions for the imported package. // Plugin downloaded and imported. Update current versions for the imported package.
AppLovinIntegrationManager.importPackageCompletedCallback = OnImportPackageCompleted; AppLovinIntegrationManager.importPackageCompletedCallback = OnImportPackageCompleted;
// Disable old consent flow if internal settings are enabled. // Disable old consent flow if new flow is enabled.
if (AppLovinSettings.Instance.ShowInternalSettingsInIntegrationManager) if (AppLovinInternalSettings.Instance.ConsentFlowEnabled)
{ {
AppLovinSettings.Instance.ConsentFlowEnabled = false; AppLovinSettings.Instance.ConsentFlowEnabled = false;
AppLovinSettings.Instance.SaveAsync();
} }
Load(); Load();
@ -190,6 +193,12 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
DrawPluginDetails(); DrawPluginDetails();
if (pluginData != null && pluginData.PartnerMicroSdks != null)
{
EditorGUILayout.LabelField("AppLovin Micro SDK Partners", titleLabelStyle);
DrawPartnerMicroSdks();
}
// Draw mediated networks // Draw mediated networks
using (new EditorGUILayout.HorizontalScope(GUILayout.ExpandHeight(false))) using (new EditorGUILayout.HorizontalScope(GUILayout.ExpandHeight(false)))
{ {
@ -313,10 +322,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
GUILayout.Space(5); GUILayout.Space(5);
} }
#if !UNITY_2018_2_OR_NEWER
EditorGUILayout.HelpBox("AppLovin MAX Unity plugin will soon require Unity 2018.2 or newer to function. Please upgrade to a newer Unity version.", MessageType.Warning);
#endif
} }
GUILayout.Space(5); GUILayout.Space(5);
@ -397,6 +402,29 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
} }
private void DrawPartnerMicroSdks()
{
if (pluginData == null) return;
GUILayout.BeginHorizontal();
GUILayout.Space(10);
using (new EditorGUILayout.VerticalScope("box"))
{
DrawHeaders("Network", true);
var partnerMicroSdks = pluginData.PartnerMicroSdks;
foreach (var partnerMicroSdk in partnerMicroSdks)
{
DrawNetworkDetailRow(partnerMicroSdk);
}
GUILayout.Space(10);
}
GUILayout.Space(5);
GUILayout.EndHorizontal();
}
/// <summary> /// <summary>
/// Draws the network specific details for a given network. /// Draws the network specific details for a given network.
/// </summary> /// </summary>
@ -476,7 +504,9 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
var pluginRoot = AppLovinIntegrationManager.MediationSpecificPluginParentDirectory; var pluginRoot = AppLovinIntegrationManager.MediationSpecificPluginParentDirectory;
foreach (var pluginFilePath in network.PluginFilePaths) foreach (var pluginFilePath in network.PluginFilePaths)
{ {
FileUtil.DeleteFileOrDirectory(Path.Combine(pluginRoot, pluginFilePath)); var filePath = Path.Combine(pluginRoot, pluginFilePath);
FileUtil.DeleteFileOrDirectory(filePath);
FileUtil.DeleteFileOrDirectory(filePath + ".meta");
} }
AppLovinIntegrationManager.UpdateCurrentVersions(network, pluginRoot); AppLovinIntegrationManager.UpdateCurrentVersions(network, pluginRoot);
@ -626,14 +656,13 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
GUILayout.Space(10); GUILayout.Space(10);
using (new EditorGUILayout.VerticalScope("box")) using (new EditorGUILayout.VerticalScope("box"))
{ {
var shouldDrawInternalSettings = AppLovinSettings.Instance.ShowInternalSettingsInIntegrationManager; if (AppLovinSettings.Instance.ConsentFlowEnabled)
if (shouldDrawInternalSettings)
{ {
DrawConsentFlowSettings(); DrawTermsFlowSettings();
} }
else else
{ {
DrawTermsFlowSettings(); DrawConsentFlowSettings();
} }
} }
@ -643,6 +672,25 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
private void DrawTermsFlowSettings() private void DrawTermsFlowSettings()
{ {
GUILayout.BeginHorizontal();
GUILayout.Space(4);
EditorGUILayout.HelpBox("The Terms Flow has been deprecated; switch to the MAX Terms and Privacy Policy Flow instead.", MessageType.Warning); // TODO Refine
GUILayout.Space(4);
GUILayout.EndHorizontal();
GUILayout.Space(4);
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
if (GUILayout.Button("Switch to MAX Terms and Privacy Policy Flow"))
{
AppLovinInternalSettings.Instance.ConsentFlowPrivacyPolicyUrl = AppLovinSettings.Instance.ConsentFlowPrivacyPolicyUrl;
AppLovinInternalSettings.Instance.ConsentFlowTermsOfServiceUrl = AppLovinSettings.Instance.ConsentFlowTermsOfServiceUrl;
AppLovinInternalSettings.Instance.ConsentFlowEnabled = true;
AppLovinSettings.Instance.ConsentFlowEnabled = false;
}
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.Space(4);
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
GUILayout.Space(4); GUILayout.Space(4);
AppLovinSettings.Instance.ConsentFlowEnabled = GUILayout.Toggle(AppLovinSettings.Instance.ConsentFlowEnabled, " Enable Terms Flow"); AppLovinSettings.Instance.ConsentFlowEnabled = GUILayout.Toggle(AppLovinSettings.Instance.ConsentFlowEnabled, " Enable Terms Flow");
@ -702,6 +750,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
Application.OpenURL(userTrackingUsageDescriptionDocsLink); Application.OpenURL(userTrackingUsageDescriptionDocsLink);
} }
GUILayout.Space(4); GUILayout.Space(4);
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
GUILayout.Space(4); GUILayout.Space(4);
@ -711,39 +760,36 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
{ {
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
GUILayout.Space(4); GUILayout.Space(4);
AppLovinInternalSettings.Instance.ConsentFlowEnabled = GUILayout.Toggle(AppLovinInternalSettings.Instance.ConsentFlowEnabled, " Enable Consent Flow"); AppLovinInternalSettings.Instance.ConsentFlowEnabled = GUILayout.Toggle(AppLovinInternalSettings.Instance.ConsentFlowEnabled, " Enable MAX Terms and Privacy Policy Flow");
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
GUILayout.Space(6);
GUILayout.Space(4); GUILayout.Space(4);
EditorGUILayout.HelpBox("This flow automatically includes Google UMP.", MessageType.Info);
GUI.enabled = true; GUI.enabled = true;
if (!AppLovinInternalSettings.Instance.ConsentFlowEnabled) return; if (!AppLovinInternalSettings.Instance.ConsentFlowEnabled) return;
GUILayout.Space(6);
GUILayout.BeginHorizontal();
GUILayout.Space(4);
EditorGUILayout.LabelField("Click the link below to access the guide on creating the GDPR form within AdMob's dashboard.");
GUILayout.Space(4);
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Space(4);
if (GUILayout.Button(new GUIContent(documentationTermsAndPrivacyPolicyFlow), linkLabelStyle))
{
Application.OpenURL(documentationTermsAndPrivacyPolicyFlow);
}
GUILayout.Space(4);
GUILayout.EndHorizontal();
GUILayout.Space(8);
AppLovinInternalSettings.Instance.ConsentFlowPrivacyPolicyUrl = DrawTextField("Privacy Policy URL", AppLovinInternalSettings.Instance.ConsentFlowPrivacyPolicyUrl, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); AppLovinInternalSettings.Instance.ConsentFlowPrivacyPolicyUrl = DrawTextField("Privacy Policy URL", AppLovinInternalSettings.Instance.ConsentFlowPrivacyPolicyUrl, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption);
AppLovinInternalSettings.Instance.ConsentFlowTermsOfServiceUrl = DrawTextField("Terms of Service URL (optional)", AppLovinInternalSettings.Instance.ConsentFlowTermsOfServiceUrl, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption); AppLovinInternalSettings.Instance.ConsentFlowTermsOfServiceUrl = DrawTextField("Terms of Service URL (optional)", AppLovinInternalSettings.Instance.ConsentFlowTermsOfServiceUrl, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption);
GUILayout.Space(4);
GUILayout.BeginHorizontal();
GUILayout.Space(4);
AppLovinInternalSettings.Instance.ConsentFlowIncludeDefaultAdvertisingPartnerUrls = GUILayout.Toggle(AppLovinInternalSettings.Instance.ConsentFlowIncludeDefaultAdvertisingPartnerUrls, " Include Default Advertising Partner URLs");
GUILayout.EndHorizontal();
GUILayout.Space(4);
GUILayout.BeginHorizontal();
GUILayout.Space(4);
AppLovinInternalSettings.Instance.ConsentFlowAdvertisingPartnerUrls = DrawTextField("Advertising Partner URLs (CSV)", AppLovinInternalSettings.Instance.ConsentFlowAdvertisingPartnerUrls, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption);
GUILayout.EndHorizontal();
GUILayout.Space(4);
GUILayout.BeginHorizontal();
GUILayout.Space(4);
AppLovinInternalSettings.Instance.ConsentFlowIncludeDefaultAnalyticsPartnerUrls = GUILayout.Toggle(AppLovinInternalSettings.Instance.ConsentFlowIncludeDefaultAnalyticsPartnerUrls, " Include Default Analytics Partner URLs");
GUILayout.EndHorizontal();
GUILayout.Space(4);
GUILayout.BeginHorizontal();
GUILayout.Space(4);
AppLovinInternalSettings.Instance.ConsentFlowAnalyticsPartnerUrls = DrawTextField("Analytics Partner URLs (CSV)", AppLovinInternalSettings.Instance.ConsentFlowAnalyticsPartnerUrls, GUILayout.Width(privacySettingLabelWidth), privacySettingFieldWidthOption);
GUILayout.EndHorizontal();
GUILayout.Space(4); GUILayout.Space(4);
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
GUILayout.Space(4); GUILayout.Space(4);
@ -800,7 +846,21 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
GUILayout.Space(4); GUILayout.Space(4);
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
GUILayout.Space(8);
GUILayout.BeginHorizontal();
GUILayout.Space(4); GUILayout.Space(4);
EditorGUILayout.LabelField("Testing:", headerLabelStyle);
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
GUILayout.Space(4);
EditorGUILayout.LabelField("Debug User Geography");
AppLovinInternalSettings.Instance.DebugUserGeography = (MaxSdkBase.ConsentFlowUserGeography) EditorGUILayout.Popup((int) AppLovinInternalSettings.Instance.DebugUserGeography, debugUserGeographies, privacySettingFieldWidthOption);
GUILayout.Space(4);
GUILayout.EndHorizontal();
EditorGUILayout.HelpBox("Debug User Geography is only enabled in debug mode", MessageType.Info);
} }
private void DrawOtherSettings() private void DrawOtherSettings()
@ -812,16 +872,12 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
GUILayout.Space(5); GUILayout.Space(5);
AppLovinSettings.Instance.SetAttributionReportEndpoint = DrawOtherSettingsToggle(AppLovinSettings.Instance.SetAttributionReportEndpoint, " Set Advertising Attribution Report Endpoint in Info.plist (iOS only)"); AppLovinSettings.Instance.SetAttributionReportEndpoint = DrawOtherSettingsToggle(AppLovinSettings.Instance.SetAttributionReportEndpoint, " Set Advertising Attribution Report Endpoint in Info.plist (iOS only)");
GUILayout.Space(5); 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");
EditorPrefs.SetBool(AppLovinAutoUpdater.KeyAutoUpdateEnabled, autoUpdateEnabled); EditorPrefs.SetBool(AppLovinAutoUpdater.KeyAutoUpdateEnabled, autoUpdateEnabled);
GUILayout.Space(5); GUILayout.Space(5);
var verboseLoggingEnabled = DrawOtherSettingsToggle(EditorPrefs.GetBool(MaxSdkLogger.KeyVerboseLoggingEnabled, false), var verboseLoggingEnabled = DrawOtherSettingsToggle(EditorPrefs.GetBool(MaxSdkLogger.KeyVerboseLoggingEnabled, false), " Enable Verbose Logging");
#if UNITY_2018_2_OR_NEWER
" Enable Verbose Logging"
#else
" Enable Build Verbose Logging"
#endif
);
EditorPrefs.SetBool(MaxSdkLogger.KeyVerboseLoggingEnabled, verboseLoggingEnabled); EditorPrefs.SetBool(MaxSdkLogger.KeyVerboseLoggingEnabled, verboseLoggingEnabled);
GUILayout.Space(5); GUILayout.Space(5);
} }

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 2bb13a4fb97554d838321056d4d1f81b guid: 84c61b4c05e114cec91df447d1b585f8
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManagerWindow.cs - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManagerWindow.cs

View File

@ -34,11 +34,8 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
[SerializeField] private bool consentFlowEnabled; [SerializeField] private bool consentFlowEnabled;
[SerializeField] private string consentFlowPrivacyPolicyUrl = string.Empty; [SerializeField] private string consentFlowPrivacyPolicyUrl = string.Empty;
[SerializeField] private string consentFlowTermsOfServiceUrl = string.Empty; [SerializeField] private string consentFlowTermsOfServiceUrl = string.Empty;
[SerializeField] private string consentFlowAdvertisingPartnerUrls = string.Empty;
[SerializeField] private bool includeDefaultAdvertisingPartnerUrls = true;
[SerializeField] private string consentFlowAnalyticsPartnerUrls = string.Empty;
[SerializeField] private bool consentFlowIncludeDefaultAnalyticsPartnerUrls = true;
[SerializeField] private bool overrideDefaultUserTrackingUsageDescriptions; [SerializeField] private bool overrideDefaultUserTrackingUsageDescriptions;
[SerializeField] private MaxSdkBase.ConsentFlowUserGeography debugUserGeography;
[SerializeField] private string userTrackingUsageDescriptionEn = string.Empty; [SerializeField] private string userTrackingUsageDescriptionEn = string.Empty;
[SerializeField] private bool userTrackingUsageLocalizationEnabled; [SerializeField] private bool userTrackingUsageLocalizationEnabled;
[SerializeField] private string userTrackingUsageDescriptionDe = string.Empty; [SerializeField] private string userTrackingUsageDescriptionDe = string.Empty;
@ -121,8 +118,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
UserTrackingUsageDescriptionEn = string.Empty; UserTrackingUsageDescriptionEn = string.Empty;
UserTrackingUsageLocalizationEnabled = false; UserTrackingUsageLocalizationEnabled = false;
OverrideDefaultUserTrackingUsageDescriptions = false; OverrideDefaultUserTrackingUsageDescriptions = false;
ConsentFlowIncludeDefaultAdvertisingPartnerUrls = true;
ConsentFlowIncludeDefaultAnalyticsPartnerUrls = true;
} }
} }
} }
@ -145,42 +140,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
set { consentFlowTermsOfServiceUrl = value; } set { consentFlowTermsOfServiceUrl = value; }
} }
/// <summary>
/// An array of advertising partner URLs. These URLs list are shown during the GDPR flow.
/// </summary>
public string ConsentFlowAdvertisingPartnerUrls
{
get { return consentFlowAdvertisingPartnerUrls; }
set { consentFlowAdvertisingPartnerUrls = value; }
}
/// <summary>
/// Whether or not to include a default set of advertising partners. Defaults to <c>true</c>.
/// </summary>
public bool ConsentFlowIncludeDefaultAdvertisingPartnerUrls
{
get { return includeDefaultAdvertisingPartnerUrls; }
set { includeDefaultAdvertisingPartnerUrls = value; }
}
/// <summary>
/// An array of analytics partner URLs. These URLs list are shown during the GDPR flow.
/// </summary>
public string ConsentFlowAnalyticsPartnerUrls
{
get { return consentFlowAnalyticsPartnerUrls; }
set { consentFlowAnalyticsPartnerUrls = value; }
}
/// <summary>
/// Whether or not to include a default set of analytics partners. Defaults to <c>true</c>.
/// </summary>
public bool ConsentFlowIncludeDefaultAnalyticsPartnerUrls
{
get { return consentFlowIncludeDefaultAnalyticsPartnerUrls; }
set { consentFlowIncludeDefaultAnalyticsPartnerUrls = value; }
}
/// <summary> /// <summary>
/// A User Tracking Usage Description in English to be shown to users when requesting permission to use data for tracking. /// A User Tracking Usage Description in English to be shown to users when requesting permission to use data for tracking.
/// For more information see <see cref="https://developer.apple.com/documentation/bundleresources/information_property_list/nsusertrackingusagedescription">Apple's documentation</see>. /// For more information see <see cref="https://developer.apple.com/documentation/bundleresources/information_property_list/nsusertrackingusagedescription">Apple's documentation</see>.
@ -191,6 +150,15 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
set { userTrackingUsageDescriptionEn = value; } set { userTrackingUsageDescriptionEn = value; }
} }
/// <summary>
/// An optional string to set debug user geography
/// </summary>
public MaxSdkBase.ConsentFlowUserGeography DebugUserGeography
{
get { return debugUserGeography; }
set { debugUserGeography = value; }
}
public bool OverrideDefaultUserTrackingUsageDescriptions public bool OverrideDefaultUserTrackingUsageDescriptions
{ {
get { return overrideDefaultUserTrackingUsageDescriptions; } get { return overrideDefaultUserTrackingUsageDescriptions; }

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 5a9f7c32d2d9e41e89f201dfc8770b13 guid: 65c51e21887ae42c2839962fb9585e9f
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinInternalSettings.cs - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinInternalSettings.cs

View File

@ -6,7 +6,7 @@
// Copyright © 2019 AppLovin. All rights reserved. // Copyright © 2019 AppLovin. All rights reserved.
// //
#if UNITY_2018_2_OR_NEWER && UNITY_ANDROID #if UNITY_ANDROID
using System.IO; using System.IO;
using UnityEditor.Android; using UnityEditor.Android;

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6af46e436a4b44671b5320be741172db guid: f75e54e2eb78f427ca8643c97684387b
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessAndroidGradle.cs - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessAndroidGradle.cs

View File

@ -49,11 +49,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
} }
// Download the ruby script needed to install Quality Service // Download the ruby script needed to install Quality Service
#if UNITY_2017_2_OR_NEWER
var downloadHandler = new DownloadHandlerFile(outputFilePath); var downloadHandler = new DownloadHandlerFile(outputFilePath);
#else
var downloadHandler = new AppLovinDownloadHandler(path);
#endif
var postJson = string.Format("{{\"sdk_key\" : \"{0}\"}}", sdkKey); var postJson = string.Format("{{\"sdk_key\" : \"{0}\"}}", sdkKey);
var bodyRaw = Encoding.UTF8.GetBytes(postJson); var bodyRaw = Encoding.UTF8.GetBytes(postJson);
var uploadHandler = new UploadHandlerRaw(bodyRaw); var uploadHandler = new UploadHandlerRaw(bodyRaw);
@ -64,21 +60,15 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
unityWebRequest.method = UnityWebRequest.kHttpVerbPOST; unityWebRequest.method = UnityWebRequest.kHttpVerbPOST;
unityWebRequest.downloadHandler = downloadHandler; unityWebRequest.downloadHandler = downloadHandler;
unityWebRequest.uploadHandler = uploadHandler; unityWebRequest.uploadHandler = uploadHandler;
#if UNITY_2017_2_OR_NEWER
var operation = unityWebRequest.SendWebRequest(); var operation = unityWebRequest.SendWebRequest();
#else
var operation = webRequest.Send();
#endif
// Wait for the download to complete or the request to timeout. // Wait for the download to complete or the request to timeout.
while (!operation.isDone) { } while (!operation.isDone) { }
#if UNITY_2020_1_OR_NEWER #if UNITY_2020_1_OR_NEWER
if (unityWebRequest.result != UnityWebRequest.Result.Success) if (unityWebRequest.result != UnityWebRequest.Result.Success)
#elif UNITY_2017_2_OR_NEWER
if (unityWebRequest.isNetworkError || unityWebRequest.isHttpError)
#else #else
if (webRequest.isError) if (unityWebRequest.isNetworkError || unityWebRequest.isHttpError)
#endif #endif
{ {
MaxSdkLogger.UserError("AppLovin Quality Service installation failed. Failed to download script with error: " + unityWebRequest.error); MaxSdkLogger.UserError("AppLovin Quality Service installation failed. Failed to download script with error: " + unityWebRequest.error);

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: cc867a09c5aa14978b1cf1d2522961ce guid: d5d209f90444f4a90830b48b5f3f3ff4
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessiOS.cs - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessiOS.cs

View File

@ -0,0 +1,105 @@
//
// AppLovinPreProcess.cs
// AppLovin MAX Unity Plugin
//
// Created by Jonathan Liu on 10/19/2023.
// Copyright © 2023 AppLovin. All rights reserved.
//
using System;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using UnityEngine;
namespace AppLovinMax.Scripts.IntegrationManager.Editor
{
public abstract class AppLovinPreProcess
{
private const string AppLovinDependenciesFileExportPath = "MaxSdk/AppLovin/Editor/Dependencies.xml";
private static readonly XmlWriterSettings DependenciesFileXmlWriterSettings = new XmlWriterSettings
{
Indent = true,
IndentChars = " ",
NewLineChars = "\n",
NewLineHandling = NewLineHandling.Replace
};
/// <summary>
/// Adds a string into AppLovin's Dependencies.xml file inside the containerElementString if it doesn't exist
/// </summary>
/// <param name="lineToAdd">The line you want to add into the xml file</param>
/// <param name="containerElementString">The root XML element under which to add the line. For example, to add a new dependency to Android, pass in "androidPackages"</param>
protected static void TryAddStringToDependencyFile(string lineToAdd, string containerElementString)
{
try
{
var dependenciesFilePath = MaxSdkUtils.GetAssetPathForExportPath(AppLovinDependenciesFileExportPath);
var dependencies = XDocument.Load(dependenciesFilePath);
// Get the container where we are going to insert the line
var containerElement = dependencies.Descendants(containerElementString).FirstOrDefault();
if (containerElement == null)
{
Debug.LogError(containerElementString + " not found in Dependencies.xml file");
return;
}
var elementToAdd = XElement.Parse(lineToAdd);
// Check if the xml file doesn't already contain the string.
if (containerElement.Elements().Any(element => XNode.DeepEquals(element, elementToAdd))) return;
// Append the new element to the container element
containerElement.Add(elementToAdd);
using (var xmlWriter = XmlWriter.Create(dependenciesFilePath, DependenciesFileXmlWriterSettings))
{
dependencies.Save(xmlWriter);
}
}
catch (Exception exception)
{
Debug.LogError("Google CMP will not function. Unable to add string to dependency file due to exception: " + exception.Message);
}
}
/// <summary>
/// Removes a string from AppLovin's Dependencies.xml file inside the containerElementString if it exists
/// </summary>
/// <param name="lineToRemove">The line you want to remove from the xml file</param>
/// <param name="containerElementString">The root XML element from which to remove the line. For example, to remove an Android dependency, pass in "androidPackages"</param>
protected static void TryRemoveStringFromDependencyFile(string lineToRemove, string containerElementString)
{
try
{
var dependenciesFilePath = MaxSdkUtils.GetAssetPathForExportPath(AppLovinDependenciesFileExportPath);
var dependencies = XDocument.Load(dependenciesFilePath);
var containerElement = dependencies.Descendants(containerElementString).FirstOrDefault();
if (containerElement == null)
{
Debug.LogError(containerElementString + " not found in Dependencies.xml file");
return;
}
// Check if the dependency line exists.
var elementToFind = XElement.Parse(lineToRemove);
var existingElement = containerElement.Elements().FirstOrDefault(element => XNode.DeepEquals(element, elementToFind));
if (existingElement == null) return;
existingElement.Remove();
using (var xmlWriter = XmlWriter.Create(dependenciesFilePath, DependenciesFileXmlWriterSettings))
{
dependencies.Save(xmlWriter);
}
}
catch (Exception exception)
{
Debug.LogError("Unable to remove string from dependency file due to exception: " + exception.Message);
}
}
}
}

View File

@ -1,8 +1,8 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 4ed678026df674e9d8df1cd02e2469e4 guid: 0e6254f24e89548b3a7644fa7bf25f9d
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinDownloadHandler.cs - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcess.cs
MonoImporter: MonoImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2

View File

@ -15,23 +15,16 @@ using System.IO;
using AppLovinMax.ThirdParty.MiniJson; using AppLovinMax.ThirdParty.MiniJson;
using UnityEditor; using UnityEditor;
using UnityEditor.Build; using UnityEditor.Build;
#if UNITY_2018_1_OR_NEWER
using UnityEditor.Build.Reporting; using UnityEditor.Build.Reporting;
using UnityEngine; using UnityEngine;
#endif
namespace AppLovinMax.Scripts.IntegrationManager.Editor namespace AppLovinMax.Scripts.IntegrationManager.Editor
{ {
/// <summary> /// <summary>
/// Adds the AppLovin Quality Service plugin to the gradle template file. See <see cref="AppLovinProcessGradleBuildFile"/> for more details. /// Adds the AppLovin Quality Service plugin to the gradle template file. See <see cref="AppLovinProcessGradleBuildFile"/> for more details.
/// </summary> /// </summary>
public class AppLovinPreProcessAndroid : AppLovinProcessGradleBuildFile, public class AppLovinPreProcessAndroid : AppLovinProcessGradleBuildFile, IPreprocessBuildWithReport
#if UNITY_2018_1_OR_NEWER
IPreprocessBuildWithReport
#else
IPreprocessBuild
#endif
{ {
private const string AppLovinSettingsFileName = "applovin_settings.json"; private const string AppLovinSettingsFileName = "applovin_settings.json";
@ -44,16 +37,15 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
private const string KeyConsentFlowEnabled = "consent_flow_enabled"; private const string KeyConsentFlowEnabled = "consent_flow_enabled";
private const string KeyConsentFlowTermsOfService = "consent_flow_terms_of_service"; private const string KeyConsentFlowTermsOfService = "consent_flow_terms_of_service";
private const string KeyConsentFlowPrivacyPolicy = "consent_flow_privacy_policy"; private const string KeyConsentFlowPrivacyPolicy = "consent_flow_privacy_policy";
private const string KeyConsentFlowAdvertisingPartners = "consent_flow_advertising_partners"; private const string KeyConsentFlowDebugUserGeography = "consent_flow_debug_user_geography";
private const string KeyConsentFlowIncludeDefaultAdvertisingPartners = "consent_flow_should_include_default_advertising_partners";
private const string KeyConsentFlowAnalyticsPartners = "consent_flow_analytics_partners";
private const string KeyConsentFlowIncludeDefaultAnalyticsPartners = "consent_flow_should_include_default_analytics_partners";
#if UNITY_2018_1_OR_NEWER
public void OnPreprocessBuild(BuildReport report) public void OnPreprocessBuild(BuildReport report)
#else {
public void OnPreprocessBuild(BuildTarget target, string path) PreprocessAppLovinQualityServicePlugin();
#endif AddGoogleCmpDependencyIfNeeded();
}
private static void PreprocessAppLovinQualityServicePlugin()
{ {
// 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). // 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 (!AppLovinIntegrationManager.GradleTemplateEnabled) return;
@ -65,15 +57,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
#else #else
AddAppLovinQualityServicePlugin(AppLovinIntegrationManager.GradleTemplatePath); AddAppLovinQualityServicePlugin(AppLovinIntegrationManager.GradleTemplatePath);
#endif #endif
// For Unity 2018.2 or newer, the consent flow is enabled in MaxPostProcessBuildAndroid.
#if !UNITY_2018_2_OR_NEWER
if (AppLovinSettings.Instance.ShowInternalSettingsInIntegrationManager)
{
var consentFlowSettingsFilePath = Path.Combine("Assets", "Plugin/Android/res/raw/");
EnableConsentFlowIfNeeded(consentFlowSettingsFilePath);
}
#endif
} }
public static void EnableConsentFlowIfNeeded(string rawResourceDirectory) public static void EnableConsentFlowIfNeeded(string rawResourceDirectory)
@ -105,20 +88,10 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
consentFlowSettings[KeyConsentFlowTermsOfService] = termsOfServiceUrl; consentFlowSettings[KeyConsentFlowTermsOfService] = termsOfServiceUrl;
} }
consentFlowSettings[KeyConsentFlowIncludeDefaultAdvertisingPartners] = AppLovinInternalSettings.Instance.ConsentFlowIncludeDefaultAdvertisingPartnerUrls; var debugUserGeography = AppLovinInternalSettings.Instance.DebugUserGeography;
var advertisingPartnerUrls = AppLovinInternalSettings.Instance.ConsentFlowAdvertisingPartnerUrls; if (debugUserGeography == MaxSdkBase.ConsentFlowUserGeography.Gdpr)
if (MaxSdkUtils.IsValidString(advertisingPartnerUrls))
{ {
var advertisingPartnerUrlsList = advertisingPartnerUrls.Split(',').ToList(); consentFlowSettings[KeyConsentFlowDebugUserGeography] = "gdpr";
consentFlowSettings[KeyConsentFlowAdvertisingPartners] = advertisingPartnerUrlsList;
}
consentFlowSettings[KeyConsentFlowIncludeDefaultAnalyticsPartners] = AppLovinInternalSettings.Instance.ConsentFlowIncludeDefaultAnalyticsPartnerUrls;
var analyticsPartnerUrls = AppLovinInternalSettings.Instance.ConsentFlowAnalyticsPartnerUrls;
if (MaxSdkUtils.IsValidString(analyticsPartnerUrls))
{
var analyticsPartnerUrlsList = analyticsPartnerUrls.Split(',').ToList();
consentFlowSettings[KeyConsentFlowAnalyticsPartners] = analyticsPartnerUrlsList;
} }
var applovinSdkSettings = new Dictionary<string, object>(); var applovinSdkSettings = new Dictionary<string, object>();
@ -130,7 +103,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
public static void EnableTermsFlowIfNeeded(string rawResourceDirectory) public static void EnableTermsFlowIfNeeded(string rawResourceDirectory)
{ {
if (AppLovinSettings.Instance.ShowInternalSettingsInIntegrationManager) return; if (AppLovinInternalSettings.Instance.ConsentFlowEnabled) return;
// Check if terms flow is enabled for this format. No need to create the applovin_consent_flow_settings.json if consent flow is disabled. // Check if terms flow is enabled for this format. No need to create the applovin_consent_flow_settings.json if consent flow is disabled.
var consentFlowEnabled = AppLovinSettings.Instance.ConsentFlowEnabled; var consentFlowEnabled = AppLovinSettings.Instance.ConsentFlowEnabled;
@ -206,6 +179,21 @@ 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";
if (AppLovinInternalSettings.Instance.ConsentFlowEnabled)
{
TryAddStringToDependencyFile(umpDependencyLine, containerElementString);
}
else
{
TryRemoveStringFromDependencyFile(umpDependencyLine, containerElementString);
}
}
public int callbackOrder public int callbackOrder
{ {
get { return int.MaxValue; } get { return int.MaxValue; }

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 0e2f9480fec024b45bb33af29d3022d6 guid: 8ccaf444d0d4f4cadb5debe7c41b20c4
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessAndroid.cs - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessAndroid.cs

View File

@ -0,0 +1,45 @@
//
// AppLovinBuildPreProcessiOS.cs
// AppLovin MAX Unity Plugin
//
// Created by Jonathan Liu on 10/17/2023.
// Copyright © 2023 AppLovin. All rights reserved.
//
#if UNITY_IOS
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
namespace AppLovinMax.Scripts.IntegrationManager.Editor
{
public class AppLovinPreProcessiOS : AppLovinPreProcess, IPreprocessBuildWithReport
{
public void OnPreprocessBuild(BuildReport report)
{
AddGoogleCmpDependencyIfNeeded();
}
private static void AddGoogleCmpDependencyIfNeeded()
{
const string umpDependencyLine = "<iosPod name=\"GoogleUserMessagingPlatform\" version=\"2.1.0\" />";
const string containerElementString = "iosPods";
if (AppLovinInternalSettings.Instance.ConsentFlowEnabled)
{
TryAddStringToDependencyFile(umpDependencyLine, containerElementString);
}
else
{
TryRemoveStringFromDependencyFile(umpDependencyLine, containerElementString);
}
}
public int callbackOrder
{
get { return int.MaxValue; }
}
}
}
#endif

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: ee45537a5833240d7afcfac4a38df1b9
labels:
- al_max
- al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessiOS.cs
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -29,7 +29,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
/// Adds or updates the AppLovin Quality Service plugin to the provided build.gradle file. /// Adds or updates the AppLovin Quality Service plugin to the provided build.gradle file.
/// If the gradle file already has the plugin, the API key is updated. /// If the gradle file already has the plugin, the API key is updated.
/// </summary> /// </summary>
public abstract class AppLovinProcessGradleBuildFile public abstract class AppLovinProcessGradleBuildFile : AppLovinPreProcess
{ {
private static readonly Regex TokenBuildScriptRepositories = new Regex(".*repositories.*"); private static readonly Regex TokenBuildScriptRepositories = new Regex(".*repositories.*");
private static readonly Regex TokenBuildScriptDependencies = new Regex(".*classpath \'com.android.tools.build:gradle.*"); private static readonly Regex TokenBuildScriptDependencies = new Regex(".*classpath \'com.android.tools.build:gradle.*");
@ -63,7 +63,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
/// Updates the provided Gradle script to add Quality Service plugin. /// Updates the provided Gradle script to add Quality Service plugin.
/// </summary> /// </summary>
/// <param name="applicationGradleBuildFilePath">The gradle file to update.</param> /// <param name="applicationGradleBuildFilePath">The gradle file to update.</param>
protected void AddAppLovinQualityServicePlugin(string applicationGradleBuildFilePath) protected static void AddAppLovinQualityServicePlugin(string applicationGradleBuildFilePath)
{ {
if (!AppLovinSettings.Instance.QualityServiceEnabled) return; if (!AppLovinSettings.Instance.QualityServiceEnabled) return;
@ -297,21 +297,15 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor
unityWebRequest.uploadHandler = uploadHandler; unityWebRequest.uploadHandler = uploadHandler;
unityWebRequest.downloadHandler = new DownloadHandlerBuffer(); unityWebRequest.downloadHandler = new DownloadHandlerBuffer();
#if UNITY_2017_2_OR_NEWER
var operation = unityWebRequest.SendWebRequest(); var operation = unityWebRequest.SendWebRequest();
#else
var operation = webRequest.Send();
#endif
// Wait for the download to complete or the request to timeout. // Wait for the download to complete or the request to timeout.
while (!operation.isDone) { } while (!operation.isDone) { }
#if UNITY_2020_1_OR_NEWER #if UNITY_2020_1_OR_NEWER
if (unityWebRequest.result != UnityWebRequest.Result.Success) if (unityWebRequest.result != UnityWebRequest.Result.Success)
#elif UNITY_2017_2_OR_NEWER
if (unityWebRequest.isNetworkError || unityWebRequest.isHttpError)
#else #else
if (webRequest.isError) if (unityWebRequest.isNetworkError || unityWebRequest.isHttpError)
#endif #endif
{ {
MaxSdkLogger.UserError("Failed to retrieve API Key for SDK Key: " + sdkKey + "with error: " + unityWebRequest.error); MaxSdkLogger.UserError("Failed to retrieve API Key for SDK Key: " + sdkKey + "with error: " + unityWebRequest.error);

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a25d66215002f4728b56848ff01f7424 guid: 732b7510bc9c94aafb3fd3b8c0dc5d2d
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinProcessGradleBuildFile.cs - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinProcessGradleBuildFile.cs

View File

@ -58,6 +58,7 @@ public class AppLovinSettings : ScriptableObject
[SerializeField] private string sdkKey; [SerializeField] private string sdkKey;
[SerializeField] private bool setAttributionReportEndpoint; [SerializeField] private bool setAttributionReportEndpoint;
[SerializeField] private bool addApsSkAdNetworkIds;
[SerializeField] private bool consentFlowEnabled; [SerializeField] private bool consentFlowEnabled;
[SerializeField] private Platform consentFlowPlatform; [SerializeField] private Platform consentFlowPlatform;
@ -163,6 +164,15 @@ public class AppLovinSettings : ScriptableObject
set { Instance.setAttributionReportEndpoint = value; } set { Instance.setAttributionReportEndpoint = value; }
} }
/// <summary>
/// Whether or not to add Amazon Publisher Services SKAdNetworkID's.
/// </summary>
public bool AddApsSkAdNetworkIds
{
get { return Instance.addApsSkAdNetworkIds; }
set { Instance.addApsSkAdNetworkIds = value; }
}
/// <summary> /// <summary>
/// Whether or not AppLovin Consent Flow is enabled. /// Whether or not AppLovin Consent Flow is enabled.
/// </summary> /// </summary>

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 589f0157fc8d1480a908eb38be2be8e6 guid: ebc0ba1b5ef6b4a6b9dd53d7eadfea16
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinSettings.cs - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinSettings.cs

View File

@ -1,18 +1,10 @@
{ {
"name": "MaxSdk.Scripts.IntegrationManager.Editor", "name": "MaxSdk.Scripts.IntegrationManager.Editor",
"rootNamespace": "",
"references": [ "references": [
"MaxSdk.Scripts" "MaxSdk.Scripts"
], ],
"includePlatforms": [ "includePlatforms": [
"Editor" "Editor"
], ],
"excludePlatforms": [], "excludePlatforms": []
"allowUnsafeCode": false, }
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 0772632c471804ae89859df0956a3692 guid: a10a05a8449c42519fd80f2b8b580de3
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/MaxSdk.IntegrationManager.Editor.asmdef - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/MaxSdk.IntegrationManager.Editor.asmdef

View File

@ -0,0 +1,170 @@
//
// MaxCmpService.cs
// AppLovin User Engagement Unity Plugin
//
// Created by Santosh Bagadi on 10/1/23.
// Copyright © 2023 AppLovin. All rights reserved.
//
using System;
using System.Collections.Generic;
#if UNITY_EDITOR
#elif UNITY_ANDROID
using UnityEngine;
#elif UNITY_IOS
using System.Runtime.InteropServices;
#endif
/// <summary>
/// This class provides direct APIs for interfacing with the Google-certified CMP installed, if any.
/// </summary>
public class MaxCmpService
{
private static readonly MaxCmpService _instance = new MaxCmpService();
private MaxCmpService() { }
private static Action<MaxCmpError> OnCompletedAction;
#if UNITY_EDITOR
#elif UNITY_ANDROID
private static readonly AndroidJavaClass MaxUnityPluginClass = new AndroidJavaClass("com.applovin.mediation.unity.MaxUnityPlugin");
#elif UNITY_IOS
[DllImport("__Internal")]
private static extern void _MaxShowCmpForExistingUser();
[DllImport("__Internal")]
private static extern bool _MaxHasSupportedCmp();
#endif
internal static MaxCmpService Instance
{
get { return _instance; }
}
/// <summary>
/// Shows the CMP flow to an existing user.
/// Note that the user's current consent will be reset before the CMP alert is shown.
/// </summary>
/// <param name="onCompletedAction">Called when the CMP flow finishes showing.</param>
public void ShowCmpForExistingUser(Action<MaxCmpError> onCompletedAction)
{
OnCompletedAction = onCompletedAction;
#if UNITY_EDITOR
var errorProps = new Dictionary<string, object>
{
{"code", (int) MaxCmpError.ErrorCode.FormUnavailable},
{"message", "CMP is not supported in Unity editor"}
};
NotifyCompletedIfNeeded(errorProps);
#elif UNITY_ANDROID
MaxUnityPluginClass.CallStatic("showCmpForExistingUser");
#elif UNITY_IOS
_MaxShowCmpForExistingUser();
#endif
}
/// <summary>
/// Returns <code>true</code> if a supported CMP SDK is detected.
/// </summary>
public bool HasSupportedCmp
{
get
{
#if UNITY_EDITOR
return false;
#elif UNITY_ANDROID
return MaxUnityPluginClass.CallStatic<bool>("hasSupportedCmp");
#elif UNITY_IOS
return _MaxHasSupportedCmp();
#else
return false;
#endif
}
}
internal static void NotifyCompletedIfNeeded(Dictionary<string, object> errorProps)
{
if (OnCompletedAction == null) return;
var error = (errorProps == null) ? null : MaxCmpError.Create(errorProps);
OnCompletedAction(error);
}
}
public class MaxCmpError
{
public enum ErrorCode
{
/// <summary>
/// Indicates that an unspecified error has occurred.
/// </summary>
Unspecified = -1,
/// <summary>
/// Indicates that the CMP has not been integrated correctly.
/// </summary>
IntegrationError = 1,
/// <summary>
/// Indicates that the CMP form is unavailable.
/// </summary>
FormUnavailable = 2,
/// <summary>
/// Indicates that the CMP form is not required.
/// </summary>
FormNotRequired = 3
}
public static MaxCmpError Create(IDictionary<string, object> error)
{
return new MaxCmpError()
{
Code = GetCode(MaxSdkUtils.GetIntFromDictionary(error, "code")),
Message = MaxSdkUtils.GetStringFromDictionary(error, "message"),
CmpCode = MaxSdkUtils.GetIntFromDictionary(error, "cmpCode", -1),
CmpMessage = MaxSdkUtils.GetStringFromDictionary(error, "cmpMessage")
};
}
private static ErrorCode GetCode(int code)
{
switch (code)
{
case 1:
return ErrorCode.IntegrationError;
case 2:
return ErrorCode.FormUnavailable;
case 3:
return ErrorCode.FormNotRequired;
default:
return ErrorCode.Unspecified;
}
}
private MaxCmpError() { }
/// <summary>
/// The error code for this error.
/// </summary>
public ErrorCode Code { get; private set; }
/// <summary>
/// The error message for this error.
/// </summary>
public string Message { get; private set; }
/// <summary>
/// The error code returned by the CMP.
/// </summary>
public int CmpCode { get; private set; }
/// <summary>
/// The error message returned by the CMP.
/// </summary>
public string CmpMessage { get; private set; }
}

View File

@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: f2e895983b04846af81b59189de0310c
labels:
- al_max
- al_max_export_path-MaxSdk/Scripts/MaxCmpService.cs
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 93afd2b1bb96f411d9e7bfa15fc9a0eb guid: e0acf281ba86b4929a6942ecd998395b
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/MaxEventSystemChecker.cs - al_max_export_path-MaxSdk/Scripts/MaxEventSystemChecker.cs

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c13d7e9087ead447aa741d6d06aef9e1 guid: 67ec2f620c6b0405ba16ea2c032dc9a2
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/MaxEvents.cs - al_max_export_path-MaxSdk/Scripts/MaxEvents.cs

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: b2529e5083a524b099f54b2bb80f05fc guid: a4cfc1a18fa3a469b96d885db522f42e
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/MaxSdk.Scripts.asmdef - al_max_export_path-MaxSdk/Scripts/MaxSdk.Scripts.asmdef

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: b9c276744a7284b6788f515c12cc403c guid: 2fc7aa576843c44e68c7ab14b475bb82
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/MaxSdk.cs - al_max_export_path-MaxSdk/Scripts/MaxSdk.cs

View File

@ -13,11 +13,6 @@ public class MaxSdkAndroid : MaxSdkBase
private static BackgroundCallbackProxy BackgroundCallback = new BackgroundCallbackProxy(); private static BackgroundCallbackProxy BackgroundCallback = new BackgroundCallbackProxy();
public static MaxVariableServiceAndroid VariableService
{
get { return MaxVariableServiceAndroid.Instance; }
}
public static MaxUserServiceAndroid UserService public static MaxUserServiceAndroid UserService
{ {
get { return MaxUserServiceAndroid.Instance; } get { return MaxUserServiceAndroid.Instance; }
@ -415,17 +410,19 @@ public class MaxSdkAndroid : MaxSdkBase
/// </summary> /// </summary>
/// <param name="adUnitIdentifier">Ad unit identifier of the banner to set the local extra parameter for.</param> /// <param name="adUnitIdentifier">Ad unit identifier of the banner to set the local extra parameter for.</param>
/// <param name="key">The key for the local extra parameter.</param> /// <param name="key">The key for the local extra parameter.</param>
/// <param name="value">The value for the extra parameter. Needs to be of type <see cref="AndroidJavaObject"/> or <c>null</c></param> /// <param name="value">The value for the extra parameter. Accepts the following types: <see cref="AndroidJavaObject"/>, <c>null</c>, <c>IList</c>, <c>IDictionary</c>, <c>string</c>, primitive types</param>
public static void SetBannerLocalExtraParameter(string adUnitIdentifier, string key, object value) public static void SetBannerLocalExtraParameter(string adUnitIdentifier, string key, object value)
{ {
if (value != null && value.GetType() != typeof(AndroidJavaObject))
{
MaxSdkLogger.E("Failed to set local extra parameter. Android local extra parameters need to be of type AndroidJavaObject");
return;
}
ValidateAdUnitIdentifier(adUnitIdentifier, "set banner local extra parameter"); ValidateAdUnitIdentifier(adUnitIdentifier, "set banner local extra parameter");
MaxUnityPluginClass.CallStatic("setBannerLocalExtraParameter", adUnitIdentifier, key, (AndroidJavaObject) value);
if (value == null || value is AndroidJavaObject)
{
MaxUnityPluginClass.CallStatic("setBannerLocalExtraParameter", adUnitIdentifier, key, (AndroidJavaObject) value);
}
else
{
MaxUnityPluginClass.CallStatic("setBannerLocalExtraParameterJson", adUnitIdentifier, key, SerializeLocalExtraParameterValue(value));
}
} }
/// <summary> /// <summary>
@ -598,17 +595,19 @@ public class MaxSdkAndroid : MaxSdkBase
/// </summary> /// </summary>
/// <param name="adUnitIdentifier">Ad unit identifier of the MREC to set the local extra parameter for.</param> /// <param name="adUnitIdentifier">Ad unit identifier of the MREC to set the local extra parameter for.</param>
/// <param name="key">The key for the local extra parameter.</param> /// <param name="key">The key for the local extra parameter.</param>
/// <param name="value">The value for the extra parameter. Needs to be of type <see cref="AndroidJavaObject"/> or <c>null</c></param> /// <param name="value">The value for the extra parameter. Accepts the following types: <see cref="AndroidJavaObject"/>, <c>null</c>, <c>IList</c>, <c>IDictionary</c>, <c>string</c>, primitive types</param>
public static void SetMRecLocalExtraParameter(string adUnitIdentifier, string key, object value) public static void SetMRecLocalExtraParameter(string adUnitIdentifier, string key, object value)
{ {
if (value != null && value.GetType() != typeof(AndroidJavaObject))
{
MaxSdkLogger.E("Failed to set local extra parameter. Android local extra parameters need to be of type AndroidJavaObject");
return;
}
ValidateAdUnitIdentifier(adUnitIdentifier, "set MREC local extra parameter"); ValidateAdUnitIdentifier(adUnitIdentifier, "set MREC local extra parameter");
MaxUnityPluginClass.CallStatic("setMRecLocalExtraParameter", adUnitIdentifier, key, (AndroidJavaObject) value);
if (value == null || value is AndroidJavaObject)
{
MaxUnityPluginClass.CallStatic("setMRecLocalExtraParameter", adUnitIdentifier, key, (AndroidJavaObject) value);
}
else
{
MaxUnityPluginClass.CallStatic("setMRecLocalExtraParameterJson", adUnitIdentifier, key, SerializeLocalExtraParameterValue(value));
}
} }
/// <summary> /// <summary>
@ -791,17 +790,19 @@ public class MaxSdkAndroid : MaxSdkBase
/// </summary> /// </summary>
/// <param name="adUnitIdentifier">Ad unit identifier of the interstitial to set the local extra parameter for.</param> /// <param name="adUnitIdentifier">Ad unit identifier of the interstitial to set the local extra parameter for.</param>
/// <param name="key">The key for the local extra parameter.</param> /// <param name="key">The key for the local extra parameter.</param>
/// <param name="value">The value for the extra parameter. Needs to be of type <see cref="AndroidJavaObject"/> or <c>null</c></param> /// <param name="value">The value for the extra parameter. Accepts the following types: <see cref="AndroidJavaObject"/>, <c>null</c>, <c>IList</c>, <c>IDictionary</c>, <c>string</c>, primitive types</param>
public static void SetInterstitialLocalExtraParameter(string adUnitIdentifier, string key, object value) public static void SetInterstitialLocalExtraParameter(string adUnitIdentifier, string key, object value)
{ {
if (value != null && value.GetType() != typeof(AndroidJavaObject))
{
MaxSdkLogger.E("Failed to set local extra parameter. Android local extra parameters need to be of type AndroidJavaObject");
return;
}
ValidateAdUnitIdentifier(adUnitIdentifier, "set interstitial local extra parameter"); ValidateAdUnitIdentifier(adUnitIdentifier, "set interstitial local extra parameter");
MaxUnityPluginClass.CallStatic("setInterstitialLocalExtraParameter", adUnitIdentifier, key, (AndroidJavaObject) value);
if (value == null || value is AndroidJavaObject)
{
MaxUnityPluginClass.CallStatic("setInterstitialLocalExtraParameter", adUnitIdentifier, key, (AndroidJavaObject) value);
}
else
{
MaxUnityPluginClass.CallStatic("setInterstitialLocalExtraParameterJson", adUnitIdentifier, key, SerializeLocalExtraParameterValue(value));
}
} }
#endregion #endregion
@ -866,17 +867,19 @@ public class MaxSdkAndroid : MaxSdkBase
/// </summary> /// </summary>
/// <param name="adUnitIdentifier">Ad unit identifier of the app open ad to set the local extra parameter for.</param> /// <param name="adUnitIdentifier">Ad unit identifier of the app open ad to set the local extra parameter for.</param>
/// <param name="key">The key for the local extra parameter.</param> /// <param name="key">The key for the local extra parameter.</param>
/// <param name="value">The value for the extra parameter. Needs to be of type <see cref="AndroidJavaObject"/> or <c>null</c></param> /// <param name="value">The value for the extra parameter. Accepts the following types: <see cref="AndroidJavaObject"/>, <c>null</c>, <c>IList</c>, <c>IDictionary</c>, <c>string</c>, primitive types</param>
public static void SetAppOpenAdLocalExtraParameter(string adUnitIdentifier, string key, object value) public static void SetAppOpenAdLocalExtraParameter(string adUnitIdentifier, string key, object value)
{ {
if (value != null && value.GetType() != typeof(AndroidJavaObject))
{
MaxSdkLogger.E("Failed to set local extra parameter. Android local extra parameters need to be of type AndroidJavaObject");
return;
}
ValidateAdUnitIdentifier(adUnitIdentifier, "set app open ad local extra parameter"); ValidateAdUnitIdentifier(adUnitIdentifier, "set app open ad local extra parameter");
MaxUnityPluginClass.CallStatic("setAppOpenAdLocalExtraParameter", adUnitIdentifier, key, (AndroidJavaObject) value);
if (value == null || value is AndroidJavaObject)
{
MaxUnityPluginClass.CallStatic("setAppOpenAdLocalExtraParameter", adUnitIdentifier, key, (AndroidJavaObject) value);
}
else
{
MaxUnityPluginClass.CallStatic("setAppOpenAdLocalExtraParameterJson", adUnitIdentifier, key, SerializeLocalExtraParameterValue(value));
}
} }
#endregion #endregion
@ -941,17 +944,19 @@ public class MaxSdkAndroid : MaxSdkBase
/// </summary> /// </summary>
/// <param name="adUnitIdentifier">Ad unit identifier of the rewarded to set the local extra parameter for.</param> /// <param name="adUnitIdentifier">Ad unit identifier of the rewarded to set the local extra parameter for.</param>
/// <param name="key">The key for the local extra parameter.</param> /// <param name="key">The key for the local extra parameter.</param>
/// <param name="value">The value for the extra parameter. Needs to be of type <see cref="AndroidJavaObject"/> or <c>null</c></param> /// <param name="value">The value for the extra parameter. Accepts the following types: <see cref="AndroidJavaObject"/>, <c>null</c>, <c>IList</c>, <c>IDictionary</c>, <c>string</c>, primitive types</param>
public static void SetRewardedAdLocalExtraParameter(string adUnitIdentifier, string key, object value) public static void SetRewardedAdLocalExtraParameter(string adUnitIdentifier, string key, object value)
{ {
if (value != null && value.GetType() != typeof(AndroidJavaObject))
{
MaxSdkLogger.E("Failed to set local extra parameter. Android local extra parameters need to be of type AndroidJavaObject");
return;
}
ValidateAdUnitIdentifier(adUnitIdentifier, "set rewarded ad local extra parameter"); ValidateAdUnitIdentifier(adUnitIdentifier, "set rewarded ad local extra parameter");
MaxUnityPluginClass.CallStatic("setRewardedAdLocalExtraParameter", adUnitIdentifier, key, (AndroidJavaObject) value);
if (value == null || value is AndroidJavaObject)
{
MaxUnityPluginClass.CallStatic("setRewardedAdLocalExtraParameter", adUnitIdentifier, key, (AndroidJavaObject) value);
}
else
{
MaxUnityPluginClass.CallStatic("setRewardedAdLocalExtraParameterJson", adUnitIdentifier, key, SerializeLocalExtraParameterValue(value));
}
} }
#endregion #endregion
@ -1016,17 +1021,19 @@ public class MaxSdkAndroid : MaxSdkBase
/// </summary> /// </summary>
/// <param name="adUnitIdentifier">Ad unit identifier of the rewarded interstitial to set the local extra parameter for.</param> /// <param name="adUnitIdentifier">Ad unit identifier of the rewarded interstitial to set the local extra parameter for.</param>
/// <param name="key">The key for the local extra parameter.</param> /// <param name="key">The key for the local extra parameter.</param>
/// <param name="value">The value for the extra parameter. Needs to be of type <see cref="AndroidJavaObject"/> or <c>null</c></param> /// <param name="value">The value for the extra parameter. Accepts the following types: <see cref="AndroidJavaObject"/>, <c>null</c>, <c>IList</c>, <c>IDictionary</c>, <c>string</c>, primitive types</param>
public static void SetRewardedInterstitialAdLocalExtraParameter(string adUnitIdentifier, string key, object value) public static void SetRewardedInterstitialAdLocalExtraParameter(string adUnitIdentifier, string key, object value)
{ {
if (value != null && value.GetType() != typeof(AndroidJavaObject))
{
MaxSdkLogger.E("Failed to set local extra parameter. Android local extra parameters need to be of type AndroidJavaObject");
return;
}
ValidateAdUnitIdentifier(adUnitIdentifier, "set rewarded interstitial ad local extra parameter"); ValidateAdUnitIdentifier(adUnitIdentifier, "set rewarded interstitial ad local extra parameter");
MaxUnityPluginClass.CallStatic("setRewardedInterstitialAdLocalExtraParameter", adUnitIdentifier, key, (AndroidJavaObject) value);
if (value == null || value is AndroidJavaObject)
{
MaxUnityPluginClass.CallStatic("setRewardedInterstitialAdLocalExtraParameter", adUnitIdentifier, key, (AndroidJavaObject) value);
}
else
{
MaxUnityPluginClass.CallStatic("setRewardedInterstitialAdLocalExtraParameterJson", adUnitIdentifier, key, SerializeLocalExtraParameterValue(value));
}
} }
#endregion #endregion

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e64643507f25d48268e8df04710b9dec guid: 10335fad6bfef47b8819a411aa591dc8
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/MaxSdkAndroid.cs - al_max_export_path-MaxSdk/Scripts/MaxSdkAndroid.cs

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
@ -16,6 +17,26 @@ public abstract class MaxSdkBase
protected static readonly MaxUserSegment SharedUserSegment = new MaxUserSegment(); protected static readonly MaxUserSegment SharedUserSegment = new MaxUserSegment();
protected static readonly MaxTargetingData SharedTargetingData = new MaxTargetingData(); protected static readonly MaxTargetingData SharedTargetingData = new MaxTargetingData();
/// <summary>
/// This enum represents the user's geography used to determine the type of consent flow shown to the user.
/// </summary>
public enum ConsentFlowUserGeography
{
/// <summary>
/// User's geography is unknown.
/// </summary>
Unknown,
/// <summary>
/// The user is in GDPR region.
/// </summary>
Gdpr,
/// <summary>
/// The user is in a non-GDPR region.
/// </summary>
Other
}
#if UNITY_EDITOR || UNITY_IPHONE || UNITY_IOS #if UNITY_EDITOR || UNITY_IPHONE || UNITY_IOS
/// <summary> /// <summary>
@ -97,6 +118,12 @@ public abstract class MaxSdkBase
public bool IsTestModeEnabled { get; private set; } public bool IsTestModeEnabled { get; private set; }
/// <summary>
/// Get the user's geography used to determine the type of consent flow shown to the user.
/// If no such determination could be made, <see cref="MaxSdkBase.ConsentFlowUserGeography.Unknown"/> will be returned.
/// </summary>
public ConsentFlowUserGeography ConsentFlowUserGeography { get; private set; }
[Obsolete("This API has been deprecated and will be removed in a future release.")] [Obsolete("This API has been deprecated and will be removed in a future release.")]
public ConsentDialogState ConsentDialogState { get; private set; } public ConsentDialogState ConsentDialogState { get; private set; }
@ -127,6 +154,21 @@ public abstract class MaxSdkBase
sdkConfiguration.CountryCode = MaxSdkUtils.GetStringFromDictionary(eventProps, "countryCode", ""); sdkConfiguration.CountryCode = MaxSdkUtils.GetStringFromDictionary(eventProps, "countryCode", "");
sdkConfiguration.IsTestModeEnabled = MaxSdkUtils.GetBoolFromDictionary(eventProps, "isTestModeEnabled"); sdkConfiguration.IsTestModeEnabled = MaxSdkUtils.GetBoolFromDictionary(eventProps, "isTestModeEnabled");
var consentFlowUserGeographyStr = MaxSdkUtils.GetStringFromDictionary(eventProps, "consentFlowUserGeography", "");
if ("1".Equals(consentFlowUserGeographyStr))
{
sdkConfiguration.ConsentFlowUserGeography = ConsentFlowUserGeography.Gdpr;
}
else if ("2".Equals(consentFlowUserGeographyStr))
{
sdkConfiguration.ConsentFlowUserGeography = ConsentFlowUserGeography.Other;
}
else
{
sdkConfiguration.ConsentFlowUserGeography = ConsentFlowUserGeography.Unknown;
}
#pragma warning disable 0618 #pragma warning disable 0618
var consentDialogStateStr = MaxSdkUtils.GetStringFromDictionary(eventProps, "consentDialogState", ""); var consentDialogStateStr = MaxSdkUtils.GetStringFromDictionary(eventProps, "consentDialogState", "");
if ("1".Equals(consentDialogStateStr)) if ("1".Equals(consentDialogStateStr))
@ -453,6 +495,14 @@ public abstract class MaxSdkBase
} }
} }
/// <summary>
/// The CMP service, which provides direct APIs for interfacing with the Google-certified CMP installed, if any.
/// </summary>
public static MaxCmpService CmpService
{
get { return MaxCmpService.Instance; }
}
protected static void ValidateAdUnitIdentifier(string adUnitIdentifier, string debugPurpose) protected static void ValidateAdUnitIdentifier(string adUnitIdentifier, string debugPurpose)
{ {
if (string.IsNullOrEmpty(adUnitIdentifier)) if (string.IsNullOrEmpty(adUnitIdentifier))
@ -525,6 +575,22 @@ public abstract class MaxSdkBase
} }
} }
protected static string SerializeLocalExtraParameterValue(object value)
{
if (!(value.GetType().IsPrimitive || value is string || value is IList || value is IDictionary))
{
MaxSdkLogger.UserError("Local extra parameters must be an IList, IDictionary, string, or a primitive type");
return "";
}
Dictionary<string, object> data = new Dictionary<string, object>
{
{"value", value}
};
return Json.Serialize(data);
}
[Obsolete("This API has been deprecated and will be removed in a future release.")] [Obsolete("This API has been deprecated and will be removed in a future release.")]
public enum ConsentDialogState public enum ConsentDialogState
{ {
@ -622,44 +688,15 @@ internal static class AdPositionExtenstion
namespace AppLovinMax.Internal.API namespace AppLovinMax.Internal.API
{ {
[Obsolete("This class has been deprecated and will be removed in a future SDK release.")]
public class CFError public class CFError
{ {
/// <summary>
/// Indicates that the flow ended in an unexpected state.
/// </summary>
public const int ErrorCodeUnspecified = -1;
/// <summary>
/// Indicates that the consent flow has not been integrated correctly.
/// </summary>
public const int ErrorCodeInvalidIntegration = -100;
/// <summary>
/// Indicates that the consent flow is already being shown.
/// </summary>
public const int ErrorCodeFlowAlreadyInProgress = -200;
/// <summary>
/// Indicates that the user is not in a GDPR region.
/// </summary>
public const int ErrorCodeNotInGdprRegion = -300;
/// <summary>
/// The error code for this error. Will be one of the error codes listed in this file.
/// </summary>
public int Code { get; private set; } public int Code { get; private set; }
/// <summary>
/// The error message for this error.
/// </summary>
public string Message { get; private set; } public string Message { get; private set; }
public static CFError Create(IDictionary<string, object> errorObject) public static CFError Create(int code = -1, string message = "")
{ {
if (!errorObject.ContainsKey("code") && !errorObject.ContainsKey("message")) return null;
var code = MaxSdkUtils.GetIntFromDictionary(errorObject, "code", ErrorCodeUnspecified);
var message = MaxSdkUtils.GetStringFromDictionary(errorObject, "message");
return new CFError(code, message); return new CFError(code, message);
} }
@ -676,97 +713,45 @@ namespace AppLovinMax.Internal.API
} }
} }
[Obsolete("This enum has been deprecated. Please use `MaxSdk.GetSdkConfiguration().ConsentFlowUserGeography` instead.")]
public enum CFType public enum CFType
{ {
/// <summary>
/// The flow type is not known.
/// </summary>
Unknown, Unknown,
/// <summary>
/// A standard flow where a TOS/PP alert is shown.
/// </summary>
Standard, Standard,
/// <summary>
/// A detailed modal shown to users in GDPR region.
/// </summary>
Detailed Detailed
} }
public class CFService public class CFService
{ {
private static Action<CFError> OnConsentFlowCompletedAction; [Obsolete("This property has been deprecated. Please use `MaxSdk.GetSdkConfiguration().ConsentFlowUserGeography` instead.")]
#if UNITY_EDITOR
#elif UNITY_ANDROID
private static readonly AndroidJavaClass MaxUnityPluginClass = new AndroidJavaClass("com.applovin.mediation.unity.MaxUnityPlugin");
#elif UNITY_IOS
[DllImport("__Internal")]
private static extern string _MaxGetCFType();
[DllImport("__Internal")]
private static extern void _MaxStartConsentFlow();
#endif
/// <summary>
/// The consent flow type that will be displayed.
/// </summary>
public static CFType CFType public static CFType CFType
{ {
get get
{ {
var cfType = "0"; switch (MaxSdk.GetSdkConfiguration().ConsentFlowUserGeography)
#if UNITY_EDITOR
#elif UNITY_ANDROID
cfType = MaxUnityPluginClass.CallStatic<string>("getCFType");
#elif UNITY_IOS
cfType = _MaxGetCFType();
#endif
if ("1".Equals(cfType))
{ {
return CFType.Standard; case MaxSdkBase.ConsentFlowUserGeography.Unknown:
return CFType.Unknown;
case MaxSdkBase.ConsentFlowUserGeography.Gdpr:
return CFType.Detailed;
case MaxSdkBase.ConsentFlowUserGeography.Other:
return CFType.Standard;
default:
throw new ArgumentOutOfRangeException();
} }
else if ("2".Equals(cfType))
{
return CFType.Detailed;
}
return CFType.Unknown;
} }
} }
/// <summary> [Obsolete("This method has been deprecated. Please use `MaxSdk.CmpService.ShowCmpForExistingUser` instead.")]
/// Starts the consent flow. Call this method to re-show the consent flow for a user in GDPR region.
///
/// Note: The flow will only be shown to users in GDPR regions.
/// </summary>
/// <param name="onFlowCompletedAction">Called when we finish showing the consent flow. Error object will be <c>null</c> if the flow completed successfully.</param>
public static void SCF(Action<CFError> onFlowCompletedAction) public static void SCF(Action<CFError> onFlowCompletedAction)
{ {
OnConsentFlowCompletedAction = onFlowCompletedAction; MaxSdkBase.CmpService.ShowCmpForExistingUser(error =>
#if UNITY_EDITOR
var errorDict = new Dictionary<string, object>()
{ {
{"code", CFError.ErrorCodeUnspecified}, if (onFlowCompletedAction == null) return;
{"message", "Consent flow is not supported in Unity Editor."}
};
NotifyConsentFlowCompletedIfNeeded(errorDict); var cfError = error == null ? null : CFError.Create((int) error.Code, error.Message);
#elif UNITY_ANDROID onFlowCompletedAction(cfError);
MaxUnityPluginClass.CallStatic("startConsentFlow"); });
#elif UNITY_IOS
_MaxStartConsentFlow();
#endif
}
public static void NotifyConsentFlowCompletedIfNeeded(IDictionary<string, object> error)
{
if (OnConsentFlowCompletedAction == null) return;
OnConsentFlowCompletedAction(CFError.Create(error));
} }
} }
} }

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 0822c80ecfc5248e2b853d8d5b449fb3 guid: 893e4e55a7e394274957f1034f7afc45
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/MaxSdkBase.cs - al_max_export_path-MaxSdk/Scripts/MaxSdkBase.cs

View File

@ -6,7 +6,6 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using UnityEngine; using UnityEngine;
using AppLovinMax.Internal.API;
using AppLovinMax.ThirdParty.MiniJson; using AppLovinMax.ThirdParty.MiniJson;
public class MaxSdkCallbacks : MonoBehaviour public class MaxSdkCallbacks : MonoBehaviour
@ -48,23 +47,6 @@ public class MaxSdkCallbacks : MonoBehaviour
} }
} }
// Fire when the MaxVariableService has finished loading the latest set of variables.
private static Action _onVariablesUpdatedEvent;
[System.Obsolete("This API has been deprecated. Please use our SDK's initialization callback to retrieve variables instead.")]
public static event Action OnVariablesUpdatedEvent
{
add
{
LogSubscribedToEvent("OnVariablesUpdatedEvent");
_onVariablesUpdatedEvent += value;
}
remove
{
LogUnsubscribedToEvent("OnVariablesUpdatedEvent");
_onVariablesUpdatedEvent -= value;
}
}
// Fire when the Consent Dialog has been dismissed. // Fire when the Consent Dialog has been dismissed.
private static Action _onSdkConsentDialogDismissedEvent; private static Action _onSdkConsentDialogDismissedEvent;
public static event Action OnSdkConsentDialogDismissedEvent public static event Action OnSdkConsentDialogDismissedEvent
@ -1360,17 +1342,14 @@ public class MaxSdkCallbacks : MonoBehaviour
var sdkConfiguration = MaxSdkBase.SdkConfiguration.Create(eventProps); var sdkConfiguration = MaxSdkBase.SdkConfiguration.Create(eventProps);
InvokeEvent(_onSdkInitializedEvent, sdkConfiguration, eventName); InvokeEvent(_onSdkInitializedEvent, sdkConfiguration, eventName);
} }
else if (eventName == "OnVariablesUpdatedEvent")
{
InvokeEvent(_onVariablesUpdatedEvent, eventName);
}
else if (eventName == "OnSdkConsentDialogDismissedEvent") else if (eventName == "OnSdkConsentDialogDismissedEvent")
{ {
InvokeEvent(_onSdkConsentDialogDismissedEvent, eventName); InvokeEvent(_onSdkConsentDialogDismissedEvent, eventName);
} }
else if (eventName == "OnSdkConsentFlowCompletedEvent") else if (eventName == "OnCmpCompletedEvent")
{ {
CFService.NotifyConsentFlowCompletedIfNeeded(eventProps); var errorProps = MaxSdkUtils.GetDictionaryFromDictionary(eventProps, "error");
MaxCmpService.NotifyCompletedIfNeeded(errorProps);
} }
// Ad Events // Ad Events
else else
@ -1734,7 +1713,6 @@ public class MaxSdkCallbacks : MonoBehaviour
private static void ResetOnDomainReload() private static void ResetOnDomainReload()
{ {
_onSdkInitializedEvent = null; _onSdkInitializedEvent = null;
_onVariablesUpdatedEvent = null;
_onSdkConsentDialogDismissedEvent = null; _onSdkConsentDialogDismissedEvent = null;
_onInterstitialAdLoadedEventV2 = null; _onInterstitialAdLoadedEventV2 = null;

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1bc9fb13147694ac795ea28866c87af9 guid: 4dc129a60049645f7a492a0a658a6c22
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/MaxSdkCallbacks.cs - al_max_export_path-MaxSdk/Scripts/MaxSdkCallbacks.cs

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 54635e7165bf2486a9cc1da416db8ae6 guid: ff2b160afdfd4a74b731954323772a90
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/MaxSdkLogger.cs - al_max_export_path-MaxSdk/Scripts/MaxSdkLogger.cs

View File

@ -32,11 +32,6 @@ public class MaxSdkUnityEditor : MaxSdkBase
private static readonly HashSet<string> ReadyAdUnits = new HashSet<string>(); private static readonly HashSet<string> ReadyAdUnits = new HashSet<string>();
private static readonly Dictionary<string, GameObject> StubBanners = new Dictionary<string, GameObject>(); private static readonly Dictionary<string, GameObject> StubBanners = new Dictionary<string, GameObject>();
public static MaxVariableServiceUnityEditor VariableService
{
get { return MaxVariableServiceUnityEditor.Instance; }
}
public static MaxUserServiceUnityEditor UserService public static MaxUserServiceUnityEditor UserService
{ {
get { return MaxUserServiceUnityEditor.Instance; } get { return MaxUserServiceUnityEditor.Instance; }

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c8c53ddc186d74166a4a1381519cbb2c guid: 13b3e537a64f24986bb8ffe3a0beef5c
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/MaxSdkUnityEditor.cs - al_max_export_path-MaxSdk/Scripts/MaxSdkUnityEditor.cs

View File

@ -12,7 +12,7 @@ using UnityEditor;
#endif #endif
public partial class MaxSdkUtils public class MaxSdkUtils
{ {
/// <summary> /// <summary>
/// An Enum to be used when comparing two versions. /// An Enum to be used when comparing two versions.
@ -349,6 +349,83 @@ public partial class MaxSdkUtils
#endif #endif
} }
/// <summary>
/// Parses the IAB TCF String to determine the consent status for the IAB vendor with the provided ID.
/// </summary>
/// <param name="vendorId">Vendor ID as defined in the Global Vendor List.</param>
/// <returns>The consent status of the IAB vendor. Returns <c>true</c> if the vendor has consent, <c>false</c> if not, or <c>null</c> if no TCF string is available on disk.</returns>
/// <see href="https://vendor-list.consensu.org/v3/vendor-list.json">Current Version of Global Vendor List</see>
public static bool? GetTcfConsentStatus(int vendorId)
{
var tcfConsentStatus = GetPlatformSpecificTcfConsentStatus(vendorId);
if (tcfConsentStatus == -1)
{
return null;
}
else
{
return tcfConsentStatus == 1;
}
}
#if UNITY_IOS
[DllImport("__Internal")]
private static extern int _MaxGetTcfConsentStatus(int vendorIdentifier);
#endif
private static int GetPlatformSpecificTcfConsentStatus(int vendorId)
{
#if UNITY_EDITOR
return -1;
#elif UNITY_IOS
return _MaxGetTcfConsentStatus(vendorId);
#elif UNITY_ANDROID
return MaxUnityPluginClass.CallStatic<int>("getTcfConsentStatus", vendorId);
#else
return -1;
#endif
}
/// <summary>
/// Parses the Google UMP's Additional Consent (AC) string to determine the consent status for the advertising entity represented by the provided Ad Technology Provider (ATP) ID.
/// </summary>
/// <param name="atpId">The ID representing the advertising entity (e.g. 89 for Meta Audience Network).</param>
/// <returns>
/// The consent status of the advertising entity. Returns <c>true</c> if the entity has consent, <c>false</c> if not, or <c>null</c> if no AC string is available on disk.
/// </returns>
/// <see href="https://support.google.com/admanager/answer/9681920">Googles Additional Consent Mode technical specification</see>
/// <see href="https://storage.googleapis.com/tcfac/additional-consent-providers.csv">List of Google ATPs and their IDs</see>
public static bool? GetAdditionalConsentStatus(int atpId)
{
var additionalConsentStatus = GetPlatformSpecificAdditionalConsentStatus(atpId);
if (additionalConsentStatus == -1)
{
return null;
}
else
{
return additionalConsentStatus == 1;
}
}
#if UNITY_IOS
[DllImport("__Internal")]
private static extern int _MaxGetAdditionalConsentStatus(int atpIdentifier);
#endif
private static int GetPlatformSpecificAdditionalConsentStatus(int atpId)
{
#if UNITY_EDITOR
return -1;
#elif UNITY_IOS
return _MaxGetAdditionalConsentStatus(atpId);
#elif UNITY_ANDROID
return MaxUnityPluginClass.CallStatic<int>("getAdditionalConsentStatus", atpId);
#else
return -1;
#endif
}
/// <summary> /// <summary>
/// Compares AppLovin MAX Unity mediation adapter plugin versions. Returns <see cref="VersionComparisonResult.Lesser"/>, <see cref="VersionComparisonResult.Equal"/>, /// Compares AppLovin MAX Unity mediation adapter plugin versions. 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. /// or <see cref="VersionComparisonResult.Greater"/> as the first version is less than, equal to, or greater than the second.
@ -521,8 +598,4 @@ public partial class MaxSdkUtils
return assetGuids.Length < 1 ? defaultPath : AssetDatabase.GUIDToAssetPath(assetGuids[0]); return assetGuids.Length < 1 ? defaultPath : AssetDatabase.GUIDToAssetPath(assetGuids[0]);
} }
#endif #endif
} }

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 5b1f7446ccb2846569bdf5db9ef4d548 guid: 47f1bc9a8eebd4d088e22e6baf00ede3
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/MaxSdkUtils.cs - al_max_export_path-MaxSdk/Scripts/MaxSdkUtils.cs

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using AOT; using AOT;
@ -18,11 +19,6 @@ public class MaxSdkiOS : MaxSdkBase
} }
#if UNITY_IOS #if UNITY_IOS
public static MaxVariableServiceiOS VariableService
{
get { return MaxVariableServiceiOS.Instance; }
}
public static MaxUserServiceiOS UserService public static MaxUserServiceiOS UserService
{ {
get { return MaxUserServiceiOS.Instance; } get { return MaxUserServiceiOS.Instance; }
@ -507,24 +503,28 @@ public class MaxSdkiOS : MaxSdkBase
[DllImport("__Internal")] [DllImport("__Internal")]
private static extern void _MaxSetBannerLocalExtraParameter(string adUnitIdentifier, string key, IntPtr value); private static extern void _MaxSetBannerLocalExtraParameter(string adUnitIdentifier, string key, IntPtr value);
[DllImport("__Internal")]
private static extern void _MaxSetBannerLocalExtraParameterJSON(string adUnitIdentifier, string key, string json);
/// <summary> /// <summary>
/// Set a local extra parameter for the banner ad. /// Set a local extra parameter for the banner ad.
/// </summary> /// </summary>
/// <param name="adUnitIdentifier">Ad unit identifier of the banner to set the local extra parameter for.</param> /// <param name="adUnitIdentifier">Ad unit identifier of the banner to set the local extra parameter for.</param>
/// <param name="key">The key for the local extra parameter.</param> /// <param name="key">The key for the local extra parameter.</param>
/// <param name="value">The value for the local extra parameter. Needs to be of type <see cref="IntPtr"/> or <c>null</c></param> /// <param name="value">The value for the local extra parameter. Accepts the following types: <see cref="IntPtr"/>, <c>null</c>, <c>IList</c>, <c>IDictionary</c>, <c>string</c>, primitive types</param>
public static void SetBannerLocalExtraParameter(string adUnitIdentifier, string key, object value) public static void SetBannerLocalExtraParameter(string adUnitIdentifier, string key, object value)
{ {
if (value != null && value.GetType() != typeof(IntPtr))
{
MaxSdkLogger.E("Failed to set local extra parameter. iOS local extra parameters need to be of type IntPtr");
return;
}
ValidateAdUnitIdentifier(adUnitIdentifier, "set banner local extra parameter"); ValidateAdUnitIdentifier(adUnitIdentifier, "set banner local extra parameter");
var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value; if (value == null || value is IntPtr)
_MaxSetBannerLocalExtraParameter(adUnitIdentifier, key, intPtrValue); {
var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value;
_MaxSetBannerLocalExtraParameter(adUnitIdentifier, key, intPtrValue);
}
else
{
_MaxSetBannerLocalExtraParameterJSON(adUnitIdentifier, key, SerializeLocalExtraParameterValue(value));
}
} }
[DllImport("__Internal")] [DllImport("__Internal")]
@ -737,24 +737,28 @@ public class MaxSdkiOS : MaxSdkBase
[DllImport("__Internal")] [DllImport("__Internal")]
private static extern void _MaxSetMRecLocalExtraParameter(string adUnitIdentifier, string key, IntPtr value); private static extern void _MaxSetMRecLocalExtraParameter(string adUnitIdentifier, string key, IntPtr value);
[DllImport("__Internal")]
private static extern void _MaxSetMRecLocalExtraParameterJSON(string adUnitIdentifier, string key, string json);
/// <summary> /// <summary>
/// Set a local extra parameter for the MREC ad. /// Set a local extra parameter for the MREC ad.
/// </summary> /// </summary>
/// <param name="adUnitIdentifier">Ad unit identifier of the MREC to set the local extra parameter for.</param> /// <param name="adUnitIdentifier">Ad unit identifier of the MREC to set the local extra parameter for.</param>
/// <param name="key">The key for the local extra parameter.</param> /// <param name="key">The key for the local extra parameter.</param>
/// <param name="value">The value for the local extra parameter. Needs to be of type <see cref="IntPtr"/> or <c>null</c></param> /// <param name="value">The value for the local extra parameter. Accepts the following types: <see cref="IntPtr"/>, <c>null</c>, <c>IList</c>, <c>IDictionary</c>, <c>string</c>, primitive types</param>
public static void SetMRecLocalExtraParameter(string adUnitIdentifier, string key, object value) public static void SetMRecLocalExtraParameter(string adUnitIdentifier, string key, object value)
{ {
if (value != null && value.GetType() != typeof(IntPtr))
{
MaxSdkLogger.E("Failed to set local extra parameter. iOS local extra parameters need to be of type IntPtr");
return;
}
ValidateAdUnitIdentifier(adUnitIdentifier, "set MREC local extra parameter"); ValidateAdUnitIdentifier(adUnitIdentifier, "set MREC local extra parameter");
var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value; if (value == null || value is IntPtr)
_MaxSetMRecLocalExtraParameter(adUnitIdentifier, key, intPtrValue); {
var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value;
_MaxSetMRecLocalExtraParameter(adUnitIdentifier, key, intPtrValue);
}
else
{
_MaxSetMRecLocalExtraParameterJSON(adUnitIdentifier, key, SerializeLocalExtraParameterValue(value));
}
} }
[DllImport("__Internal")] [DllImport("__Internal")]
@ -974,24 +978,28 @@ public class MaxSdkiOS : MaxSdkBase
[DllImport("__Internal")] [DllImport("__Internal")]
private static extern void _MaxSetInterstitialLocalExtraParameter(string adUnitIdentifier, string key, IntPtr value); private static extern void _MaxSetInterstitialLocalExtraParameter(string adUnitIdentifier, string key, IntPtr value);
[DllImport("__Internal")]
private static extern void _MaxSetInterstitialLocalExtraParameterJSON(string adUnitIdentifier, string key, string json);
/// <summary> /// <summary>
/// Set a local extra parameter for the ad. /// Set a local extra parameter for the ad.
/// </summary> /// </summary>
/// <param name="adUnitIdentifier">Ad unit identifier of the interstitial to set the local extra parameter for.</param> /// <param name="adUnitIdentifier">Ad unit identifier of the interstitial to set the local extra parameter for.</param>
/// <param name="key">The key for the local extra parameter.</param> /// <param name="key">The key for the local extra parameter.</param>
/// <param name="value">The value for the local extra parameter. Needs to be of type <see cref="IntPtr"/> or <c>null</c></param> /// <param name="value">The value for the local extra parameter. Accepts the following types: <see cref="IntPtr"/>, <c>null</c>, <c>IList</c>, <c>IDictionary</c>, <c>string</c>, primitive types</param>
public static void SetInterstitialLocalExtraParameter(string adUnitIdentifier, string key, object value) public static void SetInterstitialLocalExtraParameter(string adUnitIdentifier, string key, object value)
{ {
if (value != null && value.GetType() != typeof(IntPtr))
{
MaxSdkLogger.E("Failed to set local extra parameter. iOS local extra parameters need to be of type IntPtr");
return;
}
ValidateAdUnitIdentifier(adUnitIdentifier, "set interstitial local extra parameter"); ValidateAdUnitIdentifier(adUnitIdentifier, "set interstitial local extra parameter");
var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value; if (value == null || value is IntPtr)
_MaxSetInterstitialLocalExtraParameter(adUnitIdentifier, key, intPtrValue); {
var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value;
_MaxSetInterstitialLocalExtraParameter(adUnitIdentifier, key, intPtrValue);
}
else
{
_MaxSetInterstitialLocalExtraParameterJSON(adUnitIdentifier, key, SerializeLocalExtraParameterValue(value));
}
} }
#endregion #endregion
@ -1066,24 +1074,28 @@ public class MaxSdkiOS : MaxSdkBase
[DllImport("__Internal")] [DllImport("__Internal")]
private static extern void _MaxSetAppOpenAdLocalExtraParameter(string adUnitIdentifier, string key, IntPtr value); private static extern void _MaxSetAppOpenAdLocalExtraParameter(string adUnitIdentifier, string key, IntPtr value);
[DllImport("__Internal")]
private static extern void _MaxSetAppOpenAdLocalExtraParameterJSON(string adUnitIdentifier, string key, string json);
/// <summary> /// <summary>
/// Set a local extra parameter for the ad. /// Set a local extra parameter for the ad.
/// </summary> /// </summary>
/// <param name="adUnitIdentifier">Ad unit identifier of the app open ad to set the local extra parameter for.</param> /// <param name="adUnitIdentifier">Ad unit identifier of the app open ad to set the local extra parameter for.</param>
/// <param name="key">The key for the local extra parameter.</param> /// <param name="key">The key for the local extra parameter.</param>
/// <param name="value">The value for the local extra parameter. Needs to be of type <see cref="IntPtr"/> or <c>null</c></param> /// <param name="value">The value for the local extra parameter. Accepts the following types: <see cref="IntPtr"/>, <c>null</c>, <c>IList</c>, <c>IDictionary</c>, <c>string</c>, primitive types</param>
public static void SetAppOpenAdLocalExtraParameter(string adUnitIdentifier, string key, object value) public static void SetAppOpenAdLocalExtraParameter(string adUnitIdentifier, string key, object value)
{ {
if (value != null && value.GetType() != typeof(IntPtr))
{
MaxSdkLogger.E("Failed to set local extra parameter. iOS local extra parameters need to be of type IntPtr");
return;
}
ValidateAdUnitIdentifier(adUnitIdentifier, "set app open ad local extra parameter"); ValidateAdUnitIdentifier(adUnitIdentifier, "set app open ad local extra parameter");
var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value; if (value == null || value is IntPtr)
_MaxSetAppOpenAdLocalExtraParameter(adUnitIdentifier, key, intPtrValue); {
var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value;
_MaxSetAppOpenAdLocalExtraParameter(adUnitIdentifier, key, intPtrValue);
}
else
{
_MaxSetAppOpenAdLocalExtraParameterJSON(adUnitIdentifier, key, SerializeLocalExtraParameterValue(value));
}
} }
#endregion #endregion
@ -1158,24 +1170,28 @@ public class MaxSdkiOS : MaxSdkBase
[DllImport("__Internal")] [DllImport("__Internal")]
private static extern void _MaxSetRewardedAdLocalExtraParameter(string adUnitIdentifier, string key, IntPtr value); private static extern void _MaxSetRewardedAdLocalExtraParameter(string adUnitIdentifier, string key, IntPtr value);
[DllImport("__Internal")]
private static extern void _MaxSetRewardedAdLocalExtraParameterJSON(string adUnitIdentifier, string key, string json);
/// <summary> /// <summary>
/// Set a local extra parameter for the ad. /// Set a local extra parameter for the ad.
/// </summary> /// </summary>
/// <param name="adUnitIdentifier">Ad unit identifier of the rewarded ad to set the local extra parameter for.</param> /// <param name="adUnitIdentifier">Ad unit identifier of the rewarded ad to set the local extra parameter for.</param>
/// <param name="key">The key for the local extra parameter.</param> /// <param name="key">The key for the local extra parameter.</param>
/// <param name="value">The value for local the extra parameter. Needs to be of type <see cref="IntPtr"/> or <c>null</c></param> /// <param name="value">The value for the local extra parameter. Accepts the following types: <see cref="IntPtr"/>, <c>null</c>, <c>IList</c>, <c>IDictionary</c>, <c>string</c>, primitive types</param>
public static void SetRewardedAdLocalExtraParameter(string adUnitIdentifier, string key, object value) public static void SetRewardedAdLocalExtraParameter(string adUnitIdentifier, string key, object value)
{ {
if (value != null && value.GetType() != typeof(IntPtr)) ValidateAdUnitIdentifier(adUnitIdentifier, "set rewarded ad local extra parameter");
if (value == null || value is IntPtr)
{ {
MaxSdkLogger.E("Failed to set local extra parameter. iOS local extra parameters need to be of type IntPtr"); var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value;
return; _MaxSetRewardedAdLocalExtraParameter(adUnitIdentifier, key, intPtrValue);
}
else
{
_MaxSetRewardedAdLocalExtraParameterJSON(adUnitIdentifier, key, SerializeLocalExtraParameterValue(value));
} }
ValidateAdUnitIdentifier(adUnitIdentifier, "set rewarded local extra parameter");
var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value;
_MaxSetRewardedAdLocalExtraParameter(adUnitIdentifier, key, intPtrValue);
} }
#endregion #endregion
@ -1250,24 +1266,28 @@ public class MaxSdkiOS : MaxSdkBase
[DllImport("__Internal")] [DllImport("__Internal")]
private static extern void _MaxSetRewardedInterstitialAdLocalExtraParameter(string adUnitIdentifier, string key, IntPtr value); private static extern void _MaxSetRewardedInterstitialAdLocalExtraParameter(string adUnitIdentifier, string key, IntPtr value);
[DllImport("__Internal")]
private static extern void _MaxSetRewardedInterstitialAdLocalExtraParameterJSON(string adUnitIdentifier, string key, string json);
/// <summary> /// <summary>
/// Set a local extra parameter for the ad. /// Set a local extra parameter for the ad.
/// </summary> /// </summary>
/// <param name="adUnitIdentifier">Ad unit identifier of the rewarded interstitial ad to set the local extra parameter for.</param> /// <param name="adUnitIdentifier">Ad unit identifier of the rewarded interstitial ad to set the local extra parameter for.</param>
/// <param name="key">The key for the local extra parameter.</param> /// <param name="key">The key for the local extra parameter.</param>
/// <param name="value">The value for the local extra parameter. Needs to be of type <see cref="IntPtr"/> or <c>null</c></param> /// <param name="value">The value for the local extra parameter. Accepts the following types: <see cref="IntPtr"/>, <c>null</c>, <c>IList</c>, <c>IDictionary</c>, <c>string</c>, primitive types</param>
public static void SetRewardedInterstitialAdLocalExtraParameter(string adUnitIdentifier, string key, object value) public static void SetRewardedInterstitialAdLocalExtraParameter(string adUnitIdentifier, string key, object value)
{ {
if (value != null && value.GetType() != typeof(IntPtr)) ValidateAdUnitIdentifier(adUnitIdentifier, "set rewarded interstitial ad local extra parameter");
if (value == null || value is IntPtr)
{ {
MaxSdkLogger.E("Failed to set local extra parameter. iOS local extra parameters need to be of type IntPtr"); var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value;
return; _MaxSetRewardedInterstitialAdLocalExtraParameter(adUnitIdentifier, key, intPtrValue);
}
else
{
_MaxSetRewardedInterstitialAdLocalExtraParameterJSON(adUnitIdentifier, key, SerializeLocalExtraParameterValue(value));
} }
ValidateAdUnitIdentifier(adUnitIdentifier, "set rewarded interstitial local extra parameter");
var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value;
_MaxSetRewardedInterstitialAdLocalExtraParameter(adUnitIdentifier, key, intPtrValue);
} }
#endregion #endregion

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1c0c0863c6b44422ba7dbf7939009f74 guid: e7c7ed6cdbdca44cd8eae28d3b60d28c
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/MaxSdkiOS.cs - al_max_export_path-MaxSdk/Scripts/MaxSdkiOS.cs

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: eac21c202a5f94a2f8e6683afa591d7b guid: 409fe14211f31433da09f5b4bd5467b9
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/MaxTargetingData.cs - al_max_export_path-MaxSdk/Scripts/MaxTargetingData.cs

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e2f0d7f5729cd4f46a8498cdeb6a70e7 guid: 8fb1f6f31b19c407b9d3fa62557d373a
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/MaxUserSegment.cs - al_max_export_path-MaxSdk/Scripts/MaxUserSegment.cs

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6cc873cf061ec4b29be81d16f52762d9 guid: d2eacd6aa14494de6809b4b06027a332
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/MaxUserServiceAndroid.cs - al_max_export_path-MaxSdk/Scripts/MaxUserServiceAndroid.cs

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e3754fa2823844ae19be8cf9775fefb4 guid: 16d44e29e68204f36975abec0feb1d35
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/MaxUserServiceUnityEditor.cs - al_max_export_path-MaxSdk/Scripts/MaxUserServiceUnityEditor.cs

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 25fbc36c2e04d4127bb60c436fa54315 guid: 6233dd3f0b4664e7dbdca14cc8904176
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/MaxUserServiceiOS.cs - al_max_export_path-MaxSdk/Scripts/MaxUserServiceiOS.cs

View File

@ -1,36 +0,0 @@
using UnityEngine;
public class MaxVariableServiceAndroid
{
private static readonly AndroidJavaClass _maxUnityPluginClass = new AndroidJavaClass("com.applovin.mediation.unity.MaxUnityPlugin");
private static readonly MaxVariableServiceAndroid _instance = new MaxVariableServiceAndroid();
public static MaxVariableServiceAndroid Instance
{
get { return _instance; }
}
/// <summary>
/// Returns the variable value associated with the given key, or false if no mapping of the desired type exists for the given key.
/// </summary>
/// <param name="key">The variable name to retrieve the value for.</param>
public bool GetBoolean(string key, bool defaultValue = false)
{
return _maxUnityPluginClass.CallStatic<bool>("getBoolean", key, defaultValue);
}
/// <summary>
/// Returns the variable value associated with the given key, or an empty string if no mapping of the desired type exists for the given key.
/// </summary>
/// <param name="key">The variable name to retrieve the value for.</param>
public string GetString(string key, string defaultValue = "")
{
return _maxUnityPluginClass.CallStatic<string>("getString", key, defaultValue);
}
[System.Obsolete("This API has been deprecated. Please use our SDK's initialization callback to retrieve variables instead.")]
public void LoadVariables()
{
_maxUnityPluginClass.CallStatic("loadVariables");
}
}

View File

@ -1,6 +0,0 @@
fileFormatVersion: 2
guid: 837643e15fc734f7ab2fd5f71c919d01
labels:
- al_max
- al_max_export_path-MaxSdk/Scripts/MaxVariableServiceAndroid.cs
timeCreated: 1547608580

View File

@ -1,30 +0,0 @@
public class MaxVariableServiceUnityEditor
{
private static readonly MaxVariableServiceUnityEditor _instance = new MaxVariableServiceUnityEditor();
public static MaxVariableServiceUnityEditor Instance
{
get { return _instance; }
}
/// <summary>
/// Returns the variable value associated with the given key, or false if no mapping of the desired type exists for the given key.
/// </summary>
/// <param name="key">The variable name to retrieve the value for.</param>
public bool GetBoolean(string key, bool defaultValue = false)
{
return defaultValue;
}
/// <summary>
/// Returns the variable value associated with the given key, or an empty string if no mapping of the desired type exists for the given key.
/// </summary>
/// <param name="key">The variable name to retrieve the value for.</param>
public string GetString(string key, string defaultValue = "")
{
return defaultValue;
}
[System.Obsolete("This API has been deprecated. Please use our SDK's initialization callback to retrieve variables instead.")]
public void LoadVariables() { }
}

View File

@ -1,6 +0,0 @@
fileFormatVersion: 2
guid: cc5e13a9689324605aa62b30ba0fca1f
labels:
- al_max
- al_max_export_path-MaxSdk/Scripts/MaxVariableServiceUnityEditor.cs
timeCreated: 1547608594

View File

@ -1,47 +0,0 @@
using System.Runtime.InteropServices;
#if UNITY_IOS
public class MaxVariableServiceiOS
{
private static readonly MaxVariableServiceiOS _instance = new MaxVariableServiceiOS();
public static MaxVariableServiceiOS Instance
{
get { return _instance; }
}
[DllImport("__Internal")]
private static extern void _MaxLoadVariables();
[DllImport("__Internal")]
private static extern bool _MaxGetBool(string name, bool defaultValue);
[DllImport("__Internal")]
private static extern string _MaxGetString(string name, string defaultValue);
/// <summary>
/// Returns the variable value associated with the given key, or false if no mapping of the desired type exists for the given key.
/// </summary>
/// <param name="key">The variable name to retrieve the value for.</param>
public bool GetBoolean(string key, bool defaultValue = false)
{
return _MaxGetBool(key, defaultValue);
}
/// <summary>
/// Returns the variable value associated with the given key, or an empty string if no mapping of the desired type exists for the given key.
/// </summary>
/// <param name="key">The variable name to retrieve the value for.</param>
public string GetString(string key, string defaultValue = "")
{
return _MaxGetString(key, defaultValue);
}
[System.Obsolete("This API has been deprecated. Please use our SDK's initialization callback to retrieve variables instead.")]
public void LoadVariables()
{
_MaxLoadVariables();
}
}
#endif

View File

@ -1,6 +0,0 @@
fileFormatVersion: 2
guid: 0d10ea5dac9bb46bfb388623e6153986
labels:
- al_max
- al_max_export_path-MaxSdk/Scripts/MaxVariableServiceiOS.cs
timeCreated: 1547608568

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a6dee059874b348009ba86a51a2bc978 guid: 68fc43fe05dea4106bb4b376720d6708
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/ThirdParty - al_max_export_path-MaxSdk/Scripts/ThirdParty

View File

@ -85,7 +85,7 @@ namespace AppLovinMax.ThirdParty.MiniJson
public static object Deserialize(string json) public static object Deserialize(string json)
{ {
// save the string for debug information // save the string for debug information
if (json == null) if (string.IsNullOrEmpty(json))
{ {
return null; return null;
} }

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 741e50fb3b1ea46a5b4d05b3da5015fa guid: 52789a1d5a5754d46816fd9ed114a375
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Scripts/ThirdParty/MiniJSON.cs - al_max_export_path-MaxSdk/Scripts/ThirdParty/MiniJSON.cs

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 9410432e795b9407ab5a8b5b9e02e01d guid: 8a6ad2e147c3a4553bda59a84413f07b
labels: labels:
- al_max - al_max
- al_max_export_path-MaxSdk/Version.md - al_max_export_path-MaxSdk/Version.md