diff --git a/source/plugin/Assets/GoogleMobileAds/Api/AppOpenAdPreloader.cs b/source/plugin/Assets/GoogleMobileAds/Api/AppOpenAdPreloader.cs index db0d64cd9..1b1c6db34 100644 --- a/source/plugin/Assets/GoogleMobileAds/Api/AppOpenAdPreloader.cs +++ b/source/plugin/Assets/GoogleMobileAds/Api/AppOpenAdPreloader.cs @@ -127,7 +127,7 @@ public static Dictionary GetConfigurations() /// Returns a preloaded ad and removes it from the cache. /// /// - /// The ad's preload ID. + /// A string identifier used to preload the ads for that configuration. /// /// /// The preloaded ad for the given preload ID, or null if no ad is available. @@ -146,6 +146,26 @@ public static AppOpenAd DequeueAd(string preloadId) return new AppOpenAd(client); } + /// + /// Returns the ResponseInfo of a preloaded ad for the given preload ID without + /// dequeuing it, or null if no ad is available. + /// + /// + /// A string identifier used to preload the ads for that configuration. + /// + /// + /// The ResponseInfo of the preloaded ad for the given preload ID, or null if no ad is available. + /// + public static ResponseInfo PeekAdResponseInfo(string preloadId) + { + var responseInfoClient = _client.PeekAdResponseInfo(preloadId); + if (responseInfoClient == null) + { + return null; + } + return new ResponseInfo(responseInfoClient); + } + /// /// Get the number of ads available for the given preload ID. /// diff --git a/source/plugin/Assets/GoogleMobileAds/Api/RewardedAdPreloader.cs b/source/plugin/Assets/GoogleMobileAds/Api/RewardedAdPreloader.cs index 6824c24d4..d48856053 100644 --- a/source/plugin/Assets/GoogleMobileAds/Api/RewardedAdPreloader.cs +++ b/source/plugin/Assets/GoogleMobileAds/Api/RewardedAdPreloader.cs @@ -126,7 +126,7 @@ public static Dictionary GetConfigurations() /// Returns a preloaded ad and removes it from the cache. /// /// - /// The ad's preload ID. + /// A string identifier used to preload the ads for that configuration. /// /// /// The preloaded ad for the given preload ID, or null if no ad is available. @@ -145,6 +145,26 @@ public static RewardedAd DequeueAd(string preloadId) return new RewardedAd(client); } + /// + /// Returns the ResponseInfo of a preloaded ad for the given preload ID without + /// dequeuing it, or null if no ad is available. + /// + /// + /// A string identifier used to preload the ads for that configuration. + /// + /// + /// The ResponseInfo of the preloaded ad for the given preload ID, or null if no ad is available. + /// + public static ResponseInfo PeekAdResponseInfo(string preloadId) + { + var responseInfoClient = _client.PeekAdResponseInfo(preloadId); + if (responseInfoClient == null) + { + return null; + } + return new ResponseInfo(responseInfoClient); + } + /// /// Get the number of ads available for the given preload ID. /// diff --git a/source/plugin/Assets/GoogleMobileAds/Common/IAppOpenAdPreloaderClient.cs b/source/plugin/Assets/GoogleMobileAds/Common/IAppOpenAdPreloaderClient.cs index ab8207510..de9d26893 100644 --- a/source/plugin/Assets/GoogleMobileAds/Common/IAppOpenAdPreloaderClient.cs +++ b/source/plugin/Assets/GoogleMobileAds/Common/IAppOpenAdPreloaderClient.cs @@ -76,6 +76,18 @@ bool Preload(string preloadId, PreloadConfiguration preloadConfiguration, /// IAppOpenAdClient DequeueAd(string preloadId); + /// + /// Returns the ResponseInfo of an ad available for the given preload ID without + /// dequeuing it, or null if no ad is available. + /// + /// + /// A string identifier used to preload the ads for that configuration. + /// + /// + /// The ResponseInfo of the preloaded ad for the given preload ID, or null if no ad is available. + /// + IResponseInfoClient PeekAdResponseInfo(string preloadId); + /// /// Get the number of ads available for the given preload ID. /// diff --git a/source/plugin/Assets/GoogleMobileAds/Common/IRewardedAdPreloaderClient.cs b/source/plugin/Assets/GoogleMobileAds/Common/IRewardedAdPreloaderClient.cs index 7a9e0a9d0..047bc8284 100644 --- a/source/plugin/Assets/GoogleMobileAds/Common/IRewardedAdPreloaderClient.cs +++ b/source/plugin/Assets/GoogleMobileAds/Common/IRewardedAdPreloaderClient.cs @@ -65,7 +65,7 @@ bool Preload(string preloadId, PreloadConfiguration preloadConfiguration, /// Returns a preloaded ad and removes it from the cache. /// /// - /// The ad's preload ID. + /// A string identifier used to preload the ads for that configuration. /// /// /// The preloaded ad for the given preload ID, or null if no ad is available. @@ -76,6 +76,18 @@ bool Preload(string preloadId, PreloadConfiguration preloadConfiguration, /// IRewardedAdClient DequeueAd(string preloadId); + /// + /// Returns the ResponseInfo of an ad available for the given preload ID without + /// dequeuing it, or null if no ad is available. + /// + /// + /// A string identifier used to preload the ads for that configuration. + /// + /// + /// The ResponseInfo of the preloaded ad for the given preload ID, or null if no ad is available. + /// + IResponseInfoClient PeekAdResponseInfo(string preloadId); + /// /// Get the number of ads available for the given preload ID. /// diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/AppOpenAdPreloaderClient.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/AppOpenAdPreloaderClient.cs index 015a89c3b..e3d783da3 100644 --- a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/AppOpenAdPreloaderClient.cs +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/AppOpenAdPreloaderClient.cs @@ -70,6 +70,13 @@ public IAppOpenAdClient DequeueAd(string preloadId) return appOpenAdClient; } + public IResponseInfoClient PeekAdResponseInfo(string preloadId) + { + UnityEngine.Debug.LogError( + "PeekAdResponseInfo API is not available on the Legacy version of Google Mobile Ads Android SDK."); + return null; + } + public int GetNumAdsAvailable(string preloadId) { return _unityAppOpenAdPreloader.Call("getNumAdsAvailable", preloadId); diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/NextGenAppOpenAdPreloaderClient.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/NextGenAppOpenAdPreloaderClient.cs index e522ae509..37cd8ab14 100644 --- a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/NextGenAppOpenAdPreloaderClient.cs +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/NextGenAppOpenAdPreloaderClient.cs @@ -62,6 +62,11 @@ public IAppOpenAdClient DequeueAd(string preloadId) { return appOpenAdClient; } + public IResponseInfoClient PeekAdResponseInfo(string preloadId) { + // TODO: Implement Android Peek API + return null; + } + public int GetNumAdsAvailable(string preloadId) { return _unityAppOpenAdPreloader.Call("getNumAdsAvailable", preloadId); } diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/NextGenInterstitialAdPreloaderClient.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/NextGenInterstitialAdPreloaderClient.cs index 3a29f6ecd..b078629ae 100644 --- a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/NextGenInterstitialAdPreloaderClient.cs +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/NextGenInterstitialAdPreloaderClient.cs @@ -64,8 +64,12 @@ public IInterstitialClient DequeueAd(string preloadId) { } public IResponseInfoClient PeekAdResponseInfo(string preloadId) { - // TODO: Implement Android Peek API - return null; + var responseInfo = _unityInterstitialAdPreloader.Call( + "peekAdResponseInfo", preloadId); + if (responseInfo == null) { + return null; + } + return new NextGenResponseInfoClient(responseInfo); } public int GetNumAdsAvailable(string preloadId) { diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/NextGenRewardedAdPreloaderClient.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/NextGenRewardedAdPreloaderClient.cs index 2563efcfa..8540c6207 100644 --- a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/NextGenRewardedAdPreloaderClient.cs +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/NextGenRewardedAdPreloaderClient.cs @@ -62,6 +62,11 @@ public IRewardedAdClient DequeueAd(string preloadId) { return rewardedAdClient; } + public IResponseInfoClient PeekAdResponseInfo(string preloadId) { + // TODO: Implement Android Peek API + return null; + } + public int GetNumAdsAvailable(string preloadId) { return _unityRewardedAdPreloader.Call("getNumAdsAvailable", preloadId); } diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/RewardedAdPreloaderClient.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/RewardedAdPreloaderClient.cs index 41d150f3e..9254e2841 100644 --- a/source/plugin/Assets/GoogleMobileAds/Platforms/Android/RewardedAdPreloaderClient.cs +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Android/RewardedAdPreloaderClient.cs @@ -70,6 +70,13 @@ public IRewardedAdClient DequeueAd(string preloadId) return rewardedAdClient; } + public IResponseInfoClient PeekAdResponseInfo(string preloadId) + { + UnityEngine.Debug.LogError( + "PeekAdResponseInfo API is not available on the Legacy version of Google Mobile Ads Android SDK."); + return null; + } + public int GetNumAdsAvailable(string preloadId) { return _unityRewardedAdPreloader.Call("getNumAdsAvailable", preloadId); diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Unity/AppOpenAdPreloaderClient.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/Unity/AppOpenAdPreloaderClient.cs index 1746494ff..45565b256 100644 --- a/source/plugin/Assets/GoogleMobileAds/Platforms/Unity/AppOpenAdPreloaderClient.cs +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Unity/AppOpenAdPreloaderClient.cs @@ -126,6 +126,17 @@ public IAppOpenAdClient DequeueAd(string preloadId) return null; } + public IResponseInfoClient PeekAdResponseInfo(string preloadId) + { + Queue queue; + if (_bufferedAds.TryGetValue(preloadId, out queue) && queue.Count > 0) + { + AppOpenAdClient adClient = queue.Peek(); + return adClient.GetResponseInfoClient(); + } + return null; + } + public int GetNumAdsAvailable(string preloadId) { Queue queue; diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/Unity/RewardedAdPreloaderClient.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/Unity/RewardedAdPreloaderClient.cs index 26500567b..35e18f447 100644 --- a/source/plugin/Assets/GoogleMobileAds/Platforms/Unity/RewardedAdPreloaderClient.cs +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/Unity/RewardedAdPreloaderClient.cs @@ -117,6 +117,17 @@ public IRewardedAdClient DequeueAd(string preloadId) return null; } + public IResponseInfoClient PeekAdResponseInfo(string preloadId) + { + Queue queue; + if (_bufferedAds.TryGetValue(preloadId, out queue) && queue.Count > 0) + { + RewardedAdClient adClient = queue.Peek(); + return adClient.GetResponseInfoClient(); + } + return null; + } + public int GetNumAdsAvailable(string preloadId) { Queue queue; diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/AppOpenAdPreloaderClient.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/AppOpenAdPreloaderClient.cs index afe1f7961..93e59b735 100644 --- a/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/AppOpenAdPreloaderClient.cs +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/AppOpenAdPreloaderClient.cs @@ -122,6 +122,21 @@ public IAppOpenAdClient DequeueAd(string preloadId) return appOpenAdClient; } + public IResponseInfoClient PeekAdResponseInfo(string preloadId) + { + if (AppOpenAdPreloaderPtr == IntPtr.Zero) + { + return null; + } + var responseInfoPtr = Externs.GADUAppOpenAdPreloaderPeekAdResponseInfo( + AppOpenAdPreloaderPtr, preloadId); + if (responseInfoPtr == IntPtr.Zero) + { + return null; + } + return new ResponseInfoClient(responseInfoPtr); + } + public int GetNumAdsAvailable(string preloadId) { if (AppOpenAdPreloaderPtr == IntPtr.Zero) diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Externs.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Externs.cs index 828c27bda..89c6a9d0e 100644 --- a/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Externs.cs +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/Externs.cs @@ -325,6 +325,10 @@ internal static extern IntPtr GADUAppOpenAdPreloaderDequeueAd(IntPtr appOpenAdPr string preloadId, IntPtr appOpenAdClientPtr); + [DllImport("__Internal")] + internal static extern IntPtr GADUAppOpenAdPreloaderPeekAdResponseInfo( + IntPtr appOpenAdPreloader, string preloadId); + [DllImport("__Internal")] internal static extern int GADUAppOpenAdPreloaderGetNumAdsAvailable(IntPtr appOpenAdPreloader, string preloadId); @@ -370,6 +374,10 @@ internal static extern IntPtr GADURewardedAdPreloaderDequeueAd(IntPtr rewardedAd string preloadId, IntPtr appOpenAdClientPtr); + [DllImport("__Internal")] + internal static extern IntPtr GADURewardedAdPreloaderPeekAdResponseInfo( + IntPtr rewardedAdPreloader, string preloadId); + [DllImport("__Internal")] internal static extern int GADURewardedAdPreloaderGetNumAdsAvailable( IntPtr rewardedAdPreloader, string preloadId); diff --git a/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/RewardedAdPreloaderClient.cs b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/RewardedAdPreloaderClient.cs index bb847a2b8..aa5864da7 100644 --- a/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/RewardedAdPreloaderClient.cs +++ b/source/plugin/Assets/GoogleMobileAds/Platforms/iOS/RewardedAdPreloaderClient.cs @@ -123,6 +123,21 @@ public IRewardedAdClient DequeueAd(string preloadId) return rewardedAdClient; } + public IResponseInfoClient PeekAdResponseInfo(string preloadId) + { + if (RewardedAdPreloaderPtr == IntPtr.Zero) + { + return null; + } + var responseInfoPtr = Externs.GADURewardedAdPreloaderPeekAdResponseInfo( + RewardedAdPreloaderPtr, preloadId); + if (responseInfoPtr == IntPtr.Zero) + { + return null; + } + return new ResponseInfoClient(responseInfoPtr); + } + public int GetNumAdsAvailable(string preloadId) { if (RewardedAdPreloaderPtr == IntPtr.Zero) diff --git a/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin.androidlib/src/main/java/com/google/unity/ads/nextgen/UnityInterstitialAdPreloader.java b/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin.androidlib/src/main/java/com/google/unity/ads/nextgen/UnityInterstitialAdPreloader.java index 8eb8aef72..74354e127 100644 --- a/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin.androidlib/src/main/java/com/google/unity/ads/nextgen/UnityInterstitialAdPreloader.java +++ b/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin.androidlib/src/main/java/com/google/unity/ads/nextgen/UnityInterstitialAdPreloader.java @@ -104,6 +104,11 @@ public UnityInterstitialAd pollAd(String preloadId, UnityInterstitialAdCallback return new UnityInterstitialAd(activity, callback, interstitialAd); } + @Nullable + public ResponseInfo peekAdResponseInfo(String preloadId) { + return preloaderWrapper.peekAdResponseInfo(preloadId); + } + @Nullable public PreloadConfiguration getConfiguration(String preloadId) { return preloaderWrapper.getConfiguration(preloadId); @@ -140,6 +145,11 @@ public InterstitialAd pollAd(String preloadId) { return InterstitialAdPreloader.pollAd(preloadId); } + @Nullable + public ResponseInfo peekAdResponseInfo(String preloadId) { + return InterstitialAdPreloader.peekAdResponseInfo(preloadId); + } + public PreloadConfiguration getConfiguration(String preloadId) { return InterstitialAdPreloader.getConfiguration(preloadId); } diff --git a/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin.androidlib/src/test/java/com/google/unity/ads/nextgen/UnityInterstitialAdPreloaderTest.java b/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin.androidlib/src/test/java/com/google/unity/ads/nextgen/UnityInterstitialAdPreloaderTest.java index 0685166be..ea0f8221b 100644 --- a/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin.androidlib/src/test/java/com/google/unity/ads/nextgen/UnityInterstitialAdPreloaderTest.java +++ b/source/plugin/Assets/Plugins/Android/GoogleMobileAdsPlugin.androidlib/src/test/java/com/google/unity/ads/nextgen/UnityInterstitialAdPreloaderTest.java @@ -110,6 +110,18 @@ public void testIsAdAvailable() { verify(mockWrapper).isAdAvailable(PRELOAD_ID); } + @Test + public void testPeekAdResponseInfo() { + ResponseInfo responseInfo = + new ResponseInfo("AdapterName", "responseId", new Bundle(), null, new ArrayList<>()); + when(mockWrapper.peekAdResponseInfo(PRELOAD_ID)).thenReturn(responseInfo); + + ResponseInfo result = unityInterstitialAdPreloader.peekAdResponseInfo(PRELOAD_ID); + + assertThat(result).isEqualTo(responseInfo); + verify(mockWrapper).peekAdResponseInfo(PRELOAD_ID); + } + @Test public void testGetNumAdsAvailable() { int unused = unityInterstitialAdPreloader.getNumAdsAvailable(PRELOAD_ID); diff --git a/source/plugin/Assets/Plugins/iOS/GADUAppOpenAdPreloader.h b/source/plugin/Assets/Plugins/iOS/GADUAppOpenAdPreloader.h index 8144cf957..f10763ef0 100644 --- a/source/plugin/Assets/Plugins/iOS/GADUAppOpenAdPreloader.h +++ b/source/plugin/Assets/Plugins/iOS/GADUAppOpenAdPreloader.h @@ -78,6 +78,9 @@ appOpenAdClient: (_Nonnull GADUTypeAppOpenAdClientRef *_Nonnull)appOpenAdClient; +/// Returns the responseInfo of a preloaded app open ad for the given preload ID. +- (nullable GADResponseInfo *)adResponseInfoWithPreloadID:(nonnull NSString *)preloadID; + /// Returns the corresponding configuration for the given preload ID. - (nullable GADUPreloadConfigurationV2 *)configurationWithPreloadID:(nonnull NSString *)preloadID; diff --git a/source/plugin/Assets/Plugins/iOS/GADUAppOpenAdPreloader.m b/source/plugin/Assets/Plugins/iOS/GADUAppOpenAdPreloader.m index 1cd8d19d5..00243de1b 100644 --- a/source/plugin/Assets/Plugins/iOS/GADUAppOpenAdPreloader.m +++ b/source/plugin/Assets/Plugins/iOS/GADUAppOpenAdPreloader.m @@ -72,6 +72,10 @@ - (nullable GADUAppOpenAd *)adWithPreloadID:(nonnull NSString *)preloadID return nil; } +- (nullable GADResponseInfo *)adResponseInfoWithPreloadID:(nonnull NSString *)preloadID { + return [GADAppOpenAdPreloader.sharedInstance adResponseInfoWithPreloadID:preloadID]; +} + - (nullable GADUPreloadConfigurationV2 *)configurationWithPreloadID:(nonnull NSString *)preloadID { GADPreloadConfigurationV2 *config = [GADAppOpenAdPreloader.sharedInstance configurationWithPreloadID:preloadID]; diff --git a/source/plugin/Assets/Plugins/iOS/GADUInterface.m b/source/plugin/Assets/Plugins/iOS/GADUInterface.m index 375b5fa3e..ee42f2223 100644 --- a/source/plugin/Assets/Plugins/iOS/GADUInterface.m +++ b/source/plugin/Assets/Plugins/iOS/GADUInterface.m @@ -959,6 +959,23 @@ GADUTypeAppOpenAdRef GADUAppOpenAdPreloaderDequeueAd( return nil; } +GADUTypeResponseInfoRef GADUAppOpenAdPreloaderPeekAdResponseInfo( + GADUTypeAppOpenAdPreloaderRef appOpenAdPreloader, const char *preloadId) { + GADUAppOpenAdPreloader *internalAppOpenAdPreloader = + (__bridge GADUAppOpenAdPreloader *)appOpenAdPreloader; + if (!internalAppOpenAdPreloader) { + return nil; + } + GADResponseInfo *responseInfo = [internalAppOpenAdPreloader + adResponseInfoWithPreloadID:GADUStringFromUTF8String(preloadId)]; + if (responseInfo) { + GADUObjectCache *cache = GADUObjectCache.sharedInstance; + cache[responseInfo.gadu_referenceKey] = responseInfo; + return (__bridge GADUTypeResponseInfoRef)responseInfo; + } + return nil; +} + unsigned long GADUAppOpenAdPreloaderGetNumAdsAvailable( GADUTypeAppOpenAdPreloaderRef appOpenAdPreloader, const char *preloadId) { GADUAppOpenAdPreloader *internalAppOpenAdPreloader = @@ -1057,6 +1074,23 @@ GADUTypeRewardedAdRef GADURewardedAdPreloaderDequeueAd( return nil; } +GADUTypeResponseInfoRef GADURewardedAdPreloaderPeekAdResponseInfo( + GADUTypeRewardedAdPreloaderClientRef rewardedAdPreloader, const char *preloadId) { + GADURewardedAdPreloader *internalRewardedAdPreloader = + (__bridge GADURewardedAdPreloader *)rewardedAdPreloader; + if (!internalRewardedAdPreloader) { + return nil; + } + GADResponseInfo *responseInfo = + [internalRewardedAdPreloader adResponseInfoWithPreloadID:GADUStringFromUTF8String(preloadId)]; + if (responseInfo) { + GADUObjectCache *cache = GADUObjectCache.sharedInstance; + cache[responseInfo.gadu_referenceKey] = responseInfo; + return (__bridge GADUTypeResponseInfoRef)responseInfo; + } + return nil; +} + unsigned long GADURewardedAdPreloaderGetNumAdsAvailable( GADUTypeRewardedAdPreloaderClientRef rewardedAdPreloader, const char *preloadId) { GADURewardedAdPreloader *internalRewardedAdPreloader = diff --git a/source/plugin/Assets/Plugins/iOS/GADURewardedAdPreloader.h b/source/plugin/Assets/Plugins/iOS/GADURewardedAdPreloader.h index 2e1921c03..14e35fde5 100644 --- a/source/plugin/Assets/Plugins/iOS/GADURewardedAdPreloader.h +++ b/source/plugin/Assets/Plugins/iOS/GADURewardedAdPreloader.h @@ -63,6 +63,9 @@ /// available. - (nullable GADRewardedAd *)adWithPreloadID:(nonnull NSString *)preloadID rewardedAdClient:(_Nonnull GADUTypeRewardedAdClientRef *_Nonnull)rewardedAdClient; +/// Returns the responseInfo of a preloaded rewarded ad for the given preload ID. +- (nullable GADResponseInfo *)adResponseInfoWithPreloadID:(nonnull NSString *)preloadID; + /// Returns the corresponding configuration for the given preload ID. - (nullable GADUPreloadConfigurationV2 *)configurationWithPreloadID:(nonnull NSString *)preloadID; diff --git a/source/plugin/Assets/Plugins/iOS/GADURewardedAdPreloader.m b/source/plugin/Assets/Plugins/iOS/GADURewardedAdPreloader.m index 4a92a0d84..079784ec9 100644 --- a/source/plugin/Assets/Plugins/iOS/GADURewardedAdPreloader.m +++ b/source/plugin/Assets/Plugins/iOS/GADURewardedAdPreloader.m @@ -50,6 +50,10 @@ - (nullable GADURewardedAd *)adWithPreloadID:(nonnull NSString *)preloadID rewar return nil; } +- (nullable GADResponseInfo *)adResponseInfoWithPreloadID:(nonnull NSString *)preloadID { + return [GADRewardedAdPreloader.sharedInstance adResponseInfoWithPreloadID:preloadID]; +} + - (nullable GADUPreloadConfigurationV2 *)configurationWithPreloadID:(nonnull NSString *)preloadID { GADPreloadConfigurationV2 *config = [GADRewardedAdPreloader.sharedInstance configurationWithPreloadID:preloadID]; if (!config) {