From 1c92d913aa75c7f8e14f0d1ffa18df1e8cec9ec7 Mon Sep 17 00:00:00 2001 From: prod-applovin-deploy Date: Thu, 27 Jan 2022 13:19:17 -0800 Subject: [PATCH] GoogleAdManager/8.13.0.5 --- ...vinMediationGoogleAdManagerAdapter.podspec | 8 +++--- GoogleAdManager/CHANGELOG.md | 3 ++ .../ALGoogleAdManagerMediationAdapter.m | 28 +++++++++++++++++-- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/GoogleAdManager/AppLovinMediationGoogleAdManagerAdapter.podspec b/GoogleAdManager/AppLovinMediationGoogleAdManagerAdapter.podspec index a617e2eb41..74d1377a45 100644 --- a/GoogleAdManager/AppLovinMediationGoogleAdManagerAdapter.podspec +++ b/GoogleAdManager/AppLovinMediationGoogleAdManagerAdapter.podspec @@ -5,10 +5,10 @@ s.authors = 'AppLovin Corporation' => 'devsupport@applovin.com' } s.name = 'AppLovinMediationGoogleAdManagerAdapter' -s.version = '8.13.0.4' +s.version = '8.13.0.5' s.platform = :ios, '9.0' s.summary = 'Google Ad Manager adapter used for mediation with the AppLovin MAX SDK' -s.homepage = 'https://github.com/CocoaPods/Specs/search?o=desc&q=AppLovinMediationGoogleAdManagerAdapter&s=indexed' +s.homepage = "https://github.com/CocoaPods/Specs/search?o=desc&q=#{s.name}&s=indexed" s.license = { :type => 'Commercial License', @@ -23,11 +23,11 @@ LICENSE s.source = { - :http => 'https://artifacts.applovin.com/ios/com/applovin/mediation/googleadmanager-adapter/AppLovinMediationGoogleAdManagerAdapter-8.13.0.4.zip', + :http => "https://artifacts.applovin.com/ios/com/applovin/mediation/googleadmanager-adapter/#{s.name}-#{s.version}.zip", :type => 'zip' } -s.vendored_frameworks = 'AppLovinMediationGoogleAdManagerAdapter-8.13.0.4/AppLovinMediationGoogleAdManagerAdapter.framework' +s.vendored_frameworks = "#{s.name}-#{s.version}/#{s.name}.framework" s.dependency 'Google-Mobile-Ads-SDK', '= 8.13.0' s.dependency 'AppLovinSDK' diff --git a/GoogleAdManager/CHANGELOG.md b/GoogleAdManager/CHANGELOG.md index 3c937cfb42..e74c736b72 100644 --- a/GoogleAdManager/CHANGELOG.md +++ b/GoogleAdManager/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 8.13.0.5 +* Add support for custom [AdChoices placements](https://developers.google.com/admob/ios/api/reference/Enums/GADAdChoicesPosition.html), which publishers can set by calling `setLocalExtraParameterForKey("gam_ad_choices_placement", GADAdChoicesPosition)` on the `MANativeAdLoader` instance. + ## 8.13.0.4 * Fix additional potential UI API being called on a background thread for native ads. diff --git a/GoogleAdManager/GoogleAdManagerAdapter/ALGoogleAdManagerMediationAdapter.m b/GoogleAdManager/GoogleAdManagerAdapter/ALGoogleAdManagerMediationAdapter.m index d1c462e0f9..4607a73944 100644 --- a/GoogleAdManager/GoogleAdManagerAdapter/ALGoogleAdManagerMediationAdapter.m +++ b/GoogleAdManager/GoogleAdManagerAdapter/ALGoogleAdManagerMediationAdapter.m @@ -9,7 +9,7 @@ #import "ALGoogleAdManagerMediationAdapter.h" #import -#define ADAPTER_VERSION @"8.13.0.4" +#define ADAPTER_VERSION @"8.13.0.5" @interface ALGoogleAdManagerInterstitialDelegate : NSObject @property (nonatomic, weak) ALGoogleAdManagerMediationAdapter *parentAdapter; @@ -385,7 +385,7 @@ - (void)loadAdViewAdForParameters:(id)parameters if ( isNative ) { GADNativeAdViewAdOptions *adViewAdOptions = [[GADNativeAdViewAdOptions alloc] init]; - adViewAdOptions.preferredAdChoicesPosition = GADAdChoicesPositionTopRightCorner; + adViewAdOptions.preferredAdChoicesPosition = [self adChoicesPlacementFromLocalExtra: parameters.localExtraParameters]; GADNativeAdImageAdLoaderOptions *nativeAdImageAdLoaderOptions = [[GADNativeAdImageAdLoaderOptions alloc] init]; nativeAdImageAdLoaderOptions.shouldRequestMultipleImages = (adFormat == MAAdFormat.mrec); // MRECs can handle multiple images via AdMob's media view @@ -433,7 +433,7 @@ - (void)loadNativeAdForParameters:(nonnull id)param GADRequest *request = [self createAdRequestWithParameters: parameters]; GADNativeAdViewAdOptions *nativeAdViewOptions = [[GADNativeAdViewAdOptions alloc] init]; - nativeAdViewOptions.preferredAdChoicesPosition = GADAdChoicesPositionTopRightCorner; + nativeAdViewOptions.preferredAdChoicesPosition = [self adChoicesPlacementFromLocalExtra: parameters.localExtraParameters]; GADNativeAdImageAdLoaderOptions *nativeAdImageAdLoaderOptions = [[GADNativeAdImageAdLoaderOptions alloc] init]; @@ -696,6 +696,28 @@ - (BOOL)isValidNativeAd:(GADNativeAd *)nativeAd return nativeAd.headline != nil; } +- (NSInteger)adChoicesPlacementFromLocalExtra:(NSDictionary*)localExtraParams +{ + // Publishers can set via nativeAdLoader.setLocalExtraParameterForKey("gam_ad_choices_placement", value: .bottomLeftCorner.rawValue) + id adChoicesPlacementObj = localExtraParams[@"gam_ad_choices_placement"]; + return [self isValidAdChoicesPlacement: adChoicesPlacementObj] ? ((NSNumber *) adChoicesPlacementObj).integerValue : GADAdChoicesPositionTopRightCorner; +} + +- (BOOL)isValidAdChoicesPlacement:(id)placementObj +{ + if ( [placementObj isKindOfClass: [NSNumber class]] ) + { + GADAdChoicesPosition rawValue = ((NSNumber *) placementObj).integerValue; + + return rawValue == GADAdChoicesPositionTopRightCorner || + rawValue == GADAdChoicesPositionTopLeftCorner || + rawValue == GADAdChoicesPositionBottomRightCorner || + rawValue == GADAdChoicesPositionBottomLeftCorner; + } + + return NO; +} + @end @implementation ALGoogleAdManagerInterstitialDelegate