Skip to content

Commit

Permalink
GoogleAdManager/8.13.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
prod-applovin-deploy committed Jan 27, 2022
1 parent 68a0b29 commit 1c92d91
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ s.authors =
'AppLovin Corporation' => '[email protected]'
}
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',
Expand All @@ -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'
Expand Down
3 changes: 3 additions & 0 deletions GoogleAdManager/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#import "ALGoogleAdManagerMediationAdapter.h"
#import <GoogleMobileAds/GoogleMobileAds.h>

#define ADAPTER_VERSION @"8.13.0.4"
#define ADAPTER_VERSION @"8.13.0.5"

@interface ALGoogleAdManagerInterstitialDelegate : NSObject<GADFullScreenContentDelegate>
@property (nonatomic, weak) ALGoogleAdManagerMediationAdapter *parentAdapter;
Expand Down Expand Up @@ -385,7 +385,7 @@ - (void)loadAdViewAdForParameters:(id<MAAdapterResponseParameters>)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
Expand Down Expand Up @@ -433,7 +433,7 @@ - (void)loadNativeAdForParameters:(nonnull id<MAAdapterResponseParameters>)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];

Expand Down Expand Up @@ -696,6 +696,28 @@ - (BOOL)isValidNativeAd:(GADNativeAd *)nativeAd
return nativeAd.headline != nil;
}

- (NSInteger)adChoicesPlacementFromLocalExtra:(NSDictionary<NSString *, id>*)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
Expand Down

0 comments on commit 1c92d91

Please sign in to comment.