diff --git a/Google/AppLovinMediationGoogleAdapter.podspec b/Google/AppLovinMediationGoogleAdapter.podspec index 95719096a6..3e02e1ee2f 100644 --- a/Google/AppLovinMediationGoogleAdapter.podspec +++ b/Google/AppLovinMediationGoogleAdapter.podspec @@ -5,10 +5,10 @@ s.authors = 'AppLovin Corporation' => 'devsupport@applovin.com' } s.name = 'AppLovinMediationGoogleAdapter' -s.version = '8.13.0.5' +s.version = '8.13.0.6' s.platform = :ios, '9.0' s.summary = 'Google adapter used for mediation with the AppLovin MAX SDK' -s.homepage = 'https://github.com/CocoaPods/Specs/search?o=desc&q=AppLovinMediationGoogleAdapter&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/google-adapter/AppLovinMediationGoogleAdapter-8.13.0.5.zip', + :http => "https://artifacts.applovin.com/ios/com/applovin/mediation/google-adapter/#{s.name}-#{s.version}.zip", :type => 'zip' } -s.vendored_frameworks = 'AppLovinMediationGoogleAdapter-8.13.0.5/AppLovinMediationGoogleAdapter.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/Google/CHANGELOG.md b/Google/CHANGELOG.md index c3d0ef114e..230cac87a0 100644 --- a/Google/CHANGELOG.md +++ b/Google/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 8.13.0.6 +* Add support for custom [AdChoices placements](https://developers.google.com/admob/ios/api/reference/Enums/GADAdChoicesPosition.html), which publishers can set by calling `setLocalExtraParameterForKey("admob_ad_choices_placement", GADAdChoicesPosition)` on the `MANativeAdLoader` instance. + ## 8.13.0.5 * Fix additional potential UI API being called on a background thread for native ads. diff --git a/Google/GoogleAdapter/ALGoogleMediationAdapter.m b/Google/GoogleAdapter/ALGoogleMediationAdapter.m index 364efd67f7..69da3b0eb1 100644 --- a/Google/GoogleAdapter/ALGoogleMediationAdapter.m +++ b/Google/GoogleAdapter/ALGoogleMediationAdapter.m @@ -9,7 +9,7 @@ #import "ALGoogleMediationAdapter.h" #import -#define ADAPTER_VERSION @"8.13.0.5" +#define ADAPTER_VERSION @"8.13.0.6" @interface ALGoogleMediationAdapterInterstitialDelegate : NSObject @property (nonatomic, weak) ALGoogleMediationAdapter *parentAdapter; @@ -455,7 +455,7 @@ - (void)loadAdViewAdForParameters:(id)parameters if ( isNative ) { GADNativeAdViewAdOptions *nativeAdViewOptions = [[GADNativeAdViewAdOptions alloc] init]; - nativeAdViewOptions.preferredAdChoicesPosition = GADAdChoicesPositionTopRightCorner; + nativeAdViewOptions.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 @@ -503,7 +503,7 @@ - (void)loadNativeAdForParameters:(id)parameters an GADRequest *request = [self createAdRequestForBiddingAd: isBiddingAd withParameters: parameters]; GADNativeAdViewAdOptions *nativeAdViewOptions = [[GADNativeAdViewAdOptions alloc] init]; - nativeAdViewOptions.preferredAdChoicesPosition = GADAdChoicesPositionTopRightCorner; + nativeAdViewOptions.preferredAdChoicesPosition = [self adChoicesPlacementFromLocalExtra: parameters.localExtraParameters]; GADNativeAdImageAdLoaderOptions *nativeAdImageAdLoaderOptions = [[GADNativeAdImageAdLoaderOptions alloc] init]; @@ -786,6 +786,28 @@ - (BOOL)isValidNativeAd:(GADNativeAd *)nativeAd return nativeAd.headline != nil; } +- (NSInteger)adChoicesPlacementFromLocalExtra:(NSDictionary*)localExtraParams +{ + // Publishers can set via nativeAdLoader.setLocalExtraParameterForKey("admob_ad_choices_placement", value: .bottomLeftCorner.rawValue) + id adChoicesPlacementObj = localExtraParams[@"admob_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 ALGoogleMediationAdapterInterstitialDelegate