Skip to content

Commit

Permalink
GoogleAdManager/11.11.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AppLovin-Mobile-Engineering committed Oct 21, 2024
1 parent b6007d1 commit e67ef09
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Pod::Spec.new do |s|

s.authors = 'AppLovin Corporation'
s.name = 'AppLovinMediationGoogleAdManagerAdapter'
s.version = '11.10.0.0'
s.version = '11.11.0.0'
s.platform = :ios, '12.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=#{s.name}&s=indexed"
Expand All @@ -26,7 +26,7 @@ s.source =

s.vendored_frameworks = "#{s.name}-#{s.version}/#{s.name}.xcframework"

s.dependency 'Google-Mobile-Ads-SDK', '= 11.10.0'
s.dependency 'Google-Mobile-Ads-SDK', '= 11.11.0'
s.dependency 'AppLovinSDK', '>= 13.0.0'
s.swift_version = '5.0'

Expand Down
4 changes: 4 additions & 0 deletions GoogleAdManager/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 11.11.0.0
* Certified with GoogleAdManager SDK 11.11.0.
* Simplified API calls by removing selector checks; direct API calls are now safe with the updated min SDK version.

## 11.10.0.0
* Certified with GoogleAdManager SDK 11.10.0.

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 @"11.10.0.0"
#define ADAPTER_VERSION @"11.11.0.0"

#define TITLE_LABEL_TAG 1
#define MEDIA_VIEW_CONTAINER_TAG 2
Expand Down Expand Up @@ -236,10 +236,9 @@ - (void)loadInterstitialAdForParameters:(id<MAAdapterResponseParameters>)paramet
self.interstitialAd.fullScreenContentDelegate = self.interstitialAdapterDelegate;

