admin
2022-09-04 fa05f89529e05078b29606e4beda3de5cfdce485
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//
//  BUAppOpenAd.h
//  AFNetworking
//
//  Created by Willie on 2021/12/8.
//
 
#import "BUInterfaceBaseObject.h"
 
NS_ASSUME_NONNULL_BEGIN
 
@class BUAppOpenAd, BUAdSlot;
@protocol BUAppOpenAdDelegate;
 
/// Callback for loading ad results.
/// @param appOpenAd Ad instance after successfully loaded.
/// @param error Loading error.
typedef void (^BUAppOpenAdLoadCompletionHandler)(BUAppOpenAd * _Nullable appOpenAd,
                                                 NSError * _Nullable error);
 
/// App-open ad object. Use it to load ads and display.
 __attribute__((objc_subclassing_restricted))
@interface BUAppOpenAd : BUInterfaceBaseObject
 
/// Ad event delegate.
@property (nonatomic, weak, nullable) id<BUAppOpenAdDelegate> delegate;
 
/// Create an instance by BUAdSlot.
/// @param slot A BUAdSlot instance. The necessary parameter is `ID`.
- (instancetype)initWithSlot:(BUAdSlot *)slot;
 
/// Load ad data.
/// @param timeout If the ad data is not successfully loaded within the timeout period, a timeout error will be returned. The unit is seconds.
/// @param completionHandler Callback for loading ad results.
- (void)loadOpenAdWithTimeout:(NSTimeInterval)timeout
            completionHandler:(nullable BUAppOpenAdLoadCompletionHandler)completionHandler;
 
/// Display ad. You need to call `loadOpenAdWithTimeout:completionHandler:` and succeed before call `presentFromRootViewController:`
/// @param rootViewController UIViewController that ad display depends on.
- (void)presentFromRootViewController:(UIViewController *)rootViewController;
 
@end
 
 
/// Ad event protocol.
@protocol BUAppOpenAdDelegate <NSObject>
 
@optional
 
/// The ad has been presented.
/// @param appOpenAd The BUAppOpenAd instance.
- (void)didPresentForAppOpenAd:(BUAppOpenAd *)appOpenAd;
 
/// The ad was clicked.
/// @param appOpenAd The BUAppOpenAd instance.
- (void)didClickForAppOpenAd:(BUAppOpenAd *)appOpenAd;
 
/// The ad was skipped.
/// @param appOpenAd The BUAppOpenAd instance.
- (void)didClickSkipForAppOpenAd:(BUAppOpenAd *)appOpenAd;
 
/// The ad countdown is over.
/// @param appOpenAd The BUAppOpenAd instance.
- (void)countdownToZeroForAppOpenAd:(BUAppOpenAd *)appOpenAd;
 
@end
 
NS_ASSUME_NONNULL_END