commit | author | age
|
96fe76
|
1 |
// |
L |
2 |
// GADRewardedInterstitialAd.h |
|
3 |
// Google Mobile Ads SDK |
|
4 |
// |
|
5 |
// Copyright 2020 Google LLC. All rights reserved. |
|
6 |
// |
|
7 |
|
|
8 |
#import <Foundation/Foundation.h> |
|
9 |
#import <UIKit/UIKit.h> |
|
10 |
|
|
11 |
#import <GoogleMobileAds/GADAdMetadata.h> |
|
12 |
#import <GoogleMobileAds/GADAdReward.h> |
|
13 |
#import <GoogleMobileAds/GADAdValue.h> |
|
14 |
#import <GoogleMobileAds/GADFullScreenContentDelegate.h> |
|
15 |
#import <GoogleMobileAds/GADRequest.h> |
|
16 |
#import <GoogleMobileAds/GADResponseInfo.h> |
|
17 |
#import <GoogleMobileAds/GADServerSideVerificationOptions.h> |
|
18 |
|
|
19 |
@class GADRewardedInterstitialAd; |
|
20 |
|
|
21 |
/// A block to be executed when the ad request operation completes. On success, |
|
22 |
/// rewardedInterstitialAd is non-nil and |error| is nil. On failure, rewardedInterstitialAd is nil |
|
23 |
/// and |error| is non-nil. |
|
24 |
typedef void (^GADRewardedInterstitialAdLoadCompletionHandler)( |
|
25 |
GADRewardedInterstitialAd *_Nullable rewardedInterstitialAd, NSError *_Nullable error); |
|
26 |
|
|
27 |
/// A rewarded interstitial ad. Rewarded Interstitial ads are full screen ads that can be presented |
|
28 |
/// without user-opt in and allow you to reward the user with in-app items. |
|
29 |
@interface GADRewardedInterstitialAd : NSObject <GADAdMetadataProvider, GADFullScreenPresentingAd> |
|
30 |
|
|
31 |
/// The ad unit ID. |
|
32 |
@property(nonatomic, readonly, nonnull) NSString *adUnitID; |
|
33 |
|
|
34 |
/// Information about the ad response that returned the ad. |
|
35 |
@property(nonatomic, readonly, nonnull) GADResponseInfo *responseInfo; |
|
36 |
|
|
37 |
/// The reward earned by the user for interacting with the ad. |
|
38 |
@property(nonatomic, readonly, nonnull) GADAdReward *adReward; |
|
39 |
|
|
40 |
/// Options specified for server-side user reward verification. Must be set before presenting this |
|
41 |
/// ad. |
|
42 |
@property(nonatomic, copy, nullable) |
|
43 |
GADServerSideVerificationOptions *serverSideVerificationOptions; |
|
44 |
|
|
45 |
/// Delegate for handling full screen content messages. |
|
46 |
@property(nonatomic, weak, nullable) id<GADFullScreenContentDelegate> fullScreenContentDelegate; |
|
47 |
|
|
48 |
/// Called when the ad is estimated to have earned money. Available for allowlisted accounts only. |
|
49 |
@property(nonatomic, nullable, copy) GADPaidEventHandler paidEventHandler; |
|
50 |
|
|
51 |
/// Loads a rewarded interstitial ad. |
|
52 |
/// |
|
53 |
/// @param adUnitID An ad unit ID created in the AdMob or Ad Manager UI. |
|
54 |
/// @param request An ad request object. If nil, a default ad request object is used. |
|
55 |
/// @param completionHandler A handler to execute when the load operation finishes or times out. |
|
56 |
+ (void)loadWithAdUnitID:(nonnull NSString *)adUnitID |
|
57 |
request:(nullable GADRequest *)request |
|
58 |
completionHandler:(nonnull GADRewardedInterstitialAdLoadCompletionHandler)completionHandler; |
|
59 |
|
|
60 |
/// Returns whether the rewarded interstitial ad can be presented from the provided root view |
|
61 |
/// controller. Sets the error out parameter if the ad can't be presented. Must be called on the |
|
62 |
/// main thread. If rootViewController is nil, uses the top view controller of the application's |
|
63 |
/// main window. |
|
64 |
- (BOOL)canPresentFromRootViewController:(nullable UIViewController *)rootViewController |
|
65 |
error:(NSError *_Nullable __autoreleasing *_Nullable)error; |
|
66 |
|
|
67 |
/// Presents the rewarded interstitial ad. Must be called on the main thread. |
|
68 |
/// |
|
69 |
/// @param viewController A view controller to present the ad. If nil, attempts to present from the |
|
70 |
/// top view controller of the application's main window. |
|
71 |
/// @param userDidEarnRewardHandler A handler to execute when the user earns a reward. adReward |
|
72 |
/// contains the reward information. |
|
73 |
- (void)presentFromRootViewController:(nullable UIViewController *)viewController |
|
74 |
userDidEarnRewardHandler:(nonnull GADUserDidEarnRewardHandler)userDidEarnRewardHandler; |
|
75 |
|
|
76 |
@end |