From 3808e875472d956d94d30b4210218869f1905bf8 Mon Sep 17 00:00:00 2001 From: jenkins Date: Fri, 23 Sep 2022 18:53:23 -0700 Subject: [PATCH] Google/9.11.0.1 --- Google/AppLovinMediationGoogleAdapter.podspec | 2 +- Google/CHANGELOG.md | 3 + .../GoogleAdapter/ALGoogleMediationAdapter.h | 2 +- .../GoogleAdapter/ALGoogleMediationAdapter.m | 154 +++++++++++++----- 4 files changed, 114 insertions(+), 47 deletions(-) diff --git a/Google/AppLovinMediationGoogleAdapter.podspec b/Google/AppLovinMediationGoogleAdapter.podspec index f3b4a99d2d..1aa0f33b53 100644 --- a/Google/AppLovinMediationGoogleAdapter.podspec +++ b/Google/AppLovinMediationGoogleAdapter.podspec @@ -5,7 +5,7 @@ s.authors = 'AppLovin Corporation' => 'devsupport@applovin.com' } s.name = 'AppLovinMediationGoogleAdapter' -s.version = '9.11.0.0' +s.version = '9.11.0.1' s.platform = :ios, '10.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" diff --git a/Google/CHANGELOG.md b/Google/CHANGELOG.md index d72229b809..0d5e19586f 100644 --- a/Google/CHANGELOG.md +++ b/Google/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 9.11.0.1 +* App open updates. + ## 9.11.0.0 * Certified with Google SDK 9.11.0. diff --git a/Google/GoogleAdapter/ALGoogleMediationAdapter.h b/Google/GoogleAdapter/ALGoogleMediationAdapter.h index 2c46663fed..5137f9afc3 100644 --- a/Google/GoogleAdapter/ALGoogleMediationAdapter.h +++ b/Google/GoogleAdapter/ALGoogleMediationAdapter.h @@ -44,7 +44,7 @@ typedef void (^GADQueryInfoCreationCompletionHandler)(GADQueryInfo *_Nullable qu @end -@interface ALGoogleMediationAdapter : ALMediationAdapter +@interface ALGoogleMediationAdapter : ALMediationAdapter /** * Maps the provided ad network's error to an instance of @c MAAdapterError. diff --git a/Google/GoogleAdapter/ALGoogleMediationAdapter.m b/Google/GoogleAdapter/ALGoogleMediationAdapter.m index c2f289b6aa..eb95bdf1b5 100644 --- a/Google/GoogleAdapter/ALGoogleMediationAdapter.m +++ b/Google/GoogleAdapter/ALGoogleMediationAdapter.m @@ -16,12 +16,13 @@ #import "ALGoogleNativeAdViewDelegate.h" #import "ALGoogleNativeAdDelegate.h" -#define ADAPTER_VERSION @"9.11.0.0" +#define ADAPTER_VERSION @"9.11.0.1" @interface ALGoogleMediationAdapter() @property (nonatomic, strong) GADInterstitialAd *interstitialAd; @property (nonatomic, strong) GADAppOpenAd *appOpenAd; +@property (nonatomic, strong) GADInterstitialAd *appOpenInterstitialAd; @property (nonatomic, strong) GADRewardedInterstitialAd *rewardedInterstitialAd; @property (nonatomic, strong) GADRewardedAd *rewardedAd; @property (nonatomic, strong) GADBannerView *adView; @@ -31,6 +32,7 @@ @interface ALGoogleMediationAdapter() @property (nonatomic, strong) ALGoogleInterstitialDelegate *interstitialDelegate; @property (nonatomic, strong) ALGoogleAppOpenDelegate *appOpenDelegate; +@property (nonatomic, strong) ALGoogleAppOpenDelegate *appOpenInterstitialAdDelegate; @property (nonatomic, strong) ALGoogleRewardedInterstitialDelegate *rewardedInterstitialDelegate; @property (nonatomic, strong) ALGoogleRewardedDelegate *rewardedDelegate; @property (nonatomic, strong) ALGoogleAdViewDelegate *adViewDelegate; @@ -112,6 +114,10 @@ - (void)destroy self.appOpenAd = nil; self.appOpenDelegate = nil; + self.appOpenInterstitialAd.fullScreenContentDelegate = nil; + self.appOpenInterstitialAd = nil; + self.appOpenInterstitialAdDelegate = nil; + self.rewardedInterstitialAd.fullScreenContentDelegate = nil; self.rewardedInterstitialAd = nil; self.rewardedInterstitialDelegate = nil; @@ -249,63 +255,121 @@ - (void)loadAppOpenAdForParameters:(id)parameters a { NSString *placementIdentifier = parameters.thirdPartyAdPlacementIdentifier; BOOL isBiddingAd = [parameters.bidResponse al_isValidString]; - [self log: @"Loading %@app open ad: %@...", ( isBiddingAd ? @"bidding " : @"" ), placementIdentifier]; - + BOOL isInterstitial = [parameters.serverParameters al_boolForKey: @"is_inter_placement"]; + + [self log: @"Loading %@app open %@ad: %@...", ( isBiddingAd ? @"bidding " : @"" ), ( isInterstitial ? @"interstitial " : @"" ), placementIdentifier]; + [self updateMuteStateFromResponseParameters: parameters]; [self setRequestConfigurationWithParameters: parameters]; - GADRequest *request = [self createAdRequestForBiddingAd: isBiddingAd - adFormat: nil // MAAdFormat.appOpen - withParameters: parameters]; - UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; - [GADAppOpenAd loadWithAdUnitID: placementIdentifier - request: request - orientation: orientation - completionHandler:^(GADAppOpenAd *_Nullable appOpenAd, NSError *_Nullable error) { + if ( isInterstitial ) + { + GADRequest *request = [self createAdRequestForBiddingAd: isBiddingAd + adFormat: MAAdFormat.interstitial + withParameters: parameters]; - if ( error ) - { - MAAdapterError *adapterError = [ALGoogleMediationAdapter toMaxError: error]; - [self log: @"App open ad (%@) failed to load with error: %@", placementIdentifier, adapterError]; - [delegate didFailToLoadAppOpenAdWithError: adapterError]; + [GADInterstitialAd loadWithAdUnitID: placementIdentifier + request: request + completionHandler:^(GADInterstitialAd *_Nullable interstitialAd, NSError *_Nullable error) { - return; - } - - if ( !appOpenAd ) - { - [self log: @"App open ad (%@) failed to load: ad is nil", placementIdentifier]; - [delegate didFailToLoadAppOpenAdWithError: MAAdapterError.adNotReady]; + if ( error ) + { + MAAdapterError *adapterError = [ALGoogleMediationAdapter toMaxError: error]; + [self log: @"App open interstitial ad (%@) failed to load with error: %@", placementIdentifier, adapterError]; + [delegate didFailToLoadAppOpenAdWithError: adapterError]; + + return; + } - return; - } - - [self log: @"App open ad loaded: %@", placementIdentifier]; - - self.appOpenAd = appOpenAd; - self.appOpenDelegate = [[ALGoogleAppOpenDelegate alloc] initWithParentAdapter: self - placementIdentifier: placementIdentifier - andNotify: delegate]; - self.appOpenAd.fullScreenContentDelegate = self.appOpenDelegate; + if ( !interstitialAd ) + { + [self log: @"App open interstitial ad (%@) failed to load: ad is nil", placementIdentifier]; + [delegate didFailToDisplayAppOpenAdWithError: MAAdapterError.adNotReady]; + + return; + } + + [self log: @"App open interstitial ad loaded: %@", placementIdentifier]; + + self.appOpenInterstitialAd = interstitialAd; + self.appOpenInterstitialAdDelegate = [[ALGoogleAppOpenDelegate alloc] initWithParentAdapter: self + placementIdentifier: placementIdentifier + andNotify: delegate]; + self.appOpenInterstitialAd.fullScreenContentDelegate = self.appOpenInterstitialAdDelegate; + + NSString *responseId = self.appOpenInterstitialAd.responseInfo.responseIdentifier; + if ( [responseId al_isValidString] ) + { + [delegate didLoadAppOpenAdWithExtraInfo: @{@"creative_id" : responseId}]; + } + else + { + [delegate didLoadAppOpenAd]; + } + }]; + } + else + { + GADRequest *request = [self createAdRequestForBiddingAd: isBiddingAd + adFormat: MAAdFormat.appOpen + withParameters: parameters]; + UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; - NSString *responseId = self.appOpenAd.responseInfo.responseIdentifier; - if ( [responseId al_isValidString] ) - { - [delegate didLoadAppOpenAdWithExtraInfo: @{@"creative_id" : responseId}]; - } - else - { - [delegate didLoadAppOpenAd]; - } - }]; + [GADAppOpenAd loadWithAdUnitID: placementIdentifier + request: request + orientation: orientation + completionHandler:^(GADAppOpenAd *_Nullable appOpenAd, NSError *_Nullable error) { + + if ( error ) + { + MAAdapterError *adapterError = [ALGoogleMediationAdapter toMaxError: error]; + [self log: @"App open ad (%@) failed to load with error: %@", placementIdentifier, adapterError]; + [delegate didFailToLoadAppOpenAdWithError: adapterError]; + + return; + } + + if ( !appOpenAd ) + { + [self log: @"App open ad (%@) failed to load: ad is nil", placementIdentifier]; + [delegate didFailToLoadAppOpenAdWithError: MAAdapterError.adNotReady]; + + return; + } + + [self log: @"App open ad loaded: %@", placementIdentifier]; + + self.appOpenAd = appOpenAd; + self.appOpenDelegate = [[ALGoogleAppOpenDelegate alloc] initWithParentAdapter: self + placementIdentifier: placementIdentifier + andNotify: delegate]; + self.appOpenAd.fullScreenContentDelegate = self.appOpenDelegate; + + NSString *responseId = self.appOpenAd.responseInfo.responseIdentifier; + if ( [responseId al_isValidString] ) + { + [delegate didLoadAppOpenAdWithExtraInfo: @{@"creative_id" : responseId}]; + } + else + { + [delegate didLoadAppOpenAd]; + } + }]; + } } - (void)showAppOpenAdForParameters:(id)parameters andNotify:(id)delegate { NSString *placementIdentifier = parameters.thirdPartyAdPlacementIdentifier; - [self log: @"Showing app open ad: %@...", placementIdentifier]; + BOOL isInterstitial = [parameters.serverParameters al_boolForKey: @"is_inter_placement"]; + [self log: @"Showing app open %@ad: %@...", ( isInterstitial ? @"interstitial " : @"" ), placementIdentifier]; - if ( self.appOpenAd ) + if ( self.appOpenInterstitialAd ) + { + UIViewController *presentingViewController = [self presentingViewControllerForParameters: parameters]; + [self.appOpenInterstitialAd presentFromRootViewController: presentingViewController]; + } + else if ( self.appOpenAd ) { UIViewController *presentingViewController = [self presentingViewControllerForParameters: parameters]; [self.appOpenAd presentFromRootViewController: presentingViewController];