commit | author | age
|
96fe76
|
1 |
// |
L |
2 |
// GADRewardedAd.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 GADRewardedAd; |
|
20 |
|
|
21 |
/// A block to be executed when the ad request operation completes. On success, |
|
22 |
/// rewardedAd is non-nil and |error| is nil. On failure, rewardedAd is nil |
|
23 |
/// and |error| is non-nil. |
|
24 |
typedef void (^GADRewardedAdLoadCompletionHandler)(GADRewardedAd *_Nullable rewardedAd, |
|
25 |
NSError *_Nullable error); |
|
26 |
|
|
27 |
/// A rewarded ad. Rewarded ads are ads that users have the option of interacting with in exchange |
|
28 |
/// for in-app rewards. |
|
29 |
@interface GADRewardedAd : 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 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 GADRewardedAdLoadCompletionHandler)completionHandler; |
|
59 |
|
|
60 |
/// Returns whether the rewarded 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 ad. Must be called on the main thread. |
|
68 |
/// |
|
69 |
/// @param rootViewController A view controller to present the ad. If nil, attempts to present from |
|
70 |
/// the top view controller of the application's main window. |
|
71 |
/// @param userDidEarnRewardHandler A handler to execute when the user earns a reward. |
|
72 |
- (void)presentFromRootViewController:(nullable UIViewController *)rootViewController |
|
73 |
userDidEarnRewardHandler:(nonnull GADUserDidEarnRewardHandler)userDidEarnRewardHandler; |
|
74 |
|
|
75 |
@end |