diff --git a/Editor/GuruEditorMax/GuruMaxIntegrationManager.cs b/Editor/GuruEditorMax/GuruMaxIntegrationManager.cs index b950036..3aacd6b 100644 --- a/Editor/GuruEditorMax/GuruMaxIntegrationManager.cs +++ b/Editor/GuruEditorMax/GuruMaxIntegrationManager.cs @@ -36,6 +36,7 @@ namespace Guru.Editor.Max private string _admobIOSId; private bool _qualityServiceEnabled = true; private bool _setAttributionReportEndpoint = true; + private bool _addApsSkAdNetworkIds = true; private bool _isDirty; //------- AppLovinData -------- @@ -43,8 +44,6 @@ namespace Guru.Editor.Max private PluginData pluginData; #region 生命周期 - - /// /// 打开窗体 @@ -155,6 +154,7 @@ namespace Guru.Editor.Max _admobIOSId = _settings.AdMobIosAppId; _qualityServiceEnabled = _settings.QualityServiceEnabled; _setAttributionReportEndpoint = _settings.SetAttributionReportEndpoint; + _addApsSkAdNetworkIds = _settings.AddApsSkAdNetworkIds; } else { @@ -177,6 +177,7 @@ namespace Guru.Editor.Max _settings.AdMobIosAppId = _admobIOSId; _settings.QualityServiceEnabled = _qualityServiceEnabled; _settings.SetAttributionReportEndpoint = _setAttributionReportEndpoint; + _settings.AddApsSkAdNetworkIds = _addApsSkAdNetworkIds; EditorUtility.SetDirty(_settings); AssetDatabase.SaveAssetIfDirty(_settings); diff --git a/Editor/GuruEditorMax/GuruMaxSdkAPI.cs b/Editor/GuruEditorMax/GuruMaxSdkAPI.cs index c416fbd..748fb09 100644 --- a/Editor/GuruEditorMax/GuruMaxSdkAPI.cs +++ b/Editor/GuruEditorMax/GuruMaxSdkAPI.cs @@ -16,7 +16,7 @@ namespace Guru.Editor.Max { // ------------ VERSION INFO ------------ public const string Version = "0.1.0"; - public const string SdkVersion = "5.11.3"; + public const string SdkVersion = "6.1.2"; // ------------ VERSION INFO ------------ public const string PackageName = "com.guru.unity.max"; diff --git a/MaxSdk/AppLovin.meta b/MaxSdk/AppLovin.meta index e025615..85a9d74 100644 --- a/MaxSdk/AppLovin.meta +++ b/MaxSdk/AppLovin.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 24350f435b5f14067b88bad9e54f4776 +guid: c443543f84b8b443bad7d9daa264ae4f labels: - al_max - al_max_export_path-MaxSdk/AppLovin diff --git a/MaxSdk/AppLovin/Editor.meta b/MaxSdk/AppLovin/Editor.meta index 7224034..e498210 100644 --- a/MaxSdk/AppLovin/Editor.meta +++ b/MaxSdk/AppLovin/Editor.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0c096cc384c7446b5b962f359a291792 +guid: 68a1e4d0fd5e8494684b435209c3a42d labels: - al_max - al_max_export_path-MaxSdk/AppLovin/Editor diff --git a/MaxSdk/AppLovin/Editor/Dependencies.xml b/MaxSdk/AppLovin/Editor/Dependencies.xml index b951879..e94d30e 100644 --- a/MaxSdk/AppLovin/Editor/Dependencies.xml +++ b/MaxSdk/AppLovin/Editor/Dependencies.xml @@ -1,9 +1,9 @@ - + - + diff --git a/MaxSdk/AppLovin/Editor/Dependencies.xml.meta b/MaxSdk/AppLovin/Editor/Dependencies.xml.meta index 50f9829..3360fd3 100644 --- a/MaxSdk/AppLovin/Editor/Dependencies.xml.meta +++ b/MaxSdk/AppLovin/Editor/Dependencies.xml.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a36972e13b9b64a87a11421020969d76 +guid: 746da98302dc0402aaa37e8f7bd97e77 labels: - al_max - al_max_export_path-MaxSdk/AppLovin/Editor/Dependencies.xml diff --git a/MaxSdk/AppLovin/Plugins.meta b/MaxSdk/AppLovin/Plugins.meta index cad18f4..620e2b3 100644 --- a/MaxSdk/AppLovin/Plugins.meta +++ b/MaxSdk/AppLovin/Plugins.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6f0263dd851654e7598f11593e8da7a8 +guid: b0fe3bb045e0d4f6f91368c84f74412f labels: - al_max - al_max_export_path-MaxSdk/AppLovin/Plugins diff --git a/MaxSdk/AppLovin/Plugins/Android.meta b/MaxSdk/AppLovin/Plugins/Android.meta index cb45a3d..e579629 100644 --- a/MaxSdk/AppLovin/Plugins/Android.meta +++ b/MaxSdk/AppLovin/Plugins/Android.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9b47263f475c14ff8861bc3b40f416b9 +guid: b5015a52575b74babb5884f37c45b263 labels: - al_max - al_max_export_path-MaxSdk/AppLovin/Plugins/Android diff --git a/MaxSdk/AppLovin/Plugins/Android/applovin-max-unity-plugin.aar b/MaxSdk/AppLovin/Plugins/Android/applovin-max-unity-plugin.aar index 9d2a709..7575a83 100644 Binary files a/MaxSdk/AppLovin/Plugins/Android/applovin-max-unity-plugin.aar and b/MaxSdk/AppLovin/Plugins/Android/applovin-max-unity-plugin.aar differ diff --git a/MaxSdk/AppLovin/Plugins/Android/applovin-max-unity-plugin.aar.meta b/MaxSdk/AppLovin/Plugins/Android/applovin-max-unity-plugin.aar.meta index a70eb75..224076a 100644 --- a/MaxSdk/AppLovin/Plugins/Android/applovin-max-unity-plugin.aar.meta +++ b/MaxSdk/AppLovin/Plugins/Android/applovin-max-unity-plugin.aar.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8283280d1ffc84ea1856f8d8982fc3be +guid: 1db980bd612824d2097f78fd779e6051 labels: - al_max - al_max_export_path-MaxSdk/AppLovin/Plugins/Android/applovin-max-unity-plugin.aar diff --git a/MaxSdk/AppLovin/Plugins/iOS.meta b/MaxSdk/AppLovin/Plugins/iOS.meta index 123a98f..fb615c7 100644 --- a/MaxSdk/AppLovin/Plugins/iOS.meta +++ b/MaxSdk/AppLovin/Plugins/iOS.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6d1f80dfd5b7247ff9bcf9a5532eb9a3 +guid: 35602bb97c21644338be36a4331c3874 labels: - al_max - al_max_export_path-MaxSdk/AppLovin/Plugins/iOS diff --git a/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.h b/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.h index b4061d2..4af5531 100644 --- a/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.h +++ b/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.h @@ -14,91 +14,91 @@ typedef void (*ALUnityBackgroundCallback)(const char* args); - (ALSdk *)initializeSdkWithSettings:(ALSdkSettings *)settings backgroundCallback:(ALUnityBackgroundCallback)unityBackgroundCallback andCompletionHandler:(ALSdkInitializationCompletionHandler)completionHandler; -- (void)createBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier atPosition:(NSString *)bannerPosition; -- (void)createBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset; -- (void)loadBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)setBannerBackgroundColorForAdUnitIdentifier:(NSString *)adUnitIdentifier hexColorCode:(NSString *)hexColorCode; -- (void)setBannerPlacement:(nullable NSString *)placement forAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)startBannerAutoRefreshForAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)stopBannerAutoRefreshForAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)setBannerExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable NSString *)value; -- (void)setBannerLocalExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable id)value; -- (void)setBannerCustomData:(nullable NSString *)customData forAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)setBannerWidth:(CGFloat)width forAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)updateBannerPosition:(NSString *)bannerPosition forAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)updateBannerPosition:(CGFloat)xOffset y:(CGFloat)yOffset forAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)showBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)destroyBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)hideBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (NSString *)bannerLayoutForAdUnitIdentifier:(NSString *)adUnitIdentifier; +- (void)createBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier atPosition:(nullable NSString *)bannerPosition; +- (void)createBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset; +- (void)loadBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)setBannerBackgroundColorForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier hexColorCode:(nullable NSString *)hexColorCode; +- (void)setBannerPlacement:(nullable NSString *)placement forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)startBannerAutoRefreshForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)stopBannerAutoRefreshForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)setBannerExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value; +- (void)setBannerLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value; +- (void)setBannerCustomData:(nullable NSString *)customData forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)setBannerWidth:(CGFloat)width forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)updateBannerPosition:(nullable NSString *)bannerPosition forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)updateBannerPosition:(CGFloat)xOffset y:(CGFloat)yOffset forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)showBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)destroyBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)hideBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (NSString *)bannerLayoutForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; + (CGFloat)adaptiveBannerHeightForWidth:(CGFloat)width; -- (void)createMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier atPosition:(NSString *)mrecPosition; -- (void)createMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset; -- (void)loadMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)setMRecPlacement:(nullable NSString *)placement forAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)startMRecAutoRefreshForAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)stopMRecAutoRefreshForAdUnitIdentifier:(NSString *)adUnitIdentifer; -- (void)setMRecExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable NSString *)value; -- (void)setMRecLocalExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable id)value; -- (void)setMRecCustomData:(nullable NSString *)customData forAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)showMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)destroyMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)hideMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)updateMRecPosition:(NSString *)mrecPosition forAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)updateMRecPosition:(CGFloat)xOffset y:(CGFloat)yOffset forAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (NSString *)mrecLayoutForAdUnitIdentifier:(NSString *)adUnitIdentifier; +- (void)createMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier atPosition:(nullable NSString *)mrecPosition; +- (void)createMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset; +- (void)loadMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)setMRecPlacement:(nullable NSString *)placement forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)startMRecAutoRefreshForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)stopMRecAutoRefreshForAdUnitIdentifier:(nullable NSString *)adUnitIdentifer; +- (void)setMRecExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value; +- (void)setMRecLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value; +- (void)setMRecCustomData:(nullable NSString *)customData forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)showMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)destroyMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)hideMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)updateMRecPosition:(nullable NSString *)mrecPosition forAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)updateMRecPosition:(CGFloat)xOffset y:(CGFloat)yOffset forAdUnitIdentifier:(nullable 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)setCrossPromoAdPlacement:(nullable NSString *)placement forAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)showCrossPromoAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)destroyCrossPromoAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)hideCrossPromoAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)updateCrossPromoAdPositionForAdUnitIdentifier:(NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset width:(CGFloat)width height:(CGFloat)height rotation:(CGFloat)rotation; -- (NSString *)crossPromoAdLayoutForAdUnitIdentifier:(NSString *)adUnitIdentifier; +- (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:(nullable NSString *)adUnitIdentifier; +- (void)showCrossPromoAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)destroyCrossPromoAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)hideCrossPromoAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)updateCrossPromoAdPositionForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier x:(CGFloat)xOffset y:(CGFloat)yOffset width:(CGFloat)width height:(CGFloat)height rotation:(CGFloat)rotation; +- (NSString *)crossPromoAdLayoutForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; -- (void)loadInterstitialWithAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (BOOL)isInterstitialReadyWithAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)showInterstitialWithAdUnitIdentifier:(NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData; -- (void)setInterstitialExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable NSString *)value; -- (void)setInterstitialLocalExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable id)value; +- (void)loadInterstitialWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (BOOL)isInterstitialReadyWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)showInterstitialWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData; +- (void)setInterstitialExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value; +- (void)setInterstitialLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value; -- (void)loadAppOpenAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (BOOL)isAppOpenAdReadyWithAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)showAppOpenAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData; -- (void)setAppOpenAdExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable NSString *)value; -- (void)setAppOpenAdLocalExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable id)value; +- (void)loadAppOpenAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (BOOL)isAppOpenAdReadyWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)showAppOpenAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData; +- (void)setAppOpenAdExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value; +- (void)setAppOpenAdLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value; -- (void)loadRewardedAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (BOOL)isRewardedAdReadyWithAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)showRewardedAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData; -- (void)setRewardedAdExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable NSString *)value; -- (void)setRewardedAdLocalExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable id)value; +- (void)loadRewardedAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (BOOL)isRewardedAdReadyWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)showRewardedAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData; +- (void)setRewardedAdExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value; +- (void)setRewardedAdLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value; -- (void)loadRewardedInterstitialAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (BOOL)isRewardedInterstitialAdReadyWithAdUnitIdentifier:(NSString *)adUnitIdentifier; -- (void)showRewardedInterstitialAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData; -- (void)setRewardedInterstitialAdExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable NSString *)value; -- (void)setRewardedInterstitialAdLocalExtraParameterForAdUnitIdentifier:(NSString *)adUnitIdentifier key:(NSString *)key value:(nullable id)value; +- (void)loadRewardedInterstitialAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (BOOL)isRewardedInterstitialAdReadyWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; +- (void)showRewardedInterstitialAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier placement:(nullable NSString *)placement customData:(nullable NSString *)customData; +- (void)setRewardedInterstitialAdExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable NSString *)value; +- (void)setRewardedInterstitialAdLocalExtraParameterForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier key:(nullable NSString *)key value:(nullable id)value; // Event Tracking -- (void)trackEvent:(NSString *)event parameters:(NSString *)parameters; +- (void)trackEvent:(nullable NSString *)event parameters:(nullable NSString *)parameters; // Ad Info -- (NSString *)adInfoForAdUnitIdentifier:(NSString *)adUnitIdentifier; +- (NSString *)adInfoForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier; // Ad Value -- (NSString *)adValueForAdUnitIdentifier:(NSString *)adUnitIdentifier withKey:(NSString *)key; +- (NSString *)adValueForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier withKey:(nullable NSString *)key; // User Service - (void)didDismissUserConsentDialog; -// Consent Flow -- (void)startConsentFlow; +// CMP Service +- (void)showCMPForExistingUser; // Utils + (NSString *)serializeParameters:(NSDictionary *)dict; -+ (NSDictionary *)deserializeParameters:(NSString *)serialized; ++ (NSDictionary *)deserializeParameters:(nullable NSString *)serialized; /** * Creates an instance of @c MAUnityAdManager if needed and returns the singleton instance. @@ -109,8 +109,4 @@ typedef void (*ALUnityBackgroundCallback)(const char* args); @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 diff --git a/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.h.meta b/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.h.meta index 47ae840..aef1db5 100644 --- a/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.h.meta +++ b/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.h.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d3a319587a4a744d898e112357c46370 +guid: 4209563f82b8a4f7dabf03705ab761c6 labels: - al_max - al_max_export_path-MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.h diff --git a/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m b/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m index ad26ac6..eb874ac 100644 --- a/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m +++ b/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m @@ -5,7 +5,7 @@ #import "MAUnityAdManager.h" -#define VERSION @"5.11.4" +#define VERSION @"6.1.2" #define KEY_WINDOW [UIApplication sharedApplication].keyWindow #define DEVICE_SPECIFIC_ADVIEW_AD_FORMAT ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) ? MAAdFormat.leader : MAAdFormat.banner @@ -42,7 +42,7 @@ extern "C" { } #endif -@interface MAUnityAdManager() +@interface MAUnityAdManager() // Parent Fields @property (nonatomic, weak) ALSdk *sdk; @@ -184,7 +184,6 @@ static ALUnityBackgroundCallback backgroundCallback; self.sdk = [ALSdk sharedWithSettings: settings]; } - self.sdk.variableService.delegate = self; [self.sdk setPluginVersion: [@"Max-Unity-" stringByAppendingString: VERSION]]; self.sdk.mediationProvider = @"max"; [self.sdk initializeSdkWithCompletionHandler:^(ALSdkConfiguration *configuration) @@ -192,9 +191,11 @@ static ALUnityBackgroundCallback backgroundCallback; // Note: internal state should be updated first completionHandler( configuration ); + NSString *consentFlowUserGeographyStr = @(configuration.consentFlowUserGeography).stringValue; NSString *consentDialogStateStr = @(configuration.consentDialogState).stringValue; NSString *appTrackingStatus = @(configuration.appTrackingTransparencyStatus).stringValue; // Deliberately name it `appTrackingStatus` to be a bit more generic (in case Android introduces a similar concept) [MAUnityAdManager forwardUnityEventWithArgs: @{@"name" : @"OnSdkInitializedEvent", + @"consentFlowUserGeography" : consentFlowUserGeographyStr, @"consentDialogState" : consentDialogStateStr, @"countryCode" : configuration.countryCode, @"appTrackingStatus" : appTrackingStatus, @@ -207,87 +208,93 @@ static ALUnityBackgroundCallback backgroundCallback; #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]; } -- (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)]; } -- (void)loadBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier +- (void)loadBannerWithAdUnitIdentifier:(nullable NSString *)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]; } -- (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]]; } -- (void)startBannerAutoRefreshForAdUnitIdentifier:(NSString *)adUnitIdentifier +- (void)startBannerAutoRefreshForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { [self startAdViewAutoRefreshForAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]]; } -- (void)stopBannerAutoRefreshForAdUnitIdentifier:(NSString *)adUnitIdentifier +- (void)stopBannerAutoRefreshForAdUnitIdentifier:(nullable NSString *)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]]; } -- (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]]; } -- (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]]; } -- (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]; } -- (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]; } -- (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]]; } -- (void)showBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier +- (void)showBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { [self showAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]]; } -- (void)hideBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier +- (void)hideBannerWithAdUnitIdentifier:(nullable NSString *)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]]; } -- (void)destroyBannerWithAdUnitIdentifier:(NSString *)adUnitIdentifier +- (void)destroyBannerWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { [self destroyAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: [self adViewAdFormatForAdUnitIdentifier: adUnitIdentifier]]; } @@ -299,84 +306,90 @@ static ALUnityBackgroundCallback backgroundCallback; #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]; } -- (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)]; } -- (void)loadMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier +- (void)loadMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { [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]; } -- (void)startMRecAutoRefreshForAdUnitIdentifier:(NSString *)adUnitIdentifier +- (void)startMRecAutoRefreshForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { [self startAdViewAutoRefreshForAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec]; } -- (void)stopMRecAutoRefreshForAdUnitIdentifier:(NSString *)adUnitIdentifier +- (void)stopMRecAutoRefreshForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { [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]; } -- (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]; } -- (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]; } -- (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]; } -- (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]; } -- (void)showMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier +- (void)showMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { [self showAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec]; } -- (void)destroyMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier +- (void)destroyMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { [self destroyAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec]; } -- (void)hideMRecWithAdUnitIdentifier:(NSString *)adUnitIdentifier +- (void)hideMRecWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { [self hideAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec]; } -- (NSString *)mrecLayoutForAdUnitIdentifier:(NSString *)adUnitIdentifier +- (NSString *)mrecLayoutForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { return [self adViewLayoutForAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.mrec]; } #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.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)]; } -- (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]; } -- (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.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]; } -- (void)showCrossPromoAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier +- (void)showCrossPromoAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { [self showAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.crossPromo]; } -- (void)destroyCrossPromoAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier +- (void)destroyCrossPromoAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { [self destroyAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.crossPromo]; } -- (void)hideCrossPromoAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier +- (void)hideCrossPromoAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { [self hideAdViewWithAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.crossPromo]; } -- (NSString *)crossPromoAdLayoutForAdUnitIdentifier:(NSString *)adUnitIdentifier +- (NSString *)crossPromoAdLayoutForAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { return [self adViewLayoutForAdUnitIdentifier: adUnitIdentifier adFormat: MAAdFormat.crossPromo]; } #pragma mark - Interstitials -- (void)loadInterstitialWithAdUnitIdentifier:(NSString *)adUnitIdentifier +- (void)loadInterstitialWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { MAInterstitialAd *interstitial = [self retrieveInterstitialForAdUnitIdentifier: adUnitIdentifier]; [interstitial loadAd]; } -- (BOOL)isInterstitialReadyWithAdUnitIdentifier:(NSString *)adUnitIdentifier +- (BOOL)isInterstitialReadyWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { MAInterstitialAd *interstitial = [self retrieveInterstitialForAdUnitIdentifier: adUnitIdentifier]; 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]; [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]; [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]; [interstitial setLocalExtraParameterForKey: key value: value]; } #pragma mark - App Open Ads -- (void)loadAppOpenAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier +- (void)loadAppOpenAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { MAAppOpenAd *appOpenAd = [self retrieveAppOpenAdForAdUnitIdentifier: adUnitIdentifier]; [appOpenAd loadAd]; } -- (BOOL)isAppOpenAdReadyWithAdUnitIdentifier:(NSString *)adUnitIdentifier +- (BOOL)isAppOpenAdReadyWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { MAAppOpenAd *appOpenAd = [self retrieveAppOpenAdForAdUnitIdentifier: adUnitIdentifier]; 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]; [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]; [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]; [appOpenAd setLocalExtraParameterForKey: key value: value]; } #pragma mark - Rewarded -- (void)loadRewardedAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier +- (void)loadRewardedAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { MARewardedAd *rewardedAd = [self retrieveRewardedAdForAdUnitIdentifier: adUnitIdentifier]; [rewardedAd loadAd]; } -- (BOOL)isRewardedAdReadyWithAdUnitIdentifier:(NSString *)adUnitIdentifier +- (BOOL)isRewardedAdReadyWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { MARewardedAd *rewardedAd = [self retrieveRewardedAdForAdUnitIdentifier: adUnitIdentifier]; 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]; [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]; [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]; [rewardedAd setLocalExtraParameterForKey: key value: value]; } #pragma mark - Rewarded Interstitials -- (void)loadRewardedInterstitialAdWithAdUnitIdentifier:(NSString *)adUnitIdentifier +- (void)loadRewardedInterstitialAdWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { MARewardedInterstitialAd *rewardedInterstitialAd = [self retrieveRewardedInterstitialAdForAdUnitIdentifier: adUnitIdentifier]; [rewardedInterstitialAd loadAd]; } -- (BOOL)isRewardedInterstitialAdReadyWithAdUnitIdentifier:(NSString *)adUnitIdentifier +- (BOOL)isRewardedInterstitialAdReadyWithAdUnitIdentifier:(nullable NSString *)adUnitIdentifier { MARewardedInterstitialAd *rewardedInterstitialAd = [self retrieveRewardedInterstitialAdForAdUnitIdentifier: adUnitIdentifier]; 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]; [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]; [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]; [rewardedInterstitialAd setLocalExtraParameterForKey: key value: value]; } #pragma mark - Event Tracking -- (void)trackEvent:(NSString *)event parameters:(NSString *)parameters +- (void)trackEvent:(nullable NSString *)event parameters:(nullable NSString *)parameters { NSDictionary *deserializedParameters = [MAUnityAdManager deserializeParameters: parameters]; [self.sdk.eventService trackEvent: event parameters: deserializedParameters]; @@ -555,9 +592,9 @@ static ALUnityBackgroundCallback backgroundCallback; #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]; if ( !ad ) return @""; @@ -644,9 +681,10 @@ static ALUnityBackgroundCallback backgroundCallback; #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]; if ( !ad ) return @""; @@ -1119,16 +1157,21 @@ static ALUnityBackgroundCallback backgroundCallback; self.adViewAdFormats[adUnitIdentifier] = adFormat; [self positionAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat]; - // Enable adaptive banners by default. - if ( ( self.adViewExtraParametersToSetAfterCreate[@"adaptive_banner"] != nil ) && ( adFormat == MAAdFormat.banner || adFormat == MAAdFormat.leader ) ) + NSDictionary *extraParameters = self.adViewExtraParametersToSetAfterCreate[adUnitIdentifier]; + + // 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 - if ( self.adViewExtraParametersToSetAfterCreate[adUnitIdentifier] ) + if ( extraParameters ) { - NSDictionary *extraParameters = self.adViewExtraParametersToSetAfterCreate[adUnitIdentifier]; for ( NSString *key in extraParameters ) { [adView setExtraParameterForKey: key value: extraParameters[key]]; @@ -1186,7 +1229,7 @@ static ALUnityBackgroundCallback backgroundCallback; MAAdView *adView = [self retrieveAdViewForAdUnitIdentifier: adUnitIdentifier adFormat: adFormat]; 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; } @@ -1275,13 +1318,17 @@ static ALUnityBackgroundCallback backgroundCallback; max_unity_dispatch_on_main_thread(^{ [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 ) { - [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]; }); } @@ -1307,7 +1354,7 @@ static ALUnityBackgroundCallback backgroundCallback; } 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. NSMutableDictionary *extraParameters = self.adViewExtraParametersToSetAfterCreate[adUnitIdentifier]; @@ -1340,7 +1387,7 @@ static ALUnityBackgroundCallback backgroundCallback; } 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. NSMutableDictionary *localExtraParameters = self.adViewLocalExtraParametersToSetAfterCreate[adUnitIdentifier]; @@ -1698,15 +1745,7 @@ static ALUnityBackgroundCallback backgroundCallback; // All positions have constant height NSMutableArray *constraints = [NSMutableArray arrayWithObject: [adView.heightAnchor constraintEqualToConstant: adViewSize.height]]; - UILayoutGuide *layoutGuide; - if ( @available(iOS 11.0, *) ) - { - layoutGuide = superview.safeAreaLayoutGuide; - } - else - { - layoutGuide = superview.layoutMarginsGuide; - } + UILayoutGuide *layoutGuide = superview.safeAreaLayoutGuide; if ( [adViewPosition isEqual: @"top_center"] || [adViewPosition isEqual: @"bottom_center"] ) { @@ -1963,7 +2002,7 @@ static ALUnityBackgroundCallback backgroundCallback; return [[NSString alloc] initWithData: jsonData encoding: NSUTF8StringEncoding]; } -+ (NSDictionary *)deserializeParameters:(NSString *)serialized ++ (NSDictionary *)deserializeParameters:(nullable NSString *)serialized { if ( serialized.length > 0 ) { @@ -2004,37 +2043,27 @@ static ALUnityBackgroundCallback backgroundCallback; [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 *args = [NSMutableDictionary dictionaryWithCapacity: 3]; - args[@"name"] = @"OnSdkConsentFlowCompletedEvent"; + NSMutableDictionary *args = [NSMutableDictionary dictionaryWithCapacity: 2]; + args[@"name"] = @"OnCmpCompletedEvent"; if ( error ) { - args[@"code"] = @(error.code); - args[@"message"] = error.message; + args[@"error"] = @{@"code": @(error.code), + @"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 *)variables -{ - [MAUnityAdManager forwardUnityEventWithArgs: @{@"name" : @"OnVariablesUpdatedEvent"}]; -} - - (MAAd *)adWithAdUnitIdentifier:(NSString *)adUnitIdentifier { @synchronized ( self.adInfoDictLock ) diff --git a/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m.meta b/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m.meta index 6cd047c..8c3581e 100644 --- a/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m.meta +++ b/MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6106db18e3d7745c0a67bd23e2996272 +guid: 2973e70bd2fa74984b35aea07ae9db52 labels: - al_max - al_max_export_path-MaxSdk/AppLovin/Plugins/iOS/MAUnityAdManager.m diff --git a/MaxSdk/AppLovin/Plugins/iOS/MAUnityPlugin.mm b/MaxSdk/AppLovin/Plugins/iOS/MAUnityPlugin.mm index 7db976f..edac38f 100644 --- a/MaxSdk/AppLovin/Plugins/iOS/MAUnityPlugin.mm +++ b/MaxSdk/AppLovin/Plugins/iOS/MAUnityPlugin.mm @@ -33,6 +33,7 @@ extern "C" static NSString *_userIdentifierToSet; static NSString *_userSegmentNameToSet; static NSArray *_testDeviceIdentifiersToSet; + static NSNumber *_mutedToSet; static NSNumber *_verboseLoggingToSet; static NSNumber *_creativeDebuggerEnabledToSet; static NSNumber *_exceptionHandlerEnabledToSet; @@ -50,12 +51,17 @@ extern "C" // Helper method to create C string copy static const char * cStringCopy(NSString *string); // Helper method to log errors - void logUninitializedAccessError(char *callingMethod); + void logUninitializedAccessError(const char *callingMethod); bool isPluginInitialized() { return _isPluginInitialized; } + + bool isReadyToInteractWithSdk() + { + return isPluginInitialized() && _sdk; + } void maybeInitializePlugin() { @@ -65,12 +71,34 @@ extern "C" _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 * toStringArray(char **arrayPointer, int size) { NSMutableArray *array = [NSMutableArray arrayWithCapacity: size]; for ( int i = 0; i < size; i++ ) { - [array addObject: NSSTRING(arrayPointer[i])]; + NSString *element = NSSTRING(arrayPointer[i]); + if ( element ) + { + [array addObject: element]; + } } return array; @@ -105,25 +133,31 @@ extern "C" _testDeviceIdentifiersToSet = nil; } - if ( _verboseLoggingToSet ) + if ( _mutedToSet != nil) + { + settings.muted = _mutedToSet.boolValue; + _mutedToSet = nil; + } + + if ( _verboseLoggingToSet != nil ) { settings.verboseLoggingEnabled = _verboseLoggingToSet.boolValue; _verboseLoggingToSet = nil; } - if ( _creativeDebuggerEnabledToSet ) + if ( _creativeDebuggerEnabledToSet != nil ) { settings.creativeDebuggerEnabled = _creativeDebuggerEnabledToSet.boolValue; _creativeDebuggerEnabledToSet = nil; } - if ( _exceptionHandlerEnabledToSet ) + if ( _exceptionHandlerEnabledToSet != nil ) { settings.exceptionHandlerEnabled = _exceptionHandlerEnabledToSet.boolValue; _exceptionHandlerEnabledToSet = nil; } - if ( _locationCollectionEnabledToSet ) + if ( _locationCollectionEnabledToSet != nil ) { settings.locationCollectionEnabled = _locationCollectionEnabledToSet.boolValue; _locationCollectionEnabledToSet = nil; @@ -214,7 +248,7 @@ extern "C" _userSegmentNameToSet = nil; } - if ( _targetingYearOfBirth ) + if ( _targetingYearOfBirth != nil ) { _sdk.targetingData.yearOfBirth = _targetingYearOfBirth.intValue <= 0 ? nil : _targetingYearOfBirth; _targetingYearOfBirth = nil; @@ -226,7 +260,7 @@ extern "C" _targetingGender = nil; } - if ( _targetingMaximumAdContentRating ) + if ( _targetingMaximumAdContentRating != nil ) { _sdk.targetingData.maximumAdContentRating = getAppLovinAdContentRating(_targetingMaximumAdContentRating.intValue); _targetingMaximumAdContentRating = nil; @@ -453,10 +487,12 @@ extern "C" return cStringCopy(@""); } + NSString *consentFlowUserGeographyStr = @(_sdk.configuration.consentFlowUserGeography).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) - return cStringCopy([MAUnityAdManager serializeParameters: @{@"consentDialogState" : consentDialogStateStr, + return cStringCopy([MAUnityAdManager serializeParameters: @{@"consentFlowUserGeography" : consentFlowUserGeographyStr, + @"consentDialogState" : consentDialogStateStr, @"countryCode" : _sdk.configuration.countryCode, @"appTrackingStatus" : appTrackingStatus, @"isSuccessfullyInitialized" : @([_sdk isInitialized]), @@ -564,10 +600,28 @@ extern "C" void _MaxSetBannerLocalExtraParameter(const char *adUnitIdentifier, const char *key, MAUnityRef value) { + if ( !isReadyToInteractWithSdk() ) + { + logUninitializedAccessError("_MaxSetBannerLocalExtraParameter"); + } + [_adManager setBannerLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier) key: NSSTRING(key) 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) { @@ -697,10 +751,28 @@ extern "C" void _MaxSetMRecLocalExtraParameter(const char *adUnitIdentifier, const char *key, MAUnityRef value) { + if ( !isReadyToInteractWithSdk() ) + { + logUninitializedAccessError("_MaxSetMRecLocalExtraParameter"); + } + [_adManager setMRecLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier) key: NSSTRING(key) 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) { @@ -775,11 +847,29 @@ extern "C" void _MaxSetInterstitialLocalExtraParameter(const char *adUnitIdentifier, const char *key, MAUnityRef value) { + if ( !isReadyToInteractWithSdk() ) + { + logUninitializedAccessError("_MaxSetInterstitialLocalExtraParameter"); + } + [_adManager setInterstitialLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier) key: NSSTRING(key) 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) { if (!isPluginInitialized()) return false; @@ -810,10 +900,28 @@ extern "C" void _MaxSetAppOpenAdLocalExtraParameter(const char *adUnitIdentifier, const char *key, MAUnityRef value) { + if ( !isReadyToInteractWithSdk() ) + { + logUninitializedAccessError("_MaxSetAppOpenAdLocalExtraParameter"); + } + [_adManager setAppOpenAdLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier) key: NSSTRING(key) 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) { @@ -845,11 +953,29 @@ extern "C" void _MaxSetRewardedAdLocalExtraParameter(const char *adUnitIdentifier, const char *key, MAUnityRef value) { + if ( !isReadyToInteractWithSdk() ) + { + logUninitializedAccessError("_MaxSetRewardedAdLocalExtraParameter"); + } + [_adManager setRewardedAdLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier) key: NSSTRING(key) 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) { if (!isPluginInitialized()) return false; @@ -880,11 +1006,29 @@ extern "C" void _MaxSetRewardedInterstitialAdLocalExtraParameter(const char *adUnitIdentifier, const char *key, MAUnityRef value) { + if ( !isReadyToInteractWithSdk() ) + { + logUninitializedAccessError("_MaxSetRewardedInterstitialAdLocalExtraParameter"); + } + [_adManager setRewardedInterstitialAdLocalExtraParameterForAdUnitIdentifier: NSSTRING(adUnitIdentifier) key: NSSTRING(key) 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) { if (!isPluginInitialized()) return false; @@ -905,20 +1049,6 @@ extern "C" [_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() { @@ -929,6 +1059,32 @@ extern "C" { 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) { @@ -938,16 +1094,29 @@ extern "C" void _MaxSetMuted(bool muted) { - if ( !_sdk ) return; - - _sdk.settings.muted = muted; + if ( _sdk ) + { + _sdk.settings.muted = muted; + _mutedToSet = nil; + } + else + { + _mutedToSet = @(muted); + } } 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() @@ -984,9 +1153,9 @@ extern "C" { return [_sdk.settings isVerboseLoggingEnabled]; } - else if ( _verboseLoggingToSet ) + else if ( _verboseLoggingToSet != nil ) { - return _verboseLoggingToSet; + return _verboseLoggingToSet.boolValue; } return false; @@ -1060,27 +1229,27 @@ extern "C" } } } - - const char * _MaxGetCFType() - { - 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() + + void _MaxShowCmpForExistingUser() { if (!isPluginInitialized()) { - logUninitializedAccessError("_MaxStartConsentFlow"); + logUninitializedAccessError("_MaxShowCmpForExistingUser"); return; } - [_adManager startConsentFlow]; + [_adManager showCMPForExistingUser]; + } + + bool _MaxHasSupportedCmp() + { + if (!isPluginInitialized()) + { + logUninitializedAccessError("_MaxHasSupportedCmp"); + return false; + } + + return [_sdk.cmpService hasSupportedCMP]; } float _MaxGetAdaptiveBannerHeight(const float width) @@ -1088,18 +1257,10 @@ extern "C" 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); } - - [[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 diff --git a/MaxSdk/AppLovin/Plugins/iOS/MAUnityPlugin.mm.meta b/MaxSdk/AppLovin/Plugins/iOS/MAUnityPlugin.mm.meta index 5d8ad34..5ea08ff 100644 --- a/MaxSdk/AppLovin/Plugins/iOS/MAUnityPlugin.mm.meta +++ b/MaxSdk/AppLovin/Plugins/iOS/MAUnityPlugin.mm.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 193b1bac1aa9a4e1292257dc02aa3ec5 +guid: 7e373ed7168b243e6b706e991ab5a643 labels: - al_max - al_max_export_path-MaxSdk/AppLovin/Plugins/iOS/MAUnityPlugin.mm diff --git a/MaxSdk/Prefabs.meta b/MaxSdk/Prefabs.meta index 83cc3ce..d017132 100644 --- a/MaxSdk/Prefabs.meta +++ b/MaxSdk/Prefabs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2f02c68646b3246d1822c96d17458b4d +guid: 60751ca71e0eb4db49941064964cb08c labels: - al_max - al_max_export_path-MaxSdk/Prefabs diff --git a/MaxSdk/Prefabs/BannerBottom.prefab.meta b/MaxSdk/Prefabs/BannerBottom.prefab.meta index fc73161..153cfcf 100644 --- a/MaxSdk/Prefabs/BannerBottom.prefab.meta +++ b/MaxSdk/Prefabs/BannerBottom.prefab.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c40cd08161edf43b49140ec091e9f067 +guid: 54c062c0526b148efa2ea2e9489b3aa0 labels: - al_max - al_max_export_path-MaxSdk/Prefabs/BannerBottom.prefab diff --git a/MaxSdk/Prefabs/BannerTop.prefab.meta b/MaxSdk/Prefabs/BannerTop.prefab.meta index c1e2ca1..52ef464 100644 --- a/MaxSdk/Prefabs/BannerTop.prefab.meta +++ b/MaxSdk/Prefabs/BannerTop.prefab.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9b4937edd18714f3ebeb656de6e4d54b +guid: 6521750c87fd14f709d09a1e38ffde47 labels: - al_max - al_max_export_path-MaxSdk/Prefabs/BannerTop.prefab diff --git a/MaxSdk/Prefabs/Interstitial.prefab.meta b/MaxSdk/Prefabs/Interstitial.prefab.meta index d8b7b5b..4fa240b 100644 --- a/MaxSdk/Prefabs/Interstitial.prefab.meta +++ b/MaxSdk/Prefabs/Interstitial.prefab.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 06407a673b7194053b3fb593a9933c95 +guid: 3fc0c2627ce8a4490b8e319326f8a535 labels: - al_max - al_max_export_path-MaxSdk/Prefabs/Interstitial.prefab diff --git a/MaxSdk/Prefabs/Rewarded.prefab.meta b/MaxSdk/Prefabs/Rewarded.prefab.meta index 503754d..214bea1 100644 --- a/MaxSdk/Prefabs/Rewarded.prefab.meta +++ b/MaxSdk/Prefabs/Rewarded.prefab.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 72244923a898c463c912b2675256c85c +guid: a28c1544d6f094d5eafc8da2343c9119 labels: - al_max - al_max_export_path-MaxSdk/Prefabs/Rewarded.prefab diff --git a/MaxSdk/Resources.meta b/MaxSdk/Resources.meta index 85845f7..be36d03 100644 --- a/MaxSdk/Resources.meta +++ b/MaxSdk/Resources.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a1858b796f36642b8bcdcd9e7e3499e4 +guid: 3d4208cf7aaa64c71b19b2d4468d029b labels: - al_max - al_max_export_path-MaxSdk/Resources diff --git a/MaxSdk/Resources/Images.meta b/MaxSdk/Resources/Images.meta index 557d3a8..cfacfa5 100644 --- a/MaxSdk/Resources/Images.meta +++ b/MaxSdk/Resources/Images.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: afea262d96e02419e89cbd76ec9c309b +guid: 5c7cba3bc9ef5454ea7d5f9bd1dffd22 labels: - al_max - al_max_export_path-MaxSdk/Resources/Images diff --git a/MaxSdk/Resources/Images/alert_icon.png.meta b/MaxSdk/Resources/Images/alert_icon.png.meta index b3b2d45..634d290 100644 --- a/MaxSdk/Resources/Images/alert_icon.png.meta +++ b/MaxSdk/Resources/Images/alert_icon.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 39fa469b3fe3544888d5f706a27da06f +guid: 572fee4574afa4f6dbf2846e0c152fe8 labels: - al_max - al_max_export_path-MaxSdk/Resources/Images/alert_icon.png diff --git a/MaxSdk/Resources/Images/uninstall_icon.png.meta b/MaxSdk/Resources/Images/uninstall_icon.png.meta index d458454..0f39816 100644 --- a/MaxSdk/Resources/Images/uninstall_icon.png.meta +++ b/MaxSdk/Resources/Images/uninstall_icon.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 63817ca5b9e284a488a67b769db18813 +guid: d24994f48fdd0430692e3d49279cd782 labels: - al_max - al_max_export_path-MaxSdk/Resources/Images/uninstall_icon.png diff --git a/MaxSdk/Resources/Images/warning_icon.png.meta b/MaxSdk/Resources/Images/warning_icon.png.meta index d74ff37..ee4941c 100644 --- a/MaxSdk/Resources/Images/warning_icon.png.meta +++ b/MaxSdk/Resources/Images/warning_icon.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 966e6c9af57a640288672d89ee58a2fc +guid: b504c956e7ed744b6b0e7f014e1cac5a labels: - al_max - al_max_export_path-MaxSdk/Resources/Images/warning_icon.png diff --git a/MaxSdk/Scripts.meta b/MaxSdk/Scripts.meta index befb8c9..bda0c74 100644 --- a/MaxSdk/Scripts.meta +++ b/MaxSdk/Scripts.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: da3d2b54764a24ac0a8ce8394b67467f +guid: 7f9882faebe0b4edaabf65e14a921fcb labels: - al_max - al_max_export_path-MaxSdk/Scripts diff --git a/MaxSdk/Scripts/Editor.meta b/MaxSdk/Scripts/Editor.meta index 15aed79..7adfefb 100644 --- a/MaxSdk/Scripts/Editor.meta +++ b/MaxSdk/Scripts/Editor.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2b64bca2685cb419f847736eb5a1ac92 +guid: b6903b66cb8984df289e6d66f9c52ddc labels: - al_max - al_max_export_path-MaxSdk/Scripts/Editor diff --git a/MaxSdk/Scripts/Editor/MaxInitialization.cs b/MaxSdk/Scripts/Editor/MaxInitialization.cs index 16c0ccb..a1dc1df 100644 --- a/MaxSdk/Scripts/Editor/MaxInitialization.cs +++ b/MaxSdk/Scripts/Editor/MaxInitialization.cs @@ -20,11 +20,11 @@ namespace AppLovinMax.Scripts.Editor private static readonly List ObsoleteNetworks = new List { "Snap", + "Tapjoy", "VerizonAds", "VoodooAds" }; -#if UNITY_2018_2_OR_NEWER private static readonly List ObsoleteFileExportPathsToDelete = new List { // The `EventSystemChecker` has been renamed to `MaxEventSystemChecker`. @@ -45,7 +45,7 @@ namespace AppLovinMax.Scripts.Editor "Plugins/Android/MaxMediationGoogle.androidlib", "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.meta", "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.meta", "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() { @@ -84,7 +91,6 @@ namespace AppLovinMax.Scripts.Editor AppLovinIntegrationManager.AddLabelsToAssetsIfNeeded(pluginParentDir, isPluginOutsideAssetsDir); -#if UNITY_2018_2_OR_NEWER foreach (var obsoleteFileExportPathToDelete in ObsoleteFileExportPathsToDelete) { var pathToDelete = MaxSdkUtils.GetAssetPathForExportPath(obsoleteFileExportPathToDelete); @@ -95,7 +101,6 @@ namespace AppLovinMax.Scripts.Editor changesMade = true; } } -#endif // Check if any obsolete networks are installed foreach (var obsoleteNetwork in ObsoleteNetworks) diff --git a/MaxSdk/Scripts/Editor/MaxInitialization.cs.meta b/MaxSdk/Scripts/Editor/MaxInitialization.cs.meta index aaafdd0..a96a577 100644 --- a/MaxSdk/Scripts/Editor/MaxInitialization.cs.meta +++ b/MaxSdk/Scripts/Editor/MaxInitialization.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 512169ab4bfaf406c81d28878b456b30 +guid: bc0c5693335e0408a95293c0d7b61137 labels: - al_max - al_max_export_path-MaxSdk/Scripts/Editor/MaxInitialization.cs diff --git a/MaxSdk/Scripts/Editor/MaxPostProcessBuildAndroid.cs b/MaxSdk/Scripts/Editor/MaxPostProcessBuildAndroid.cs index 8ad8aee..c0d1e13 100644 --- a/MaxSdk/Scripts/Editor/MaxPostProcessBuildAndroid.cs +++ b/MaxSdk/Scripts/Editor/MaxPostProcessBuildAndroid.cs @@ -6,7 +6,7 @@ // Copyright © 2020 AppLovin. All rights reserved. // -#if UNITY_ANDROID && UNITY_2018_2_OR_NEWER +#if UNITY_ANDROID using AppLovinMax.Scripts.IntegrationManager.Editor; using System; using System.Collections.Generic; @@ -93,9 +93,8 @@ namespace AppLovinMax.Scripts.Editor ProcessAndroidManifest(path); 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); } else diff --git a/MaxSdk/Scripts/Editor/MaxPostProcessBuildAndroid.cs.meta b/MaxSdk/Scripts/Editor/MaxPostProcessBuildAndroid.cs.meta index 80d55e9..07e4133 100644 --- a/MaxSdk/Scripts/Editor/MaxPostProcessBuildAndroid.cs.meta +++ b/MaxSdk/Scripts/Editor/MaxPostProcessBuildAndroid.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 87732883951bc404e85f2a223d3bd7c8 +guid: 75fed160a41749d4990cee871ee618a4 labels: - al_max - al_max_export_path-MaxSdk/Scripts/Editor/MaxPostProcessBuildAndroid.cs diff --git a/MaxSdk/Scripts/Editor/MaxPostProcessBuildiOS.cs b/MaxSdk/Scripts/Editor/MaxPostProcessBuildiOS.cs index 9dd3d7d..816c336 100644 --- a/MaxSdk/Scripts/Editor/MaxPostProcessBuildiOS.cs +++ b/MaxSdk/Scripts/Editor/MaxPostProcessBuildiOS.cs @@ -45,17 +45,21 @@ namespace AppLovinMax.Scripts.Editor private const string KeyConsentFlowEnabled = "ConsentFlowEnabled"; private const string KeyConsentFlowTermsOfService = "ConsentFlowTermsOfService"; private const string KeyConsentFlowPrivacyPolicy = "ConsentFlowPrivacyPolicy"; - private const string KeyConsentFlowAdvertisingPartners = "ConsentFlowAdvertisingPartners"; - private const string KeyConsentFlowIncludeDefaultAdvertisingPartners = "ConsentFlowIncludeDefaultAdvertisingPartners"; - private const string KeyConsentFlowAnalyticsPartners = "ConsentFlowAnalyticsPartners"; - private const string KeyConsentFlowIncludeDefaultAnalyticsPartners = "ConsentFlowIncludeDefaultAnalyticsPartners"; + private const string KeyConsentFlowDebugUserGeography = "ConsentFlowDebugUserGeography"; private static readonly List DynamicLibrariesToEmbed = new List { "DTBiOSSDK.xcframework", + "FBAEMKit.xcframework", "FBSDKCoreKit_Basics.xcframework", + "FBSDKCoreKit.xcframework", + "FBSDKGamingServicesKit.xcframework", + "FBSDKLoginKit.xcframework", + "FBSDKShareKit.xcframework", "HyprMX.xcframework", + "LinkedinAudienceNetwork.xcframework", "IASDKCore.xcframework", + "Maio.xcframework", "MobileFuseSDK.xcframework", "OMSDK_Appodeal.xcframework", "OMSDK_Ogury.xcframework", @@ -63,31 +67,6 @@ namespace AppLovinMax.Scripts.Editor "OMSDK_Smaato.xcframework" }; - private static List SwiftLanguageNetworks - { - get - { - var swiftLanguageNetworks = new List(); - 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 EmbedSwiftStandardLibrariesNetworks = new List - { - "Facebook", - "UnityAds" - }; - private static string PluginMediationDirectory { get @@ -113,7 +92,7 @@ namespace AppLovinMax.Scripts.Editor #endif EmbedDynamicLibrariesIfNeeded(buildPath, project, unityMainTargetGuid); - var internalSettingsEnabled = AppLovinSettings.Instance.ShowInternalSettingsInIntegrationManager; + var internalSettingsEnabled = AppLovinInternalSettings.Instance.ConsentFlowEnabled; var userTrackingUsageDescriptionDe = internalSettingsEnabled ? AppLovinInternalSettings.Instance.UserTrackingUsageDescriptionDe : AppLovinSettings.Instance.UserTrackingUsageDescriptionDe; LocalizeUserTrackingDescriptionIfNeeded(userTrackingUsageDescriptionDe, "de", buildPath, project, unityMainTargetGuid); 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; LocalizeUserTrackingDescriptionIfNeeded(userTrackingUsageDescriptionZhHant, "zh-Hant", buildPath, project, unityMainTargetGuid); - AddSwiftSupportIfNeeded(buildPath, project, unityFrameworkTargetGuid); - EmbedSwiftStandardLibrariesIfNeeded(buildPath, project, unityMainTargetGuid); + AddSwiftSupport(buildPath, project, unityFrameworkTargetGuid, unityMainTargetGuid); AddYandexSettingsIfNeeded(project, unityMainTargetGuid); project.WriteToFile(projectPath); @@ -171,11 +149,7 @@ namespace AppLovinMax.Scripts.Editor } #else string runpathSearchPaths; -#if UNITY_2018_2_OR_NEWER runpathSearchPaths = project.GetBuildPropertyForAnyConfig(targetGuid, "LD_RUNPATH_SEARCH_PATHS"); -#else - runpathSearchPaths = "$(inherited)"; -#endif runpathSearchPaths += string.IsNullOrEmpty(runpathSearchPaths) ? "" : " "; // 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; var settings = AppLovinSettings.Instance; - var internalSettingsEnabled = settings.ShowInternalSettingsInIntegrationManager; - if (internalSettingsEnabled) - { - var internalSettings = AppLovinInternalSettings.Instance; - return !internalSettings.ConsentFlowEnabled || !internalSettings.UserTrackingUsageLocalizationEnabled; - } + var internalSettings = AppLovinInternalSettings.Instance; - 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 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 CreateSwiftFile(swiftFilePath); var swiftFileGuid = project.AddFile(swiftFileRelativePath, swiftFileRelativePath, PBXSourceTree.Source); - project.AddFileToBuild(targetGuid, swiftFileGuid); + project.AddFileToBuild(unityFrameworkTargetGuid, swiftFileGuid); // Add Swift version property if needed -#if UNITY_2018_2_OR_NEWER - var swiftVersion = project.GetBuildPropertyForAnyConfig(targetGuid, "SWIFT_VERSION"); -#else - // Assume that swift version is not set on older versions of Unity. - const string swiftVersion = ""; -#endif + var swiftVersion = project.GetBuildPropertyForAnyConfig(unityFrameworkTargetGuid, "SWIFT_VERSION"); if (string.IsNullOrEmpty(swiftVersion)) { - project.SetBuildProperty(targetGuid, "SWIFT_VERSION", "5.0"); + project.SetBuildProperty(unityFrameworkTargetGuid, "SWIFT_VERSION", "5.0"); } // Enable Swift modules - project.AddBuildProperty(targetGuid, "CLANG_ENABLE_MODULES", "YES"); - } - - /// - /// 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 - /// - 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"); + project.AddBuildProperty(unityFrameworkTargetGuid, "CLANG_ENABLE_MODULES", "YES"); + project.AddBuildProperty(unityMainTargetGuid, "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", "YES"); } private static void CreateSwiftFile(string swiftFilePath) @@ -356,10 +285,8 @@ namespace AppLovinMax.Scripts.Editor SetSdkKeyIfNeeded(plist); SetAttributionReportEndpointIfNeeded(plist); -#if UNITY_2018_2_OR_NEWER EnableVerboseLoggingIfNeeded(plist); AddGoogleApplicationIdIfNeeded(plist); -#endif AddSdkSettingsIfNeeded(plist, path); EnableTermsFlowIfNeeded(plist); @@ -396,7 +323,6 @@ namespace AppLovinMax.Scripts.Editor } } -#if UNITY_2018_2_OR_NEWER private static void EnableVerboseLoggingIfNeeded(PlistDocument plist) { if (!EditorPrefs.HasKey(MaxSdkLogger.KeyVerboseLoggingEnabled)) return; @@ -428,7 +354,6 @@ namespace AppLovinMax.Scripts.Editor plist.root.SetString(googleApplicationIdentifier, appId); } -#endif private static void AddYandexSettingsIfNeeded(PBXProject project, string unityMainTargetGuid) { @@ -445,8 +370,6 @@ namespace AppLovinMax.Scripts.Editor 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. if (!AppLovinInternalSettings.Instance.ConsentFlowEnabled) return; @@ -495,44 +418,22 @@ namespace AppLovinMax.Scripts.Editor consentFlowInfoRoot.SetString(KeyConsentFlowPrivacyPolicy, privacyPolicyUrl); var termsOfServiceUrl = AppLovinInternalSettings.Instance.ConsentFlowTermsOfServiceUrl; - if (!string.IsNullOrEmpty(termsOfServiceUrl)) + if (MaxSdkUtils.IsValidString(termsOfServiceUrl)) { consentFlowInfoRoot.SetString(KeyConsentFlowTermsOfService, termsOfServiceUrl); } - var advertisingPartnerUrls = AppLovinInternalSettings.Instance.ConsentFlowAdvertisingPartnerUrls; - if (MaxSdkUtils.IsValidString(advertisingPartnerUrls)) + var debugUserGeography = AppLovinInternalSettings.Instance.DebugUserGeography; + if (debugUserGeography == MaxSdkBase.ConsentFlowUserGeography.Gdpr) { - var advertisingPartnerUrlsList = advertisingPartnerUrls.Split(','); - var advertisingPartnersArray = consentFlowInfoRoot.CreateArray(KeyConsentFlowAdvertisingPartners); - foreach (var advertisingPartner in advertisingPartnerUrlsList) - { - advertisingPartnersArray.AddString(advertisingPartner); - } + consentFlowInfoRoot.SetString(KeyConsentFlowDebugUserGeography, "gdpr"); } - 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); } 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. var consentFlowEnabled = AppLovinSettings.Instance.ConsentFlowEnabled; if (!consentFlowEnabled) return; @@ -625,37 +526,36 @@ namespace AppLovinMax.Scripts.Editor 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 var maxMediationDirectory = PluginMediationDirectory; if (Directory.Exists(maxMediationDirectory)) { var mediationNetworkDirectories = Directory.GetDirectories(maxMediationDirectory); - var installedNetworks = mediationNetworkDirectories.Select(Path.GetFileName).ToArray(); - var adNetworks = string.Join(",", installedNetworks); + var installedNetworks = mediationNetworkDirectories.Select(Path.GetFileName).ToList(); + if (AppLovinSettings.Instance.AddApsSkAdNetworkIds) + { + installedNetworks.Add("AmazonPublisherServices"); + } + + var adNetworks = string.Join(",", installedNetworks.ToArray()); 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())) { -#if UNITY_2017_2_OR_NEWER var operation = unityWebRequest.SendWebRequest(); -#else - var operation = unityWebRequest.Send(); -#endif // Wait for the download to complete or the request to timeout. while (!operation.isDone) { } #if UNITY_2020_1_OR_NEWER if (unityWebRequest.result != UnityWebRequest.Result.Success) -#elif UNITY_2017_2_OR_NEWER - if (unityWebRequest.isNetworkError || unityWebRequest.isHttpError) #else - if (unityWebRequest.isError) + if (unityWebRequest.isNetworkError || unityWebRequest.isHttpError) #endif { MaxSdkLogger.UserError("Failed to retrieve SKAdNetwork IDs with error: " + unityWebRequest.error); diff --git a/MaxSdk/Scripts/Editor/MaxPostProcessBuildiOS.cs.meta b/MaxSdk/Scripts/Editor/MaxPostProcessBuildiOS.cs.meta index 0c510bc..78d2f6d 100644 --- a/MaxSdk/Scripts/Editor/MaxPostProcessBuildiOS.cs.meta +++ b/MaxSdk/Scripts/Editor/MaxPostProcessBuildiOS.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e71caf465f5b24f848fa05c337203e79 +guid: 29959b3cd36c484a9d57d6b7ca7f7bfa labels: - al_max - al_max_export_path-MaxSdk/Scripts/Editor/MaxPostProcessBuildiOS.cs diff --git a/MaxSdk/Scripts/Editor/MaxSdk.Scripts.Editor.asmdef.meta b/MaxSdk/Scripts/Editor/MaxSdk.Scripts.Editor.asmdef.meta index 690992a..b13c71a 100644 --- a/MaxSdk/Scripts/Editor/MaxSdk.Scripts.Editor.asmdef.meta +++ b/MaxSdk/Scripts/Editor/MaxSdk.Scripts.Editor.asmdef.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 75f93d930c51d43579f691746bd04a70 +guid: 691e0eb4b7a542dba2219d48c3254f1c labels: - al_max - al_max_export_path-MaxSdk/Scripts/Editor/MaxSdk.Scripts.Editor.asmdef diff --git a/MaxSdk/Scripts/IntegrationManager.meta b/MaxSdk/Scripts/IntegrationManager.meta index 054e7b9..39f65cc 100644 --- a/MaxSdk/Scripts/IntegrationManager.meta +++ b/MaxSdk/Scripts/IntegrationManager.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9903db0d6994746d4bee2e4ac615e8ef +guid: e01816bc45c944d03afb95d035caf0e1 labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager diff --git a/MaxSdk/Scripts/IntegrationManager/Editor.meta b/MaxSdk/Scripts/IntegrationManager/Editor.meta index 06993c4..1d8400a 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor.meta +++ b/MaxSdk/Scripts/IntegrationManager/Editor.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 735b8675e6ac746d0ac244312653f7f2 +guid: 0da229e279400497786c39933fe02e52 labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinAutoUpdater.cs b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinAutoUpdater.cs index 01cc639..2b3e87b 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinAutoUpdater.cs +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinAutoUpdater.cs @@ -19,9 +19,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor public class AppLovinAutoUpdater { 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 static readonly DateTime EpochTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); 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"}, {"MYTARGET_NETWORK", "android_5.9.1.2_ios_5.7.5.1"}, {"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"}, {"UNITY_NETWORK", "android_3.4.8.2_ios_3.4.8.2"}, {"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. EditorPrefs.SetInt(KeyLastUpdateCheckTime, now); -#if !UNITY_2018_2_OR_NEWER - ShowNotSupportingOldUnityVersionsIfNeeded(); -#endif - // Load the plugin data AppLovinEditorCoroutine.StartCoroutine(AppLovinIntegrationManager.Instance.LoadPluginData(data => { @@ -156,27 +148,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor 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) { var googleResult = MaxSdkUtils.CompareVersions(googleVersion, breakingVersion); diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinAutoUpdater.cs.meta b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinAutoUpdater.cs.meta index 33f843c..0070e74 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinAutoUpdater.cs.meta +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinAutoUpdater.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: cad9b94a708924ff0a04401d8fe8f91e +guid: 8bcdd5226273242c5bd9ec79568202e6 labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinAutoUpdater.cs diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinCommandLine.cs.meta b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinCommandLine.cs.meta index 8b9aea2..2c3ff20 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinCommandLine.cs.meta +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinCommandLine.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 869a2cef2a7a64292929ad064f924d02 +guid: 2d0aa55f9a7d2440f871dfb256372a33 labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinCommandLine.cs diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinDownloadHandler.cs b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinDownloadHandler.cs deleted file mode 100644 index 75f359a..0000000 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinDownloadHandler.cs +++ /dev/null @@ -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 diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinEditorCoroutine.cs.meta b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinEditorCoroutine.cs.meta index 8c0e60e..c622bab 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinEditorCoroutine.cs.meta +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinEditorCoroutine.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 3c817f90804464e0b85d008d27c91f9e +guid: 95747c688378548eeb92aeb528ac96ff labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinEditorCoroutine.cs diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManager.cs b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManager.cs index 1b328e1..3b1b9d9 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManager.cs +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManager.cs @@ -24,6 +24,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor { public Network AppLovinMax; public Network[] MediatedNetworks; + public Network[] PartnerMicroSdks; } [Serializable] @@ -183,14 +184,10 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor /// /// Whether or not the plugin is under the Assets/ folder. /// -//--- INJECT PluginOutside START --- public static bool IsPluginOutsideAssetsDirectory - { get => !(PluginParentDirectory.StartsWith("Assets") || PluginParentDirectory.StartsWith("Packages")); } -//--- INJECT PluginOutside OVER --- -// { -// get { return !PluginParentDirectory.StartsWith("Assets"); } -// } - + { + get { return !PluginParentDirectory.StartsWith("Assets"); } + } /// /// Whether or not gradle build system is enabled. @@ -213,7 +210,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor /// public static bool CanProcessAndroidQualityServiceSettings { - get { return GradleTemplateEnabled || (GradleBuildEnabled && IsUnity2018_2OrNewer()); } + get { return GradleTemplateEnabled || GradleBuildEnabled; } } /// @@ -283,23 +280,17 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor /// Callback to be called once the plugin data download completes. public IEnumerator LoadPluginData(Action 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)) { -#if UNITY_2017_2_OR_NEWER 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. #if UNITY_2020_1_OR_NEWER if (www.result != UnityWebRequest.Result.Success) -#elif UNITY_2017_2_OR_NEWER - if (www.isNetworkError || www.isHttpError) #else - if (www.isError) + if (www.isNetworkError || www.isHttpError) #endif { callback(null); @@ -329,6 +320,11 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor { UpdateCurrentVersions(network, mediationPluginParentDirectory); } + + foreach (var partnerMicroSdk in pluginData.PartnerMicroSdks) + { + UpdateCurrentVersions(partnerMicroSdk, mediationPluginParentDirectory); + } } callback(pluginData); @@ -410,22 +406,14 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor public IEnumerator DownloadPlugin(Network network, bool showImport = true) { 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); -#else - var downloadHandler = new AppLovinDownloadHandler(path); -#endif webRequest = new UnityWebRequest(network.DownloadUrl) { method = UnityWebRequest.kHttpVerbGET, downloadHandler = downloadHandler }; -#if UNITY_2017_2_OR_NEWER var operation = webRequest.SendWebRequest(); -#else - var operation = webRequest.Send(); -#endif while (!operation.isDone) { 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 (webRequest.result != UnityWebRequest.Result.Success) -#elif UNITY_2017_2_OR_NEWER - if (webRequest.isNetworkError || webRequest.isHttpError) #else - if (webRequest.isError) + if (webRequest.isNetworkError || webRequest.isHttpError) #endif { MaxSdkLogger.UserError(webRequest.error); @@ -593,16 +579,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor return importingNetwork != null && GetPluginFileName(importingNetwork).Contains(packageName); } - /// - /// Returns a URL friendly version string by replacing periods with underscores. - /// - private static string GetPluginVersionForUrl() - { - var version = MaxSdk.Version; - var versionsSplit = version.Split('.'); - return string.Join("_", versionsSplit); - } - /// /// Adds labels to assets so that they can be easily found. /// @@ -795,15 +771,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor 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) { return network.Name.ToLowerInvariant() + "_" + network.LatestVersions.Unity + ".unitypackage"; diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManager.cs.meta b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManager.cs.meta index b9938d2..e9e3603 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManager.cs.meta +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManager.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: da789f9f05f40451a9e20176746ee18d +guid: c5b874c1e65274159bcc0dc15d9458cc labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManager.cs diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManagerWindow.cs b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManagerWindow.cs index 59a3911..5c3f2d1 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManagerWindow.cs +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManagerWindow.cs @@ -25,6 +25,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor private const string appLovinSdkKeyLink = "https://dash.applovin.com/o/account#keys"; private const string userTrackingUsageDescriptionDocsLink = "https://developer.apple.com/documentation/bundleresources/information_property_list/nsusertrackingusagedescription"; + private const string documentationTermsAndPrivacyPolicyFlow = "https://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 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"; @@ -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" + "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[] debugUserGeographies = new string[2] {"Not Set", "GDPR"}; private Vector2 scrollPosition; 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. AppLovinIntegrationManager.importPackageCompletedCallback = OnImportPackageCompleted; - // Disable old consent flow if internal settings are enabled. - if (AppLovinSettings.Instance.ShowInternalSettingsInIntegrationManager) + // Disable old consent flow if new flow is enabled. + if (AppLovinInternalSettings.Instance.ConsentFlowEnabled) { AppLovinSettings.Instance.ConsentFlowEnabled = false; + AppLovinSettings.Instance.SaveAsync(); } Load(); @@ -190,6 +193,12 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor DrawPluginDetails(); + if (pluginData != null && pluginData.PartnerMicroSdks != null) + { + EditorGUILayout.LabelField("AppLovin Micro SDK Partners", titleLabelStyle); + DrawPartnerMicroSdks(); + } + // Draw mediated networks using (new EditorGUILayout.HorizontalScope(GUILayout.ExpandHeight(false))) { @@ -313,10 +322,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor 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); @@ -397,6 +402,29 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor 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(); + } + /// /// Draws the network specific details for a given network. /// @@ -476,7 +504,9 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor var pluginRoot = AppLovinIntegrationManager.MediationSpecificPluginParentDirectory; 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); @@ -626,14 +656,13 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor GUILayout.Space(10); using (new EditorGUILayout.VerticalScope("box")) { - var shouldDrawInternalSettings = AppLovinSettings.Instance.ShowInternalSettingsInIntegrationManager; - if (shouldDrawInternalSettings) + if (AppLovinSettings.Instance.ConsentFlowEnabled) { - DrawConsentFlowSettings(); + DrawTermsFlowSettings(); } else { - DrawTermsFlowSettings(); + DrawConsentFlowSettings(); } } @@ -643,6 +672,25 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor 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.Space(4); AppLovinSettings.Instance.ConsentFlowEnabled = GUILayout.Toggle(AppLovinSettings.Instance.ConsentFlowEnabled, " Enable Terms Flow"); @@ -702,6 +750,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor Application.OpenURL(userTrackingUsageDescriptionDocsLink); } + GUILayout.Space(4); GUILayout.EndHorizontal(); GUILayout.Space(4); @@ -711,39 +760,36 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor { GUILayout.BeginHorizontal(); 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.Space(6); GUILayout.Space(4); + EditorGUILayout.HelpBox("This flow automatically includes Google UMP.", MessageType.Info); + GUI.enabled = true; 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.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.BeginHorizontal(); GUILayout.Space(4); @@ -800,7 +846,21 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor GUILayout.Space(4); GUILayout.EndHorizontal(); + GUILayout.Space(8); + + GUILayout.BeginHorizontal(); 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() @@ -812,16 +872,12 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor GUILayout.Space(5); AppLovinSettings.Instance.SetAttributionReportEndpoint = DrawOtherSettingsToggle(AppLovinSettings.Instance.SetAttributionReportEndpoint, " Set Advertising Attribution Report Endpoint in Info.plist (iOS only)"); 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"); EditorPrefs.SetBool(AppLovinAutoUpdater.KeyAutoUpdateEnabled, autoUpdateEnabled); GUILayout.Space(5); - var verboseLoggingEnabled = DrawOtherSettingsToggle(EditorPrefs.GetBool(MaxSdkLogger.KeyVerboseLoggingEnabled, false), -#if UNITY_2018_2_OR_NEWER - " Enable Verbose Logging" -#else - " Enable Build Verbose Logging" -#endif - ); + var verboseLoggingEnabled = DrawOtherSettingsToggle(EditorPrefs.GetBool(MaxSdkLogger.KeyVerboseLoggingEnabled, false), " Enable Verbose Logging"); EditorPrefs.SetBool(MaxSdkLogger.KeyVerboseLoggingEnabled, verboseLoggingEnabled); GUILayout.Space(5); } diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManagerWindow.cs.meta b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManagerWindow.cs.meta index 4163743..d7996fd 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManagerWindow.cs.meta +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManagerWindow.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2bb13a4fb97554d838321056d4d1f81b +guid: 84c61b4c05e114cec91df447d1b585f8 labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinIntegrationManagerWindow.cs diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinInternalSettings.cs b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinInternalSettings.cs index 61962f3..41552d9 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinInternalSettings.cs +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinInternalSettings.cs @@ -34,11 +34,8 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor [SerializeField] private bool consentFlowEnabled; [SerializeField] private string consentFlowPrivacyPolicyUrl = 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 MaxSdkBase.ConsentFlowUserGeography debugUserGeography; [SerializeField] private string userTrackingUsageDescriptionEn = string.Empty; [SerializeField] private bool userTrackingUsageLocalizationEnabled; [SerializeField] private string userTrackingUsageDescriptionDe = string.Empty; @@ -121,8 +118,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor UserTrackingUsageDescriptionEn = string.Empty; UserTrackingUsageLocalizationEnabled = false; OverrideDefaultUserTrackingUsageDescriptions = false; - ConsentFlowIncludeDefaultAdvertisingPartnerUrls = true; - ConsentFlowIncludeDefaultAnalyticsPartnerUrls = true; } } } @@ -145,42 +140,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor set { consentFlowTermsOfServiceUrl = value; } } - /// - /// An array of advertising partner URLs. These URLs list are shown during the GDPR flow. - /// - public string ConsentFlowAdvertisingPartnerUrls - { - get { return consentFlowAdvertisingPartnerUrls; } - set { consentFlowAdvertisingPartnerUrls = value; } - } - - /// - /// Whether or not to include a default set of advertising partners. Defaults to true. - /// - public bool ConsentFlowIncludeDefaultAdvertisingPartnerUrls - { - get { return includeDefaultAdvertisingPartnerUrls; } - set { includeDefaultAdvertisingPartnerUrls = value; } - } - - /// - /// An array of analytics partner URLs. These URLs list are shown during the GDPR flow. - /// - public string ConsentFlowAnalyticsPartnerUrls - { - get { return consentFlowAnalyticsPartnerUrls; } - set { consentFlowAnalyticsPartnerUrls = value; } - } - - /// - /// Whether or not to include a default set of analytics partners. Defaults to true. - /// - public bool ConsentFlowIncludeDefaultAnalyticsPartnerUrls - { - get { return consentFlowIncludeDefaultAnalyticsPartnerUrls; } - set { consentFlowIncludeDefaultAnalyticsPartnerUrls = value; } - } - /// /// A User Tracking Usage Description in English to be shown to users when requesting permission to use data for tracking. /// For more information see Apple's documentation. @@ -191,6 +150,15 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor set { userTrackingUsageDescriptionEn = value; } } + /// + /// An optional string to set debug user geography + /// + public MaxSdkBase.ConsentFlowUserGeography DebugUserGeography + { + get { return debugUserGeography; } + set { debugUserGeography = value; } + } + public bool OverrideDefaultUserTrackingUsageDescriptions { get { return overrideDefaultUserTrackingUsageDescriptions; } diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinInternalSettings.cs.meta b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinInternalSettings.cs.meta index 80da2bf..a863905 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinInternalSettings.cs.meta +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinInternalSettings.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 5a9f7c32d2d9e41e89f201dfc8770b13 +guid: 65c51e21887ae42c2839962fb9585e9f labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinInternalSettings.cs diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessAndroidGradle.cs b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessAndroidGradle.cs index ad4b31c..5e094fd 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessAndroidGradle.cs +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessAndroidGradle.cs @@ -6,7 +6,7 @@ // Copyright © 2019 AppLovin. All rights reserved. // -#if UNITY_2018_2_OR_NEWER && UNITY_ANDROID +#if UNITY_ANDROID using System.IO; using UnityEditor.Android; diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessAndroidGradle.cs.meta b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessAndroidGradle.cs.meta index 25d8a71..c167f0c 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessAndroidGradle.cs.meta +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessAndroidGradle.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6af46e436a4b44671b5320be741172db +guid: f75e54e2eb78f427ca8643c97684387b labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessAndroidGradle.cs diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessiOS.cs b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessiOS.cs index 078ae4a..41c1561 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessiOS.cs +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessiOS.cs @@ -49,11 +49,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor } // Download the ruby script needed to install Quality Service -#if UNITY_2017_2_OR_NEWER var downloadHandler = new DownloadHandlerFile(outputFilePath); -#else - var downloadHandler = new AppLovinDownloadHandler(path); -#endif var postJson = string.Format("{{\"sdk_key\" : \"{0}\"}}", sdkKey); var bodyRaw = Encoding.UTF8.GetBytes(postJson); var uploadHandler = new UploadHandlerRaw(bodyRaw); @@ -64,21 +60,15 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor unityWebRequest.method = UnityWebRequest.kHttpVerbPOST; unityWebRequest.downloadHandler = downloadHandler; unityWebRequest.uploadHandler = uploadHandler; -#if UNITY_2017_2_OR_NEWER var operation = unityWebRequest.SendWebRequest(); -#else - var operation = webRequest.Send(); -#endif // Wait for the download to complete or the request to timeout. while (!operation.isDone) { } #if UNITY_2020_1_OR_NEWER if (unityWebRequest.result != UnityWebRequest.Result.Success) -#elif UNITY_2017_2_OR_NEWER - if (unityWebRequest.isNetworkError || unityWebRequest.isHttpError) #else - if (webRequest.isError) + if (unityWebRequest.isNetworkError || unityWebRequest.isHttpError) #endif { MaxSdkLogger.UserError("AppLovin Quality Service installation failed. Failed to download script with error: " + unityWebRequest.error); diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessiOS.cs.meta b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessiOS.cs.meta index 7166385..8182708 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessiOS.cs.meta +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessiOS.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: cc867a09c5aa14978b1cf1d2522961ce +guid: d5d209f90444f4a90830b48b5f3f3ff4 labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPostProcessiOS.cs diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcess.cs b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcess.cs new file mode 100644 index 0000000..2b8500d --- /dev/null +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcess.cs @@ -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 + }; + + /// + /// Adds a string into AppLovin's Dependencies.xml file inside the containerElementString if it doesn't exist + /// + /// The line you want to add into the xml file + /// The root XML element under which to add the line. For example, to add a new dependency to Android, pass in "androidPackages" + 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); + } + } + + /// + /// Removes a string from AppLovin's Dependencies.xml file inside the containerElementString if it exists + /// + /// The line you want to remove from the xml file + /// The root XML element from which to remove the line. For example, to remove an Android dependency, pass in "androidPackages" + 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); + } + } + } +} diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinDownloadHandler.cs.meta b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcess.cs.meta similarity index 81% rename from MaxSdk/Scripts/IntegrationManager/Editor/AppLovinDownloadHandler.cs.meta rename to MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcess.cs.meta index b6e7d3c..f5e00db 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinDownloadHandler.cs.meta +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcess.cs.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: 4ed678026df674e9d8df1cd02e2469e4 +guid: 0e6254f24e89548b3a7644fa7bf25f9d labels: - al_max -- al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinDownloadHandler.cs +- al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcess.cs MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessAndroid.cs b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessAndroid.cs index 366288b..2761fec 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessAndroid.cs +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessAndroid.cs @@ -15,23 +15,16 @@ using System.IO; using AppLovinMax.ThirdParty.MiniJson; using UnityEditor; using UnityEditor.Build; -#if UNITY_2018_1_OR_NEWER using UnityEditor.Build.Reporting; using UnityEngine; -#endif namespace AppLovinMax.Scripts.IntegrationManager.Editor { /// /// Adds the AppLovin Quality Service plugin to the gradle template file. See for more details. /// - public class AppLovinPreProcessAndroid : AppLovinProcessGradleBuildFile, -#if UNITY_2018_1_OR_NEWER - IPreprocessBuildWithReport -#else - IPreprocessBuild -#endif + public class AppLovinPreProcessAndroid : AppLovinProcessGradleBuildFile, IPreprocessBuildWithReport { 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 KeyConsentFlowTermsOfService = "consent_flow_terms_of_service"; private const string KeyConsentFlowPrivacyPolicy = "consent_flow_privacy_policy"; - private const string KeyConsentFlowAdvertisingPartners = "consent_flow_advertising_partners"; - 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"; + private const string KeyConsentFlowDebugUserGeography = "consent_flow_debug_user_geography"; -#if UNITY_2018_1_OR_NEWER public void OnPreprocessBuild(BuildReport report) -#else - public void OnPreprocessBuild(BuildTarget target, string path) -#endif + { + PreprocessAppLovinQualityServicePlugin(); + 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). if (!AppLovinIntegrationManager.GradleTemplateEnabled) return; @@ -65,15 +57,6 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor #else AddAppLovinQualityServicePlugin(AppLovinIntegrationManager.GradleTemplatePath); #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) @@ -105,20 +88,10 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor consentFlowSettings[KeyConsentFlowTermsOfService] = termsOfServiceUrl; } - consentFlowSettings[KeyConsentFlowIncludeDefaultAdvertisingPartners] = AppLovinInternalSettings.Instance.ConsentFlowIncludeDefaultAdvertisingPartnerUrls; - var advertisingPartnerUrls = AppLovinInternalSettings.Instance.ConsentFlowAdvertisingPartnerUrls; - if (MaxSdkUtils.IsValidString(advertisingPartnerUrls)) + var debugUserGeography = AppLovinInternalSettings.Instance.DebugUserGeography; + if (debugUserGeography == MaxSdkBase.ConsentFlowUserGeography.Gdpr) { - var advertisingPartnerUrlsList = advertisingPartnerUrls.Split(',').ToList(); - 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; + consentFlowSettings[KeyConsentFlowDebugUserGeography] = "gdpr"; } var applovinSdkSettings = new Dictionary(); @@ -130,7 +103,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor 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. var consentFlowEnabled = AppLovinSettings.Instance.ConsentFlowEnabled; @@ -206,6 +179,21 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor } } + private static void AddGoogleCmpDependencyIfNeeded() + { + const string umpDependencyLine = ""; + const string containerElementString = "androidPackages"; + + if (AppLovinInternalSettings.Instance.ConsentFlowEnabled) + { + TryAddStringToDependencyFile(umpDependencyLine, containerElementString); + } + else + { + TryRemoveStringFromDependencyFile(umpDependencyLine, containerElementString); + } + } + public int callbackOrder { get { return int.MaxValue; } diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessAndroid.cs.meta b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessAndroid.cs.meta index 1446db4..4dd79e8 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessAndroid.cs.meta +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessAndroid.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0e2f9480fec024b45bb33af29d3022d6 +guid: 8ccaf444d0d4f4cadb5debe7c41b20c4 labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessAndroid.cs diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessiOS.cs b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessiOS.cs new file mode 100644 index 0000000..dcffbc6 --- /dev/null +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessiOS.cs @@ -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 = ""; + const string containerElementString = "iosPods"; + + if (AppLovinInternalSettings.Instance.ConsentFlowEnabled) + { + TryAddStringToDependencyFile(umpDependencyLine, containerElementString); + } + else + { + TryRemoveStringFromDependencyFile(umpDependencyLine, containerElementString); + } + } + + public int callbackOrder + { + get { return int.MaxValue; } + } + } +} + +#endif diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessiOS.cs.meta b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessiOS.cs.meta new file mode 100644 index 0000000..33bdffb --- /dev/null +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinPreProcessiOS.cs.meta @@ -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: diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinProcessGradleBuildFile.cs b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinProcessGradleBuildFile.cs index 1ad2a82..48b4d0e 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinProcessGradleBuildFile.cs +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinProcessGradleBuildFile.cs @@ -29,7 +29,7 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor /// 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. /// - public abstract class AppLovinProcessGradleBuildFile + public abstract class AppLovinProcessGradleBuildFile : AppLovinPreProcess { private static readonly Regex TokenBuildScriptRepositories = new Regex(".*repositories.*"); 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. /// /// The gradle file to update. - protected void AddAppLovinQualityServicePlugin(string applicationGradleBuildFilePath) + protected static void AddAppLovinQualityServicePlugin(string applicationGradleBuildFilePath) { if (!AppLovinSettings.Instance.QualityServiceEnabled) return; @@ -297,21 +297,15 @@ namespace AppLovinMax.Scripts.IntegrationManager.Editor unityWebRequest.uploadHandler = uploadHandler; unityWebRequest.downloadHandler = new DownloadHandlerBuffer(); -#if UNITY_2017_2_OR_NEWER var operation = unityWebRequest.SendWebRequest(); -#else - var operation = webRequest.Send(); -#endif // Wait for the download to complete or the request to timeout. while (!operation.isDone) { } #if UNITY_2020_1_OR_NEWER if (unityWebRequest.result != UnityWebRequest.Result.Success) -#elif UNITY_2017_2_OR_NEWER - if (unityWebRequest.isNetworkError || unityWebRequest.isHttpError) #else - if (webRequest.isError) + if (unityWebRequest.isNetworkError || unityWebRequest.isHttpError) #endif { MaxSdkLogger.UserError("Failed to retrieve API Key for SDK Key: " + sdkKey + "with error: " + unityWebRequest.error); diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinProcessGradleBuildFile.cs.meta b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinProcessGradleBuildFile.cs.meta index 3b9b19c..5e49844 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinProcessGradleBuildFile.cs.meta +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinProcessGradleBuildFile.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a25d66215002f4728b56848ff01f7424 +guid: 732b7510bc9c94aafb3fd3b8c0dc5d2d labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinProcessGradleBuildFile.cs diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinSettings.cs b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinSettings.cs index 94bc0d0..540cbe8 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinSettings.cs +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinSettings.cs @@ -58,6 +58,7 @@ public class AppLovinSettings : ScriptableObject [SerializeField] private string sdkKey; [SerializeField] private bool setAttributionReportEndpoint; + [SerializeField] private bool addApsSkAdNetworkIds; [SerializeField] private bool consentFlowEnabled; [SerializeField] private Platform consentFlowPlatform; @@ -163,6 +164,15 @@ public class AppLovinSettings : ScriptableObject set { Instance.setAttributionReportEndpoint = value; } } + /// + /// Whether or not to add Amazon Publisher Services SKAdNetworkID's. + /// + public bool AddApsSkAdNetworkIds + { + get { return Instance.addApsSkAdNetworkIds; } + set { Instance.addApsSkAdNetworkIds = value; } + } + /// /// Whether or not AppLovin Consent Flow is enabled. /// diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinSettings.cs.meta b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinSettings.cs.meta index 9c8ec08..7e40d73 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinSettings.cs.meta +++ b/MaxSdk/Scripts/IntegrationManager/Editor/AppLovinSettings.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 589f0157fc8d1480a908eb38be2be8e6 +guid: ebc0ba1b5ef6b4a6b9dd53d7eadfea16 labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/AppLovinSettings.cs diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/MaxSdk.IntegrationManager.Editor.asmdef b/MaxSdk/Scripts/IntegrationManager/Editor/MaxSdk.IntegrationManager.Editor.asmdef index 2737229..1cc80b7 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/MaxSdk.IntegrationManager.Editor.asmdef +++ b/MaxSdk/Scripts/IntegrationManager/Editor/MaxSdk.IntegrationManager.Editor.asmdef @@ -1,18 +1,10 @@ { "name": "MaxSdk.Scripts.IntegrationManager.Editor", - "rootNamespace": "", "references": [ "MaxSdk.Scripts" ], "includePlatforms": [ "Editor" ], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file + "excludePlatforms": [] +} diff --git a/MaxSdk/Scripts/IntegrationManager/Editor/MaxSdk.IntegrationManager.Editor.asmdef.meta b/MaxSdk/Scripts/IntegrationManager/Editor/MaxSdk.IntegrationManager.Editor.asmdef.meta index a99dbb6..272b872 100644 --- a/MaxSdk/Scripts/IntegrationManager/Editor/MaxSdk.IntegrationManager.Editor.asmdef.meta +++ b/MaxSdk/Scripts/IntegrationManager/Editor/MaxSdk.IntegrationManager.Editor.asmdef.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0772632c471804ae89859df0956a3692 +guid: a10a05a8449c42519fd80f2b8b580de3 labels: - al_max - al_max_export_path-MaxSdk/Scripts/IntegrationManager/Editor/MaxSdk.IntegrationManager.Editor.asmdef diff --git a/MaxSdk/Scripts/MaxCmpService.cs b/MaxSdk/Scripts/MaxCmpService.cs new file mode 100644 index 0000000..c142439 --- /dev/null +++ b/MaxSdk/Scripts/MaxCmpService.cs @@ -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 + +/// +/// This class provides direct APIs for interfacing with the Google-certified CMP installed, if any. +/// +public class MaxCmpService +{ + private static readonly MaxCmpService _instance = new MaxCmpService(); + + private MaxCmpService() { } + + private static Action 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; } + } + + /// + /// Shows the CMP flow to an existing user. + /// Note that the user's current consent will be reset before the CMP alert is shown. + /// + /// Called when the CMP flow finishes showing. + public void ShowCmpForExistingUser(Action onCompletedAction) + { + OnCompletedAction = onCompletedAction; + +#if UNITY_EDITOR + var errorProps = new Dictionary + { + {"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 + } + + /// + /// Returns true if a supported CMP SDK is detected. + /// + public bool HasSupportedCmp + { + get + { +#if UNITY_EDITOR + return false; +#elif UNITY_ANDROID + return MaxUnityPluginClass.CallStatic("hasSupportedCmp"); +#elif UNITY_IOS + return _MaxHasSupportedCmp(); +#else + return false; +#endif + } + } + + internal static void NotifyCompletedIfNeeded(Dictionary errorProps) + { + if (OnCompletedAction == null) return; + + var error = (errorProps == null) ? null : MaxCmpError.Create(errorProps); + OnCompletedAction(error); + } +} + +public class MaxCmpError +{ + public enum ErrorCode + { + /// + /// Indicates that an unspecified error has occurred. + /// + Unspecified = -1, + + /// + /// Indicates that the CMP has not been integrated correctly. + /// + IntegrationError = 1, + + /// + /// Indicates that the CMP form is unavailable. + /// + FormUnavailable = 2, + + /// + /// Indicates that the CMP form is not required. + /// + FormNotRequired = 3 + } + + public static MaxCmpError Create(IDictionary 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() { } + + /// + /// The error code for this error. + /// + public ErrorCode Code { get; private set; } + + /// + /// The error message for this error. + /// + public string Message { get; private set; } + + /// + /// The error code returned by the CMP. + /// + public int CmpCode { get; private set; } + + /// + /// The error message returned by the CMP. + /// + public string CmpMessage { get; private set; } +} diff --git a/MaxSdk/Scripts/MaxCmpService.cs.meta b/MaxSdk/Scripts/MaxCmpService.cs.meta new file mode 100644 index 0000000..598fc90 --- /dev/null +++ b/MaxSdk/Scripts/MaxCmpService.cs.meta @@ -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: diff --git a/MaxSdk/Scripts/MaxEventSystemChecker.cs.meta b/MaxSdk/Scripts/MaxEventSystemChecker.cs.meta index f75521a..12874b6 100644 --- a/MaxSdk/Scripts/MaxEventSystemChecker.cs.meta +++ b/MaxSdk/Scripts/MaxEventSystemChecker.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 93afd2b1bb96f411d9e7bfa15fc9a0eb +guid: e0acf281ba86b4929a6942ecd998395b labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxEventSystemChecker.cs diff --git a/MaxSdk/Scripts/MaxEvents.cs.meta b/MaxSdk/Scripts/MaxEvents.cs.meta index 3a28e28..bfb6ad5 100644 --- a/MaxSdk/Scripts/MaxEvents.cs.meta +++ b/MaxSdk/Scripts/MaxEvents.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c13d7e9087ead447aa741d6d06aef9e1 +guid: 67ec2f620c6b0405ba16ea2c032dc9a2 labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxEvents.cs diff --git a/MaxSdk/Scripts/MaxSdk.Scripts.asmdef.meta b/MaxSdk/Scripts/MaxSdk.Scripts.asmdef.meta index cf4cd69..b55da72 100644 --- a/MaxSdk/Scripts/MaxSdk.Scripts.asmdef.meta +++ b/MaxSdk/Scripts/MaxSdk.Scripts.asmdef.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b2529e5083a524b099f54b2bb80f05fc +guid: a4cfc1a18fa3a469b96d885db522f42e labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxSdk.Scripts.asmdef diff --git a/MaxSdk/Scripts/MaxSdk.cs b/MaxSdk/Scripts/MaxSdk.cs index 1ffcf2c..9d24ee3 100644 --- a/MaxSdk/Scripts/MaxSdk.cs +++ b/MaxSdk/Scripts/MaxSdk.cs @@ -18,7 +18,7 @@ public class MaxSdk : MaxSdkUnityEditor #endif { - private const string _version = "5.11.4"; + private const string _version = "6.1.2"; /// /// Returns the current plugin version. diff --git a/MaxSdk/Scripts/MaxSdk.cs.meta b/MaxSdk/Scripts/MaxSdk.cs.meta index 9f55566..c1c32f4 100644 --- a/MaxSdk/Scripts/MaxSdk.cs.meta +++ b/MaxSdk/Scripts/MaxSdk.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b9c276744a7284b6788f515c12cc403c +guid: 2fc7aa576843c44e68c7ab14b475bb82 labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxSdk.cs diff --git a/MaxSdk/Scripts/MaxSdkAndroid.cs b/MaxSdk/Scripts/MaxSdkAndroid.cs index 47aecb1..0ed7612 100644 --- a/MaxSdk/Scripts/MaxSdkAndroid.cs +++ b/MaxSdk/Scripts/MaxSdkAndroid.cs @@ -13,11 +13,6 @@ public class MaxSdkAndroid : MaxSdkBase private static BackgroundCallbackProxy BackgroundCallback = new BackgroundCallbackProxy(); - public static MaxVariableServiceAndroid VariableService - { - get { return MaxVariableServiceAndroid.Instance; } - } - public static MaxUserServiceAndroid UserService { get { return MaxUserServiceAndroid.Instance; } @@ -415,17 +410,19 @@ public class MaxSdkAndroid : MaxSdkBase /// /// Ad unit identifier of the banner to set the local extra parameter for. /// The key for the local extra parameter. - /// The value for the extra parameter. Needs to be of type or null + /// The value for the extra parameter. Accepts the following types: , null, IList, IDictionary, string, primitive types 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"); - 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)); + } } /// @@ -598,17 +595,19 @@ public class MaxSdkAndroid : MaxSdkBase /// /// Ad unit identifier of the MREC to set the local extra parameter for. /// The key for the local extra parameter. - /// The value for the extra parameter. Needs to be of type or null + /// The value for the extra parameter. Accepts the following types: , null, IList, IDictionary, string, primitive types 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"); - 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)); + } } /// @@ -791,17 +790,19 @@ public class MaxSdkAndroid : MaxSdkBase /// /// Ad unit identifier of the interstitial to set the local extra parameter for. /// The key for the local extra parameter. - /// The value for the extra parameter. Needs to be of type or null + /// The value for the extra parameter. Accepts the following types: , null, IList, IDictionary, string, primitive types 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"); - 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 @@ -866,17 +867,19 @@ public class MaxSdkAndroid : MaxSdkBase /// /// Ad unit identifier of the app open ad to set the local extra parameter for. /// The key for the local extra parameter. - /// The value for the extra parameter. Needs to be of type or null + /// The value for the extra parameter. Accepts the following types: , null, IList, IDictionary, string, primitive types 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"); - 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 @@ -941,17 +944,19 @@ public class MaxSdkAndroid : MaxSdkBase /// /// Ad unit identifier of the rewarded to set the local extra parameter for. /// The key for the local extra parameter. - /// The value for the extra parameter. Needs to be of type or null + /// The value for the extra parameter. Accepts the following types: , null, IList, IDictionary, string, primitive types 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"); - 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 @@ -1016,17 +1021,19 @@ public class MaxSdkAndroid : MaxSdkBase /// /// Ad unit identifier of the rewarded interstitial to set the local extra parameter for. /// The key for the local extra parameter. - /// The value for the extra parameter. Needs to be of type or null + /// The value for the extra parameter. Accepts the following types: , null, IList, IDictionary, string, primitive types 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"); - 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 diff --git a/MaxSdk/Scripts/MaxSdkAndroid.cs.meta b/MaxSdk/Scripts/MaxSdkAndroid.cs.meta index c5cacde..2cf5448 100644 --- a/MaxSdk/Scripts/MaxSdkAndroid.cs.meta +++ b/MaxSdk/Scripts/MaxSdkAndroid.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e64643507f25d48268e8df04710b9dec +guid: 10335fad6bfef47b8819a411aa591dc8 labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxSdkAndroid.cs diff --git a/MaxSdk/Scripts/MaxSdkBase.cs b/MaxSdk/Scripts/MaxSdkBase.cs index 539e4cf..dfe1228 100644 --- a/MaxSdk/Scripts/MaxSdkBase.cs +++ b/MaxSdk/Scripts/MaxSdkBase.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -16,6 +17,26 @@ public abstract class MaxSdkBase protected static readonly MaxUserSegment SharedUserSegment = new MaxUserSegment(); protected static readonly MaxTargetingData SharedTargetingData = new MaxTargetingData(); + /// + /// This enum represents the user's geography used to determine the type of consent flow shown to the user. + /// + public enum ConsentFlowUserGeography + { + /// + /// User's geography is unknown. + /// + Unknown, + + /// + /// The user is in GDPR region. + /// + Gdpr, + + /// + /// The user is in a non-GDPR region. + /// + Other + } #if UNITY_EDITOR || UNITY_IPHONE || UNITY_IOS /// @@ -97,6 +118,12 @@ public abstract class MaxSdkBase public bool IsTestModeEnabled { get; private set; } + /// + /// Get the user's geography used to determine the type of consent flow shown to the user. + /// If no such determination could be made, will be returned. + /// + public ConsentFlowUserGeography ConsentFlowUserGeography { get; private set; } + [Obsolete("This API has been deprecated and will be removed in a future release.")] public ConsentDialogState ConsentDialogState { get; private set; } @@ -127,6 +154,21 @@ public abstract class MaxSdkBase sdkConfiguration.CountryCode = MaxSdkUtils.GetStringFromDictionary(eventProps, "countryCode", ""); 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 var consentDialogStateStr = MaxSdkUtils.GetStringFromDictionary(eventProps, "consentDialogState", ""); if ("1".Equals(consentDialogStateStr)) @@ -453,6 +495,14 @@ public abstract class MaxSdkBase } } + /// + /// The CMP service, which provides direct APIs for interfacing with the Google-certified CMP installed, if any. + /// + public static MaxCmpService CmpService + { + get { return MaxCmpService.Instance; } + } + protected static void ValidateAdUnitIdentifier(string adUnitIdentifier, string debugPurpose) { 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 data = new Dictionary + { + {"value", value} + }; + + return Json.Serialize(data); + } + [Obsolete("This API has been deprecated and will be removed in a future release.")] public enum ConsentDialogState { @@ -622,44 +688,15 @@ internal static class AdPositionExtenstion namespace AppLovinMax.Internal.API { + [Obsolete("This class has been deprecated and will be removed in a future SDK release.")] public class CFError { - /// - /// Indicates that the flow ended in an unexpected state. - /// - public const int ErrorCodeUnspecified = -1; - - /// - /// Indicates that the consent flow has not been integrated correctly. - /// - public const int ErrorCodeInvalidIntegration = -100; - - /// - /// Indicates that the consent flow is already being shown. - /// - public const int ErrorCodeFlowAlreadyInProgress = -200; - - /// - /// Indicates that the user is not in a GDPR region. - /// - public const int ErrorCodeNotInGdprRegion = -300; - - /// - /// The error code for this error. Will be one of the error codes listed in this file. - /// public int Code { get; private set; } - /// - /// The error message for this error. - /// public string Message { get; private set; } - public static CFError Create(IDictionary 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); } @@ -676,97 +713,45 @@ namespace AppLovinMax.Internal.API } } + [Obsolete("This enum has been deprecated. Please use `MaxSdk.GetSdkConfiguration().ConsentFlowUserGeography` instead.")] public enum CFType { - /// - /// The flow type is not known. - /// Unknown, - - /// - /// A standard flow where a TOS/PP alert is shown. - /// Standard, - - /// - /// A detailed modal shown to users in GDPR region. - /// Detailed } public class CFService { - private static Action OnConsentFlowCompletedAction; - -#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 - - /// - /// The consent flow type that will be displayed. - /// + [Obsolete("This property has been deprecated. Please use `MaxSdk.GetSdkConfiguration().ConsentFlowUserGeography` instead.")] public static CFType CFType { get { - var cfType = "0"; -#if UNITY_EDITOR -#elif UNITY_ANDROID - cfType = MaxUnityPluginClass.CallStatic("getCFType"); -#elif UNITY_IOS - cfType = _MaxGetCFType(); -#endif - - if ("1".Equals(cfType)) + switch (MaxSdk.GetSdkConfiguration().ConsentFlowUserGeography) { - 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; } } - /// - /// 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. - /// - /// Called when we finish showing the consent flow. Error object will be null if the flow completed successfully. + [Obsolete("This method has been deprecated. Please use `MaxSdk.CmpService.ShowCmpForExistingUser` instead.")] public static void SCF(Action onFlowCompletedAction) { - OnConsentFlowCompletedAction = onFlowCompletedAction; - -#if UNITY_EDITOR - var errorDict = new Dictionary() + MaxSdkBase.CmpService.ShowCmpForExistingUser(error => { - {"code", CFError.ErrorCodeUnspecified}, - {"message", "Consent flow is not supported in Unity Editor."} - }; + if (onFlowCompletedAction == null) return; - NotifyConsentFlowCompletedIfNeeded(errorDict); -#elif UNITY_ANDROID - MaxUnityPluginClass.CallStatic("startConsentFlow"); -#elif UNITY_IOS - _MaxStartConsentFlow(); -#endif - } - - public static void NotifyConsentFlowCompletedIfNeeded(IDictionary error) - { - if (OnConsentFlowCompletedAction == null) return; - - OnConsentFlowCompletedAction(CFError.Create(error)); + var cfError = error == null ? null : CFError.Create((int) error.Code, error.Message); + onFlowCompletedAction(cfError); + }); } } } diff --git a/MaxSdk/Scripts/MaxSdkBase.cs.meta b/MaxSdk/Scripts/MaxSdkBase.cs.meta index 5874250..f27f769 100644 --- a/MaxSdk/Scripts/MaxSdkBase.cs.meta +++ b/MaxSdk/Scripts/MaxSdkBase.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0822c80ecfc5248e2b853d8d5b449fb3 +guid: 893e4e55a7e394274957f1034f7afc45 labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxSdkBase.cs diff --git a/MaxSdk/Scripts/MaxSdkCallbacks.cs b/MaxSdk/Scripts/MaxSdkCallbacks.cs index d4ade54..bf3084f 100644 --- a/MaxSdk/Scripts/MaxSdkCallbacks.cs +++ b/MaxSdk/Scripts/MaxSdkCallbacks.cs @@ -6,7 +6,6 @@ using System; using System.Collections.Generic; using System.Globalization; using UnityEngine; -using AppLovinMax.Internal.API; using AppLovinMax.ThirdParty.MiniJson; 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. private static Action _onSdkConsentDialogDismissedEvent; public static event Action OnSdkConsentDialogDismissedEvent @@ -1360,17 +1342,14 @@ public class MaxSdkCallbacks : MonoBehaviour var sdkConfiguration = MaxSdkBase.SdkConfiguration.Create(eventProps); InvokeEvent(_onSdkInitializedEvent, sdkConfiguration, eventName); } - else if (eventName == "OnVariablesUpdatedEvent") - { - InvokeEvent(_onVariablesUpdatedEvent, eventName); - } else if (eventName == "OnSdkConsentDialogDismissedEvent") { 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 else @@ -1734,7 +1713,6 @@ public class MaxSdkCallbacks : MonoBehaviour private static void ResetOnDomainReload() { _onSdkInitializedEvent = null; - _onVariablesUpdatedEvent = null; _onSdkConsentDialogDismissedEvent = null; _onInterstitialAdLoadedEventV2 = null; diff --git a/MaxSdk/Scripts/MaxSdkCallbacks.cs.meta b/MaxSdk/Scripts/MaxSdkCallbacks.cs.meta index c383446..dd08049 100644 --- a/MaxSdk/Scripts/MaxSdkCallbacks.cs.meta +++ b/MaxSdk/Scripts/MaxSdkCallbacks.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1bc9fb13147694ac795ea28866c87af9 +guid: 4dc129a60049645f7a492a0a658a6c22 labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxSdkCallbacks.cs diff --git a/MaxSdk/Scripts/MaxSdkLogger.cs.meta b/MaxSdk/Scripts/MaxSdkLogger.cs.meta index 1f09051..01a3427 100644 --- a/MaxSdk/Scripts/MaxSdkLogger.cs.meta +++ b/MaxSdk/Scripts/MaxSdkLogger.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 54635e7165bf2486a9cc1da416db8ae6 +guid: ff2b160afdfd4a74b731954323772a90 labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxSdkLogger.cs diff --git a/MaxSdk/Scripts/MaxSdkUnityEditor.cs b/MaxSdk/Scripts/MaxSdkUnityEditor.cs index 8aa8a53..61c93b1 100644 --- a/MaxSdk/Scripts/MaxSdkUnityEditor.cs +++ b/MaxSdk/Scripts/MaxSdkUnityEditor.cs @@ -32,11 +32,6 @@ public class MaxSdkUnityEditor : MaxSdkBase private static readonly HashSet ReadyAdUnits = new HashSet(); private static readonly Dictionary StubBanners = new Dictionary(); - public static MaxVariableServiceUnityEditor VariableService - { - get { return MaxVariableServiceUnityEditor.Instance; } - } - public static MaxUserServiceUnityEditor UserService { get { return MaxUserServiceUnityEditor.Instance; } diff --git a/MaxSdk/Scripts/MaxSdkUnityEditor.cs.meta b/MaxSdk/Scripts/MaxSdkUnityEditor.cs.meta index 932a5ac..145875b 100644 --- a/MaxSdk/Scripts/MaxSdkUnityEditor.cs.meta +++ b/MaxSdk/Scripts/MaxSdkUnityEditor.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c8c53ddc186d74166a4a1381519cbb2c +guid: 13b3e537a64f24986bb8ffe3a0beef5c labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxSdkUnityEditor.cs diff --git a/MaxSdk/Scripts/MaxSdkUtils.cs b/MaxSdk/Scripts/MaxSdkUtils.cs index c24f081..063106d 100644 --- a/MaxSdk/Scripts/MaxSdkUtils.cs +++ b/MaxSdk/Scripts/MaxSdkUtils.cs @@ -12,7 +12,7 @@ using UnityEditor; #endif -public partial class MaxSdkUtils +public class MaxSdkUtils { /// /// An Enum to be used when comparing two versions. @@ -349,6 +349,83 @@ public partial class MaxSdkUtils #endif } + /// + /// Parses the IAB TCF String to determine the consent status for the IAB vendor with the provided ID. + /// + /// Vendor ID as defined in the Global Vendor List. + /// The consent status of the IAB vendor. Returns true if the vendor has consent, false if not, or null if no TCF string is available on disk. + /// Current Version of Global Vendor List + 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("getTcfConsentStatus", vendorId); +#else + return -1; +#endif + } + + /// + /// 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. + /// + /// The ID representing the advertising entity (e.g. 89 for Meta Audience Network). + /// + /// The consent status of the advertising entity. Returns true if the entity has consent, false if not, or null if no AC string is available on disk. + /// + /// Google’s Additional Consent Mode technical specification + /// List of Google ATPs and their IDs + 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("getAdditionalConsentStatus", atpId); +#else + return -1; +#endif + } + /// /// Compares AppLovin MAX Unity mediation adapter plugin versions. Returns , , /// or 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]); } #endif - - - - } diff --git a/MaxSdk/Scripts/MaxSdkUtils.cs.meta b/MaxSdk/Scripts/MaxSdkUtils.cs.meta index 21bbc33..a1b67cf 100644 --- a/MaxSdk/Scripts/MaxSdkUtils.cs.meta +++ b/MaxSdk/Scripts/MaxSdkUtils.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 5b1f7446ccb2846569bdf5db9ef4d548 +guid: 47f1bc9a8eebd4d088e22e6baf00ede3 labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxSdkUtils.cs diff --git a/MaxSdk/Scripts/MaxSdkiOS.cs b/MaxSdk/Scripts/MaxSdkiOS.cs index 7a46c11..4254776 100644 --- a/MaxSdk/Scripts/MaxSdkiOS.cs +++ b/MaxSdk/Scripts/MaxSdkiOS.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.Collections.Generic; using System.Runtime.InteropServices; using AOT; @@ -18,11 +19,6 @@ public class MaxSdkiOS : MaxSdkBase } #if UNITY_IOS - public static MaxVariableServiceiOS VariableService - { - get { return MaxVariableServiceiOS.Instance; } - } - public static MaxUserServiceiOS UserService { get { return MaxUserServiceiOS.Instance; } @@ -507,24 +503,28 @@ public class MaxSdkiOS : MaxSdkBase [DllImport("__Internal")] private static extern void _MaxSetBannerLocalExtraParameter(string adUnitIdentifier, string key, IntPtr value); + [DllImport("__Internal")] + private static extern void _MaxSetBannerLocalExtraParameterJSON(string adUnitIdentifier, string key, string json); + /// /// Set a local extra parameter for the banner ad. /// /// Ad unit identifier of the banner to set the local extra parameter for. /// The key for the local extra parameter. - /// The value for the local extra parameter. Needs to be of type or null + /// The value for the local extra parameter. Accepts the following types: , null, IList, IDictionary, string, primitive types 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"); - var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value; - _MaxSetBannerLocalExtraParameter(adUnitIdentifier, key, intPtrValue); + if (value == null || value is IntPtr) + { + var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value; + _MaxSetBannerLocalExtraParameter(adUnitIdentifier, key, intPtrValue); + } + else + { + _MaxSetBannerLocalExtraParameterJSON(adUnitIdentifier, key, SerializeLocalExtraParameterValue(value)); + } } [DllImport("__Internal")] @@ -737,24 +737,28 @@ public class MaxSdkiOS : MaxSdkBase [DllImport("__Internal")] private static extern void _MaxSetMRecLocalExtraParameter(string adUnitIdentifier, string key, IntPtr value); + [DllImport("__Internal")] + private static extern void _MaxSetMRecLocalExtraParameterJSON(string adUnitIdentifier, string key, string json); + /// /// Set a local extra parameter for the MREC ad. /// /// Ad unit identifier of the MREC to set the local extra parameter for. /// The key for the local extra parameter. - /// The value for the local extra parameter. Needs to be of type or null + /// The value for the local extra parameter. Accepts the following types: , null, IList, IDictionary, string, primitive types 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"); - var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value; - _MaxSetMRecLocalExtraParameter(adUnitIdentifier, key, intPtrValue); + if (value == null || value is IntPtr) + { + var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value; + _MaxSetMRecLocalExtraParameter(adUnitIdentifier, key, intPtrValue); + } + else + { + _MaxSetMRecLocalExtraParameterJSON(adUnitIdentifier, key, SerializeLocalExtraParameterValue(value)); + } } [DllImport("__Internal")] @@ -974,24 +978,28 @@ public class MaxSdkiOS : MaxSdkBase [DllImport("__Internal")] private static extern void _MaxSetInterstitialLocalExtraParameter(string adUnitIdentifier, string key, IntPtr value); + [DllImport("__Internal")] + private static extern void _MaxSetInterstitialLocalExtraParameterJSON(string adUnitIdentifier, string key, string json); + /// /// Set a local extra parameter for the ad. /// /// Ad unit identifier of the interstitial to set the local extra parameter for. /// The key for the local extra parameter. - /// The value for the local extra parameter. Needs to be of type or null + /// The value for the local extra parameter. Accepts the following types: , null, IList, IDictionary, string, primitive types 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"); - var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value; - _MaxSetInterstitialLocalExtraParameter(adUnitIdentifier, key, intPtrValue); + if (value == null || value is IntPtr) + { + var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value; + _MaxSetInterstitialLocalExtraParameter(adUnitIdentifier, key, intPtrValue); + } + else + { + _MaxSetInterstitialLocalExtraParameterJSON(adUnitIdentifier, key, SerializeLocalExtraParameterValue(value)); + } } #endregion @@ -1066,24 +1074,28 @@ public class MaxSdkiOS : MaxSdkBase [DllImport("__Internal")] private static extern void _MaxSetAppOpenAdLocalExtraParameter(string adUnitIdentifier, string key, IntPtr value); + [DllImport("__Internal")] + private static extern void _MaxSetAppOpenAdLocalExtraParameterJSON(string adUnitIdentifier, string key, string json); + /// /// Set a local extra parameter for the ad. /// /// Ad unit identifier of the app open ad to set the local extra parameter for. /// The key for the local extra parameter. - /// The value for the local extra parameter. Needs to be of type or null + /// The value for the local extra parameter. Accepts the following types: , null, IList, IDictionary, string, primitive types 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"); - var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value; - _MaxSetAppOpenAdLocalExtraParameter(adUnitIdentifier, key, intPtrValue); + if (value == null || value is IntPtr) + { + var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value; + _MaxSetAppOpenAdLocalExtraParameter(adUnitIdentifier, key, intPtrValue); + } + else + { + _MaxSetAppOpenAdLocalExtraParameterJSON(adUnitIdentifier, key, SerializeLocalExtraParameterValue(value)); + } } #endregion @@ -1158,24 +1170,28 @@ public class MaxSdkiOS : MaxSdkBase [DllImport("__Internal")] private static extern void _MaxSetRewardedAdLocalExtraParameter(string adUnitIdentifier, string key, IntPtr value); + [DllImport("__Internal")] + private static extern void _MaxSetRewardedAdLocalExtraParameterJSON(string adUnitIdentifier, string key, string json); + /// /// Set a local extra parameter for the ad. /// /// Ad unit identifier of the rewarded ad to set the local extra parameter for. /// The key for the local extra parameter. - /// The value for local the extra parameter. Needs to be of type or null + /// The value for the local extra parameter. Accepts the following types: , null, IList, IDictionary, string, primitive types 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"); - return; + var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value; + _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 @@ -1250,24 +1266,28 @@ public class MaxSdkiOS : MaxSdkBase [DllImport("__Internal")] private static extern void _MaxSetRewardedInterstitialAdLocalExtraParameter(string adUnitIdentifier, string key, IntPtr value); + [DllImport("__Internal")] + private static extern void _MaxSetRewardedInterstitialAdLocalExtraParameterJSON(string adUnitIdentifier, string key, string json); + /// /// Set a local extra parameter for the ad. /// /// Ad unit identifier of the rewarded interstitial ad to set the local extra parameter for. /// The key for the local extra parameter. - /// The value for the local extra parameter. Needs to be of type or null + /// The value for the local extra parameter. Accepts the following types: , null, IList, IDictionary, string, primitive types 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"); - return; + var intPtrValue = value == null ? IntPtr.Zero : (IntPtr) value; + _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 diff --git a/MaxSdk/Scripts/MaxSdkiOS.cs.meta b/MaxSdk/Scripts/MaxSdkiOS.cs.meta index 977d50d..9adec1b 100644 --- a/MaxSdk/Scripts/MaxSdkiOS.cs.meta +++ b/MaxSdk/Scripts/MaxSdkiOS.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1c0c0863c6b44422ba7dbf7939009f74 +guid: e7c7ed6cdbdca44cd8eae28d3b60d28c labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxSdkiOS.cs diff --git a/MaxSdk/Scripts/MaxTargetingData.cs.meta b/MaxSdk/Scripts/MaxTargetingData.cs.meta index a10f79a..35e7771 100644 --- a/MaxSdk/Scripts/MaxTargetingData.cs.meta +++ b/MaxSdk/Scripts/MaxTargetingData.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: eac21c202a5f94a2f8e6683afa591d7b +guid: 409fe14211f31433da09f5b4bd5467b9 labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxTargetingData.cs diff --git a/MaxSdk/Scripts/MaxUserSegment.cs.meta b/MaxSdk/Scripts/MaxUserSegment.cs.meta index 9d8df97..9c1916a 100644 --- a/MaxSdk/Scripts/MaxUserSegment.cs.meta +++ b/MaxSdk/Scripts/MaxUserSegment.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e2f0d7f5729cd4f46a8498cdeb6a70e7 +guid: 8fb1f6f31b19c407b9d3fa62557d373a labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxUserSegment.cs diff --git a/MaxSdk/Scripts/MaxUserServiceAndroid.cs.meta b/MaxSdk/Scripts/MaxUserServiceAndroid.cs.meta index bb05c50..5457a76 100644 --- a/MaxSdk/Scripts/MaxUserServiceAndroid.cs.meta +++ b/MaxSdk/Scripts/MaxUserServiceAndroid.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6cc873cf061ec4b29be81d16f52762d9 +guid: d2eacd6aa14494de6809b4b06027a332 labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxUserServiceAndroid.cs diff --git a/MaxSdk/Scripts/MaxUserServiceUnityEditor.cs.meta b/MaxSdk/Scripts/MaxUserServiceUnityEditor.cs.meta index 587807d..4e6640c 100644 --- a/MaxSdk/Scripts/MaxUserServiceUnityEditor.cs.meta +++ b/MaxSdk/Scripts/MaxUserServiceUnityEditor.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e3754fa2823844ae19be8cf9775fefb4 +guid: 16d44e29e68204f36975abec0feb1d35 labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxUserServiceUnityEditor.cs diff --git a/MaxSdk/Scripts/MaxUserServiceiOS.cs.meta b/MaxSdk/Scripts/MaxUserServiceiOS.cs.meta index d70cda4..0220cdc 100644 --- a/MaxSdk/Scripts/MaxUserServiceiOS.cs.meta +++ b/MaxSdk/Scripts/MaxUserServiceiOS.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 25fbc36c2e04d4127bb60c436fa54315 +guid: 6233dd3f0b4664e7dbdca14cc8904176 labels: - al_max - al_max_export_path-MaxSdk/Scripts/MaxUserServiceiOS.cs diff --git a/MaxSdk/Scripts/MaxVariableServiceAndroid.cs b/MaxSdk/Scripts/MaxVariableServiceAndroid.cs deleted file mode 100644 index ee8651a..0000000 --- a/MaxSdk/Scripts/MaxVariableServiceAndroid.cs +++ /dev/null @@ -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; } - } - - /// - /// Returns the variable value associated with the given key, or false if no mapping of the desired type exists for the given key. - /// - /// The variable name to retrieve the value for. - public bool GetBoolean(string key, bool defaultValue = false) - { - return _maxUnityPluginClass.CallStatic("getBoolean", key, defaultValue); - } - - /// - /// 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. - /// - /// The variable name to retrieve the value for. - public string GetString(string key, string defaultValue = "") - { - return _maxUnityPluginClass.CallStatic("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"); - } -} diff --git a/MaxSdk/Scripts/MaxVariableServiceAndroid.cs.meta b/MaxSdk/Scripts/MaxVariableServiceAndroid.cs.meta deleted file mode 100644 index d153c60..0000000 --- a/MaxSdk/Scripts/MaxVariableServiceAndroid.cs.meta +++ /dev/null @@ -1,6 +0,0 @@ -fileFormatVersion: 2 -guid: 837643e15fc734f7ab2fd5f71c919d01 -labels: -- al_max -- al_max_export_path-MaxSdk/Scripts/MaxVariableServiceAndroid.cs -timeCreated: 1547608580 diff --git a/MaxSdk/Scripts/MaxVariableServiceUnityEditor.cs b/MaxSdk/Scripts/MaxVariableServiceUnityEditor.cs deleted file mode 100644 index 43f8857..0000000 --- a/MaxSdk/Scripts/MaxVariableServiceUnityEditor.cs +++ /dev/null @@ -1,30 +0,0 @@ -public class MaxVariableServiceUnityEditor -{ - private static readonly MaxVariableServiceUnityEditor _instance = new MaxVariableServiceUnityEditor(); - - public static MaxVariableServiceUnityEditor Instance - { - get { return _instance; } - } - - /// - /// Returns the variable value associated with the given key, or false if no mapping of the desired type exists for the given key. - /// - /// The variable name to retrieve the value for. - public bool GetBoolean(string key, bool defaultValue = false) - { - return defaultValue; - } - - /// - /// 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. - /// - /// The variable name to retrieve the value for. - 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() { } -} diff --git a/MaxSdk/Scripts/MaxVariableServiceUnityEditor.cs.meta b/MaxSdk/Scripts/MaxVariableServiceUnityEditor.cs.meta deleted file mode 100644 index 772b2c3..0000000 --- a/MaxSdk/Scripts/MaxVariableServiceUnityEditor.cs.meta +++ /dev/null @@ -1,6 +0,0 @@ -fileFormatVersion: 2 -guid: cc5e13a9689324605aa62b30ba0fca1f -labels: -- al_max -- al_max_export_path-MaxSdk/Scripts/MaxVariableServiceUnityEditor.cs -timeCreated: 1547608594 diff --git a/MaxSdk/Scripts/MaxVariableServiceiOS.cs b/MaxSdk/Scripts/MaxVariableServiceiOS.cs deleted file mode 100644 index b039bb8..0000000 --- a/MaxSdk/Scripts/MaxVariableServiceiOS.cs +++ /dev/null @@ -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); - - /// - /// Returns the variable value associated with the given key, or false if no mapping of the desired type exists for the given key. - /// - /// The variable name to retrieve the value for. - public bool GetBoolean(string key, bool defaultValue = false) - { - return _MaxGetBool(key, defaultValue); - } - - /// - /// 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. - /// - /// The variable name to retrieve the value for. - 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 diff --git a/MaxSdk/Scripts/MaxVariableServiceiOS.cs.meta b/MaxSdk/Scripts/MaxVariableServiceiOS.cs.meta deleted file mode 100644 index eacfb37..0000000 --- a/MaxSdk/Scripts/MaxVariableServiceiOS.cs.meta +++ /dev/null @@ -1,6 +0,0 @@ -fileFormatVersion: 2 -guid: 0d10ea5dac9bb46bfb388623e6153986 -labels: -- al_max -- al_max_export_path-MaxSdk/Scripts/MaxVariableServiceiOS.cs -timeCreated: 1547608568 diff --git a/MaxSdk/Scripts/ThirdParty.meta b/MaxSdk/Scripts/ThirdParty.meta index f78bcbe..81ce936 100644 --- a/MaxSdk/Scripts/ThirdParty.meta +++ b/MaxSdk/Scripts/ThirdParty.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a6dee059874b348009ba86a51a2bc978 +guid: 68fc43fe05dea4106bb4b376720d6708 labels: - al_max - al_max_export_path-MaxSdk/Scripts/ThirdParty diff --git a/MaxSdk/Scripts/ThirdParty/MiniJSON.cs b/MaxSdk/Scripts/ThirdParty/MiniJSON.cs index 32e0dec..b5fbd51 100644 --- a/MaxSdk/Scripts/ThirdParty/MiniJSON.cs +++ b/MaxSdk/Scripts/ThirdParty/MiniJSON.cs @@ -85,7 +85,7 @@ namespace AppLovinMax.ThirdParty.MiniJson public static object Deserialize(string json) { // save the string for debug information - if (json == null) + if (string.IsNullOrEmpty(json)) { return null; } diff --git a/MaxSdk/Scripts/ThirdParty/MiniJSON.cs.meta b/MaxSdk/Scripts/ThirdParty/MiniJSON.cs.meta index 1bed086..0200dde 100644 --- a/MaxSdk/Scripts/ThirdParty/MiniJSON.cs.meta +++ b/MaxSdk/Scripts/ThirdParty/MiniJSON.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 741e50fb3b1ea46a5b4d05b3da5015fa +guid: 52789a1d5a5754d46816fd9ed114a375 labels: - al_max - al_max_export_path-MaxSdk/Scripts/ThirdParty/MiniJSON.cs diff --git a/MaxSdk/Version.md.meta b/MaxSdk/Version.md.meta index 708a8bb..9b80f0c 100644 --- a/MaxSdk/Version.md.meta +++ b/MaxSdk/Version.md.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9410432e795b9407ab5a8b5b9e02e01d +guid: 8a6ad2e147c3a4553bda59a84413f07b labels: - al_max - al_max_export_path-MaxSdk/Version.md