//
|
// BUNativeAd.h
|
// BUAdSDK
|
//
|
// Copyright © 2017 bytedance. All rights reserved.
|
//
|
|
#import <Foundation/Foundation.h>
|
#import <UIKit/UIKit.h>
|
#import "BUAdSlot.h"
|
#import "BUMaterialMeta.h"
|
#import "BUVideoAdView.h"
|
#import "BUMopubAdMarkUpDelegate.h"
|
|
|
@protocol BUNativeAdDelegate;
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
/**
|
Abstract ad slot containing ad data loading, response callbacks.
|
BUNativeAd currently supports native ads.
|
Native ads include in-feed ad (multiple ads, image + video), general native ad (single ad, image + video), native banner ad, and native interstitial ad.
|
Support interstitial ad, banner ad, splash ad, rewarded video ad, full-screen video ad.
|
*/
|
@interface BUNativeAd : NSObject <BUMopubAdMarkUpDelegate>
|
|
/**
|
Ad slot description.
|
*/
|
@property (nonatomic, strong, readwrite, nullable) BUAdSlot *adslot;
|
|
/**
|
Ad slot material.
|
*/
|
@property (atomic, strong, readonly, nullable) BUMaterialMeta *data;
|
|
/**
|
The delegate for receiving state change messages.
|
The delegate is not limited to viewcontroller.
|
The delegate can be set to any object which conforming to <BUNativeAdDelegate>.
|
*/
|
@property (nonatomic, weak, readwrite, nullable) id<BUNativeAdDelegate> delegate;
|
|
/**
|
required.
|
Root view controller for handling ad actions.
|
Action method includes is 'presentViewController'.
|
*/
|
@property (nonatomic, weak, readwrite) UIViewController *rootViewController;
|
|
/**
|
Initializes native ad with ad slot.
|
@param slot : ad slot description.
|
including slotID,adType,adPosition,etc.
|
@return BUNativeAd
|
*/
|
- (instancetype)initWithSlot:(BUAdSlot *)slot;
|
|
/**
|
Register clickable views in native ads view.
|
Interaction types can be configured on TikTok Audience Network.
|
Interaction types include view video ad details page, make a call, send email, download the app, open the webpage using a browser,open the webpage within the app, etc.
|
@param containerView : required.
|
container view of the native ad.
|
@param clickableViews : optional.
|
Array of views that are clickable.
|
*/
|
- (void)registerContainer:(__kindof UIView *)containerView
|
withClickableViews:(NSArray<__kindof UIView *> *_Nullable)clickableViews;
|
|
/**
|
Unregister ad view from the native ad.
|
*/
|
- (void)unregisterView;
|
|
/**
|
Actively request nativeAd datas.
|
*/
|
- (void)loadAdData;
|
|
@end
|
|
|
@protocol BUNativeAdDelegate <NSObject>
|
|
@optional
|
|
/**
|
This method is called when native ad material loaded successfully. This method will be deprecated. Use nativeAdDidLoad:view: instead
|
*/
|
- (void)nativeAdDidLoad:(BUNativeAd *)nativeAd;
|
|
|
/**
|
This method is called when native ad material loaded successfully.
|
*/
|
- (void)nativeAdDidLoad:(BUNativeAd *)nativeAd view:(UIView *_Nullable)view;
|
|
/**
|
This method is called when native ad materia failed to load.
|
@param error : the reason of error
|
*/
|
- (void)nativeAd:(BUNativeAd *)nativeAd didFailWithError:(NSError *_Nullable)error;
|
|
/**
|
This method is called when native ad slot has been shown.
|
*/
|
- (void)nativeAdDidBecomeVisible:(BUNativeAd *)nativeAd;
|
|
/**
|
This method is called when another controller has been closed.
|
@param interactionType : open appstore in app or open the webpage or view video ad details page.
|
*/
|
- (void)nativeAdDidCloseOtherController:(BUNativeAd *)nativeAd interactionType:(BUInteractionType)interactionType;
|
|
/**
|
This method is called when native ad is clicked.
|
*/
|
- (void)nativeAdDidClick:(BUNativeAd *)nativeAd withView:(UIView *_Nullable)view;
|
|
/**
|
This method is called when the user clicked dislike reasons.
|
Only used for dislikeButton in BUNativeAdRelatedView.h
|
@param filterWords : reasons for dislike
|
*/
|
- (void)nativeAd:(BUNativeAd *_Nullable)nativeAd dislikeWithReason:(NSArray<BUDislikeWords *> *_Nullable)filterWords;
|
@end
|
|
NS_ASSUME_NONNULL_END
|