NSString *responseId = self.interstitialAd.responseInfo.responseIdentifier;
if ( ALSdk.versionCode >= 6150000 && [responseId al_isValidString] )
if ( [responseId al_isValidString] )
{
[delegate performSelector: @selector(didLoadInterstitialAdWithExtraInfo:)
withObject: @{@"creative_id" : responseId}];
[delegate didLoadInterstitialAdWithExtraInfo: @{@"creative_id" : responseId}];
}
else
{
Expand Down Expand Up @@ -400,10 +399,9 @@ - (void)loadRewardedInterstitialAdForParameters:(id<MAAdapterResponseParameters>
self.rewardedInterstitialAd.fullScreenContentDelegate = self.rewardedInterstitialAdapterDelegate;

NSString *responseId = self.rewardedInterstitialAd.responseInfo.responseIdentifier;
if ( ALSdk.versionCode >= 6150000 && [responseId al_isValidString] )
if ( [responseId al_isValidString] )
{
[delegate performSelector: @selector(didLoadRewardedInterstitialAdWithExtraInfo:)
withObject: @{@"creative_id" : responseId}];
[delegate didLoadRewardedInterstitialAdWithExtraInfo: @{@"creative_id" : responseId}];
}
else
{
Expand Down Expand Up @@ -491,10 +489,9 @@ - (void)loadRewardedAdForParameters:(id<MAAdapterResponseParameters>)parameters
self.rewardedAd.fullScreenContentDelegate = self.rewardedAdapterDelegate;

NSString *responseId = self.rewardedAd.responseInfo.responseIdentifier;
if ( ALSdk.versionCode >= 6150000 && [responseId al_isValidString] )
if ( [responseId al_isValidString] )
{
[delegate performSelector: @selector(didLoadRewardedAdWithExtraInfo:)
withObject: @{@"creative_id" : responseId}];
[delegate didLoadRewardedAdWithExtraInfo: @{@"creative_id" : responseId}];
}
else
{
Expand Down Expand Up @@ -1136,31 +1133,22 @@ - (void)bannerViewDidReceiveAd:(GADBannerView *)bannerView
{
[self.parentAdapter log: @"%@ ad loaded: %@", self.adFormat.label, bannerView.adUnitID];

if ( ALSdk.versionCode >= 6150000 )
NSMutableDictionary *extraInfo = [NSMutableDictionary dictionaryWithCapacity: 3];

NSString *responseId = bannerView.responseInfo.responseIdentifier;
if ( [responseId al_isValidString] )
{
NSMutableDictionary *extraInfo = [NSMutableDictionary dictionaryWithCapacity: 3];

NSString *responseId = bannerView.responseInfo.responseIdentifier;
if ( [responseId al_isValidString] )
{
extraInfo[@"creative_id"] = responseId;
}

CGSize adSize = bannerView.adSize.size;
if ( !CGSizeEqualToSize(CGSizeZero, adSize) )
{
extraInfo[@"ad_width"] = @(adSize.width);
extraInfo[@"ad_height"] = @(adSize.height);
}

[self.delegate performSelector: @selector(didLoadAdForAdView:withExtraInfo:)
withObject: bannerView
withObject: extraInfo];
extraInfo[@"creative_id"] = responseId;
}
else

CGSize adSize = bannerView.adSize.size;
if ( !CGSizeEqualToSize(CGSizeZero, adSize) )
{
[self.delegate didLoadAdForAdView: bannerView];
extraInfo[@"ad_width"] = @(adSize.width);
extraInfo[@"ad_height"] = @(adSize.height);
}

[self.delegate didLoadAdForAdView: bannerView withExtraInfo: extraInfo];
}

- (void)bannerView:(GADBannerView *)bannerView didFailToReceiveAdWithError:(NSError *)error
Expand Down Expand Up @@ -1282,11 +1270,9 @@ - (void)adLoader:(GADAdLoader *)adLoader didReceiveNativeAd:(GADNativeAd *)nativ
[self.parentAdapter.nativeAdView al_pinToSuperview];

NSString *responseId = nativeAd.responseInfo.responseIdentifier;
if ( ALSdk.versionCode >= 6150000 && [responseId al_isValidString] )
if ( [responseId al_isValidString] )
{
[self.delegate performSelector: @selector(didLoadAdForAdView:withExtraInfo:)
withObject: maxNativeAdView
withObject: @{@"creative_id" : responseId}];
[self.delegate didLoadAdForAdView: maxNativeAdView withExtraInfo: @{@"creative_id" : responseId}];
}
else
{
Expand Down Expand Up @@ -1406,6 +1392,7 @@ - (void)adLoader:(GADAdLoader *)adLoader didReceiveNativeAd:(GADNativeAd *)nativ
builderBlock:^(MANativeAdBuilder *builder) {

builder.title = nativeAd.headline;
builder.advertiser = nativeAd.advertiser;
builder.body = nativeAd.body;
builder.callToAction = nativeAd.callToAction;

Expand All @@ -1418,32 +1405,10 @@ - (void)adLoader:(GADAdLoader *)adLoader didReceiveNativeAd:(GADNativeAd *)nativ
builder.icon = [[MANativeAdImage alloc] initWithURL: nativeAd.icon.imageURL];
}

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector"
// Introduced in 10.4.0
if ( [builder respondsToSelector: @selector(setAdvertiser:)] )
{
[builder performSelector: @selector(setAdvertiser:) withObject: nativeAd.advertiser];
}

builder.mainImage = mainImage;
builder.mediaView = mediaView;
if ( ALSdk.versionCode >= 11040299 )
{
[builder performSelector: @selector(setMainImage:) withObject: mainImage];
}

// Introduced in 11.4.0
if ( [builder respondsToSelector: @selector(setMediaContentAspectRatio:)] )
{
[builder performSelector: @selector(setMediaContentAspectRatio:) withObject: @(mediaContentAspectRatio)];
}

// Introduced in 11.7.0
if ( [builder respondsToSelector: @selector(setStarRating:)] )
{
[builder performSelector: @selector(setStarRating:) withObject: nativeAd.starRating];
}
#pragma clang diagnostic pop
builder.mediaContentAspectRatio = mediaContentAspectRatio;
builder.starRating = nativeAd.starRating;
}];

NSString *responseId = nativeAd.responseInfo.responseIdentifier;
Expand Down

0 comments on commit e67ef09

Please sign in to comment.