commit | author | age
|
96fe76
|
1 |
// |
L |
2 |
// GADMediationAdapter.h |
|
3 |
// Google Mobile Ads SDK |
|
4 |
// |
|
5 |
// Copyright 2018 Google LLC. All rights reserved. |
|
6 |
// |
|
7 |
|
|
8 |
#import <GoogleMobileAds/Mediation/GADMediationAdEventDelegate.h> |
|
9 |
#import <GoogleMobileAds/Mediation/GADMediationAppOpenAd.h> |
|
10 |
#import <GoogleMobileAds/Mediation/GADMediationBannerAd.h> |
|
11 |
#import <GoogleMobileAds/Mediation/GADMediationInterstitialAd.h> |
|
12 |
#import <GoogleMobileAds/Mediation/GADMediationNativeAd.h> |
|
13 |
#import <GoogleMobileAds/Mediation/GADMediationRewardedAd.h> |
|
14 |
#import <GoogleMobileAds/Mediation/GADMediationServerConfiguration.h> |
|
15 |
#import <GoogleMobileAds/Mediation/GADVersionNumber.h> |
|
16 |
#import <UIKit/UIKit.h> |
|
17 |
|
|
18 |
/// Called by the adapter after loading the banner ad or encountering an error. Returns an ad |
|
19 |
/// event object to send ad events to the Google Mobile Ads SDK. The block returns nil if a delegate |
|
20 |
/// couldn't be created or if the block has already been called. |
|
21 |
typedef id<GADMediationBannerAdEventDelegate> _Nullable (^GADMediationBannerLoadCompletionHandler)( |
|
22 |
_Nullable id<GADMediationBannerAd> ad, NSError *_Nullable error); |
|
23 |
|
|
24 |
/// Called by the adapter after loading the interscroller ad or encountering an error. Returns an ad |
|
25 |
/// event object to send ad events to the Google Mobile Ads SDK. The block returns nil if a delegate |
|
26 |
/// couldn't be created or if the block has already been called. |
|
27 |
typedef id<GADMediationBannerAdEventDelegate> _Nullable ( |
|
28 |
^GADMediationInterscrollerAdLoadCompletionHandler)(_Nullable id<GADMediationInterscrollerAd> ad, |
|
29 |
NSError *_Nullable error); |
|
30 |
|
|
31 |
/// Called by the adapter after loading the interstitial ad or encountering an error. Returns an |
|
32 |
/// ad event delegate to send ad events to the Google Mobile Ads SDK. The block returns nil if a |
|
33 |
/// delegate couldn't be created or if the block has already been called. |
|
34 |
typedef id<GADMediationInterstitialAdEventDelegate> _Nullable ( |
|
35 |
^GADMediationInterstitialLoadCompletionHandler)(_Nullable id<GADMediationInterstitialAd> ad, |
|
36 |
NSError *_Nullable error); |
|
37 |
|
|
38 |
/// Called by the adapter after loading the native ad or encountering an error. Returns an ad |
|
39 |
/// event delegate to send ad events to the Google Mobile Ads SDK. The block returns nil if a |
|
40 |
/// delegate couldn't be created or if the block has already been called. |
|
41 |
typedef id<GADMediationNativeAdEventDelegate> _Nullable (^GADMediationNativeLoadCompletionHandler)( |
|
42 |
_Nullable id<GADMediationNativeAd> ad, NSError *_Nullable error); |
|
43 |
|
|
44 |
/// Called by the adapter after loading the rewarded ad or encountering an error. Returns an ad |
|
45 |
/// event delegate to send ad events to the Google Mobile Ads SDK. The block returns nil if a |
|
46 |
/// delegate couldn't be created or if the block has already been called. |
|
47 |
typedef id<GADMediationRewardedAdEventDelegate> _Nullable ( |
|
48 |
^GADMediationRewardedLoadCompletionHandler)(_Nullable id<GADMediationRewardedAd> ad, |
|
49 |
NSError *_Nullable error); |
|
50 |
|
|
51 |
/// Called by the adapter after loading the app open ad or encountering an error. Returns an ad |
|
52 |
/// event delegate to send ad events to the Google Mobile Ads SDK. The block returns nil if a |
|
53 |
/// delegate couldn't be created or if the block has already been called. |
|
54 |
typedef id<GADMediationAppOpenAdEventDelegate> _Nullable ( |
|
55 |
^GADMediationAppOpenLoadCompletionHandler)(_Nullable id<GADMediationAppOpenAd> ad, |
|
56 |
NSError *_Nullable error); |
|
57 |
/// Executes when adapter set up completes. |
|
58 |
typedef void (^GADMediationAdapterSetUpCompletionBlock)(NSError *_Nullable error); |
|
59 |
|
|
60 |
@protocol GADAdNetworkExtras; |
|
61 |
|
|
62 |
/// Receives messages and requests from the Google Mobile Ads SDK. Provides GMA to 3P SDK |
|
63 |
/// communication. |
|
64 |
/// |
|
65 |
/// Adapters are initialized on a background queue and should avoid using the main queue until |
|
66 |
/// load time. |
|
67 |
@protocol GADMediationAdapter <NSObject> |
|
68 |
/// Returns the adapter version. |
|
69 |
+ (GADVersionNumber)adapterVersion; |
|
70 |
|
|
71 |
/// Returns the ad SDK version. |
|
72 |
+ (GADVersionNumber)adSDKVersion; |
|
73 |
|
|
74 |
/// The extras class that is used to specify additional parameters for a request to this ad network. |
|
75 |
/// Returns Nil if the network doesn't have publisher provided extras. |
|
76 |
+ (nullable Class<GADAdNetworkExtras>)networkExtrasClass; |
|
77 |
|
|
78 |
/// Returns an initialized mediation adapter. |
|
79 |
- (nonnull instancetype)init; |
|
80 |
|
|
81 |
@optional |
|
82 |
|
|
83 |
/// Tells the adapter to set up its underlying ad network SDK and perform any necessary prefetching |
|
84 |
/// or configuration work. The adapter must call completionHandler once the adapter can service ad |
|
85 |
/// requests, or if it encounters an error while setting up. |
|
86 |
+ (void)setUpWithConfiguration:(nonnull GADMediationServerConfiguration *)configuration |
|
87 |
completionHandler:(nonnull GADMediationAdapterSetUpCompletionBlock)completionHandler; |
|
88 |
|
|
89 |
/// Asks the adapter to load a banner ad with the provided ad configuration. The adapter must call |
|
90 |
/// back completionHandler with the loaded ad, or it may call back with an error. This method is |
|
91 |
/// called on the main thread, and completionHandler must be called back on the main thread. |
|
92 |
- (void)loadBannerForAdConfiguration:(nonnull GADMediationBannerAdConfiguration *)adConfiguration |
|
93 |
completionHandler: |
|
94 |
(nonnull GADMediationBannerLoadCompletionHandler)completionHandler; |
|
95 |
|
|
96 |
/// Asks the adapter to load an interscroller ad with the provided ad configuration. The adapter |
|
97 |
/// must call back completionHandler with the loaded ad, or it may call back with an error. This |
|
98 |
/// method is called on the main thread, and completionHandler must be called back on the main |
|
99 |
/// thread. |
|
100 |
- (void)loadInterscrollerAdForAdConfiguration: |
|
101 |
(nonnull GADMediationBannerAdConfiguration *)adConfiguration |
|
102 |
completionHandler: |
|
103 |
(nonnull GADMediationInterscrollerAdLoadCompletionHandler) |
|
104 |
completionHandler; |
|
105 |
|
|
106 |
/// Asks the adapter to load an interstitial ad with the provided ad configuration. The adapter |
|
107 |
/// must call back completionHandler with the loaded ad, or it may call back with an error. This |
|
108 |
/// method is called on the main thread, and completionHandler must be called back on the main |
|
109 |
/// thread. |
|
110 |
- (void)loadInterstitialForAdConfiguration: |
|
111 |
(nonnull GADMediationInterstitialAdConfiguration *)adConfiguration |
|
112 |
completionHandler:(nonnull GADMediationInterstitialLoadCompletionHandler) |
|
113 |
completionHandler; |
|
114 |
|
|
115 |
/// Asks the adapter to load a native ad with the provided ad configuration. The adapter must call |
|
116 |
/// back completionHandler with the loaded ad, or it may call back with an error. This method is |
|
117 |
/// called on the main thread, and completionHandler must be called back on the main thread. |
|
118 |
- (void)loadNativeAdForAdConfiguration:(nonnull GADMediationNativeAdConfiguration *)adConfiguration |
|
119 |
completionHandler: |
|
120 |
(nonnull GADMediationNativeLoadCompletionHandler)completionHandler; |
|
121 |
|
|
122 |
/// Asks the adapter to load a rewarded ad with the provided ad configuration. The adapter must |
|
123 |
/// call back completionHandler with the loaded ad, or it may call back with an error. This method |
|
124 |
/// is called on the main thread, and completionHandler must be called back on the main thread. |
|
125 |
- (void)loadRewardedAdForAdConfiguration: |
|
126 |
(nonnull GADMediationRewardedAdConfiguration *)adConfiguration |
|
127 |
completionHandler: |
|
128 |
(nonnull GADMediationRewardedLoadCompletionHandler)completionHandler; |
|
129 |
|
|
130 |
/// Asks the adapter to load a rewarded interstitial ad with the provided ad configuration. The |
|
131 |
/// adapter must call back completionHandler with the loaded ad, or it may call back with an error. |
|
132 |
/// This method is called on the main thread, and completionHandler must be called back on the main |
|
133 |
/// thread. |
|
134 |
- (void)loadRewardedInterstitialAdForAdConfiguration: |
|
135 |
(nonnull GADMediationRewardedAdConfiguration *)adConfiguration |
|
136 |
completionHandler: |
|
137 |
(nonnull GADMediationRewardedLoadCompletionHandler) |
|
138 |
completionHandler; |
|
139 |
|
|
140 |
/// Asks the adapter to load an app open ad with the provided ad configuration. The |
|
141 |
/// adapter must call back completionHandler with the loaded ad, or it may call back with an error. |
|
142 |
/// This method is called on the main thread, and completionHandler must be called back on the main |
|
143 |
/// thread. |
|
144 |
- (void)loadAppOpenAdForAdConfiguration: |
|
145 |
(nonnull GADMediationAppOpenAdConfiguration *)adConfiguration |
|
146 |
completionHandler: |
|
147 |
(nonnull GADMediationAppOpenLoadCompletionHandler)completionHandler; |
|
148 |
@end |