Skip to content

Commit

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

Expand Down
28 changes: 25 additions & 3 deletions Google/GoogleAdapter/ALGoogleMediationAdapter.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#import "ALGoogleMediationAdapter.h"
#import <GoogleMobileAds/GoogleMobileAds.h>

#define ADAPTER_VERSION @"8.13.0.5"
#define ADAPTER_VERSION @"8.13.0.6"

@interface ALGoogleMediationAdapterInterstitialDelegate : NSObject<GADFullScreenContentDelegate>
@property (nonatomic, weak) ALGoogleMediationAdapter *parentAdapter;
Expand Down Expand Up @@ -455,7 +455,7 @@ - (void)loadAdViewAdForParameters:(id<MAAdapterResponseParameters>)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
Expand Down Expand Up @@ -503,7 +503,7 @@ - (void)loadNativeAdForParameters:(id<MAAdapterResponseParameters>)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];

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

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

0 comments on commit 68a0b29

Please sign in to comment.