Skip to content

Commit

Permalink
Google/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 b83d5b4 commit b6007d1
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 62 deletions.
4 changes: 2 additions & 2 deletions Google/AppLovinMediationGoogleAdapter.podspec
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 = 'AppLovinMediationGoogleAdapter'
s.version = '11.10.0.0'
s.version = '11.11.0.0'
s.platform = :ios, '12.0'
s.summary = 'Google 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 Google/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 11.11.0.0
* Certified with Google 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 Google SDK 11.10.0.

Expand Down
33 changes: 12 additions & 21 deletions Google/GoogleAdapter/ALGoogleAdViewDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,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
17 changes: 7 additions & 10 deletions Google/GoogleAdapter/ALGoogleMediationAdapter.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#import "ALGoogleNativeAdViewDelegate.h"
#import "ALGoogleNativeAdDelegate.h"

#define ADAPTER_VERSION @"11.10.0.0"
#define ADAPTER_VERSION @"11.11.0.0"

@interface ALGoogleMediationAdapter ()

Expand Down Expand Up @@ -214,10 +214,9 @@ - (void)loadInterstitialAdForParameters:(id<MAAdapterResponseParameters>)paramet
self.interstitialAd.fullScreenContentDelegate = self.interstitialDelegate;

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 @@ -425,10 +424,9 @@ - (void)loadRewardedInterstitialAdForParameters:(id<MAAdapterResponseParameters>
self.rewardedInterstitialAd.fullScreenContentDelegate = self.rewardedInterstitialDelegate;

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 @@ -509,10 +507,9 @@ - (void)loadRewardedAdForParameters:(id<MAAdapterResponseParameters>)parameters
self.rewardedAd.fullScreenContentDelegate = self.rewardedDelegate;

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
29 changes: 4 additions & 25 deletions Google/GoogleAdapter/ALGoogleNativeAdDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,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 @@ -110,32 +111,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
6 changes: 2 additions & 4 deletions Google/GoogleAdapter/ALGoogleNativeAdViewDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,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

0 comments on commit b6007d1

Please sign in to comment.